SongKong Jaikoz

SongKong and Jaikoz Music Tagger Community Forum

Scripter and setting a Genre

I am trying to write a script that will fix any classical albums and set the genre to Classical.

I have this:

if (genre == null || genre.length == 0) {
    genre = ["Classical"];
    print("No genre found. Setting genre to Classical.");
} else {
    genre = ["Classical"];
    print("Overwriting genre with Classical.");
}

I ran it on an album and it removed Pop from the genre field but failed to set it to classical. What am I don’t wrong?

I tried again with an album tagged symphonic. I uploaded support files

Hi, it doesnt like the square brackets, also there is nowhere to output the print output. so I would remove them

So this modification works

  if (genre == null || genre.length == 0) {
        genre = "Classical";
    } else {
        genre = "Classical"
    }

but changes all songs to Classical, in which case it could be simplified to

genre = "Classical"

But we also have an existing script called Set Classical Genre that only sets genre to Classical if SongKong has identified it as Classical that may be better

if(isclassical=='1')
{
   if(genre=='')
   {
      genre='Classical'
   }
}
1 Like

This worked perfectly. Thank you!

1 Like