add support for episode without title, but warn user that this is dumb
git-svn-id: svn://svn.berlios.de/gpodder/branches/gpodder-thp-200708@388 b0d088ad-0a06-0410-aad2-9ed5178a7e87
This commit is contained in:
parent
a421d7e935
commit
272255131c
|
@ -490,18 +490,15 @@ class podcastItem(object):
|
|||
def from_feedparser_entry( entry, channel):
|
||||
episode = podcastItem( channel)
|
||||
|
||||
episode.title = entry.title
|
||||
if hasattr( entry, 'link'):
|
||||
episode.link = entry.link
|
||||
if hasattr( entry, 'summary'):
|
||||
episode.description = util.remove_html_tags( entry.summary)
|
||||
elif hasattr( entry, 'link'):
|
||||
episode.description = entry.link
|
||||
else:
|
||||
episode.description = entry.title
|
||||
episode.title = entry.get( 'title', util.get_first_line( util.remove_html_tags( entry.get( 'summary', ''))))
|
||||
episode.link = entry.get( 'link', '')
|
||||
episode.description = util.remove_html_tags( entry.get( 'summary', entry.get( 'link', entry.get( 'title', ''))))
|
||||
episode.guid = entry.id
|
||||
episode.pubDate = entry.updated
|
||||
|
||||
if episode.title == '':
|
||||
log( 'Warning: Episode has no title, adding anyways.. (Feed Is Buggy!)', sender = episode)
|
||||
|
||||
if len(entry.enclosures) > 1:
|
||||
log( 'Warning: More than one enclosure found in feed, only using first', sender = episode)
|
||||
|
||||
|
|
|
@ -299,3 +299,11 @@ def get_tree_icon( icon_name, add_bullet = False, icon_cache = None):
|
|||
|
||||
return icon
|
||||
|
||||
|
||||
def get_first_line( s):
|
||||
"""
|
||||
Returns only the first line of a string, stripped so
|
||||
that it doesn't have whitespace before or after.
|
||||
"""
|
||||
return s.strip().split('\n')[0].strip()
|
||||
|
||||
|
|
Loading…
Reference in New Issue