Home User Forums SongKong Music Tagger Jaikoz Music Tagger Albunack Music Service
Showing posts with label rename. Show all posts
Showing posts with label rename. Show all posts

Saturday, 26 April 2014

Sharing filename masks between SongKong and Jaikoz

A longtime customer of Jaikoz and SongKong asked on the forums whether you can share filename masks between SongKong and Jaikoz,well yes you can but with a couple of adjustments.

Both applications use Javascript expressions to rename files, although this powerful syntax takes a few minutes to understand, but there are three important differences.

Two masks versus one

In both applications we have the concept of  a base folder, subfolder and filename which is described in detail here. With SongKong there is a single mask to modify the subfolder and filename in one go, in contrast Jaikoz has one mask for modifying the subfolder and one for modifying the filename.

Field names

Fields names for both applications are the same, except Jaikoz uses trackno to represent a trackno and SongKong uses track.


Functions

In Jaikoz Javascript functions needed to be included as part of the rename mask, but in SongKong they can be stored separately and referenced by masks, SongKong also allows rename masks to be named and stored so you can easily switch between different masks.

An Example

SongKong mask

(Note if notempty() function is predefined function)
   ifnotempty(albumartist,'/')
 + ifnotempty(album,' ')
 + (year.length>0  ? '(' + year + ') ' : '')
 +  (mbreleasecountry.length>0  ? '(' + mbreleasecountry + ') ' : '')
 +'/'
 + (disctotal>1 ? discno + '-' : '')
 + track + ' - '
 + title
 
 Jaikoz SubFolder mask
 
 function ifnotempty(value,sep){
     return value.length > 0 ? value + sep : '';
 }

    
 ifnotempty(albumartist,'/')
 + ifnotempty(album,' ')
 + (year.length>0  ? '(' + year + ') ' : '')
 +  (mbreleasecountry.length>0  ? '(' + mbreleasecountry + ') ' : '')
Jaikoz Filename Mask
(disctotal>1 ? discno + '-' : '')
 + trackno + ' - '
 + title

Wednesday, 5 March 2014

Why is SongKong not renaming my music ?

I had three different customers reporting that SongKong is not renaming their files for three completely different reasons so I thought it would be worth sharing this with everyone.

Rename Files From Metadata Not Enabled

By default SongKong does not rename files, in many ways it would make more sense for renaming to be the default so they reflect the new metadata added to them - however I have had too many occurrences of Jaikoz customers wondering where their files have gone to think this is a good idea.

The problem in this case was that although the customer had gone to the File naming tab and checked their rename and compilation masks


They had forgotten to actually check the Rename files based on metadata when matched on the Basic tab, this is required to actually do the rename.


iTunes Organizing Your Music Files

If you have configured SongKong to inform of iTunes of modifications then iTunes will can be kept up to date with metadata modifications, new songs added to iTunes and songs deleted. 




However within iTunes if you have Preferences:Advanced:Keep iTunes Media Folder Organized enabled whenever iTunes is informed of a change to a song it will rename the song based on the new metadata. This is okay if you are not using SongKong to rename your songs but if you are using SongKong to rename (or move) songs you should ensure this iTunes option is not enabled. 


Because SongKongs rename mechanism is much more advanced then iTunes and because SongKong logs the changes it makes I recommend not allowing iTunes to organize your media.
 

Songs not Renamed because not Matched

The final reason is because of the way SongKong works, when SongKong gets to the save stage it will only rename the file if it has been matched to MusicBrainz or Discogs, This is done by checking the MB_RECORDING_ID and DISCOGS_RELEASE_URL fields so even if the files were not matched during this run previously matched files can be renamed.

It wouldn't make much sense to rename songs that contained poor or non-existent metadata because their current filename may be the only means of identifying them. But you may have songs that SongKong has not matched to MusicBrainz or Discogs but other than that omission contain correct metadata and could be safetly renamed. I'm looking at adding an extra option ion SongKong for this scenario

Wednesday, 1 August 2012

Introducing functions in rename masks

An important aspect of tagging your songs is renaming your songs so that they match the metadata within the song. Although most music players depend only on the metadata within the song itself, we all have different preference of how to name our files and this helps us to keep them organized. Some applications require the filename to be in a particular format.

Jaikoz used to have quite a simple language for the rename mask that allowed most metadata to be used in the filename but only provided simple if statements. Then this was replaced with support for full Javascript syntax, this allows you to do pretty much anything but creating the correct mask could be long winded and error prone.

Consider this simple mask
 (album.length>0 ? album + '-':'') + (trackno.length>0 ? trackno + '-':'') 
 + (title.length>0 ? title:'')

Although its fairly clear what it is doing. its very fiddly and easy to make a mistake when editing. Unfortunately as a number of you have commented the Javascript is not as easy to understand as the old syntax, I traded this for the power the Javascript notation gives us.

However recently discovered there is nothing to stop you defining functions within your filename mask so the above can be replaced by

 function ifnotempty(value,sep){
     return value != undefined && value.length > 0 ? value + sep : '';
 }
 ifnotempty(album,'-')+ ifnotempty(trackno,'-') + ifnotempty(title,'') 

As you can now see the complexity is put into the function once, then the resultant mask can be much more concise.

In Jaikoz 3.6 we have made use of functions to provide better default masks. Of course if you are upgrading Jaikoz it will keep your existing mask so you will not see them so I have posted them below.

Folder Rename Mask

 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,folderseparator) + ifnotempty(album,folderseparator)
 + (disctotal>1 ? discno  + folderseperator : '') 

Filename Rename Mask

function pad(number, length) {
      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

In future versions of Jaikoz I'm going to add the ability to create and store custom javascript functions with a name to make this even easier, but hopefully in the meantime the use of functions should make creating masks simpler.

Jthink blog Jthink Facebook page google_plus Jthink YouTube channel Email Paul at Jthink Subscribe to Weekly Newsletter