SongKong Jaikoz

SongKong and Jaikoz Music Tagger Community Forum

How to amend the rename mask

Newbie here, but loving Jaikoz! Please bear with a basic question…

I understand how to use Action>File & Folder Correct>Correct Filename from Metadata.
But what I don’t understand is how to take control of that mask. I’ve spent a long time messing about with the ‘code’ in the top box, (which doesn’t mean anything to me - sorry!) but can’t get it to do what I want.
Clicking on the items in the bottom box adds the item(s) to the example mask, but only AFTER the fields already contained in the example mask. It ‘looks’ like I should be able to use those items to order them how I want… or maybe not?

I’ve checked the online help, which explains all the things I already know about that function, but seems to assume alevel of understanding about coding which i don’t have.

Can anyone please explain ins imple terms how to control the mask?

What I want is actually very simple:
Title - Artist - Album - Track No

I know this is a basic and maybe dumb question, but I’ve already spent too long trying to figure it out. Thanks.

Hi Jeff its Javascript which I realise isnt the simplest thing ever if you dont know Javascript - but it does give you a lot of power and flexibility. Previously the rename mask used a simpler format but the trouble was that it only worked for simple masks and couldnt be adapted for more complex masks. I plan to provide lots of predefined masks (like I do in SongKong) so then you can just pick a mask, and only need do any editing if you need a custom mask.

But for now, you can edit the mask - clicking on the bottom bar adds them to the end of the mask, but of course you can put them in the order you want by editing the text in the top window.

just change the last line of both masks to:


Hello Paul,

I just read your answer but it doesn’t help me further. You give the code for the last line suggesting there should be more lines. I’ve been experimenting (without knowledge of Javascript) and I don’t have any previous lines. Only the last line gives an error.

I prefer Artist - Album - Track No - Title

Can you give me all the lines I need to make this work?

Hi the default mask consists of some functions first and then the mask that uses the functions, you probably do have the functions but just haven’t noticed them but in case you haven’t I post the complete mask as you require including the functions

function pad(number, length) {
      if (number == '') { return '';} 
      var str = '' + number; 
      while (str.length < length) {  
          str = '0' + str;
      }
      return str;
  }
 
 function ifnotempty(value,sep){
     return value.length > 0 ? value + sep : '';
 }
 
 function ifnotempty2(value1,value2,sep){
     return value1.length > 0 ? value1 + sep :value2.length > 0 ? value2 + sep:'' ;
 }
 
 ifnotempty2(albumartist,artist,' - ') + ifnotempty(album,' - ') + ifnotempty(pad(trackno,2),' - ') + title

Thanks, that was quick ;).
Gonna try it soon.