Last active
February 16, 2020 01:40
-
-
Save notfood/6fc39f7e16618fe91f8980d6c08a1b6f to your computer and use it in GitHub Desktop.
Makes a preview of recent archived sessions available
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
export XDG_RUNTIME_DIR=/tmp/runtime-root | |
SESSIONS=/var/lib/drawpile/sessions | |
ARCHIVES=/var/lib/drawpile/archived | |
cp $SESSIONS/*.session $ARCHIVES 2>/dev/null | |
mv $SESSIONS/*.session.archived $ARCHIVES 2>/dev/null | |
for f in $(ls $SESSIONS/*.dprec.archived); do | |
/usr/local/bin/drawpile-cmd -platform offscreen -f jpeg -a -s 200x150 -S $f | |
mv $f $ARCHIVES | |
done | |
mv $SESSIONS/*.jpeg $ARCHIVES | |
rename -- .archived '' /var/lib/drawpile/archived/*.archived | |
#Ubuntu uses a different rename, the above can fail, replace with this one | |
#rename 's/\.archived$//' /var/lib/drawpile/archived/*.archived |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
[Unit] | |
Description=Drawpile archived sessions vacuum | |
[Service] | |
Type=oneshot | |
ExecStart=find /var/lib/drawpile/archived/ -type f -mtime +1 -delete | |
[Install] | |
WantedBy=multi-user.target |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
[Timer] | |
OnCalendar=daily | |
[Install] | |
WantedBy=timers.target |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
[Path] | |
PathExistsGlob=/var/lib/drawpile/sessions/*.archived | |
[Install] | |
WantedBy=multi-user.target |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
[Unit] | |
Description=Drawpile archived sessions render | |
[Service] | |
Type=oneshot | |
ExecStart=drawpile-archives-process.sh | |
[Install] | |
WantedBy=multi-user.target |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment