Adds two config options to the INI file, in the [hashtaglist] section:
tag_delimiter defines a character in the RSS feed delimiting tags tag_force overrides existing tags in an RSS feed example: tag_delimiter=, tag_force=tabletop,gaming,dnd
This commit is contained in:
parent
04d5441be4
commit
c40499ea7b
|
@ -128,6 +128,16 @@ class Main:
|
||||||
}
|
}
|
||||||
|
|
||||||
severalwordsinhashtag = False
|
severalwordsinhashtag = False
|
||||||
|
try:
|
||||||
|
delimiter=config.get('hashtaglist','tag_delimiter')
|
||||||
|
except:
|
||||||
|
delimiter=False
|
||||||
|
|
||||||
|
try:
|
||||||
|
tagforce=config.get('hashtaglist', 'tag_force')
|
||||||
|
except:
|
||||||
|
tagforce=False
|
||||||
|
|
||||||
# lets see if the rss feed has hashtag
|
# lets see if the rss feed has hashtag
|
||||||
if 'tags' in entry and options['addtags']:
|
if 'tags' in entry and options['addtags']:
|
||||||
hastags = True
|
hastags = True
|
||||||
|
@ -145,7 +155,7 @@ class Main:
|
||||||
tmphashtags = prehashtags.replace(element,
|
tmphashtags = prehashtags.replace(element,
|
||||||
''.join(element.split()))
|
''.join(element.split()))
|
||||||
# replace characters stopping a word from being a hashtag
|
# replace characters stopping a word from being a hashtag
|
||||||
if severalwordsinhashtag:
|
if severalwordsinhashtag and not tagforce:
|
||||||
# remove ' from hashtag
|
# remove ' from hashtag
|
||||||
tmphashtags = tmphashtags.replace("'", "")
|
tmphashtags = tmphashtags.replace("'", "")
|
||||||
# remove - from hashtag
|
# remove - from hashtag
|
||||||
|
@ -154,7 +164,15 @@ class Main:
|
||||||
tmphashtags = tmphashtags.replace(".", "")
|
tmphashtags = tmphashtags.replace(".", "")
|
||||||
# remove space from hashtag
|
# remove space from hashtag
|
||||||
finalhashtags = tmphashtags.replace(" ", "")
|
finalhashtags = tmphashtags.replace(" ", "")
|
||||||
|
# swap delimiter with hash
|
||||||
|
finalhashtags = tmphashtags.replace(delimiter, " #")
|
||||||
rss['hashtags'].append('#{}'.format(finalhashtags))
|
rss['hashtags'].append('#{}'.format(finalhashtags))
|
||||||
|
elif tagforce:
|
||||||
|
tmphashtags = tuple(tagforce.split(delimiter))
|
||||||
|
for t in tmphashtags:
|
||||||
|
#rss['hashtags'].append(t)
|
||||||
|
#finalhashtags = tmphashtags.replace(",", " #")
|
||||||
|
rss['hashtags'].append('#{}'.format(t))
|
||||||
else:
|
else:
|
||||||
nospace = ''.join(entry['tags'][i]['term'])
|
nospace = ''.join(entry['tags'][i]['term'])
|
||||||
# remove space from hashtag
|
# remove space from hashtag
|
||||||
|
|
Loading…
Reference in a new issue