SongKong Jaikoz

SongKong and Jaikoz Music Tagger Community Forum

Tutorial: Preferences: Predefined Scripts

Previous
Next

Certain predefined scripts are available.

Add Album disambugation to Album title

This is the details of the Add Album disambugation to Album title script

if(mb_comment.length>0 && !album.contains(mb_comment))
{
      album = album  + ' (' + mb_comment + ")";
}

The script works as follows, it checks if there is a value in the mb_comment field (this is taken directly from the MusicBrainz Release Disambiguation field if linked to MusicBrainz and it has a value). If there is, and the existing value of the album field for the song does not contain the mb_comment then we add it to the end of the album field surrounded by brackets. By checking if the value has already been added it means we can rerun this script on a song more than once without adding the value multiple times.

An alternative version could be

if(albumversion.length>0 && !album.contains(albumversion))
{
      album = album  + ' (' + albumversion + ")";
}

This uses the value in the albumversion field, and this is also set to the release disambuguation if matched to MusicBrainz. Both would work the difference is that if we had configured Fix Songs so the albumversion was added to the Never modify or add these fields then the albumversion would always be empty unlike the mb_comment field. Another difference is we could manually modify the value of the albumversion field using Manual Edit task, the mb_comment field could only be modified by editing the release disambuguation on the MusicBrainz database.

Classical Composer Last Name Only

This is details of the Classical Composer Last Name Only script

if(isclassical =='1'  && composersort_index.length > 0)
{
      var composerBuilder='';
      for (i = 0; i < composersort_index.length; i++) 
      { 
         var indexOfComma = composersort_index[i].indexOf(',');
         if(indexOfComma>0)
         {
             composerBuilder+=substring(composersort_index[i], indexOfComma) + "; "
        }
     }       
     if(composerBuilder.length>0)
     {
         composerBuilder=substring(composerBuilder, composerBuilder.length - 2);
         composer=composerBuilder;
     }
}

Some customers prefer to only store the last name for the composers of Classical music. So this script checks classical releases that we have composersort values for and then tries to extract the lastname from each sort value and adds them separated by '; ’ to a composerBuilder variable we declare in the script. We then replace the composer field with the new value. Note we can declare variables in a script that can be assigned to, but this does not create new tag fields. Only assigning values to the tag fields in the first list will cause the song metadata to be modified.

Track Artist set to Album Artist and move any additional artists into title

This is details of the Track Artist set to Album Artist and move any additional artists into title script

if(albumartist!='' && albumartist!='Various Artists')
{
   artist=albumartist;
   var ft='';

   for (var index = 0; index < artists_index.length; index++) 
   {
      if(!artist.contains(artists_index[index]))
      {
         ft+=artists_index[index] + '; ';
      }
   } 
   if(ft.length>0)
   {
      ft=ft.substring(0, ft.length-2);
      if(mb_track_title.length()>0)
      {
         title=mb_track_title +' (Ft. ' + ft +')';
      }
      else if(discogs_title.length()>0)
      {
         title=discogs_title +' (Ft. ' + ft +')';
      }
   }

   artists=albumartists;
   artistsort=albumartistsort;
   artistssort=albumartistssort;
}

Some basic car audio systems do not understand the albumartist field only the (Track) artist , so in order to browse complete albums by artist we need to set the artist field to the albumartist Field. But in order not to lose details of additional track artists we add them to the title field as featured artists.

This script set the artist to the albumartist as long as album not credited to Various Artists. It then makes use of the artists field because this stores each artist as a separate value in an array by looping the artists_index field and adding all artists not now listed in the artist field to ft local variable, separated by a semicolon.

If after looping round we have found addtional artists and added them to the ft variable, we then construct a new track title by taking the original title from MusicBrainz or Discogs and setting the title field to it. If the song has not been matched to MusicBrainz or Discogs we cannot update the title safely because the title may already contain featured artists and we dont want the artist to be added multiple times.

As well as setting the artist to albumartist, we keep things consistent by setting artists to albumartists, artistsort to albumartistsort and artistssort to albumartistssort.

Remove Discno Padding

discno=unpad(discno);

Use new function unpad to remove any leading zeroes using regular expressions

function unpad(value)
{
      return value.replace(/^0+/, '');
}

Previous
Next