From: Silvio Rhatto Date: Thu, 19 Oct 2023 18:16:50 +0000 (-0300) Subject: Fix: hydractl: sync-media: workflow improvements X-Git-Url: https://gitweb.fluxo.info/?a=commitdiff_plain;h=30458ae1ace879bfc56cc72e3ed024c6f13c9adb;p=hydra.git Fix: hydractl: sync-media: workflow improvements --- diff --git a/share/hydractl/sync-media b/share/hydractl/sync-media index 12d9b69..48b03b7 100755 --- a/share/hydractl/sync-media +++ b/share/hydractl/sync-media @@ -53,6 +53,10 @@ function sync_media_add { # Add meta files, making sure they're handled directly by Git function sync_media_add_metadata { + # Playlist files + find -name '*.m3u' -type l -exec git annex unlock {} \; + find -name '*.m3u' -exec git add {} \; + # Koreader metadata files find -name metadata.pdf.lua -type l -exec git annex unlock {} \; find -name metadata.pdf.lua -exec git add {} \; @@ -206,13 +210,32 @@ for folder in $REPOSITORIES; do cd $CACHE/$folder echo "Syncing $CACHE/$folder..." - sync_media_add_metadata - sync_media_playlist_perms + # Ensure the removable volume is in the list of remotes sync_media_ensure_remote $REMOTE $VOLUME/$MEDIA/$folder + + # Ensure the repository is identified sync_media_identity + + # Sync before changing anything, to make sure the history does not have + # conflicts with other remotes + git annex sync + + # Fix any playlist permissions + sync_media_playlist_perms + + # Process metadata + sync_media_add_metadata + + # Add new content, and catch up changes sync_media_add + + # Sync everything again git annex sync + + # Get all that needs to be got sync_media_getall $CACHE/$folder + + # Repository maintenance sync_media_fsck sync_media_dropunused )