Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save solarkennedy/c47a8f97fe16ca388d03e703e63359f1 to your computer and use it in GitHub Desktop.
Save solarkennedy/c47a8f97fe16ca388d03e703e63359f1 to your computer and use it in GitHub Desktop.
Script to move watched videos in Kodi to a git annex remote
#!/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