]> gitweb.fluxo.info Git - scripts.git/commitdiff
Adding playlist-copy script
authorSilvio Rhatto <rhatto@riseup.net>
Wed, 2 Apr 2014 16:48:10 +0000 (13:48 -0300)
committerSilvio Rhatto <rhatto@riseup.net>
Wed, 2 Apr 2014 16:48:10 +0000 (13:48 -0300)
playlist-copy [new symlink]
playlist-get

diff --git a/playlist-copy b/playlist-copy
new file mode 120000 (symlink)
index 0000000..a766a62
--- /dev/null
@@ -0,0 +1 @@
+playlist-get
\ No newline at end of file
index 8895ae5f5cbefbf720b19bd99a99fc4112d43d22..d6b7d63da70b78d0292c087288822720646b3e7f 100755 (executable)
@@ -6,11 +6,12 @@
 # Parameters
 BASENAME="`basename $0`"
 PLAYLIST="$1"
+DEST="$2"
 MEDIA="/var/cache/media/noise"
 PLAYLISTS="$MEDIA/playlists"
 
 if [ -z "$PLAYLIST" ]; then
-  echo "Usage: $BASENAME <playlist>"
+  echo "Usage: $BASENAME <playlist> [dest]"
 
   if [ -d "$PLAYLISTS" ]; then
     echo ""
@@ -26,6 +27,13 @@ fi
 
 if [ "$BASENAME" == "playlist-drop" ]; then
   command="drop"
+elif [ "$BASENAME" == "playlist-copy" ]; then
+  if [ -z "$DEST" ]; then
+    echo "No destination specified"
+    exit 1
+  fi
+
+  command="copy"
 else
   command="get"
 fi
@@ -36,6 +44,6 @@ cat $PLAYLISTS/$PLAYLIST.m3u | while read file; do
   dir="$(dirname "$file")"
   base="$(basename "$file")"
   mkdir -p "$MEDIA/$dir"
-  ( cd "$MEDIA/$dir" && git annex $command "$base" )
+  ( cd "$MEDIA/$dir" && git annex $command "$base" $DEST )
 done