option [hashtaglist] section. fixes #5
This commit is contained in:
parent
c1503e1fd1
commit
02e61d68ad
|
@ -64,7 +64,16 @@ For the [rss] section:
|
|||
|
||||
For the [hashtaglist] section:
|
||||
|
||||
- several_words_hashtags_list: a path to the file containing hashtags in two or more words. Absolute path is mandatory. By default Feed2toot adds a # before every words of a hashtag.
|
||||
- several_words_hashtags_list: a path to the file containing hashtags in two or more words. Absolute path is mandatory. By default Feed2toot adds a # before every words of a hashtag. See documentation below for an example of this file.
|
||||
|
||||
Example of the list of hash tags
|
||||
================================
|
||||
The list of hash tags is a simple text file with one hash tag composed by several words on a single line::
|
||||
|
||||
free software community
|
||||
open-source
|
||||
|
||||
Instead of having #free #software #community or #open-source in the resulting toot, you will have #freesoftwarecommunity and #opensource. You only have to identify the hash tags you frequently use in your RSS feeds and put them in this file to have well formatted hash tags in your toots.
|
||||
|
||||
List of rss feeds
|
||||
=================
|
||||
|
|
|
@ -191,12 +191,13 @@ class ConfParse(object):
|
|||
if not self.clioptions.hashtaglist:
|
||||
confoption = 'several_words_hashtags_list'
|
||||
if config.has_section(section):
|
||||
options['hashtaglist'] = config.get(section, confoption)
|
||||
options['hashtaglist'] = os.path.expanduser(options['hashtaglist'])
|
||||
if not os.path.exists(options['hashtaglist']) or not os.path.isfile(options['hashtaglist']):
|
||||
sys.exit('The path to the several_words_hashtags_list parameter is not valid: {hashtaglist}'.format(hashtaglist=options['hashtaglist']))
|
||||
if config.has_option(section, confoption):
|
||||
options['hashtaglist'] = config.get(section, confoption)
|
||||
options['hashtaglist'] = os.path.expanduser(options['hashtaglist'])
|
||||
if not os.path.exists(options['hashtaglist']) or not os.path.isfile(options['hashtaglist']):
|
||||
sys.exit('The path to the several_words_hashtags_list parameter is not valid: {hashtaglist}'.format(hashtaglist=options['hashtaglist']))
|
||||
else:
|
||||
options['hashtaglist'] = False
|
||||
options['hashtaglist'] = ''
|
||||
###########################
|
||||
#
|
||||
# the plugins section
|
||||
|
|
|
@ -75,10 +75,12 @@ class Main(object):
|
|||
plugins = conf[4]
|
||||
# create link to the persistent list
|
||||
cache = FeedCache(options)
|
||||
if options['hashtaglist']:
|
||||
if 'hashtaglist' in options and options['hashtaglist']:
|
||||
severalwordshashtags = codecs.open(options['hashtaglist'],
|
||||
encoding='utf-8').readlines()
|
||||
severalwordshashtags = [i.rstrip('\n') for i in severalwordshashtags]
|
||||
else:
|
||||
severalwordshashtags = []
|
||||
# reverse feed entries because most recent one should be sent as the last one in Mastodon
|
||||
for feed in feeds:
|
||||
# store the patterns by rss
|
||||
|
|
Loading…
Reference in a new issue