Last active
February 15, 2016 08:39
-
-
Save anjandev/80eedbb46fabe1e00943 to your computer and use it in GitHub Desktop.
sync playlist files to phone
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#! /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