Re: Script help: convert music files to be compatible with MPD



Justin C wrote:
Sorry if the subject is not clear, but what I want to do isn't easy to
explain in a short space.

I have recently acquired some music. It's an extract from a Windows
Media Player library. I, however, use MPD. The files are all MP3 so
there's no problem there. I do, however, need to re-name them and create
play-lists from them.

In my music library I have, for example:

/home/music/david_bowie/aladdin_sane/aladdin_sane.mp3
/home/music/david_bowie/aladdin_sane/cracked_actor.mp3
/home/music/david_bowie/aladdin_sane/drive_in_saturday.mp3
/home/music/david_bowie/ziggy_stardust/five_years.ogg
/home/music/david_bowie/ziggy_stardust/hang_onto_yourself.ogg
/home/music/david_bowie/ziggy_stardust/ ...etc

I also have, in /home/music playlist files of the m3u type for each
album.

The music I have acquired is in the following structure:
/home/music/David Bowie/Aladdin Sane/David Bowie Aladdin Sane 01 Aladdin Sane.mp3
/home/music/David Bowie/Aladdin Sane/David Bowie Aladdin Sane 02 Cracked Actor.mp3
/home/music/David Bowie/Ziggy Stardust/David Bowie Ziggy Stardust 01 Five Years.mp3

Does anyone know of an easy way to:
create the playlists
rename the files to something sensible (lose artist name and album name from the file name)

I've started work on a Perl script to handle all this, but I'm at about
200 lines already and it's looking more complicated the more I look at
it. I'm sure someone must have had to do something similar before, so
I'm taking a break from coding it, and hoping to find somewhere it's
already been done. Any ideas?

Because i do it so infrequently and it takes me ages to work out how to do it again, i gave up writing scripts to do this sort of thing long ago. Now i use a text editor to create a script, using search and replace etc. I usually use nedit, because it's got the ability to select and paste columns.

I start off with 'ls > filelist' .

Then i open filelist with nedit and select and copy the list of files at the bottom of the file (so there are now two copies of the list in that file, probably separated by a few spaces). Then i select the bottom copy of the list and do whatever search and replace operations need to be done on it. Then i select it as a column (in nedit this is done by holding down <ctrl> while selecting), do <ctrl>-x, then paste it as a column (<ctrl><shift>-v) to the right of the top (original) copy of the list. Then do regex search and replace to change '^' to 'mv '.

Save the file and run is using 'sh filelist'.

Well, that's the basics - which probably won't work for you exactly as i described it - but you can work it out.

I find this considerably simpler than trying to work out a script!

Sometimes i use the shell command 'paste' to join the two lists together into one script - depending on what exactly i'm doing. If you haven't got an editor that can copy and paste columns, you could try that.

Of course, creating the m3u playlist is as simple as:

find /home/music/David Bowie > playlist.m3u

or whatever...


--
http://NovemberEchoRomeoDelta.com
.



Relevant Pages

  • Re: Script help: convert music files to be compatible with MPD
    ... Then i open filelist with nedit and select and copy the list of files at ... I find this considerably simpler than trying to work out a script! ... Sometimes i use the shell command 'paste' to join the two lists together ... got an editor that can copy and paste columns, ...
    (uk.comp.os.linux)
  • [Full-Disclosure] Re: [0day] ExploitLabs.com CGI Script Irony (was: Vote Today)
    ... It is also my belief that Donnie Werner's ... For the benefit of the lists, ... Filtering Flaws in ExploitLabs.com CGI Script ... Donnie's script insecurely sanitizes the "host" URI parameter. ...
    (Full-Disclosure)
  • Re: cp/mv with verify step?
    ... script), so a quick'n'dirty check would be to see if the last argument ... is a directory (in which case you append each source filename in turn) ... for every "target" file. ... Generating the lists *could* be scripted, ...
    (comp.os.linux.misc)
  • Re: checking dns records from named.conf
    ... > I have already modified your script to read named.conf file and parse it ... generated lists to tell me which of the 20 nameservers I'm responsible ... to detect sub-domains of zones we also hold. ... Writing something to keep a single DNS platform neat and tidy is on my ...
    (freebsd-isp)
  • Re: Tracking Dependencies
    ... Solved with simple script! ... Hal Vaughan wrote: ... #Get the lists of program and module directories from the argument list ... # Loop through all the files given, read each file into an array ...
    (comp.lang.perl.misc)

Loading