mirror of
https://gitlab.com/chaica/feed2toot.git
synced 2024-11-27 22:11:10 +00:00
add support for feedname for uri parameter
This commit is contained in:
parent
f129d15f11
commit
3aef77acac
|
@ -107,7 +107,7 @@ class ConfParse:
|
||||||
for line in rsslist:
|
for line in rsslist:
|
||||||
line = line.strip()
|
line = line.strip()
|
||||||
# split each line in two parts, rss link and a string with the different patterns to look for
|
# split each line in two parts, rss link and a string with the different patterns to look for
|
||||||
feedname = None
|
feedname = ''
|
||||||
if '<' in line:
|
if '<' in line:
|
||||||
matches = re.match('(.*) <(.*)>', line)
|
matches = re.match('(.*) <(.*)>', line)
|
||||||
if not matches:
|
if not matches:
|
||||||
|
@ -147,7 +147,18 @@ class ConfParse:
|
||||||
if not feeds and not self.clioptions.rss_uri:
|
if not feeds and not self.clioptions.rss_uri:
|
||||||
confoption = 'uri'
|
confoption = 'uri'
|
||||||
if config.has_option(section, confoption):
|
if config.has_option(section, confoption):
|
||||||
options['rss_uri'] = config.get('rss', 'uri')
|
urifeed = config.get('rss', 'uri')
|
||||||
|
feedname = None
|
||||||
|
if '<' in urifeed:
|
||||||
|
matches = re.match('(.*) <(.*)>', urifeed)
|
||||||
|
if not matches:
|
||||||
|
sys.exit('This uri to parse is not formatted correctly: {urifeed}'.format(urifeed))
|
||||||
|
feedname, finaluri = matches.groups()
|
||||||
|
print(feedname)
|
||||||
|
print(finaluri)
|
||||||
|
options['rss_uri'] = finaluri
|
||||||
|
else:
|
||||||
|
options['rss_uri'] = config.get('rss', 'uri')
|
||||||
else:
|
else:
|
||||||
sys.exit('{confoption} parameter in the [{section}] section of the configuration file is mandatory. Exiting.'.format(section=section, confoption=confoption))
|
sys.exit('{confoption} parameter in the [{section}] section of the configuration file is mandatory. Exiting.'.format(section=section, confoption=confoption))
|
||||||
else:
|
else:
|
||||||
|
@ -240,7 +251,7 @@ class ConfParse:
|
||||||
if feeds:
|
if feeds:
|
||||||
self.confs.append((options, config, self.tweetformat, feeds, plugins))
|
self.confs.append((options, config, self.tweetformat, feeds, plugins))
|
||||||
else:
|
else:
|
||||||
self.confs.append((options, config, self.tweetformat, [{'feed': feed, 'patterns': [], 'rssobject': ''}], plugins))
|
self.confs.append((options, config, self.tweetformat, [{'feed': feed, 'patterns': [], 'rssobject': '', 'feedname': feedname}], plugins))
|
||||||
|
|
||||||
@property
|
@property
|
||||||
def confvalues(self):
|
def confvalues(self):
|
||||||
|
|
Loading…
Reference in New Issue
Block a user