package org.wamblee.crawler.kiss;
import org.wamblee.crawler.Action;
+import org.wamblee.crawler.Page;
import org.wamblee.crawler.PageException;
/**
* Name of the record action on the program details page.
*/
private static final String RECORD_ACTION = "record";
+
+ private static final String RESULT_ELEM = "result";
+
+ public enum RecordingResult {
+ OK("Successfully recorded programs"),
+ DUPLICATE("Already recorded programs"),
+ CONFLICT("Programs in conflict with another recorded program"),
+ OLDSHOW("Programs that occured in the past"),
+ ERROR("Programs that could not be recorded for technical reasons");
+
+ private String _description;
+
+ private RecordingResult(String aDescription) {
+ _description = aDescription;
+ }
+
+ public String getDescription() {
+ return _description;
+ }
+ };
/**
* Indent string to use for pretty printing.
* @return True iff an attempt could be made to record the page.
* @throws PageException In case of problems recording the page.
*/
- public boolean record() throws PageException {
+ public RecordingResult record() throws PageException {
Action record = _programInfo.execute().getAction(RECORD_ACTION);
if (record == null) {
- return false;
+ return RecordingResult.OLDSHOW;
}
- record.execute();
- return true;
+ Page result = record.execute();
+ return RecordingResult.valueOf(result.getContent().getText());
}
/**