Skip episodes with no download URL, e.g. future episodes
This commit is contained in:
		
							parent
							
								
									e5debbf337
								
							
						
					
					
						commit
						3b271fdaa3
					
				
					 1 changed files with 9 additions and 1 deletions
				
			
		| 
						 | 
				
			
			@ -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"]
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Reference in a new issue