Topic: Slashes, Underscores and Dots

Hi, I am newb so please bear with me :D

I am trying to tag AC/DC.  MBP find the metadata and names the Artist AC/DC which is correct, this is what I want in the tag itself.

My problem is that when picard renames and moves the files, the slash is of course an invalid character in windows, so it replaces the slash with an underscore: AC_DC/AC_DC - Live (disc 1) [2003]/01 AC_DC - Thunderstruck.mp3

I would prefer if they were dots instead of  underscores....whilst still keeping the slashes in the metadata.

Anyway to do this?

Thanks

Re: Slashes, Underscores and Dots

Not currently possible specifically for slashes AFAIK; see http://forums.musicbrainz.org/viewtopic.php?id=1319

You could remove/replace all underscores with .s though (including legitimate underscores in names/titles); which is what most people seem to be doing at http://forums.musicbrainz.org/viewtopic.php?id=514

Re: Slashes, Underscores and Dots

Thanks!

(Always read the stickies!)

4 (edited by kelani 2009-07-14 17:37:05)

Re: Slashes, Underscores and Dots

Is that only a problem when moving files? If so, there may be a workaround. Add a replace on underscore and don't auto-move the files when renaming. Doing that, I can replace anything and it works fine. When moving, success varies. Isn't it the backslash that has problems then? Anyway, here's my naming strings if you want to give them a try.

File: (note it's all one line, no line breaks)
$if2(%artist%,%albumartist%)\\\\($left(%date%,4)\) $replace($replace($replace($replace(%album%,?,),/,-),_,),:, -)\\$if($gt(%totaldiscs%,1),%discnumber%.)$if(%tracknumber%,$num(%tracknumber%,2).,) $replace($replace($replace($replace($replace(%artist% - %title%,?,),/,-),_,-),*,x),:, -)
When moving it creates this structure: Artist\(date) AlbumCD.Track. Artist - Title (Subtitle) [remix].ext
Ex: Kelani\(1996) Firesprung\1.01. Kelani - Intro.mp3

When just renaming it does this:

1.01 Kelani - Intro.mp3

Multiple Artist:
$if2(%albumartist%,%artist%)\\\\($left(%date%,4)\) $replace($replace($replace($replace(%album%,?,),/,-),_,),:, -)\\$if($gt(%totaldiscs%,1),%discnumber%.)$if(%tracknumber%,$num(%tracknumber%,2).,) $replace($replace($replace($replace($if2(%artist%,%albumartist%) - %title%,?,),_,),*,x),:, -)
Same thing, just checks albumartist first.

I just tested it on a song I named and saved in Picard:

Artist: AC/DC AC\DC?
Title: ABC\DEF/GHI?
Track: 1
File was renamed to:
01. AC-DC AC-DC - Blue-Red-Yawn.mp3

With the right gear, even a half-deaf audio engineer could make a dog stuck in a sewer pipe sound like the Mormon Tabernacle Choir.
-Kelani (1995)

Re: Slashes, Underscores and Dots

Thanks Kelani, but I am having trouble getting my head around these strings.  I tried a few of the examples from that sticky, but I am not happy with the way the end results are formatted.

I just want a string that does this:

Artist\Artist - Album [Year]\tracknumber Artist - Song

That is what the below code does, but it doesn't replace underscores with spaces, and unfortunately I can't get my head around how to do that.

$if2(%albumartist%,%artist%)/%albumartist% - %album% [$left(%date%,4)]/$num(%tracknumber%,2) %artist% - %title%

6 (edited by kelani 2009-07-15 01:55:38)

Re: Slashes, Underscores and Dots

Yeah, I know how you feel. It definitely is a pile 'o script in such a tiny box. :)  We basically have the same format with the date moved and a few other minor differences, so it's just a matter of moving stuff around.

The underscore and other replacement happens inside all those $replace($replace($replace($replace statements. Unfortunately, I don't know of any way in Picard to condense it into one $replace() It can be done, just not sure about in Picard. For some reason, I had the replacements duplicated in there. No idea why. Sleep deprivation, probably. No matter, I'll rewrite it to match what you wanted.

[elapse 10 mins]

OK. Try this:

Single Artist:

$replace($replace($replace($replace($replace($if2(%artist%,%albumartist%)\\$if2(%artist%,%albumartist%) - %album% [$left(%date%,4)]\\$num(%tracknumber%,2) $if2(%artist%,%albumartist%) - %title%,?,),/,-),_, ),*,x),:, -)

Various Artists:
Only one difference: $if2(%artist%,%albumartist%) is changed to $if2(%albumartist%,%artist%) in both places it's used.  So:

$replace($replace($replace($replace($replace($if2(%albumartist%,%artist%)\\$if2(%albumartist%,%artist%) - %album% [$left(%date%,4)]\\$num(%tracknumber%,2) $if2(%artist%,%albumartist%) - %title%,?,),/,-),_, ),*,x),:, -)

Output: F:\mp3\scrounged\The Beatles\The Beatles - Help! [1965]\07 The Beatles - Ticket to Ride.mp3

This one does the following replacements:

?  to  <nothing> 
_  to  <space>   
*  to  x    (To note unreleased/demo tracks: 01. SomeBand - SuperSecret Track [x].mp3  )
:  to  <space>-
/  to -
In my version I had underscores replaced by nothing, to help avoid double spaces, but I changed it for ya.

If you want to alter any of the replacements, just look for the character,replacement) at the end of the string: ,?,),/,-),_, ),*,x),:, -) 

Each $replace( has one ,foo,bar) and that's where they do their magic...one at a time.

If you want to add more replaces, just add a $replace( somewhere with the others, and add the replacement stuff at the end of the string:

$replace($replace($replace($replace($replace(blahblahblah %title%,?,),_, ),*,x),:, -)!!!,!)

(That'd replace !!! with !)


Anyway, it worked for me. Hopefully it should work for you as well. Let me know if not. :)

Kel

With the right gear, even a half-deaf audio engineer could make a dog stuck in a sewer pipe sound like the Mormon Tabernacle Choir.
-Kelani (1995)

Re: Slashes, Underscores and Dots

kelani wrote:

Is that only a problem when moving files?

Specifically addressing slashes without affecting other underscores is a problem for both. And it's a problem for either slash, since Picard is cross platform and removes both. Which is why I suggested that you can replace /all/ underscores with a different character; a hyphen, space etc. But having all underscores changed to hyphens may not be what some users may not want (although fine for most artists/track titles).

You just can't specifically change only the slashes, since they are all turned into underscores before your file naming script is even evaluated. Which is why your above single-artist replacement script actually replaces the AC/DC slash with a space, rather than a hyphen, as you'd expect from reading it.

8 (edited by zan5hin 2009-07-15 11:11:38)

Re: Slashes, Underscores and Dots

Kelani, I can't thank you enough, it's formatting the albums perfectly now, just the way I want it :D

You're a forum superstar :)

edit: only issue I have now is that some albums have the wrong date in musicbrainz i.e. Diana Ross & The Supremes - The No. 1's was released in 2004 but it replaces it with 1965!  This also happened on Aretha Franklins greatest hits, replaced a 200x release date with a date a couple of decades ago.

Re: Slashes, Underscores and Dots

zan5hin wrote:

edit: only issue I have now is that some albums have the wrong date in musicbrainz i.e. Diana Ross & The Supremes - The No. 1's was released in 2004 but it replaces it with 1965!  This also happened on Aretha Franklins greatest hits, replaced a 200x release date with a date a couple of decades ago.

Well the first release actually is correct in MB: http://musicbrainz.org/release/18225d5a … 1e9ce.html

Are you using lastfmplus to set the original release year or something?

Re: Slashes, Underscores and Dots

I'm using the lastfmplus, with the default settings.  Just installed it and hit "reload defaults" and that's it.

11 (edited by kelani 2009-07-15 18:26:55)

Re: Slashes, Underscores and Dots

voice: thanks for the clarification on that. Yeah, I'm pretty much a no-underscores anywhere kind of guy. Some may not like that. To each his own, I guess.

zan5hin: Glad it worked for you and thanks for the kind words. I'm definitely not a superstar in any form, though; just a guy trying to solve a persistent and annoying problem (and getting nowhere fast). Given my current issues with original date not working at all, I'm kinda jealous of your problem there, but yeah, I had the same thing happen with the exact same album (yay, Aretha) and hundreds of others.

I store all my albums in this same structure:

Artist\(Year) Album\CD#.Track#. Artist - Title (Subtitle) [Remix].ext

You'll find a lot of times the release year you have doesn't match what Musicbrainz sets. Such is the nature of different releases, typos and such. Because of that, I've gotten to where I check & change the date before saving. Personally, I prefer the original release year shown, as it also functions as a good decade substitute, and makes nice chronological lists of an artist's works.

For example, on a compilation of music from 1928, I dont' really want: Various Artists\(2007) Music of 1928\

The only thing I can recommend is, before saving, take note of the existing release date you want to use. If it populates the wrong one, right click on the cluster and see if one with the date you want appears in the Releases dialog. If it's there, select it. If not, manually select all the files in the release, hit details and change the Date value to what you want. That should fix it.

Kel

With the right gear, even a half-deaf audio engineer could make a dog stuck in a sewer pipe sound like the Mormon Tabernacle Choir.
-Kelani (1995)

Re: Slashes, Underscores and Dots

To step back a bit - it's worth noting that using the lastfmplus script to set original release year completely circumvents MB's data and is not a properly supported mechanism to use MB's data set. The data for that doesn't even come from MB, so if you get bad results, I'm not surprised at all. I think most of us are aware of how crap Last.fm's objective data is.

But I'm also confused by zan5hin's complaint. If you have a Supremes compilation and you're complaining that the year isn't "2004" then it means that you don't actually want "Original release date" in your tags; you want the actual release date, which is what MB stores. THe "original" release year of the tracks on such a compilation is obviously the 60s.

So perhaps the problem is actually that you don't seem to be able to control this lastfmplus behaviour to disable the setting of originalyear/originaldate?

Re: Slashes, Underscores and Dots

Kelani - thanks again for the tip about how to change all the release dates at once, I tried changing from the album title date field but it didn't replicate to all the tracks.

Voice - I don't think I have setup Lastfmplus to grab the date, I was under the assumption the lookup/scan action only sources dates from the musicbrainz database.

Re: Slashes, Underscores and Dots

I've just played around with lastfmplus and have replicated what has happened - I'm still not sure it's behaving as expected; only RifRaf would know, probably. I can see that it's changing the date to 1965 on all tracks; I've have expected the original year to be different for each track, given it's a compilation but for it to not have changed the true release date as well as the original year. Hmm.

Anyway, if you don't want the dates mucked around with from the lastfmplus plugin, remove all the the filter entries from the plugin options > Tag Filter Lists > original year tags box. That should stop it from interpreting any last.fm tags as dates; thus stopping it overriding MB's data.

15 (edited by kelani 2009-07-16 19:28:40)

Re: Slashes, Underscores and Dots

zan: no problem, It was a happy day when I discovered that functonality :P

voice: btw, you mentioned in teh other thread Picard has an issue with its built-in originaldate. Can you give me a summary of what that problem is? I've looked everywhere and found nothing relating to it anywhere.

zan+voice: Well, I've spent at least 40 hours staring at the code, so I should know the answer to that one. :p

I believe that behavior is by design. Picard does set the release date (date) from MusicBrainz, and lastfmplus just tries to find an original release year for each track at runtime. Like voice said, Last.fm's data is, frankly, utter crap. In the (likely) event lastfmplus can't find an ORY, or if the ORY is greater than the release date for some reason, it'll set originaldate=date.

That's where last.fm's crappy data causes problems. I'm not 100% certain on this, but I'm thinking if it finds, say, one ORY for a track, and none for the others, it'll set the same ORY across all tracks in that cluster. You see that a lot with reissues of albums. Ex: A 2005 re-issue of a 1982 album will have an ORY of 1982 for all tracks, even when some of those may be earlier.

The ORY feature is definitely hit or miss. Unless the stuff you're tagging is incredibly popular or mainstream (or thas a fan base with too much spare time) a lot of what you tag won't find a date at all. :/

That's where I wish someone would write a plugin to yank the date off of Wikipedia. For individual songs, it has MUCH more reliable info, and the layout is standard enough that you should be able to get a much higher success % than with lastfm.  I'm in the midst of moving, but when I get set up, if nobody's written anything like that, I may have to.

With the right gear, even a half-deaf audio engineer could make a dog stuck in a sewer pipe sound like the Mormon Tabernacle Choir.
-Kelani (1995)

Re: Slashes, Underscores and Dots

kelani wrote:

voice: btw, you mentioned in teh other thread Picard has an issue with its built-in originaldate. Can you give me a summary of what that problem is? I've looked everywhere and found nothing relating to it anywhere.

There are a couple of saliant points here:

1) Picard doesn't contain the logic, across ID3 versions to write the tag, AFAIK. That's why RifRaf has to hack it with the special ~ID3:TDOR tag, rather than relying on an internal metadata value.

2) The reason Picard has never really supported this is that MusicBrainz itself cannot currently supply the data reliably. While tracks and releases can be linked in MB to their earliest releases; to link and maintain the data currently is unscalable, unwieldy and too time consuming for all but the most fanatic editor, so there are probably all of about 5 releases in MB linked correctly. To provide this data accurately and efficiently and on a wider scale requires a different database structure (which the long heralded "NGS" will hopefully provide).

Now that MB has release groups (as of May 2009), it'd be possible to get this data from MB for re-releases of albums. It'd be possible to code a plugin that finds the earliest release of an album inside the same RG and takes the date of that. But it wouldn't really work at the track level for compilations.

kelani wrote:

zan+voice: Well, I've spent at least 40 hours staring at the code, so I should know the answer to that one. :p

I believe that behavior is by design. Picard does set the release date (date) from MusicBrainz, and lastfmplus just tries to find an original release year for each track at runtime. Like voice said, Last.fm's data is, frankly, utter crap. In the (likely) event lastfmplus can't find an ORY, or if the ORY is greater than the release date for some reason, it'll set originaldate=date.

Sure, but I don't think the regular "date" metadata should be changed by the plugin, which it is in the above case. I think the originaldata from last.fm should always just be in the additional oridinaldate/TDOR field.

kelani wrote:

That's where last.fm's crappy data causes problems. I'm not 100% certain on this, but I'm thinking if it finds, say, one ORY for a track, and none for the others, it'll set the same ORY across all tracks in that cluster. You see that a lot with reissues of albums. Ex: A 2005 re-issue of a 1982 album will have an ORY of 1982 for all tracks, even when some of those may be earlier.

The ORY feature is definitely hit or miss. Unless the stuff you're tagging is incredibly popular or mainstream (or thas a fan base with too much spare time) a lot of what you tag won't find a date at all. :/

I'd have thought it'd just take the top tag from the "original year" filter list for each track individually (assuming you have "use track tags" enabled) but I concede I haven't spent a lot of time with the plugin.

kelani wrote:

That's where I wish someone would write a plugin to yank the date off of Wikipedia. For individual songs, it has MUCH more reliable info, and the layout is standard enough that you should be able to get a much higher success % than with lastfm.  I'm in the midst of moving, but when I get set up, if nobody's written anything like that, I may have to.

You're still going to be using a match on the artist/track name to do that which would be difficult. If you're thinking about doing that, IMO you'd probably be better to try and write a plugin to query MusicBrainz's web service itself. It's not that MB doesn't have original data (often); its just that the track<->track links aren't there for it to be reliably retrieved from later releases.

Re: Slashes, Underscores and Dots

kelani wrote:

This one does the following replacements:
/  to -
Kel

Hi - the above replacement does not seem to work.

I have included your replacement string (with a few additions) to my own string (the "----NEW STRING 23/07/2009---" http://forums.musicbrainz.org/viewtopic … 017#p7017).
However while my string seem to work fine with all/most albums I have tested it has failed with Peel Slowly and See (disc 4: 1968/1969) (http://musicbrainz.org/album/b481a1e3-d … tport=8000) which became Peel Slowly and See (disc 4 19681969) instead of Peel Slowly and See (disc 4 1968-1969).

Any clue on why it is happening? (I suspect it has to do with what voiceinsideyou was saying)

Re: Slashes, Underscores and Dots

Yes, I specifically referred to this here.

I believe the coded logic of Picard is this.

1) Retrieve metadata fields from MB server
2) Build up ID3/WM/etc tags
3) save tags to file
4) Prepare for file renaming. Replace all / or \ from tag variables with _ to be used in file rename string.
5) Insert variables into String
6) Evaluate tagger script
7) Split result into directories/files as appropriate

It must do the replacement of the slashes before inserting variables into the String currently because otherwise it would not know which /es are intended as folders/directories and which are part of metadata. There is no way this can be changed except by changing the code.

That's why I say that you must replace all _ with some other character. By the time #6 is done, there are no /s left in your metadata for it to replace; they have already been converted to underscores. So you can replace all of the underscores.

Re: Slashes, Underscores and Dots

voiceinsideyou wrote:

1) Retrieve metadata fields from MB server
2) Build up ID3/WM/etc tags
3) save tags to file
4) Prepare for file renaming. Replace all / or \ from tag variables with _ to be used in file rename string.
5) Insert variables into String
6) Evaluate tagger script
7) Split result into directories/files as appropriate

need to print that out. thanx)