SongKong Jaikoz

SongKong and Jaikoz Music Tagger Community Forum

Running songkong cmdline in script in Docker environment

Well, not quite because it is modifying metadata and hence is part of FixSongs task. So would have to run Fix Songs again to change the album metadata field. So I would suggest we leave that for when you next run Fix Songs and just make the changes to the masks for now and rerun Rename Files.

Okay I will do that now.

Correct.

But do you know why there is no FixSongsReport ?

Okay go to Preferences and then Filename masks tab

Select FirstLetterOfArtist/AlbumArtistorArtist/Album/AlbumArtistorArtist - Album - Track - Title from filename mask dropdopwn and selecte Clone,

Give it a new name e.g FirstLetterOfArtist with AlbumVersion

Modify Mask from

ifnotempty2(albumartist.substring(0,1),artist.substring(0,1),'/')
+ ifnotempty2(albumartist,artist,'/')
+ ifnotempty(album,'/')
+ ifnotempty2(albumartist,artist,' - ')
+ ifnotempty(album,' - ')
+ ifmultidisc(ifnotempty(pad(discno,2),' - '))
+ ifnotempty(pad(trackno,2),' - ')
+ title

to

ifnotempty2(albumartist.substring(0,1),artist.substring(0,1),'/')
+ ifnotempty2(albumartist,artist,'/')
+ ifnotempty(album +  (albumversion.length > 0 ? ' (' + albumversion + ')'  : ''),'/')
+ ifnotempty2(albumartist,artist,' - ')
+ ifnotempty(album,' - ')
+ ifmultidisc(ifnotempty(pad(discno,2),' - '))
+ ifnotempty(pad(trackno,2),' - ')
+ titleSelect *Save*

Then when run Rename Files task set Rename Mask and Compilation Mask to new name e.g FirstLetterOfArtist with AlbumVersion

Will now include album disambuguation in brackets after album folder

However, not many albums actually have this and it wont fix the multiple audio formats problem or single with same name as album problem. So we could also add in audiofornat and mbreleasetype bearing in mind if at a later stage you make the change to add them to the album metadata field, the information would be duplicated.

So we could change mask to

ifnotempty2(albumartist.substring(0,1),artist.substring(0,1),'/')
+ ifnotempty2(albumartist,artist,'/')
+ ifnotempty(album + ' (' + audioformat + ',  ' + mbreleasetype +') '  
+ (albumversion.length > 0 ? ' (' + albumversion + ')'  : ''),
'/')
+ ifnotempty2(albumartist,artist,' - ')
+ ifnotempty(album,' - ')
+ ifmultidisc(ifnotempty(pad(discno,2),' - '))
+ ifnotempty(pad(trackno,2),' - ')
+ title

This would give us

Obviously you can make adjustments to the mask for the exact formatting you would like.

thanks for this Paul.

Now, if it is really nice that I’ll have the different versions of the albums sorted in separate folder + their different “quality” versions as well. I should run this. But once I’ll start to remove the duplicates, I will get rid of the lower quality versions of same albums anyway. :wink: But totally worth it for now to at least have a clear, poper sort of all these “different / same” albums.

Now what is still unclear to me is how I am suppposed to do to pu all these folers that were put aside my “letter” folders in their own, dedicate “compilations” folder. AS far as I am reading the new mask you wrote, I cannot see this being part of it ?

Okay I didnt see that bit, will have to come back to that as out all afternoon.

here is my attempt :

if(contains(toLowerCase(releaseType), 'compilation'),
  if(toLowerCase(genre) == 'classical',
    'Classical_Compilations/',
    'Compilations/'
  ),
  ifnotempty2(albumartist.substring(0,1),artist.substring(0,1),'/')
)
+ ifnotempty2(albumartist,artist,'/')
+ ifnotempty(album + ' (' + audioformat + ',  ' + mbreleasetype +') '  
+ (albumversion.length > 0 ? ' (' + albumversion + ')'  : ''),
'/')
+ ifnotempty2(albumartist,artist,' - ')
+ ifnotempty(album,' - ')
+ ifmultidisc(ifnotempty(pad(discno,2),' - '))
+ ifnotempty(pad(trackno,2),' - ')
+ title

Here, I keep the artists “letters” and album versions etc.
I also added some lower and upped cap check, to make sure the mask isn’t only detecting “Compilation” but “compilation” as well.

Aside that, I check if the release is a compilation. If it’s a compilation AND genre is classical, then the whole folder gets moved to a folder called Classical_Compilations

If the release is a compilation, but NOT the genre is NOT classical, then the compilation goes to “Compilations”. This way, I’d like to move all these folders that polutes my “artists letters folders” to their own parent folder. And I also do separate “classical” compilations (which are often boxsets), of other compilations.

Could you confirm this is the right way to write / do it ?

Hi, you should use the iscompilation and isclassical fields these are better, in fact look at the Javascript functions that already exist addClassical() and addCompilation(). Also remember you set two rename masks, the rename mask and the compilation rename mask, the compilation rename mask is only applied to songs that have iscompilation==1 therefore if you use two different masks you dont have to code the iscompilation check into the mask anyway.

OK so in order to get non compilation Classical releases put in “Classical” folder :

if(isclassical == 1, 'Classical/')
else ifnotempty2(albumartist.substring(0,1),artist.substring(0,1),'/')
+ ifnotempty2(albumartist,artist,'/')
+ ifnotempty(album + ' (' + audioformat + ',  ' + mbreleasetype +') '  
+ (albumversion.length > 0 ? ' (' + albumversion + ')'  : ''),
'/')
+ ifnotempty2(albumartist,artist,' - ')
+ ifnotempty(album,' - ')
+ ifmultidisc(ifnotempty(pad(discno,2),' - '))
+ ifnotempty(pad(trackno,2),' - ')
+ title

This is to be used in the first mask (non compilation)

and the second one that wouuld be used as “compilations mask” could be:

if(isclassical == 1, 'Classical_Compilations/')
else 'Compilations/'
+ ifnotempty2(albumartist,artist,'/')
+ ifnotempty(album + ' (' + audioformat + ',  ' + mbreleasetype +') '  
+ (albumversion.length > 0 ? ' (' + albumversion + ')'  : ''),
'/')
+ ifnotempty2(albumartist,artist,' - ')
+ ifnotempty(album,' - ')
+ ifmultidisc(ifnotempty(pad(discno,2),' - '))
+ ifnotempty(pad(trackno,2),' - ')
+ title

This way, I guess that :

  1. non compilation releases that are genred “classical” will go in their own “Classical” folder instead of the general Letters folders. This way, I’ll keep classical music separated from rest of the collection (I think about doing this as I have several friends that are ONLY interested in classical music, I4d like to build a dedicated library for them).

  2. for compilations, I’ll have two folders been created. If the genre is classical, releases goes to “Classical_compilations” folder. if non classical, the release goes to “Compilation” folder.

Is this allright ?

Yes I think so, except in your mask your if else syntax is not quite right it should be

if(isclassical == '1') { 'Classical/' } else  {ifnotempty2(albumartist.substring(0,1),artist.substring(0,1),'/')}
ifnotempty2(albumartist,artist,'/')
+ ifnotempty(album + ' (' + audioformat + ',  ' + mbreleasetype +') '  
+ (albumversion.length > 0 ? ' (' + albumversion + ')'  : ''),
'/')
+ ifnotempty2(albumartist,artist,' - ')
+ ifnotempty(album,' - ')
+ ifmultidisc(ifnotempty(pad(discno,2),' - '))
+ ifnotempty(pad(trackno,2),' - ')
+ title

and if Classical you dont break down by first letter, is that what you want?

And second should be

if(isclassical == '1') { 'Classical Compilations/' } else  {'Compilations/'}
ifnotempty2(albumartist,artist,'/')
+ ifnotempty(album + ' (' + audioformat + ',  ' + mbreleasetype +') '  
+ (albumversion.length > 0 ? ' (' + albumversion + ')'  : ''),
'/')
+ ifnotempty2(albumartist,artist,' - ')
+ ifnotempty(album,' - ')
+ ifmultidisc(ifnotempty(pad(discno,2),' - '))
+ ifnotempty(pad(trackno,2),' - ')
+ title
1 Like

Well, idea to split artists by their letter is due to the amount of artists. There are way less composers, so I guess i can live without the letter folders.

Thanks for the double check paul! When the current rename task will be done i will adapt the masks and run the task one more time!

1 Like

I’ve noticed a huge slowdown again. This is areally really weird. First 300k files were moved in a couple of hours, while in then last 2 days, I had a process of approximately 50k files per 24 hours.

I did cancel the current rename task, wait for the report to be generated, and will send you the support files in order to see if we can detect why songkong performace gets impacted that way. I will then restart the same task on the remaining files (approx 100k files) and see if performance is allright again.

OK so I used the two above masks, ran a new rename task over the remaining 10k. and the "Classical Compilations/ and Compilations/ folders are not been created. look:

Actually, you can see even “regular” albums are not put in their artists letter folder anymore. they are placed aside my previously created letter folders, in an artist name folder. :frowning:

Also I can see it only renamed 3202 files in 49 minutes, which seems totally unrealistic to me. And yes, I’ve stopped and restarted songkong in between :frowning:

  • Report 141 started at Sep 12, 2023, 9:20:20 AM
  • 49 minutes 29 seconds
  • Report 141 finished at Sep 12, 2023, 10:09:50 AM

Ah, sorry missed a plus sign at start of second line, should be

if(isclassical == '1') { 'Classical/' } else  {ifnotempty2(albumartist.substring(0,1),artist.substring(0,1),'/')}
+ ifnotempty2(albumartist,artist,'/')
+ ifnotempty(album + ' (' + audioformat + ',  ' + mbreleasetype +') '  
+ (albumversion.length > 0 ? ' (' + albumversion + ')'  : ''),
'/')
+ ifnotempty2(albumartist,artist,' - ')
+ ifnotempty(album,' - ')
+ ifmultidisc(ifnotempty(pad(discno,2),' - '))
+ ifnotempty(pad(trackno,2),' - ')
+ title

and

if(isclassical == '1') { 'Classical Compilations/' } else  {'Compilations/'}
+ ifnotempty2(albumartist,artist,'/')
+ ifnotempty(album + ' (' + audioformat + ',  ' + mbreleasetype +') '  
+ (albumversion.length > 0 ? ' (' + albumversion + ')'  : ''),
'/')
+ ifnotempty2(albumartist,artist,' - ')
+ ifnotempty(album,' - ')
+ ifmultidisc(ifnotempty(pad(discno,2),' - '))
+ ifnotempty(pad(trackno,2),' - ')
+ title

When doing things for first time I like to run for short time in preview mode first and check the results in the report before committing myself.

ok I do a total restart of my unraid server before running sonkong again, just to compare the process speed.

I’ll keep you posted ! :slight_smile:

THANKS !!!

when using this mask I’m getting this error by songkong :

Mask is invalid, attempt to add Number but missing Number argument

and this is also happening for the other mask.

Okay, parser doesnt seem to like the full if else statement so I use the ternary ?: operator instead within Preferences and that worked for me without reporting error

RenameMask

   isclassical == '1' ?  'Classical/'  :  ifnotempty2(albumartist.substring(0,1),artist.substring(0,1) , '/') 
    + ifnotempty2(albumartist,artist,'/')
    + ifnotempty(album + ' (' + audioformat + ',  ' + mbreleasetype +') '  
    + (albumversion.length > 0 ? ' (' + albumversion + ')'  : ''),
    '/')
    + ifnotempty2(albumartist,artist,' - ')
    + ifnotempty(album,' - ')
    + ifmultidisc(ifnotempty(pad(discno,2),' - '))
    + ifnotempty(pad(trackno,2),' - ')
    + title

Compilation Rename mask

isclassical == '1' ? 'Classical Compilations/' :  'Compilations/'
+ ifnotempty2(albumartist,artist,'/')
+ ifnotempty(album + ' (' + audioformat + ',  ' + mbreleasetype +') '  
+ (albumversion.length > 0 ? ' (' + albumversion + ')'  : ''),
'/')
+ ifnotempty2(albumartist,artist,' - ')
+ ifnotempty(album,' - ')
+ ifmultidisc(ifnotempty(pad(discno,2),' - '))
+ ifnotempty(pad(trackno,2),' - ')
+ title

now it indeed do create a folder called Classical, but look how the tracks are put inside it :

:confused:

12/09/2023 12.22.30:CEST:FileNameFormatter:formatFromMask:INFO: newFilename(0):Classical/lengthOfNewMask:32
12/09/2023 12.22.30:CEST:FileNameFormatter:formatFromMask:INFO: newFilename(Final):Classical/lengthOfNewMask:32
12/09/2023 12.22.30:CEST:FileRenamer:renameSubFolderAndFilenameFromMask:WARNING: New SubFolder/Filename Path is(1):Classical/.flac
12/09/2023 12.22.30:CEST:FileRenamer:renameFileBasedOnMetadata:INFO: newFilename(merged):/music/Music_processed/Classical/.flacLength:38
12/09/2023 12.22.30:CEST:FileRenamer:renameFileBasedOnMetadata:INFO: 235840:Rename Song based on Metadata:/music/Music_dump/01-2015/Giuseppe Verdi - Il Trovatore - Tullio Serafin [Deutsche Grammophon 435 053-2]/CD 2/04 Il trovatore - Act III, Scene 2 - Scena ed Aria. Quale d'armi fragor poc'anzi intesi.flac

looking in the logs is seems it is searchign for .flac which brings the following error on the table :

12/09/2023 12.36.39:CEST:AbstractLoadFilesWorker:createMapOfFileToAudioFile:SEVERE: Failed AddSongToDatabase for file(0):/music/Music_dump/01-2015/Various Artists - Sonatas & Partitas for Solo Violin Cello Suites (2004) [FLAC]/CD2/05 - Johann Sebastian Bach - Partita No. 2 in D minor, BWV 1004- V. Ciaccona.flac:/music/Music_dump/01-2015/Various Artists - Sonatas & Partitas for Solo Violin Cello Suites (2004) [FLAC]/CD2/05 - Johann Sebastian Bach - Partita No. 2 in D minor, BWV 1004- V. Ciaccona.flac Flac Header not found, not a flac file
org.jaudiotagger.audio.exceptions.CannotReadException: /music/Music_dump/01-2015/Various Artists - Sonatas & Partitas for Solo Violin Cello Suites (2004) [FLAC]/CD2/05 - Johann Sebastian Bach - Partita No. 2 in D minor, BWV 1004- V. Ciaccona.flac Flac Header not found, not a flac file

I can’t understand what is happening here. Support Files would help although I understand you are probably still uploading the previous one. Before you next upload support files it maybe a good idea to go into reports folder and manually delete some of the reports if no longer using so support file will be smaller, because by default it sends the last five reports for each file type.

But going back to this issue can you do open last report, go to Browse By Folder , navigate to Classical folder and show screenshot. Are you saying it is doing this for all Classical or just a few songs.

Then try rerunning in Preview mode and look at the results within Browse By Folder, is it working in preview mode or still going wrong ?

I did run the rename one more time on a test folder.

The folder had one classical release, a few compilations, a two previously unmatched releases.

HEre is what I could see (using the two masks you wrote) :

Working part:

  1. Compilations are put in the right folder aside the letter folders, and the respective sub folders are correctly created (using the compilations mask)
  2. Letter folders are correctly created, and contains their artists sub-folders

Not working part:

  1. While Classical Compilations folder gets created, the artist sub folders are not created, and songkong puts the flac files directly inside Classical Compilations folder, like this :

I am uploading latest report files now.

But here is what I can find in the report under errors :

Sep 12, 2023, 2:17:32 PM
Warning:File new name clashed, renamed again from /music/test/Alexander Scriabin - Horowitz Plays Scriabin (2003)/02 - Alexander Scriabin - Piano Sonata no. 10, op. 70.flac to /music/Music_processed/Classical Compilations/(1).flac

Sep 12, 2023, 2:17:32 PM
Warning:File new name clashed, renamed again from /music/test/Alexander Scriabin - Horowitz Plays Scriabin (2003)/03 - Alexander Scriabin - Etude in C-sharp minor, op. 2 no. 1 (1962 studio recording).flac to /music/Music_processed/Classical Compilations/(2).flac

Sep 12, 2023, 2:17:32 PM
Warning:File new name clashed, renamed again from /music/test/Alexander Scriabin - Horowitz Plays Scriabin (2003)/04 - Alexander Scriabin - Etude in C-sharp minor, op. 2 no. 1 (1965 live recording).flac to /music/Music_processed/Classical Compilations/(3).flac

Sep 12, 2023, 2:17:32 PM
Warning:File new name clashed, renamed again from /music/test/Alexander Scriabin - Horowitz Plays Scriabin (2003)/05 - Alexander Scriabin - Etude in F-sharp minor, op. 8 no. 2.flac to /music/Music_processed/Classical Compilations/(4).flac

So, something is going wrong, exclusively when a classical compilation is found.

Until I get the support files the only thing I can think of is that classical albums tend to result in longer filenames then other albums, have you set a max folder path length that is causing SongKong to shorten the filename part down to nothing?

no, I don’t wanty to shrink the filenames, I am not using windows at all, so no need for me to use this feature.

Reports are uploading while we chat.