SongKong Jaikoz

SongKong and Jaikoz Music Tagger Community Forum

replace the forward slash when naming but keep the tag

I’m trying to metatag/rename the artist AC/DC and having some difficulty getting everything to display correctly.

After autocorrecting/double checking if I go to save the file WITHOUT an entry in “Preferences->File and Folder Correct->File and Folder Naming” to replace “/” with “_” I get the folder structure of ```Base Folder/AC/DC/(1980) AC/DC - Back in Black/


meaning the actual songs are [i]four[/i] folders deep from the Base Folder.

But if I DO have an entry for replacing "/" with "_" i get this folder structure:
```Base Folder/AC_DC_(1980) AC_DC - Back in Black

meaning the actual songs are one folder deep from the Base Folder.

What I really want is my songs two folders deep from the Base Folder, one folder for the Artist and one for the Album. I think this just means that I need Jaikoz to replace the “/”'s with “_” in the folder renaming, but not for it to touch the “/” being used as a folder separator.

Any help in how I would accomplish this would be greatly appreciated.

Thanks!

Edit: Just found this post http://www.jthink.net/jaikozforum/posts/list/4450.page Is this still my best option? Please say no :stuck_out_tongue:

Ah the AC/DC problem. Yes the problem is that when the Replace From Char with to Char option is used at save time it has no idea when a ‘/’ is being used to separate folders and when it is part of the fieldname. So what we need to do is address this issue in the rename mask. I have edited the default rename mask for folder naming so that AC/DC becomes AC_DC as follows:

function ifnotempty(value,sep){
     value=(value=='AC/DC' ? 'AC_DC' : value);
     return value.length > 0 ? value + sep : '';
 }
 
 function ifnotempty2(value1,value2,sep){
     value1=(value1=='AC/DC' ? 'AC_DC' : value1);
     value2=(value2=='AC/DC' ? 'AC_DC' : value2);

     return value1.length > 0 ? value1 + sep :value2.length > 0 ? value2 + sep:'' ;
 }
 
 ifnotempty2(albumartist,artist,'/') + ifnotempty(album,'/') + (disctotal>1 ? discno  + '/' : '')

And this works. Of course this only works for AC/DC if you have other artists with the same problem you would have to modify the script to include these but at least it works in this case.

For the filename renaming part the ‘/’ gets removed automatically because ‘/’ is not allowed so you just get ACDC but if you would want the underscore here as well you would have to do a similar change here as well.

Im struggling to think of a general purpose change I could make to Jaikoz to make it work automatically, if you have an idea let me know.

Paul, thanks so much for you’re reply, but I was REALLY hoping that wasn’t gonna be the answer. I knew I could do something along those lines but as you surmised, AC/DC is just the most common example. There are many other items that contain a forward slash. I’ve replaced many of them with underscores or ampersands but I’d really like to avoid doing that. And I already have an incredibly complicated renaming scheme for both file and folder options.

I guess I really don’t know the technicals of how you implement the Replace From Char with to Char option but it seems to me that its a order of operations issue. As in, if Jaikoz manipulated the different fields BEFORE they were sent to the renaming mask it could be avoided. Or if a Placeholder is inserted inplace of “Folder seperator” (though I suppose that is a sort of placeholder) and the forward slash’s were inserted only directly before the actual renaming (i.e. after all the other char have been replaced in the Replace From Char with to Char option. But again, this is just a layman’s ramblings.

I suppose I could add something to the beginning of all the strings along the lines of:

string noslashartist = (artist.indexOf('/') == -1 ? artist : artist.replace('/', '_'));
string noslashalbumartist = (albumartist.indexOf('/') == -1 ? albumartist : string albumartist.replace('/', '_'));
string noslashtitle = (title.indexOf('/') == -1 ? title : title.replace('/', '_');
*etc etc etc

and then use my new “noslashxxx” strings in my renaming. But I’m not much of a coder and not really sure this is optimal (or even if it works). Think I should add some check to see if there actually IS an artist, album artist, title etc…

Ah, youve solved it !

I was thinking that Replace From Char with to Char was applied at save time, but it isn’t it is applied when you run Correct Subfolder from Metadata.

As you said currently we perform the rename mask on the fieldnames and then do Replace from Char but if Jaikoz did Replace from Char first and then perform the rename mask there would be no problem. I can do this for the next release.

Sweet! so I should hold off on adding those lines from my second post to my renaming masks? When do you think the new release can/will be released (I’m in no rush, just curious)?

I expect the next release will be in about a month.

Hey Paul!

No rush, just curious if this has been implemented yet? I’ve been on other projects, but opened up jaikoz yesterday to see if it informed me of an update and it didn’t. Again no rush, thanks for everything you do with this, just curious what the status of this was…

Sorry, yes I did apply and release a fix for this problem.

If you go to Preferences:File and Folder Naming:Correct Filename from Metadata
and add a ‘/’ to ‘_’ mapping to Replace ‘From’ Character ‘To’ Character

then when you run Correct Filename from Metadata AC/DC will be converted to AC_DC

Unfortunately it didnt quite work because if you then run Correct Subfolder from Filename on OSX/Linux because the ‘/’ seperating each folder component get converted to ‘_’

So you could apply the fix and just run Correct Filename from Metadata and then change back, otherwise this will be resolved for the next release…

Thanks Paul.

That work around seems like kind of a lot of work. If I understand correctly I would change the / to _ in the file then run “Correct Folder from Metadata” then switch the tag info back to / and then add / to _ in the “Correct Filename from Metadata” and then run it? Seems a bit involved and still means my folder structure is messed up. Thanks so much for the suggestion but I think I’m just gonna hold off till a full fix is in place (seeing as I’m going to have to replace literally thousands of underscores and ampersands with forward slashs). I’ve got plenty to do in the meantime.

No thats not what I was saying, I was saying you can use this fix to easily correct your filenames but you cannot use it to correct your subfolder structure.

But rereading you original question you only talk about the folder structure not the last filename component part (i.e AC_DC.mp3) so I guess this is not much use to you

yeah after rereading and sitting on it for a sec I realized what you were talking about. And yes the folder’s is the issue because instead of nesting artist/album it creates a giant folder (AC_DC_(1992) AC_DC T.N.T.). Or if I leave the slashs in it creates a super nested AC/DC/ (1992) AC/ DC T.N.T./ AC/ DC - title of song.

Anyways, thanks again, I’ll stay put and tuned in for the next release

At last, fixed for new release,will be out later this week.

Saaahhhhhweeeet. thanks paul

Awesome, I’m on OSX and this was bugging me too. Thank you, Paul!

Now resolved in Jaikoz 5.0.0 http://jthink.net/jaikozforum/posts/list/6880.page

You can’t see me now but if you could you would be watching a pretty mean robot dance…

Cool,. but have you actually tried it yet, please check it works for you.

Ahhh good point, I’ll test tonight

Paul, What’s the best way to install this? When I tried to install it over the old instance I got an “Incompatible installation detected. Uninstall it first or choose another directory”. I would like to keep as many of my settings as possible…