You are not logged in.
Pages: 1
Hello,
I'm currently trying to sync a playlist created in amarok to my new phone (Jolla) using rsync.
I'm using the "--files-from" option, targetting the *.m3u file. Option are ok, but I'm stuck with the following :
In the m3u file from Amarok, audio files (mostly *.ogg) are listed using URL formatted path (I mean ' ' are replaced by %20 and so on) obviously, rsync complains about not finding those files.
So I went into bash scripting to convert those URLpath to linux path :
rm newList.m3u
for i in $(grep '../Musique' list.m3u)
do
#awk snippet courtesly from http://rosettacode.org/wiki/URL_decoding#AWK
awk -v str=$i '
BEGIN {
#printf("%s\n",str)
len=length(str)
for (i=1;i<=len;i++) {
if ( substr(str,i,1) == "%") {
L = substr(str,1,i-1) # chars to left of "%"
M = substr(str,i+1,2) # 2 chars to right of "%"
R = substr(str,i+3) # chars to right of "%xx"
str = sprintf("%s%c%s",L,hex2dec(M),R)
}
}
printf("%s\n",str)
exit(0)
}
function hex2dec(s, num) {
num = index("0123456789ABCDEF",toupper(substr(s,length(s)))) - 1
sub(/.$/,"",s)
return num + (length(s) ? 16*hex2dec(s) : 0)
}' >> newList.m3u
donesync command :
rsync -hrut --progress --files-from=newList.m3u ~ Jolla:/home/nemo/Music/'Jolla' is a known host
It works quite good (most of the files are sync'd), but some characters aren't converted as expected (e.g. '%C3%84' should be 'Ä' but becomes 'Ã') and rsync still complains about those files.
So I'm looking for an easier way, without translating the playlist : any way to get an Amarok playlist with real linux path ? or any way to get rsync accept those URL ?
(Or is there any mistake in the awk script ?...)
Thanks everyone ![]()
Offline
Pages: 1