SongKong Jaikoz

SongKong and Jaikoz Music Tagger Community Forum

Remove folders after deleting duplicates

I wonder did this folder actually contain any audio before you ran Delete Duplicates?

When a file is deleted we then check if we can delete its folder (and subfolders) , but if this folder never contained any music files then we wouldnt check to delete it.

You are right, I just checked the original folder, and it was not containing any music files.

On how to delete files names that way -> .fuse_hiddenXXXXXXXX
using *fuse_hidden* did the trick on these ones (*.fuse_hidden* didn’t)

But as soon I do add *]-[* to the list, none of the folders gets deleted.

More generally, I think there should be an option to allow deleting folders that do not contain music. maybe the day the feature will be available as a top feature.

In the meanwhile, can you please share the command that gets run to delete the files? Can I simply put it in a bash script to get things deleted ?

Okay. the code actually use a Glob, a simplified version of regular expressions. We take the list and make it into a single glob

e.g

*.jpg
*.png

becomes

{*.jpg, *.png}

But both regular expressions and globs are too complex for most users to bother about, so we just mention the wildcard.

However, [ and ] and - are special characters in a glob, so you need to escape them with backslash character

e.g try this

*\]\-\[*

But its not clear to me why

*.fuse_hidden*

would not work

Yes that is going to be new top level task Delete Folders, also useful to run after Fix Songs

Its Java code, Im not running a linux command

unfortunately, after checking all the folders that got processed for duplicates, I did figure out that the issue “some tracks here and some tracks there” is still present.

In Arovane, I have 4 instances of Radius 2

respectively :

Radius 2
Radius 2 (1)
Radius 2 (2)
Radius 2 (3)

Before the duplicates job here is each folders content :

root@Tower:/mnt/user/MURRAY/Music_processed/Arovane_Backup/Radius 2# ls -lah
total 131M
drwxrwxrwx 1 root root 4.0K Nov 10 11:49 ./
drwxrwxrwx 1 root root 4.0K Nov 10 11:50 …/
-rw-rw-rw- 1 root root 23M Nov 10 11:49 01\ -\ Derveed.flac
-rw-rw-rw- 1 root root 9.4M Nov 10 11:49 01\ -\ Derveed.mp3
-rw-rw-rw- 1 root root 15M Nov 10 11:49 02\ -\ Lenc-Crade.mp3
-rw-rw-rw- 1 root root 7.4M Nov 10 11:49 03\ -\ Dwaard.mp3
-rw-rw-rw- 1 root root 35M Nov 10 11:49 04\ -\ Inglued.flac
-rw-rw-rw- 1 root root 12M Nov 10 11:49 04\ -\ Inglued.mp3
-rw-rw-rw- 1 root root 23M Nov 10 11:49 05\ -\ Quandt.flac
-rw-rw-rw- 1 root root 7.8M Nov 10 11:49 05\ -\ Quandt.mp3
-rw-rw-rw- 1 root root 146K Nov 10 11:49 Cover.jpg
drwxrwxrwx 1 root root 23 Nov 10 11:49 Covers/
-rw-rw-rw- 1 root root 2.6K Nov 10 11:49 Folder.auCDtect.txt
-rw-rw-rw- 1 root root 939 Nov 10 11:49 album.nfo
-rw-rw-rw- 1 root root 41K Nov 10 11:49 cover.jpg
-rw-rw-rw- 1 root root 59K Nov 10 11:49 folder.jpg

Raduis 2 (1):

root@Tower:/mnt/user/MURRAY/Music_processed/Arovane_Backup/Radius 2 (1)# ls -lah
total 80M
drwxrwxrwx 1 root root 113 Nov 10 11:47 ./
drwxrwxrwx 1 root root 4.0K Nov 10 11:50 …/
-rw-rw-rw- 1 root root 38M Nov 10 11:47 02\ -\ Lenc-Crade.flac
-rw-rw-rw- 1 root root 37M Nov 10 11:47 03\ -\ Dwaard.flac
-rw-rw-rw- 1 root root 5.3M Nov 10 11:47 cover.jpg
-rw-rw-rw- 1 root root 59K Nov 10 11:47 folder.jpg

Radius 2 (2):

root@Tower:/mnt/user/MURRAY/Music_processed/Arovane_Backup/Radius 2 (2)# ls -lah
total 160M
drwxrwxrwx 1 root root 199 Nov 10 11:49 ./
drwxrwxrwx 1 root root 4.0K Nov 10 11:50 …/
-rw-rw-rw- 1 root root 23M Nov 10 11:49 01\ -\ Derveed.flac
-rw-rw-rw- 1 root root 38M Nov 10 11:49 02\ -\ Lenc-Crade.flac
-rw-rw-rw- 1 root root 37M Nov 10 11:49 03\ -\ Dwaard.flac
-rw-rw-rw- 1 root root 35M Nov 10 11:49 04\ -\ Inglued.flac
-rw-rw-rw- 1 root root 23M Nov 10 11:49 05\ -\ Quandt.flac
-rw-rw-rw- 1 root root 5.3M Nov 10 11:49 cover.jpg
-rw-rw-rw- 1 root root 59K Nov 10 11:49 folder.jpg

root@Tower:/mnt/user/MURRAY/Music_processed/Arovane_Backup/Radius 2 (3)# ls -lah
total 197M
drwxrwxrwx 1 root root 39 Nov 10 11:49 ./
drwxrwxrwx 1 root root 4.0K Nov 10 11:50 …/
-rw-rw-rw- 1 root root 38M Nov 10 11:49 .fuse_hidden0035a52a0000a790
-rw-rw-rw- 1 root root 23M Nov 10 11:49 01\ -\ Derveed.flac
-rw-rw-rw- 1 root root 38M Nov 10 11:49 02\ -\ Lenc-Crade.flac
-rw-rw-rw- 1 root root 37M Nov 10 11:49 03\ -\ Dwaard.flac
-rw-rw-rw- 1 root root 35M Nov 10 11:49 04\ -\ Inglued.flac
-rw-rw-rw- 1 root root 23M Nov 10 11:49 05\ -\ Quandt.flac
-rw-rw-rw- 1 root root 5.3M Nov 10 11:49 cover.jpg
-rw-rw-rw- 1 root root 59K Nov 10 11:49 folder.jpg

After running the job I still have 3 folders remaining
Radius 2, Radius 2 (1), Radius 2 (3)

here are their content at that time :

root@Tower:/mnt/user/MURRAY/Music_processed/Arovane/Radius 2# ls -lah
total 58M
drwxrwxrwx 1 root root 201 Nov 16 15:31 ./
drwxrwxrwx 1 root root 65 Nov 16 15:32 …/
-rw-rw-rw- 1 root root 35M Nov 16 15:29 04\ -\ Inglued.flac
-rw-rw-rw- 1 root root 23M Nov 16 15:29 05\ -\ Quandt.flac
-rw-rw-rw- 1 root root 146K Nov 16 15:29 Cover.jpg
drwxrwxrwx 1 root root 31 Nov 16 15:29 Covers/
-rw-rw-rw- 1 root root 2.6K Nov 16 15:29 Folder.auCDtect.txt
-rw-rw-rw- 1 root root 939 Nov 16 15:29 album.nfo
-rw-rw-rw- 1 root root 41K Nov 16 15:29 cover.jpg
-rw-rw-rw- 1 root root 59K Nov 16 15:29 folder.jpg

root@Tower:/mnt/user/MURRAY/Music_processed/Arovane/Radius 2 (1)# ls -lah
total 80M
drwxrwxrwx 1 root root 113 Nov 16 15:29 ./
drwxrwxrwx 1 root root 65 Nov 16 15:32 …/
-rw-rw-rw- 1 root root 38M Nov 16 15:29 02\ -\ Lenc-Crade.flac
-rw-rw-rw- 1 root root 37M Nov 16 15:29 03\ -\ Dwaard.flac
-rw-rw-rw- 1 root root 5.3M Nov 16 15:29 cover.jpg
-rw-rw-rw- 1 root root 59K Nov 16 15:29 folder.jpg

root@Tower:/mnt/user/MURRAY/Music_processed/Arovane/Radius 2 (3)# ls -lah
total 66M
drwxrwxrwx 1 root root 122 Nov 16 15:31 ./
drwxrwxrwx 1 root root 65 Nov 16 15:32 …/
-rw-rw-rw- 1 root root 38M Nov 16 15:29 .fuse_hidden0035a52a0000a790
-rw-rw-rw- 1 root root 23M Nov 16 15:29 01\ -\ Derveed.flac
-rw-rw-rw- 1 root root 5.3M Nov 16 15:29 cover.jpg
-rw-rw-rw- 1 root root 59K Nov 16 15:29 folder.jpg

As you can see, initial state, I had 3 over 4 folders that got the 5 full tracks of that EP. For some reason, I end up with 3 folders, 1 contains track 4 and 5, the next one track 2 and 3, and the last one got track 1. So the release is split in 3 folders instead of been kept in a single one.

OK that did the trick thanks !

it works, then I guess we’ll only have two issues left.

  1. be able to delete folders not containing any music files
  2. figure out why we keep having this “one files here and there” issue :slight_smile:

Album with Most Tracks has not been used to as the deciding deletion criteria in any case, can you check to see if these have a value for Track Total, an easy way to do is run Status Report on the folder

Looks like tracks total is 100% complete for all albums detected in the Arovane_Backup folder upfront duplicates deletion :

Here is what it tells me after I ran the duplicates finder process:

the backup folder (what files are before being processed) :

the processed folders :

Is there anything else you are seeking for ?

Okay maybe the value is the same for all songs, if you select View as Spreadsheet then you should be able to check the values in spreadsheet, or just resend me support files if that is easier.

Actually just realized you are using (album specific version) so all versions must be matched to same version of album, not different versions (as they were earlier), in which case track total would be same, do you know why the change?

Even more confusingly, we now log the actual deletions/comparisons as they happen (in songkongdebug0-0.log)

So first loads Radius 2 folder, where there are mp3 and flac versions of same song the mp3s get deleted.

Then loads Radius 2 (1), this deletes more mp3s that did not have a flac equivalent in Radius folder but do in Radius (1) folder

Then loads Radius 2 (2), this also contains a Derweed.flac file, and because folder creation time (13:43:13) of Radius(2) is earlier than Radius (13:54:47) it keeps the one in Radius(2)

Found Duplicate for:854cd1e7-5404-446f-bdfc-eaf54352f710:498:504:/music_processed/Arovane/Radius 2 (2)/01 - Derveed.flac
 Earliest Folder Creation Date:1:504:2022-11-16T13:43:13.347941173Z:498:2022-11-16T13:54:47.556354468Z
Keep:/music_processed/Arovane/Radius 2 (2)/01 - Derveed.flac
Delete:498:/music_processed/Arovane/Radius 2/01 - Derveed.flac

However it also has a Dwaard.flac file, and when it compares this with the one kept in Radius(1)

Found Duplicate for:5327c9ea-3055-405f-b3ce-eca42c466794:175:506:/music_processed/Arovane/Radius 2 (2)/03 - Dwaard.flac
Earliest Folder Creation Date:-1:506:2022-11-16T13:54:47.58635522Z:175:2022-11-16T13:41:34.897470399Z
Keep:/music_processed/Arovane/Radius 2 (1)/03 - Dwaard.flac
Delete:506:/music_processed/Arovane/Radius 2 (2)/03 - Dwaard.flac

You can see folder creation date for Radius (2) is now 13:54:47

How can the folder creation date of the same folder suddenly differ ?

Hmm, okay I don’t understand it but we load most information about song into database as we load into cache, this includes tag metadata and some audio data (such as audiobitrate and audiosamplerate)… But we didn’t store fileCreationDate or folderCreationDate because not needed by Fix Songs.

Maybe should be stored so for DeleteDuplicates cannot possibly change during the deletion, although I cant see why creationDate could change (unlike modifiedDate)

Okay it seems linux doesnt actually store fileCreationDate - https://stackoverflow.com/questions/14842195/how-to-get-file-creation-date-time-in-bash-debian I didnt know this, so what I am getting is lastModifiedDate, and as files gets deleted that changes.

Storing the value as files loaded would mean consistent for folder, but would not gurantee that the first created folder would have the earliest modification time.

Works as expected on Windows, need to check MacOS.

Take your time, I still have tons of folders to process the fix on :wink:

Okay, do you have an answer to the Album with Most Tracks question?

Plan is https://jthink.atlassian.net/browse/SONGKONG-2365

1 Like

No, I dont have a clue why creation dates are changing.

only thing I could think about is the date /time delta between the docker and the actual host.

by default, songkong time is set to london’s time:

/opt/songkong # date
Wed Nov 16 19:06:23 UTC 2022

while server time is :
root@Tower:/# date
Wed Nov 16 20:06:37 CET 2022

I will rebuild the docker and add the right timezone and see what happens. I’m doing this tomorrow morning though, time to spend some time with my kid before bed time !

i’ll keep you posted paul.

Hi no need to do that, I know why creationTime is wrong linux doesn’t actually store creationTime, when I call the creationTime() it’s just giving me lastModifiedTime().

No, my question was did all your songs have same value for Track Total, can you just send me your support files.

Did you get last support files ? I’m not sure they proceeded to be sent.

Yes, i have them thanks

1 Like