Created
May 17, 2020 16:57
-
-
Save solarkennedy/c47a8f97fe16ca388d03e703e63359f1 to your computer and use it in GitHub Desktop.
Script to move watched videos in Kodi to a git annex remote
This file contains hidden or 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/bash | |
SQL=$(cat <<EOF | |
select p.strPath || f.strFilename | |
from files f | |
join path p | |
on p.idPath = f.idPath | |
where f.playCount > 0; | |
EOF | |
) | |
IFS=" | |
" | |
for file in `sqlite3 /home/$USER/.kodi/userdata/Database/MyVideos116.db < <(echo "$SQL")`; do | |
if [[ -f "$file" ]] && [[ -L "$file" ]]; then | |
cd /archive/ | |
git annex move --force --to RemoteDrive "$file" | |
fi | |
done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment