Package: errol
ErrolErrol is a file sender that rely onwatchdog. It can be used to watch a directory and automatically transfers the new files (or modified ones) with XMPP.PrerequisitesErrol needs the following requirements:A system supportingwatchdog(Linux, Windows, Mac OS X, FreeBSD). Note: only Linux has been tested so far.An XMPP (jabber) account supporting the following XEPs:Mandatory:Stream Management,Optional:Publish-SubscribeOptional:Multi-User ChatIf pubsub: a pubsub service where the nodes can be set as open. The node name is defined in the configuration file. I personally  usesat_pubsub. A pubsub
component developed for the projectSalut à Toi.A Multi-User Chat because not all XMPP accounts support PubSub. For now, some information are still shared through MUC messages. This behavior could change in the future.You can use your own XMPP server or choose a XMPP service among the following list.https://conversations.im/compliance/Create the pubsub nodeThis step is optional if you already have a write access on the pubsub node. The following example usejp, the Salut à  Toi command-line interface butslixmppcan be used.$ jp pubsub node create -f publish_model open be.agayon.errol:0 -s pubsub.agayon.be -cThe node name be.agayon.errol:0 is recommended in order to identify the functionnality.As an example, there are the node options on the service pubsub.agayon.be:$ jp pubsub node info be.agayon.errol:0 -s pubsub.agayon.be
persist_items: True
deliver_payloads: True
serial_ids: False
publish_model: open
access_model: open
send_last_published_item: on_subTestsYou can test your setup with the examples scripts ofslixmpp.pubsub_client.pypubsub_events.pys5b_receiver.pys5b_sender.pyExample:./s5b_file_sender.py -j jid@example.org -p pass -r john@example.org -f /path/to/file.txtSee the scripts for more information.Getting started with ErrolFirst you need to clone the repository.
Errol needs the following dependencies:slixmpp(python 3 only)asyncioconfigparserwatchdoghachikoInstallingYou can easily install errol with pip:$pipinstallerrolgit$ python3 setup.py installErrol can easily be installed in a [virtualenv](https://virtualenv.pypa.io/en/stable/user_guide.html.ArchlinuxA [PKGBUILD](https://aur.archlinux.org/packages/python-errol/) is already available.ConfigurationYou need to provide information about the XMPP account.$ cat config.example.ini

[XMPP]
pubsub_enable=true
muc_enable=true
pubsub=pubsub.example.org
node=be.agayon.errol:0
room=chat@chat.example.org
jid=jid@example.org/errol
password=pass
ressource_receiver=-receiver
ressource_sender=-
nick_sender=example_sender
nick_receiver=example_receiver
receiver=jid@example.org/errol-receiver
presence_file=/tmp/errol_presence.txtjid : the jabber accountpassword: the xmpp passwordpubsub: the pubsub server (publish activity)room: the MUC (chatroom) where errol display information.presence_file: a writable file used to keep track of presences. When receiver is online, the file contains '1' and '0' otherwise. I use it to check the presence in a Django Application.The files will be sent byjid@example.org/errol-0 and received byjid@example.org/errol-receiver
. The nicks are the usernames used on the MUC.RunningOnce installed, Errol can be launched in a terminal.$ errol --help
usage: errol [-h] [-e EVENTS] [-f FILE] [-d] -p PATH -c COMMAND

Automatic XMPP file sender and directory watcher

optional arguments:
  -h, --help            show this help message and exit
  -e EVENTS, --events EVENTS
                        Number of events to watch (delete, create modify) in
                        the directory. Once reached, the program stops.
  -f FILE, --file FILE  Config file containing XMPP parameters
  -d, --debug           set logging to DEBUG
  -p PATH, --path PATH  The path watched.
  -c COMMAND, --command COMMAND
                        The executed command: xmpp or watcherOn device AIf you want to watch the directory /tmp/sender, the following command can be used:$ errol -f config.example.ini -p /tmp/sender -c watcherAll modified or new files created in the watched location will be sent by XMPP.On device BIf you want to receive the files, you have to launch Errol with the following command line.$ errol -f config.example.ini -p /tmp/receiver -c xmppAll the received files will be stored in the directory defined with the option '-p'.Launch with systemdErrol can be launched with systemd. Two unit files are provided to help you:errol_in.serviceerrol_out.serviceFirst, you need to create the config directory and copy the unit files.$ mkdir -p ~/.config/errol/
$ mkdir -p ~/.config/systemd/user/
$ cp systemd/environment.sh ~/.config/errol/
$ cp systemd/errol_watcher.service ~/.config/systemd/user/
$ cp systemd/errol_sender.service ~/.config/systemd/user/Then, you can edit the environment and the unit files to match your preferences and reload the units.$ systemctl --user daemon-reloadThe units can then be launched and activated at boot:$  systemctl --user start errol_in
$  systemctl --user start errol_out
$  systemctl --user enable errol_in
$  systemctl --user enable errol_outIf you encounter some problems, you can read the logs with the following command:$ journalctl --user -xe
$ systemctl --user status errol_out.service
$ systemctl --user status errol_in.serviceLicenseThis project is licensed under the GPLv3 - see theLICENSE.txtfile for detailsAcknowledgmentsSlixmppfor their nice library.French XMPP community (sat@chat.jabberfr.org,jabberfr@chat.jabberfr.org)Goffi from theSalut à Toiproject.