You are not logged in.
Pages: 1
Hi, I could use your help..
The problem: I've got an m3u playlist with some of my favorite tracks. The files reside in album folders, which follow a naming scheme, but that has changed so I have to update all the references. What I have in mind is to use sed for extracting the mp3 filename, then somehow find the new path to that file and substitute it for the old one. I've managed to crawl this far, but obviously it won't work:
cat ultimate.m3u | sed -e 's/.*\///g' | sed -e 's/\(.*\.mp3')/`find -name \1`/g
please show me some geekism, regards
flo
Offline
Could you show us eg. 10 entries from 'ultimate.m3u' ? (I hope there are no spaces in the filenames!!)
Offline
yes... more info plz... like "old scheme" and "new scheme". Please specify what they are
Stand back, intruder, or i'll blast you out of space! I am Klixon and I don't want any dealings with you human lifeforms. I'm a cyborg!
Offline
sure. na, no spaces, i despise those
G2/G2-G2010-2003-Bad_MF/01-bad-mf-cosmois.mp3
720_Degrees/720_Degrees-720NU016-Blame-2004/01-blame-desert_planet.mp3
Virus-Various_Artists-VRS009-Life_Story_Vol_1-2001/02-cause_4_concern-peep_show.mp3
1210/1210-1210-006-Crossfire-2003/01-crossfire_-_hideout.mp3
Violence/Violence-Gridlok-2003-VIO006/02-gridlok-aggressor.mp3
the new scheme is more consistent .. mostly, e.a. Artist-CatNo-...
Last edited by flocntl (2009-11-05 20:43:39)
Offline
Offline
@brisbin33
*lol* you just pulled the rug from under my feet - that was more or less exactly what I would have suggested ... (there are always more ways than one to skin a cat, and personally I abhor these sed escape-sequences ...)
Offline
hmm, thanks brisbin33, but it seems that new_path is always empty. I guess "$file" won't evaluate in the find command?
Offline
cannot reproduce...
//blue/0/~ cat ./test.m3u
G2/G2-G2010-2003-Bad_MF/01-bad-mf-cosmois.mp3
720_Degrees/720_Degrees-720NU016-Blame-2004/01-blame-desert_planet.mp3
Virus-Various_Artists-VRS009-Life_Story_Vol_1-2001/02-cause_4_concern-peep_show.mp3
1210/1210-1210-006-Crossfire-2003/01-crossfire_-_hideout.mp3
Violence/Violence-Gridlok-2003-VIO006/02-gridlok-aggressor.mp3
//blue/0/~ while read old_path; do
// file=$(basename $old_path)
// echo file is $file
// echo "i would be finding ./ -name '$file' right now..."
// done < ./test.m3u
file is 01-bad-mf-cosmois.mp3
i would be finding ./ -name '01-bad-mf-cosmois.mp3' right now...
file is 01-blame-desert_planet.mp3
i would be finding ./ -name '01-blame-desert_planet.mp3' right now...
file is 02-cause_4_concern-peep_show.mp3
i would be finding ./ -name '02-cause_4_concern-peep_show.mp3' right now...
file is 01-crossfire_-_hideout.mp3
i would be finding ./ -name '01-crossfire_-_hideout.mp3' right now...
file is 02-gridlok-aggressor.mp3
i would be finding ./ -name '02-gridlok-aggressor.mp3' right now...
seems to be working here. perhaps your not looking in the right directory with your find command? ~/Music was just my example.
//github/
Offline
Pages: 1