Piwigo.org

You are not logged in. (Register / Login)

Announcement

#1 2017-04-14 13:51:02

Protheus
Member
Registered: 2016-10-25
Posts: 7

Piwigo Refresh

Greetings,

Since i upload all my Android Photos via FolderSync and SSH, they are already on the Server in the right place. I couldn't find a proper Commandline Tool to trigger only the Syncronization of this Incoming Folder to Piwigo. So i have tried too write my own small Script. I have used piwigo_import_tree.pl as inspiration since this is my first try with a Perl Script.

In my case i run the Script via a Cronjob, but maybe later i switch to inotify or anything similar. You can run the Script manually or via Cron like this example:

perl /media/hdd/piwigo_refresh.pl --base_url=http://localhost:81/piwigo/ --user=your_username --password=your_password --directory="absolute_path_to_your_ssh_upload_dir" --caddie=0 --privacy_level=4 --cat=your_category_id --subcat=1

If you find Problems, please let me know. I will try to solve them. I have tested this Script via 2.8.6 and 2.90RC2.

Piwigo URL: http://piwigo.org/ext/extension_view.php?eid=855

Offline

 

#2 2017-04-14 14:24:21

Protheus
Member
Registered: 2016-10-25
Posts: 7

Re: Piwigo Refresh

If you want, here is a small Shell Script which uses inotify-tools (install via "apt install inotify-tools" on Ubuntu/Debian) to monitor my Directory (and Subdirs) for Uploads, Delete's, Changes and so on and starts afterwards a Sync.

Code:

#!/bin/bash
monitor_dir="Absolute/Path/To/Monitor/And/Sync"
pwg_user="Piwigo_Username"
pwg_pwd="Piwigo_Password"
base_url="URL To your Piwigo Installation"
script_path="/Absolute/Path/To/The/QuickSync/Script"

while true
do 
inotifywait -r -e modify,attrib,close_write,move,create,delete $monitor_dir && perl $script_path --base_url=$base_url --user=$pwg_user --password=$pwg_pwd --directory=$monitor_dir --caddie=0 --privacy_level=4 --cat=162 --subcat=1
done

You should start the Script to the Background, so that you can close your SSH Session after starting

Offline

 

Board footer

Powered by FluxBB

github twitter facebook google+ newsletter Donate Piwigo.org © 2002-2017 · Contact