Install via pip: #+BEGIN_SRC sh $ su -c "pip install gnusrss" #+END_SRC
Or clone the repository: #+BEGIN_SRC sh $ git clone git://daemons.cf/gnusrss # OR ... $ git clone https://notabug.org/drymer/gnusrss/ $ cd gnusrss $ su -c "pip install -r requirements.txt" $ su -c "python3 setup.py install" #+END_SRC
The program is (or should be) quite intuitive. Running the following, should show the basics:
#+BEGIN_SRC sh $ gnusrss.py usage: gnusrss [-h] [-c file_name] [-C] [-p config_file] [-P] [-k file_name]
Post feeds to GNU Social
optional arguments: -h, --help show this help message and exit -c file_name, --create-config file_name creates a config file -C, --create-db creates the database -p config_file, --post config_file posts feeds -P, --post-all posts all feeds -k file_name, --populate-database file_name fetch the RSS and save it in the database #+END_SRC
In any case, if not clear, read the following.
For the first use, it must be created the database and the first configuration file. This can done using the same command, like this:
#+BEGIN_SRC sh $ gnusrss.py --create-db --create-config daemons #+END_SRC
Then it will ask several questions to create the first configuration file. It should look like this:
#+BEGIN_SRC dita Database created! Hi! Now we'll create config file! Please enter the feed's URL: https://daemons.cf/rss.xml Please enter your username (user@server.com): drymer@quitter.se Please enter your password: falsePassword Do you need to shorten the URLs that you 'post? Please take in account That You should only use it if your node only have 140 characters. Answer with "yes" or just press enter if you do not want to use it: Please enter your feed's fallbackurl. If you do not want or have one, just press enter: Now we're gona fetch the feed. Please wait ... Done! The tags are: tags title_detail link authors links author_detail published_parsed title summary id author published guidislink summary_detail The XML has-been parsed. Choose wich format you want: Please put the tags inside the square brackets Ex: {title} - {link} by @{author}: {title} - {link} by @{author} #+END_SRC
The file is saved under the name 'daemons.ini'. It should look like this:
#+BEGIN_SRC dita
[Feeds]
feed = https://daemons.cf/rss.xml
user = drymer@quitter.se
password = falsePassword
shorten
fallback_feed =
format
{title} - {link} by @ {author}
#+END_SRC
It can create all the configuration files you want. When creating the above file, it put into the database all the feeds that had so far. Thus, when running gnusrss for the first time, it will not post nothing to GNU Social until the feed has new information. To post feeds from a concrete config file or all execute, respectively, the following:
#+BEGIN_SRC sh $ gnusrss.py -p daemons.ini $ gnusrss.py -P #+END_SRC
If the config file is created manually and the user don't want to post all the feed's content, just use the --populate-database option to save them to the database:
#+BEGIN_SRC sh $ gnusrss.py -k otherFile.ini #+END_SRC
The recommended way to execute gnurss is using the crontab. Each time it's run, a single item of the feed will be posted to prevent flood. Depending on the number of feeds that are published, you should choose a different runtime. For a blog that publishs once a day, it could be used the following:
#+BEGIN_SRC sh * 12 * * * cd $rutaDEgnusrss && gnusrss.py -p daemons.ini #+END_SRC
So it runs once, every day at midday. If, however, it's used with twitter2rss, it could be recommended putting it to run every five minutes. It has to be remembered that is important to run in the directory where the database was created, because is where it will search it.. #+BEGIN_SRC dita 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 (At your option) 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.
Instalar usando pip: #+BEGIN_SRC sh $ su -c "pip install gnusrss" #+END_SRC
Clonar el repositorio: #+BEGIN_SRC sh $ git clone git://daemons.cf/gnusrss # O ... $ git clone https://notabug.org/drymer/gnusrss/ $ cd gnusrss $ su -c "pip install -r requirements.txt" $ su -c "python3 setup.py install" #+END_SRC El programa es (o debería ser) bastante intuitivo. Ejecutando lo siguiente, deberia verse lo básico:
#+BEGIN_SRC sh $ gnusrss.py usage: gnusrss [-h] [-c file_name] [-C] [-p config_file] [-P] [-k file_name]
Post feeds to GNU Social
optional arguments: -h, --help show this help message and exit -c file_name, --create-config file_name creates a config file -C, --create-db creates the database -p config_file, --post config_file posts feeds -P, --post-all posts all feeds -k file_name, --populate-database file_name fetch the RSS and save it in the database #+END_SRC
En cualquier caso, si no queda claro, leer lo siguiente.
Para el primer uso, la base de datos y el primer archivo de configuración deben ser creados. Podemos hacerlo usando la misma orden, tal que así:
#+BEGIN_SRC sh $ gnusrss.py --create-db --create-config daemons #+END_SRC
A continuación hará varias preguntas para configurar el primer archivo de configuración. Debería verse así:
#+BEGIN_SRC dita Database created! Hi! Now we'll create de config file! Please introduce the feed's url: https://daemons.cf/rss.xml Please introduce your username (user@server.com): drymer@quitter.se Please introduce your password: contraseñaFalsa Do you need to shorten the urls that you post? Please take in account that you should only use it if your node only has 140 characters. Answer with "yes" or just press enter if you don't want to use it: Please introduce your feed's fallbackurl. If you don't want or have one, just press enter: Now we're gona fetch the feed. Please wait... Done! The tags are: tags title_detail link authors links author_detail published_parsed title summary id author published guidislink summary_detail The XML has been parsed. Choose wich format you want: Please put the tags inside the square brackets Ex: {title} - {link} by @{author}: {title} - {link} by @{author} #+END_SRC
El archivo se guardará con el nombre 'daemons.ini'. Después de todas estas preguntas, debería verse similar a esto:
#+BEGIN_SRC dita
[feeds]
feed = https://daemons.cf/rss.xml
user = drymer@quitter.se
password = contraseñaFalsa
shorten
fallback_feed =
format
{title} - {link} by @{author}
#+END_SRC
Se pueden crear todos los archivos de configuración que se quieran. Al haber creado el archivo anterior, se han metido en la base de datos todos los feeds que habian hasta el momento. Por lo tanto, cuando se ejecuta gnusrss por primera vez, no posteará nada en GNU Social, a menos que el feed tenga nueva información. Para postear los feeds de un archivo o todos, ejecutar, respectivamente, lo siguiente:
#+BEGIN_SRC sh $ gnusrss.py -p daemons.ini $ gnusrss.py -P #+END_SRC
Si el archivo de configuración ha sido creado manualmente y no se quiere postear el contenido del feed, sólo hay que ejecutar la opción --populate-database para guardar estos en la base de datos:
#+BEGIN_SRC sh $ gnusrss.py -k otherFile.ini #+END_SRC
El modo recomendado de ejecución de gnusrss es usando el crontab. Cada vez que se ejecute posteará un sólo elemento del feed para evitar el flood. Según la cantidad de feeds que se publiquen, se deberia escoger un tiempo de ejecución distinto. Para un blog que publique una vez al día, con poner lo siguiente, deberia valer:
#+BEGIN_SRC sh * 12 * * * cd $rutaDEgnusrss && gnusrss.py -p daemons.cf #+END_SRC
Así se ejecuta una vez al día, a las doce de la mañana. Si, en cambio, lo usasemos con twitter2rss, se recomienda poner que se ejecute cada cinco minutos. Hay que recordar que es importante que se ejecute en el directorio en el que se ha creado la base de datos, ya que es ahí dónde la buscará. #+BEGIN_SRC dita 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 (at your option) 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 . #+END_SRC