Page 1 of 2

Music Renaming

Posted: 20 Jan 2019, 07:42
by Annihilator1243
My Music is sorted in such a way that when is it a single disc album it is not stored in a cd number folder but if it is a multi disc album then it is stored in CD number folders.

Single Disc: Music\Kiss\Love Gun\01 - Love Gun.mp3

Multi Disc: Music\Kiss\Love Gun\CD 01\01 - Love Gun.mp3

I am currently using two separate presets to sort my music, however i would like to find a way to use only 1 preset that sorts the music so that if the album is a single disc then it renames it to the single disc path above and if it is a multi disc album then is renames it to the multi disc path as above.

Any Help would be appreciated.

Re: Music Renaming

Posted: 20 Jan 2019, 07:58
by rednoah
Yes, you can use if-then-else expression for that.

What formats are you currently using for these two use cases?

Re: Music Renaming

Posted: 20 Jan 2019, 08:09
by Annihilator1243
These are the Formats That i am currently Using.

Single Disc: \Music\{n}\[{y}] - {album}\{pi.pad(2)} - {t}

Multi Disc: \Music\{n}\[{y}] - {album}\CD {media.'part/position'}\{pi.pad(2)} - {t}

Re: Music Renaming

Posted: 20 Jan 2019, 09:12
by rednoah
Is there any way to know if the album is a single disc? Is there {media} binding that could tell us the number of CDs?

Re: Music Renaming

Posted: 20 Jan 2019, 09:52
by Annihilator1243
not that i have found

Re: Music Renaming

Posted: 20 Jan 2019, 10:32
by rednoah
Something like this might work:

Code: Select all

{if (model.findAll{ it.album == album }.media.Part.any{ it.toInteger() > 1 }) 'CD'+media.Part}
The {model} binding allow you to access all matches, and then check if any of the other matches that belong to the same album have a media.Part value of 2 or higher.

This is is a bit tricky though. May or may not be possible depending on how you do things.

Re: Music Renaming

Posted: 20 Jan 2019, 10:38
by Annihilator1243
Doesnt work. says Binding "model" : java.lang.NullPointerException.

Re: Music Renaming

Posted: 20 Jan 2019, 11:47
by rednoah
Yeah, might not work on some files, depending on what you load into FileBot and what tags are set.

If you can make some test data available via Google Drive, then I could look into smoothing out the corner cases.

Re: Music Renaming

Posted: 20 Jan 2019, 12:04
by Annihilator1243
Hes the Test Data I have put on Google Drive

https://drive.google.com/drive/folders/ ... sp=sharing

Re: Music Renaming

Posted: 20 Jan 2019, 13:42
by rednoah
:?: How do you determine which files need to be organized into CD1/2 folders and which don't?


Sorry, the metadata in those files don't make it possible to guess which might be CD1 and which might be CD2:

Code: Select all

Title	Heart Of Chrome
Album	Revenge
Part/Position	01\02
Track	Heart Of Chrome
Track/Position	07

Code: Select all

Title	Black Diamond
Album	Box Set
Part/Position	01\05
Track	Black Diamond
Track/Position	14
:?: How do you get the CD index for those files? One is CD1 and one is CD2 right? But how would I know?


I see these properties though, which might be useful for guess which CD files belong to? Doesn't help me find CD 1/2 but might allow me to guess which files belong to the same CD group, assuming DISCID is actually the same for all files belonging to the same CD.

Code: Select all

DISCID	AF0B800C

Code: Select all

DISCID	25127A15

Re: Music Renaming

Posted: 20 Jan 2019, 13:45
by Annihilator1243
so there is no way of doing what i want to do?

Re: Music Renaming

Posted: 20 Jan 2019, 13:46
by rednoah
EDIT: I've edited my posted above. Please re-read.

But you somehow know which files go on which CD right? How do you know?

Re: Music Renaming

Posted: 20 Jan 2019, 13:56
by Annihilator1243
When I tag the MP3 Files I input the disc number into the ID3 Tags, so that's how i know which files go on which CD. There is obviously no way to do what i want the program to do so i will just keep using the 2 separate presets. thanks for your help.

Re: Music Renaming

Posted: 20 Jan 2019, 14:07
by rednoah
Well, if the files are tagged, then it'll work. But as far as I can tell, the sample files you gave me are not tagged with CD1 / CD2 in any ID3 field that I can see.

Code: Select all

$ id3info '07 - Heart Of Chrome.mp3'

*** Tag information for 07 - Heart Of Chrome.mp3
=== TIT2 (Title/songname/content description): Heart Of Chrome
=== TALB (Album/Movie/Show title): Revenge
=== TCON (Content type): Hard Rock
=== TPE1 (Lead performer(s)/Soloist(s)): Kiss
=== TPOS (Part of a set): 01\02
=== TRCK (Track number/Position in set): 07
=== TYER (Year): 1992
=== TXXX (User defined text information): (DISCID): AF0B800C
=== COMM (Comments): ()[eng]:
=== USLT (Unsynchronized lyric/text transcription): ()[eng]: You better listen up
...
=== APIC (Attached picture): ()[, 3]: image/jpeg, 123162 bytes
*** mp3 info
MPEG1/layer III
Bitrate: 320KBps
Frequency: 44KHz
:?: So you're saying one of these fields somehow tells you it's CD1 / CD2? Or is there a tag that normal id3 tagging tools somehow can't read?

Re: Music Renaming

Posted: 20 Jan 2019, 14:17
by Annihilator1243
this is what my id3 tag software looks like when tagging an MP3

https://drive.google.com/open?id=1HBxTh ... K1mB9hleZ8

Re: Music Renaming

Posted: 20 Jan 2019, 14:25
by rednoah
Can you confirm that it says Disk # 02 in your ID3 Editor for the second file?


07 - Heart Of Chrome.mp3 The only thing that says 01 is the first half of TPOS:

Code: Select all

TPOS (Part of a set): 01\02
14 - Black Diamond.mp3 But it's also 01 in the second sample file you posted:

Code: Select all

TPOS (Part of a set): 01\05

That's the only two files I got from you, so I assume that one of them is CD1 and one is CD2. :lol:

Re: Music Renaming

Posted: 20 Jan 2019, 14:30
by Annihilator1243
they are both cd 1 as they are from different albums. i dont think the problem is with the files.

Re: Music Renaming

Posted: 20 Jan 2019, 14:56
by rednoah
I see, so the ID3 tags do tell us which file is which CD# number and total number of CDs.

If you tag your Disk # value like so:

Code: Select all

Disk Number/Total Number of Disks

Code: Select all

01/02
Then this will work:

Code: Select all

X:/Music/{n}/[{y}] - {album}{'/CD ' + media.PartPosition.match(/([0-9][0-9]).0[2-9]/)}/{pi.pad(2)} - {t}
The key is to take the PartPosition value, e.g. 01/01 (read Disk 1 of 1) or 01/02 (read Disk 1 of 2), and then just grab the first number, if the second number is 02 or 03 ... or 09:

Code: Select all

media.PartPosition.match(/([0-9][0-9]).0[2-9]/)
:!: This code won't work for 01/10 (read Disk 1 of 10) though.



e.g. 07 - Heart Of Chrome.mp3 (Disk 1 of 2)

Code: Select all

X:/Music/Kiss/[1992] - Revenge/CD 01/07 - Heart Of Chrome
e.g. 14 - Black Diamond.mp3 (Disk 1 of 5)

Code: Select all

X:/Music/Kiss/[2001] - Box Set/CD 01/14 - Black Diamond
:idea: Since your example data does not contain a test case for Disk 1 of 1, I have not included one here, but it should work.

Re: Music Renaming

Posted: 20 Jan 2019, 15:03
by Annihilator1243
that doesnt work as if the album is single disk then i dont want the files to be stored in a CD 01 folder.

Re: Music Renaming

Posted: 20 Jan 2019, 15:09
by rednoah
Yes, it'll work. (assuming files are tagged correctly as described above as given in your example files)

:idea: If it's a single disk, then media.PartPosition will be 01/01 which does not match the pattern ([0-9][0-9]).0[2-9] which means the whole {'/CD ' + ...} expression will have no value (no "/CD" either), resulting in there not being a CD1/2/3 folder.

Re: Music Renaming

Posted: 20 Jan 2019, 15:18
by Annihilator1243

Re: Music Renaming

Posted: 20 Jan 2019, 15:25
by rednoah
In this particular case, do you want the CD1/2/3 folder?

If you don't want the CD1/2/3 folder, then it's already working.

If you do want the CD1/2/3 folder, then you first need to tag the file correctly. Because the media.PartPosition variable should say something like 01/03 (Disk 1 out of 3) and not 03 (What does 03 mean? Disk 3 out of IDK? Disk IDK out of 3?).

Re: Music Renaming

Posted: 20 Jan 2019, 16:19
by Annihilator1243
this is what ended up working.

Code: Select all

\Music\{n}\[{y}] - {album}{media.'part/position_total' == null ? null : '/CD ' + media.'part/position'}\{pi.pad(2)} - {t}

Re: Music Renaming

Posted: 21 Jan 2019, 00:28
by Annihilator1243
is there a way to just get the year and month the album was released instead of the entire date?

Re: Music Renaming

Posted: 21 Jan 2019, 02:20
by rednoah
Yes, if that information in the tags. What {variable} are you using to get the entire date?

Unfortunately, the sample files you gave me only contains the release year information, so it may not be possible for many of your files:

Code: Select all

=== TYER (Year): 1992