Skip to content

Commit 09b7076

Browse files
Add section detection and return to calling function to OPML Importer
1 parent de9e26c commit 09b7076

File tree

1 file changed

+7
-0
lines changed

1 file changed

+7
-0
lines changed

src/gpodder/opml.py

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -70,10 +70,16 @@ def __init__(self, url, opml_str=None):
7070
else:
7171
doc = xml.dom.minidom.parseString(util.urlopen(url).read())
7272

73+
section = None
7374
for outline in doc.getElementsByTagName('outline'):
7475
# Make sure we are dealing with a valid link type (ignore case)
7576
otl_type = outline.getAttribute('type')
7677
if otl_type is None or otl_type.lower() not in self.VALID_TYPES:
78+
otl_title = outline.getAttribute('title')
79+
otl_text = outline.getAttribute('text')
80+
#gPodder sections will have name == text, if OPML accepts it type=section
81+
if otl_title is not None and otl_title == otl_text:
82+
section = otl_title
7783
continue
7884

7985
if outline.getAttribute('xmlUrl') or outline.getAttribute('url'):
@@ -86,6 +92,7 @@ def __init__(self, url, opml_str=None):
8692
'description': (outline.getAttribute('text') or
8793
outline.getAttribute('xmlUrl') or
8894
outline.getAttribute('url')),
95+
'section': section or 'audio'
8996
}
9097

9198
if channel['description'] == channel['title']:

0 commit comments

Comments
 (0)