You are not logged in.

#1 2011-04-15 09:21:36

lswest
Member
From: Munich, Germany
Registered: 2008-06-14
Posts: 456
Website

[solved]Condensing non-unique results in BASH

Hey,

I'm currently working on a small script to go through my mp3 collection and save the album art stored within the id3 tags under the format artist+album.jpg, so that conky can display it.  However, the problem I have is creating the list of files to iterate over.  Currently I'm using find to create a list of all my mp3 files in the music directory, but I only need one mp3 per album directory.

Example to clarify:

/home/lswest/Music/Hyperion/Santana/Supernatural/01 (Da_Le)_Yaleo.mp3
/home/lswest/Music/Hyperion/Santana/Supernatural/02 Love_Of_My_Life.mp3
/home/lswest/Music/Hyperion/Santana/Supernatural/03 Put_Your_Lights_On.mp3
/home/lswest/Music/Hyperion/Santana/Supernatural/04 Africa_Bamba.mp3
/home/lswest/Music/Hyperion/Santana/Supernatural/05 Smooth.mp3
/home/lswest/Music/Hyperion/Santana/Supernatural/06 Do_You_Like_The_Way.mp3
/home/lswest/Music/Hyperion/Santana/Supernatural/07 Maria_Maria.mp3
/home/lswest/Music/Hyperion/Santana/Supernatural/08 Migra.mp3
/home/lswest/Music/Hyperion/Santana/Supernatural/09 Corazon_Espinado.mp3
/home/lswest/Music/Hyperion/Santana/Supernatural/10 Wishing_It_Was.mp3
/home/lswest/Music/Hyperion/Santana/Supernatural/11 El_Farol.mp3
/home/lswest/Music/Hyperion/Santana/Supernatural/12 Primavera.mp3
/home/lswest/Music/Hyperion/Santana/Supernatural/13 The_Calling.mp3

The above is the result for my Supernatural directory using the find method.  Since the album art is the same for the entire album (and there are no multiple artists in that album), I only need to access one mp3 file.  However, the lists are different lengths per directory, and uniq won't catch them since the mp3 files are all named differently.

Anyone have any ideas?

For anyone who's interested in it, eyeD3 is what I'm using the read the album art (it has the -i argument) and id3v2 to read the artist and album information from the files (since each album art file will need to be renamed).

Last edited by lswest (2011-04-15 09:44:34)


Lswest <- the first letter of my username is a lowercase "L".
"...the Linux philosophy is "laugh in the face of danger". Oops. Wrong one. "Do it yourself". That's it." - Linus Torvalds

Offline

#2 2011-04-15 09:38:14

tomk
Forum Fellow
From: Ireland
Registered: 2004-07-21
Posts: 9,839

Re: [solved]Condensing non-unique results in BASH

Maybe 'find 01*.mp3' instead of 'find *.mp3'.

Offline

#3 2011-04-15 09:42:56

lswest
Member
From: Munich, Germany
Registered: 2008-06-14
Posts: 456
Website

Re: [solved]Condensing non-unique results in BASH

@tomk:

Thanks, I didn't think of that.  It works for most of my albums (not all of them have the first track, you see), but the albums covered by this are mainly the ones which lack normal album art, so I'll consider this solved.

Last edited by lswest (2011-04-15 09:44:21)


Lswest <- the first letter of my username is a lowercase "L".
"...the Linux philosophy is "laugh in the face of danger". Oops. Wrong one. "Do it yourself". That's it." - Linus Torvalds

Offline

Board footer

Powered by FluxBB