]> gitweb.fluxo.info Git - playlister.git/commitdiff
Fix: playlist-copy: adb: update file list at the destination
authorSilvio Rhatto <rhatto@riseup.net>
Sat, 13 Jan 2024 12:30:09 +0000 (09:30 -0300)
committerSilvio Rhatto <rhatto@riseup.net>
Sat, 13 Jan 2024 12:30:09 +0000 (09:30 -0300)
playlist-get

index 2d6426db50e7764dc75b5f96670b2315bf785a2c..661eac910c64beb89d2b54edd4ad42630d27a5e9 100755 (executable)
@@ -59,6 +59,7 @@ else
   action="get"
 fi
 
+# Start
 echo "Getting files from $PLAYLISTS/$PLAYLIST.m3u..."
 cd $MEDIA
 
@@ -74,17 +75,22 @@ cat $PLAYLISTS/$PLAYLIST.m3u | while read file; do
     prefix="/$(dirname "$file")"
     echo mkdir -p \"$DEST$prefix\" | adb shell
     $APP $action "$file" "$DEST$prefix"
-
-    # Thanks https://stackoverflow.com/questions/17928576/refresh-android-mediastore-using-adb
-    adb shell "find $DEST -exec am broadcast \
-    -a android.intent.action.MEDIA_SCANNER_SCAN_FILE \
-    -d file://{} \\;"
   else
     $APP $action "$file" $DEST
   fi
 done
 
-# Copy the playlist to the destination
+# Additional procedures
 if [ "$action" != "get" ]; then
+  # Copy the playlist to the destination
   $APP $action "$PLAYLISTS/$PLAYLIST.m3u" $DEST/$PLAYLIST.m3u
+
+  # Refresh file list at the destination
+  if [ "$APP" == "adb" ]; then
+    # Thanks https://stackoverflow.com/questions/17928576/refresh-android-mediastore-using-adb
+    echo "Updating file list at the destination..."
+    adb shell "find $DEST -exec am broadcast \
+    -a android.intent.action.MEDIA_SCANNER_SCAN_FILE \
+    -d file://{} \\;"
+  fi
 fi