Topic: How To: moc & conky - correct filenames (no id3)

just wanted to share a little tip i have for using MOC with conky.
if you are like me and you hate ID3 tags and just spend hours of your life making sure all your filenames are in order, you don't want to use the ${moc_artist/album/title} options from conky. a 2nd reason for not wanting this is because (afaik) there is no ${moc_number} option to display the position of the song on the album.
so, you want to use the ${moc_file} option, but it gives you the full path to your song. it needs to be trimmed.

i just spent the last hour figuring out how 'sed' works for this so you don't have to. add this line to your conky to show the filename of whatever you're playing in moc without the whole path and without the file-extension:

${if_running mocp}${exec mocp -Q %file | sed -e 's_/.*/__' -e 's_\..\{3\}$__' -e 's/_/ /g'} :: ${exec mocp -Q %tl} / ${exec mocp -Q %tt}  [ ${exec mocp -Q %state} ] $endif

translation:
${exec mocp -Q %file} < do 'man moc' for details, this gives you the filename, same as ${moc_file}
sed -e 's_/.*/__' < sed: strip everything between the first and last forward slash, leaving you with just the filename
-e 's_\..\{3\}$__'} < sed continued: strip everything with '.blahblablah' from the end of the line
-e 's/_/ /g' < sed continued: display underscores as spaces
(used the _ as a delimiter in sed as to not get a big mess of slashes)

hope this is of any use to anyone :)

edit: made some changes. above code now also includes other stuff like moc time left and total time and moc state. see a couple posts below to see description of changes.

Last edited by rhowaldt (2011-09-07 14:04:01)

Re: How To: moc & conky - correct filenames (no id3)

Very nice!I just used it now and it works very well!

Last edited by sunfizz98 (2011-09-06 23:57:13)

Re: How To: moc & conky - correct filenames (no id3)

Why would you hate ID3 tags? That's just so... wrong! Of course, I've never had to try editing them in #!, but there's a great windows program for it. Hell, it does it itself, mostly. big_smile

Re: How To: moc & conky - correct filenames (no id3)

The MoC support in Conky has always been buggy anyway; I spend hours making sure my id3v2.3.0 tags are accurate (and that the filenames match), and I use ${mocp -Q %title}; I also changed the FormatString in a custom ~/.moc/config because I didn't like the default format of %title.  Nice to see another creative solution using ${exec mocp yada} though. cool

while ( ! ( succeed = try() ) );

Re: How To: moc & conky - correct filenames (no id3)

thevdude wrote:

Why would you hate ID3 tags? That's just so... wrong!

i hate them because i cannot understand why you would edit all sorts of tagging-fields embedded in a file, while you have a perfectly valid place for placing that information already, which is the filename.
also, because of the embedded nature of ID3 tags, every stupid person in the world can just place stuff in there and i will not notice until i load it all up in my ID3-reading player, and see 'RiPpEd By JaCk!1!!!!!111' or some shit like that at the end of the title or whatever.
also, what's with the 'genre' option? either nobody bothers to fill it up so it is always 'Blues', or people think it really funny to have a metal-track with genre 'christian folk' or something like that.
and the thing i hate most about is i think is: people tend to stop taking care of their filenames. that is all fine and dandy when you are in a piece of software reading ID3 tags, but what if i want to browse your music folder and copy stuff over to my USB stick or something, and i keep looking for that one file who's ID3-tag tells me is 'Metallica - Enter Sandman', but i cannot seem to find it, only to realize (by going to the software, right-clicking the file and doing something like 'view location' or whatever)'it was called 'g8!!_ejhegwubi.MP3' all along.

[/rant] smile

Re: How To: moc & conky - correct filenames (no id3)

I've haven't had those problems since the days of Napster and KaZzA. D: I understand "Why use tags, there's a place for that information", I just disagree that the place is the filename. It's the tags!

I keep my library mostly organized. I started going letter/artist/album-year/tracknumber-title with a few, but it takes a long time with a large library, and there's so many that I only have one or two albums that it seems silly to do that with the whole thing. It'll all get done eventually (Except my house/dubstep music, that's a separate folder entirely), but I like being able to go through all my music by Artist, Album, Year, or really any of the tags without restructuring my library.

Last edited by thevdude (2011-09-07 12:21:34)

Re: How To: moc & conky - correct filenames (no id3)

@thevdude: i guess it is also a matter of preference. seeing you mention the 'year' factor, that is for example something i couldn't care less about. my mp3's are nearly always full albums and my folders are loosely set up as 'genre - subgenre - (artist) - artist+album' - i only have a separate 'artist' folder if i have a lot of stuff by that particular artist, say, more than three albums. so in the case of Venetian Snares for example, i have:
#mp3/#beats/#breaks/#breakcore/venetian snares/venetian snares - the chocolate wheelchair/venetian snares - the chocolate wheelchair - 01 - <don't remember the title>.mp3

just wrote a script to make all the spaces into underscores as well, because linux does not like spaces where windows does not mind, and almost my entire music collection has been built in previous days on windows.
to get back on topic, i've since modified the conky script-part to display underscores as spaces and to only show the moc-stuff when moc is actually running (and made a little tweak somewhere because sometimes it did not work properly but forgot what it was). here is the new and improved (i'll edit the 1st post as well):

${if_running mocp}${exec mocp -Q %file | sed -e 's_/.*/__' -e 's_\..\{3\}$__' -e 's/_/ /g'} :: ${exec mocp -Q %tl} / ${exec mocp -Q %tt}  [ ${exec mocp -Q %state} ] $endif

oh, and thanks for the love sunfizz & pvsage!

Last edited by rhowaldt (2011-09-07 14:02:42)

Re: How To: moc & conky - correct filenames (no id3)

I understand your pain with the ID3 tags.  They're very fickle.  Sometimes they're tagged correctly.  Other times, you get jerks who put in comment tags unrelated to the band artist.  There are some great applications that can mass tag albums, but even that process is time consuming.

Re: How To: moc & conky - correct filenames (no id3)

^ And you need to be sure you're editing the *right* tags.  Picard, for example, automatically uses id3v2.4.0, which is apparently the "latest & greatest", but most apps & personal media players only see id3v2.3.0 and id3v1; this caused a lot of consternation on my part when, after using Picard to retag my entire library (which itself was actually quite painless), none of the track information would show up in the pmp I was using at the time.

EDIT:  I don't know if Picard can be forced to use id3v2.3.0...I've since switched to mp3diags for tagging.

EDIT:  One upside of mistagged (and misnamed) mp3's on file sharing networks is you might encounter new music from bands you've never thought about looking for...a couple great examples are "Gin and Juice" as covered by The Gourds (commonly mis-attributed to Phish) and "Cat's in the Cradle" as covered by Ugly Kid Joe (often mistaken for Guns and Roses), both of which I found by accident.

Last edited by pvsage (2011-09-07 16:15:10)

while ( ! ( succeed = try() ) );

Re: How To: moc & conky - correct filenames (no id3)

@sunfizz: i need an application for mass-renaming mp3's to my preferred format :)
funny thing is that i used an app called 'Filerfrog' on Windows which does append and search-and-replace stuff on filenames, and i was missing such a thing on Linux. so i figured i could script my own CLI 'append', and so i did, and it is working perfectly :) (if anyone wants to see that, let me know and i'll copy-paste it right in here :)

@pvsage: yeah the ID3-versions thingy is annoying and i can fully understand your frustration going through that nonsense.
with regards to the discovery of new music, i had not thought of it that way and you are right. personally i just do a 'browse user files' on my preferred client (a linux-version of which i am still not getting to work btw) on anyone that seems to have some good taste in music, and i download stuff i never heard about and check it out. sometimes it sucks, sometimes you hit gold :)

Last edited by rhowaldt (2011-09-07 16:20:22)

Re: How To: moc & conky - correct filenames (no id3)

So I'm assuming the id3 fiasco is upwards compatible but not the other way around...  I was thinking about mass tagging my music collection for my xbmc rig, but now it seems like a lot of wasted effort.

Re: How To: moc & conky - correct filenames (no id3)

I think just about all the taggers use 2.3.0 by default; Picard (recommended by a member of this forum IIRC) is the only one I know of that uses 2.4.0 or later.  I mean, when you consider just about everyone uses the orchestra tag for "albumartist", 2.3.0 pretty much covers all the bases, so IMHO it should be chiseled in stone as The MP3 ID3 Tag Format(tm).

while ( ! ( succeed = try() ) );