Music Renaming

All about user-defined episode / movie / file name format expressions
Annihilator1243
Posts: 16
Joined: 20 Jan 2019, 07:34

Music Renaming

Post 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.
User avatar
rednoah
The Source
Posts: 22923
Joined: 16 Nov 2011, 08:59
Location: Taipei
Contact:

Re: Music Renaming

Post by rednoah »

Yes, you can use if-then-else expression for that.

What formats are you currently using for these two use cases?
:idea: Please read the FAQ and How to Request Help.
Annihilator1243
Posts: 16
Joined: 20 Jan 2019, 07:34

Re: Music Renaming

Post 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}
User avatar
rednoah
The Source
Posts: 22923
Joined: 16 Nov 2011, 08:59
Location: Taipei
Contact:

Re: Music Renaming

Post 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?
:idea: Please read the FAQ and How to Request Help.
Annihilator1243
Posts: 16
Joined: 20 Jan 2019, 07:34

Re: Music Renaming

Post by Annihilator1243 »

not that i have found
User avatar
rednoah
The Source
Posts: 22923
Joined: 16 Nov 2011, 08:59
Location: Taipei
Contact:

Re: Music Renaming

Post 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.
:idea: Please read the FAQ and How to Request Help.
Annihilator1243
Posts: 16
Joined: 20 Jan 2019, 07:34

Re: Music Renaming

Post by Annihilator1243 »

Doesnt work. says Binding "model" : java.lang.NullPointerException.
User avatar
rednoah
The Source
Posts: 22923
Joined: 16 Nov 2011, 08:59
Location: Taipei
Contact:

Re: Music Renaming

Post 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.
:idea: Please read the FAQ and How to Request Help.
Annihilator1243
Posts: 16
Joined: 20 Jan 2019, 07:34

Re: Music Renaming

Post by Annihilator1243 »

Hes the Test Data I have put on Google Drive

https://drive.google.com/drive/folders/ ... sp=sharing
User avatar
rednoah
The Source
Posts: 22923
Joined: 16 Nov 2011, 08:59
Location: Taipei
Contact:

Re: Music Renaming

Post 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
:idea: Please read the FAQ and How to Request Help.
Annihilator1243
Posts: 16
Joined: 20 Jan 2019, 07:34

Re: Music Renaming

Post by Annihilator1243 »

so there is no way of doing what i want to do?
User avatar
rednoah
The Source
Posts: 22923
Joined: 16 Nov 2011, 08:59
Location: Taipei
Contact:

Re: Music Renaming

Post 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?
:idea: Please read the FAQ and How to Request Help.
Annihilator1243
Posts: 16
Joined: 20 Jan 2019, 07:34

Re: Music Renaming

Post 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.
User avatar
rednoah
The Source
Posts: 22923
Joined: 16 Nov 2011, 08:59
Location: Taipei
Contact:

Re: Music Renaming

Post 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?
:idea: Please read the FAQ and How to Request Help.
Annihilator1243
Posts: 16
Joined: 20 Jan 2019, 07:34

Re: Music Renaming

Post by Annihilator1243 »

this is what my id3 tag software looks like when tagging an MP3

https://drive.google.com/open?id=1HBxTh ... K1mB9hleZ8
User avatar
rednoah
The Source
Posts: 22923
Joined: 16 Nov 2011, 08:59
Location: Taipei
Contact:

Re: Music Renaming

Post 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:
:idea: Please read the FAQ and How to Request Help.
Annihilator1243
Posts: 16
Joined: 20 Jan 2019, 07:34

Re: Music Renaming

Post by Annihilator1243 »

they are both cd 1 as they are from different albums. i dont think the problem is with the files.
User avatar
rednoah
The Source
Posts: 22923
Joined: 16 Nov 2011, 08:59
Location: Taipei
Contact:

Re: Music Renaming

Post 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.
:idea: Please read the FAQ and How to Request Help.
Annihilator1243
Posts: 16
Joined: 20 Jan 2019, 07:34

Re: Music Renaming

Post 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.
User avatar
rednoah
The Source
Posts: 22923
Joined: 16 Nov 2011, 08:59
Location: Taipei
Contact:

Re: Music Renaming

Post 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.
:idea: Please read the FAQ and How to Request Help.
Annihilator1243
Posts: 16
Joined: 20 Jan 2019, 07:34

Re: Music Renaming

Post by Annihilator1243 »

User avatar
rednoah
The Source
Posts: 22923
Joined: 16 Nov 2011, 08:59
Location: Taipei
Contact:

Re: Music Renaming

Post 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?).
:idea: Please read the FAQ and How to Request Help.
Annihilator1243
Posts: 16
Joined: 20 Jan 2019, 07:34

Re: Music Renaming

Post 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}
Annihilator1243
Posts: 16
Joined: 20 Jan 2019, 07:34

Re: Music Renaming

Post by Annihilator1243 »

is there a way to just get the year and month the album was released instead of the entire date?
User avatar
rednoah
The Source
Posts: 22923
Joined: 16 Nov 2011, 08:59
Location: Taipei
Contact:

Re: Music Renaming

Post 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
:idea: Please read the FAQ and How to Request Help.
Post Reply