This forum has been archived. All content is frozen. Please use KDE Discuss instead.

URL Encodings and Bash Scripts

Tags: None
(comma "," separated)
User avatar
kkrizka
Registered Member
Posts
5
Karma
0

URL Encodings and Bash Scripts

Sat Aug 25, 2007 7:37 pm
Hi there,

I'm trying to set up fftrans script so I can automatically transfer my music to my PSP. I need this because PSP only supports MP3, and my entire library is in OGG format. It's quite cool that Amarok does the conversion for me automatically. Thanks guys, this is one of the most useful features ever!

But right now I still have one problem. I have several non-english songs in my library, and they have filenames with symbols in them. This means that when the bash script is called, the URL to the file will have the symbols encoded. For example, a song by Elán will have El%C3%A1n in it's path, which will result in a "File Not Found" error. Is there a way around this? I do not mind renaming all the files to get rid of the special symbols, but I rather not do it manually because there is just too many of them. Would it possible to create an amarok script that does this?
User avatar
Alanceil
Registered Member
Posts
160
Karma
0
OS

Re: URL Encodings and Bash Scripts

Thu Aug 30, 2007 10:38 am
PHP can decode those %nn strings. Just pipe it through:

Code: Select all
echo '<?php echo urldecode("a%20b"); ?>' | php


Where a%20b is an example string. I don't know how your shellscript works, but you'll most likely have to insert a variable there, which might look like this then:

DECODEDPATH=`echo "" | php`

(can't put this in [ code ] tags, because the forum deletes the escaped ' " ' ...)

Last edited by Alanceil on Thu Aug 30, 2007 10:42 am, edited 1 time in total.
User avatar
kkrizka
Registered Member
Posts
5
Karma
0

Re: URL Encodings and Bash Scripts

Fri Aug 31, 2007 7:35 pm
Thanks, that got it working!


Bookmarks



Who is online

Registered users: abc72656, Bing [Bot], daret, Google [Bot], Sogou [Bot], Yahoo [Bot]