android
  #1  
Old 10-06-2008, 05:26 AM
jgustavogm jgustavogm is offline
Junior Member
 
Join Date: Feb 2008
Posts: 2
Default Linux users: Sync your .m3u files

Hi everyone... here is a small script (/bin/bash) made for synchronize your .m3u files created by known media players (I just proved it for Banshee 1.2) to your UMS-P2 (you can change device and folder destination). At the end, you will have your song path same as in your machine, without the /path/before/your/Music/folder preffix which is replace by /your_device/Music_folder.

Save next code in a executable file (e.g. syncMP3) into a bin folder.
Code:
#!/bin/bash

device=/media/P2
folder=Music

while read line; do
        song=${line}
        path=${song#*/music_folder/}    # replace music_folder/  by your Music Folder (e.g. /home/foo/MUSIC -- use MUSIC/ instead) 
        path=${path%/*}
        file=${song##*/}

        if [[ ${song:0:1} != "#" ]]; then
                if [ -d $device/$folder ]; then
                        echo -e $song
                        mkdir -p "$device/$folder/$path"
                        cp -r "$song" "$device/$folder/$path/"
                else
                        echo "El directorio destino NO EXISTE"
                        echo "Por favor checa el directorio destino"
                        exit
                fi
        fi
done < $1
echo "Archivos copiados con éxito"
Use it as
Code:
syncMP3 yourplaylist.m3u
Make sure to specify your mountpoint and folder destination inside the script, device and folder variables, respectively.

I suggest at first try with a TMP folder made by yourself, don't forget to change folder (destination) variable.

Any debug or suggestion are welcome. Thank you for this forum.

Last edited by jgustavogm; 10-06-2008 at 05:58 AM.
Reply With Quote

Advertisement [Remove Advertisement]

Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump



All times are GMT -5. The time now is 08:53 PM.