From 3b271fdaa34c5a49ced7a100c6459b3305636b0f Mon Sep 17 00:00:00 2001 From: neingeist Date: Mon, 9 Feb 2009 22:25:26 +0000 Subject: [PATCH] Skip episodes with no download URL, e.g. future episodes --- neinomat-radio-chaotica | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/neinomat-radio-chaotica b/neinomat-radio-chaotica index 1fc2572..19da121 100755 --- a/neinomat-radio-chaotica +++ b/neinomat-radio-chaotica @@ -62,6 +62,9 @@ episodes = [] # Check problem fields MediaWiki::logger.warn "Field beschreibung in #{episode["url"]} empty" if episode["description"] == "" + # Skip episodes with no download URL, e.g. future episodes + next if episode["enclosure_url"] == "" + # Get a real date erste_sendung.gsub!(/\s*um\s*\d+:\d+$/,"") if erste_sendung !~ /^[0-9]{2}\.[0-9]{2}\.[0-9]{4}.*$/ @@ -72,7 +75,12 @@ episodes = [] episode["pubdate"] = episode["date"].strftime(RFC822) # Get content type and length - head = head(episode["enclosure_url"]) + begin + head = head(episode["enclosure_url"]) + rescue Errno::ECONNREFUSED + MediaWiki::logger.warn "Something wrong with download URL #{episode["enclosure_url"]}, skipping." + next + end episode["length"] = head["content-length"] episode["type"] = head["content-type"]