# XML tag used for pattern recognition
fun tag_title: String do return "title"
+ # XML tag of the link to act upon
+ fun tag_link: String do return "link"
+
# Action to apply on each selected RSS element
fun act_on(element: Element)
do
for element in matches do
var unique_id = element.unique_id(config)
- if local_path.to_path.exists then
- # Do not redownload a file (we assume that the file name is unique by itself)
- if sys.verbose then print "File exists, skipping {element}"
- continue
- else if history.has(unique_id) then
+ if history.has(unique_id) then
# Do not download a file that is not unique according to `unique_id`
if not element.is_unique_exception(config) then
# We make some exceptions
end
for dir in source_folder.files do if dir.stat.is_dir then
- folder_names.add dir.to_s
+ folder_names.add dir.filename
end
end
fun to_rss_elements: Array[Element]
do
var xml = to_xml
+ if xml isa XMLError then
+ print_error "RSS Parse Error: {xml.message}:{xml.location or else "null"}"
+ return new Array[Element]
+ end
var items = xml["rss"].first["channel"].first["item"]
var elements = new Array[Element]
for item in items do
var title = item[tool_config.tag_title].first.as(XMLStartTag).data
- var link = item["link"].first.as(XMLStartTag).data
+ var link = item[tool_config.tag_link].first.as(XMLStartTag).data
elements.add new Element(title, link)
end