Bugfix: language value was looked at the wrong place

This commit is contained in:
Gabor Sebestyen 2023-07-12 10:18:55 +02:00
parent 2e2b436e78
commit 5303a3f5b8
1 changed files with 8 additions and 4 deletions

View File

@ -43,6 +43,7 @@ from feed2toot.plugins import activate_plugins
from feed2toot.rss import populate_rss
from feed2toot.sortentries import sort_entries
class Main:
'''Main class of Feed2toot'''
@ -105,10 +106,13 @@ class Main:
totweet = sort_entries(clioptions.all, cache, entries)
# get language of the feed
# language code should conform to ISO-639-1
if 'language' in feed['feed']:
language = feed['feed']['language']
if 'language' in feed['feed']['feed']:
# Only the first two letters count ...
language = feed['feed']['feed']['language'][:2]
else:
language = 'en'
print("Language of feeds: {}".format(language))
for entry in totweet:
# populate rss with new entry to send
rss = populate_rss(entry)
@ -117,8 +121,8 @@ class Main:
elements = re.findall(r"\{(.*?)\}",tweetformat)
# strip : from elements to allow string formating, eg. {title:.20}
for i,s in enumerate(elements):
if s.find(':'):
elements[i] = s.split(':')[0]
if s.find(':'):
elements[i] = s.split(':')[0]
fe = FilterEntry(elements, entry, options, feed['patterns'], feed['rssobject'], feed['feedname'])
entrytosend = fe.finalentry
if entrytosend: