From c548e0cecb0c90f2498b86401b5feb7c91377fd8 Mon Sep 17 00:00:00 2001 From: Carl Chenet Date: Wed, 30 May 2018 23:24:47 +0200 Subject: [PATCH] add [media] parameter and bump to 0.8 --- .gitignore | 1 + CHANGELOG | 4 ++++ README.md | 2 +- docs/source/configure.rst | 7 ++++++ docs/source/install.rst | 2 +- feed2toot/cliparse.py | 2 +- feed2toot/confparse.py | 5 +++++ feed2toot/confparsers/media.py | 39 ++++++++++++++++++++++++++++++++++ feed2toot/main.py | 2 +- feed2toot/tootpost.py | 9 ++++++-- setup.py | 2 +- 11 files changed, 68 insertions(+), 7 deletions(-) create mode 100644 feed2toot/confparsers/media.py diff --git a/.gitignore b/.gitignore index 7a3968d..f5189cf 100644 --- a/.gitignore +++ b/.gitignore @@ -7,3 +7,4 @@ feedlist *.ini *.txt *.bck +*.png diff --git a/CHANGELOG b/CHANGELOG index 52cf501..87edf46 100644 --- a/CHANGELOG +++ b/CHANGELOG @@ -1,3 +1,7 @@ +## [0.8] - 2018-05-30 +### Added +- add the custom parameter in [media] section to join a custom media with every toots + ## [0.7] - 2017-09-26 ### Changed - fix issue while using uri_list diff --git a/README.md b/README.md index 25bfec3..f468e58 100644 --- a/README.md +++ b/README.md @@ -20,7 +20,7 @@ Alternatively you can donate cryptocurrencies: [Installation Guide](http://feed2toot.readthedocs.org/en/latest/install.html)* - # tar zxvf feed2toot-0.7.tar.gz + # tar zxvf feed2toot-0.8.tar.gz # cd feed2toot # python3 setup.py install # # or diff --git a/docs/source/configure.rst b/docs/source/configure.rst index 513493e..1953f4d 100644 --- a/docs/source/configure.rst +++ b/docs/source/configure.rst @@ -47,6 +47,9 @@ In order to configure Feed2toot, you need to create a feed2toot.ini file (or any [feedparser] accept_bozo_exceptions=true + [media] + custom=/var/lib/feed2toot/media/logo.png + For the [mastodon] section: - instance_url: the url of your Mastodon instance @@ -81,6 +84,10 @@ for the [feedparser] section: - accept_bozo_exceptions: If set to true, feed2toot will accept malformed feeds, which are rejected by default. +For the [media] section: + +- custom: the path to a media (should be supported by Mastodon) to be posted with every Mastodon post. + 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:: diff --git a/docs/source/install.rst b/docs/source/install.rst index 943428d..966a647 100644 --- a/docs/source/install.rst +++ b/docs/source/install.rst @@ -25,7 +25,7 @@ Alternatively, Setuptools may be installed to a user-local path:: * Untar the tarball and go to the source directory with the following commands:: - $ tar zxvf feed2toot-0.7.tar.gz + $ tar zxvf feed2toot-0.8.tar.gz $ cd feed2toot * Next, to install Feed2toot on your computer, type the following command with the root user:: diff --git a/feed2toot/cliparse.py b/feed2toot/cliparse.py index cbacd11..e196382 100644 --- a/feed2toot/cliparse.py +++ b/feed2toot/cliparse.py @@ -24,7 +24,7 @@ import os import os.path import sys -__version__ = '0.7' +__version__ = '0.8' class CliParse: '''CliParse class''' diff --git a/feed2toot/confparse.py b/feed2toot/confparse.py index c6b9e20..ae5a723 100644 --- a/feed2toot/confparse.py +++ b/feed2toot/confparse.py @@ -31,6 +31,7 @@ import feedparser from feed2toot.confparsers.cache import parsecache from feed2toot.confparsers.hashtaglist import parsehashtaglist from feed2toot.confparsers.feedparser import parsefeedparser +from feed2toot.confparsers.media import parsemedia from feed2toot.confparsers.plugins import parseplugins from feed2toot.confparsers.rss.pattern import parsepattern from feed2toot.confparsers.rss.toot import parsetoot @@ -85,6 +86,10 @@ class ConfParse: ########################### options['hashtaglist'] = parsehashtaglist(self.clioptions.hashtaglist, config) ########################### + # the media section + ########################### + options['media'] = parsemedia(config) + ########################### # the plugins section ########################### plugins = parseplugins(config) diff --git a/feed2toot/confparsers/media.py b/feed2toot/confparsers/media.py new file mode 100644 index 0000000..4bd577f --- /dev/null +++ b/feed2toot/confparsers/media.py @@ -0,0 +1,39 @@ +# -*- coding: utf-8 -*- +# Copyright © 2015-2017 Carl Chenet +# This program is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# any later version. +# +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with this program. If not, see