Gentoo Forums
Gentoo Forums
Gentoo Forums
Quick Search: in
Print MP3 Id3 tags to file
View unanswered posts
View posts from last 24 hours

 
Reply to topic    Gentoo Forums Forum Index Multimedia
View previous topic :: View next topic  
Author Message
Qweasda
Apprentice
Apprentice


Joined: 04 Feb 2003
Posts: 152

PostPosted: Sat Mar 22, 2003 5:10 pm    Post subject: Print MP3 Id3 tags to file Reply with quote

How would I go about this? I want to print the mp3 tags to a file to print, with track numbers.
I first just ls'd the directory and copied/pasted the lines to a text file to print, but they have no numbers. I don't want to manually enter 1500 numbers.
Can mp3info or id3ed do this?

Thanks for help.
Back to top
View user's profile Send private message
ggelln
Tux's lil' helper
Tux's lil' helper


Joined: 24 Jan 2003
Posts: 98
Location: Montreal Quebec

PostPosted: Sun Mar 23, 2003 9:01 am    Post subject: Reply with quote

not sure I completely understand what you mean . . .

but lets say you want the track name and title,
this is one whay of getting a list:

Code:

mp3info -p "%n %t\n" * | sort -n > songlist.list


I put the trank number first because on my system it is not organized in this order so I must use numerical sort to deal with the song order, if you don't like this is would be easy to fix this after.

You can also be much more verbose on the output, lookup 'man mp3info' for format string needs. (ie print filename, album name, etc)

if this is in line tell me!
otherwise I can try to think of another solution

Gabriel
Back to top
View user's profile Send private message
Qweasda
Apprentice
Apprentice


Joined: 04 Feb 2003
Posts: 152

PostPosted: Sun Mar 23, 2003 5:10 pm    Post subject: Reply with quote

Thanks for the reply.
That is basically what I want, except I need it to add a number (1 through however many songs there are) at the beginning.

I am doing this because I have a mp3 CD player in my car and would like to be able to look at a print out of songs and go right to track, say, 153 and know what it is.

I was thinking, is there a text editor that can do this? Throw a number for each line? That would do the trick.


Thanks!
Back to top
View user's profile Send private message
ggelln
Tux's lil' helper
Tux's lil' helper


Joined: 24 Jan 2003
Posts: 98
Location: Montreal Quebec

PostPosted: Sun Mar 23, 2003 5:42 pm    Post subject: Reply with quote

hold on . . . do you mean that you want the list of files to be numbered, not from the track info, but
in the order it is loaded in your car mp3 player?

makes more sense now . . .

not as sure on this topic. It might depend on how your mp3 player organizes the files, it it does it alphebetically/numerically then it would be easy:
a quick and dirty version would be:
Code:

mp3info -p "  %a: %t\n" * | grep -n '.*' > carlist.list

which works nicely if everything has a id3 tag (otherwise you get some blank title entries)

if this is along the lines tell me, if you are not into scripting I could write the code so that it does more error testing and what not (ie prints the filename if no id3 tag, etc)

Tell me if this works with your player (ie the order matches)

Gabriel


Last edited by ggelln on Sun Mar 23, 2003 6:03 pm; edited 1 time in total
Back to top
View user's profile Send private message
Qweasda
Apprentice
Apprentice


Joined: 04 Feb 2003
Posts: 152

PostPosted: Sun Mar 23, 2003 5:58 pm    Post subject: Reply with quote

Your example was right on target.
I want to add the Track 1 line to the beginning of the song in the list I create. Example -
I have the mp3 called this:
Code:
Band Name - Song Name.mp3

I want it to look like this in the songlist.list file:
Code:
Track 1: Band Name - Song Name.mp3

And the next song would have Track 2, the next Track 3, etc.

Just the number without the Track part would be great as well.
Back to top
View user's profile Send private message
ggelln
Tux's lil' helper
Tux's lil' helper


Joined: 24 Jan 2003
Posts: 98
Location: Montreal Quebec

PostPosted: Sun Mar 23, 2003 6:11 pm    Post subject: Reply with quote

okay if you don't want the info from the id3 tag
(see my above edit, changed it before I say your update!)

then do this:

Code:

ls | sort | grep -n '.*' | sed 's/:/:   /'


the last sed part is just because I find the grep output to close to the filename otherwise.

again if I am on track tell me,
I am more than happy to write a more complex fix once we get the design ideas clear.

Gabriel
Back to top
View user's profile Send private message
Qweasda
Apprentice
Apprentice


Joined: 04 Feb 2003
Posts: 152

PostPosted: Sun Mar 23, 2003 6:29 pm    Post subject: Reply with quote

Great!
Code:
ls | sort | grep -n '.*' | sed 's/:/:   /'

is exactly what I wanted. Works great, thanks a bunch ggelln!
Back to top
View user's profile Send private message
ggelln
Tux's lil' helper
Tux's lil' helper


Joined: 24 Jan 2003
Posts: 98
Location: Montreal Quebec

PostPosted: Sun Mar 23, 2003 6:36 pm    Post subject: Reply with quote

good to hear

Gabriel
Back to top
View user's profile Send private message
Qweasda
Apprentice
Apprentice


Joined: 04 Feb 2003
Posts: 152

PostPosted: Sun Mar 23, 2003 6:44 pm    Post subject: Reply with quote

Well, now I'm just getting picky hehe. :)
But, is there an easy way to remove the .mp3 from the end of the name? It just makes the list look a bit better, nothing important though.
Back to top
View user's profile Send private message
ggelln
Tux's lil' helper
Tux's lil' helper


Joined: 24 Jan 2003
Posts: 98
Location: Montreal Quebec

PostPosted: Sun Mar 23, 2003 7:02 pm    Post subject: Reply with quote

sure just add another sed line:

Code:

ls | sort | grep -n '.*' | sed 's/:/:   ' | sed 's/\.mp3//'


nothing wrong with being picky :-)

Gabriel
Back to top
View user's profile Send private message
Qweasda
Apprentice
Apprentice


Joined: 04 Feb 2003
Posts: 152

PostPosted: Sun Mar 23, 2003 7:14 pm    Post subject: Reply with quote

Hmm, I get this:
Code:
$ ls | sort | grep -n '.*' | sed 's/:/:   ' | sed 's/\.mp3//'
sed: -e expression #1, char 8: Unterminated `s' command
Back to top
View user's profile Send private message
ggelln
Tux's lil' helper
Tux's lil' helper


Joined: 24 Jan 2003
Posts: 98
Location: Montreal Quebec

PostPosted: Sun Mar 23, 2003 10:21 pm    Post subject: Reply with quote

sorry for the typo, I didn't close the the first sed line
when I retyped!

Code:

ls | sort | grep -n '.*' | sed 's/:/:   /' | sed 's/\.mp3//'


sorry . . .

Gabriel
Back to top
View user's profile Send private message
Qweasda
Apprentice
Apprentice


Joined: 04 Feb 2003
Posts: 152

PostPosted: Tue Mar 25, 2003 1:47 am    Post subject: Reply with quote

Thanks again.

Eeek, another question.
Can I output what that command gives me to a file?
Back to top
View user's profile Send private message
ggelln
Tux's lil' helper
Tux's lil' helper


Joined: 24 Jan 2003
Posts: 98
Location: Montreal Quebec

PostPosted: Tue Mar 25, 2003 6:00 am    Post subject: Reply with quote

of course, just use the redirect (>)

therefore the final command would be:

Code:

ls | sort | grep -n '.*' | sed 's/:/:   /' | sed 's/\.mp3//' > carlist.txt


has been loads o-fun . . .
if you have any other scripting problem I hope I can help :-)

Gabriel
Back to top
View user's profile Send private message
Display posts from previous:   
Reply to topic    Gentoo Forums Forum Index Multimedia All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum