Skip to content

Instantly share code, notes, and snippets.

@anjandev
Last active February 15, 2016 08:39
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 anjandev/80eedbb46fabe1e00943 to your computer and use it in GitHub Desktop.
Save anjandev/80eedbb46fabe1e00943 to your computer and use it in GitHub Desktop.
sync playlist files to phone
#! /bin/bash
#sync playlist files to phone
#MAKE SURE THIS FILE IS RAN FROM ~/Scripts
# add save_absolute_paths_in_playlists "yes" to your mpd.conf and regenerate playlists
cat ~/.mpd/playlists/phone.m3u | grep -v '#' | \
while read i; do cp -vu "${i}" /var/run/user/1000/gvfs/*/*/Music; done
BASEDIR=/var/run/user/1000/gvfs/
cd $BASEDIR`ls $BASEDIR | head -n 1`/Internal\ storage/Music
pwd
if [ "$(pwd)" == '/home/anjan/Scripts' ]; then
echo 'couldnt cd'
exit 1;
fi
if [ "$(pwd)" == '/home/anjan' ]; then
echo 'couldnt cd'
exit 1;
fi
for file in *
do grep -q -F "$file" ~/.mpd/playlists/phone.m3u || rm "$file"
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment