aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSilvio Rhatto <rhatto@riseup.net>2014-04-02 13:48:10 -0300
committerSilvio Rhatto <rhatto@riseup.net>2014-04-02 13:48:10 -0300
commitcaad449131325ed4b88ec9c1a10f6ef0758da21e (patch)
tree0d7ca3e7a96f77841d543c5524e5e675cd9c9e12
parentcb1d39b480ee0a16211405ca378c5a6753d03af6 (diff)
downloadscripts-caad449131325ed4b88ec9c1a10f6ef0758da21e.tar.gz
scripts-caad449131325ed4b88ec9c1a10f6ef0758da21e.tar.bz2
Adding playlist-copy script
l---------playlist-copy1
-rwxr-xr-xplaylist-get12
2 files changed, 11 insertions, 2 deletions
diff --git a/playlist-copy b/playlist-copy
new file mode 120000
index 0000000..a766a62
--- /dev/null
+++ b/playlist-copy
@@ -0,0 +1 @@
+playlist-get \ No newline at end of file
diff --git a/playlist-get b/playlist-get
index 8895ae5..d6b7d63 100755
--- a/playlist-get
+++ b/playlist-get
@@ -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