INTERACT FORUM

Please login or register.

Login with username, password and session length
Advanced search  
Pages: [1]   Go Down

Author Topic: Multiple Disc File Naming Expression  (Read 4413 times)

jeffcdo

  • Recent member
  • *
  • Posts: 41
Multiple Disc File Naming Expression
« on: April 05, 2018, 06:18:10 pm »

I have a simple filename rule for multiple disc sets:

[Disc #]-[Track #] - [Name]

..and another for single discs:

[Track #] - [Name]

..using an expression can I combine these into one rule that will automatically append the disc number to the beginning of the filename only if the total number of discs is greater than one?
Logged

RoderickGI

  • MC Beta Team
  • Citizen of the Universe
  • *****
  • Posts: 8186
Re: Multiple Disc File Naming Expression
« Reply #1 on: April 05, 2018, 09:28:11 pm »

File naming:
If(!isempty([Disc #], 1), [Disc #]-,)[Track #] - [Name]

Gives a name like "1-01 - The Weekend Has Landed.m4a" when the [Disc #] tag contains data.

Optional sub-directory naming:
[Album Artist (auto)]\[Album]\If(!isempty([Disc #], 1), Disc [Disc #],)\

Gives a sub-directory name like "(Multiple Artists)\Human Traffic Soundtrack\Disc 1\" when the [Disc #] tag contains data.

Same concept.

Reference: https://wiki.jriver.com/index.php/Expression_Language

Logged
What specific version of MC you are running:MC27.0.27 @ Oct 27, 2020 and updating regularly Jim!                        MC Release Notes: https://wiki.jriver.com/index.php/Release_Notes
What OS(s) and Version you are running:     Windows 10 Pro 64bit Version 2004 (OS Build 19041.572).
The JRMark score of the PC with an issue:    JRMark (version 26.0.52 64 bit): 3419
Important relevant info about your environment:     
  Using the HTPC as a MC Server & a Workstation as a MC Client plus some DLNA clients.
  Running JRiver for Android, JRemote2, Gizmo, & MO 4Media on a Sony Xperia XZ Premium Android 9.
  Playing video out to a Sony 65" TV connected via HDMI, playing digital audio out via motherboard sound card, PCIe TV tuner

jeffcdo

  • Recent member
  • *
  • Posts: 41
Re: Multiple Disc File Naming Expression
« Reply #2 on: April 05, 2018, 10:54:00 pm »

My issue is that the Disc # isn't empty, it still contains a value of 1 for a single disc. Can this be modified to check if my Total Discs field is greater than 1?
Logged

RoderickGI

  • MC Beta Team
  • Citizen of the Universe
  • *****
  • Posts: 8186
Re: Multiple Disc File Naming Expression
« Reply #3 on: April 05, 2018, 11:19:50 pm »

Ah, I missed that bit. That is a whole lot harder, because MC works at the file level, not at the Disc or Album level. It may be possible, but I don't have time to tackle that at the moment.

However, I think there have been requests along those lines in the past. Use Google to search the forum and see if you can find threads on the topic.
Logged
What specific version of MC you are running:MC27.0.27 @ Oct 27, 2020 and updating regularly Jim!                        MC Release Notes: https://wiki.jriver.com/index.php/Release_Notes
What OS(s) and Version you are running:     Windows 10 Pro 64bit Version 2004 (OS Build 19041.572).
The JRMark score of the PC with an issue:    JRMark (version 26.0.52 64 bit): 3419
Important relevant info about your environment:     
  Using the HTPC as a MC Server & a Workstation as a MC Client plus some DLNA clients.
  Running JRiver for Android, JRemote2, Gizmo, & MO 4Media on a Sony Xperia XZ Premium Android 9.
  Playing video out to a Sony 65" TV connected via HDMI, playing digital audio out via motherboard sound card, PCIe TV tuner

RD James

  • Citizen of the Universe
  • *****
  • Posts: 1871
Re: Multiple Disc File Naming Expression
« Reply #4 on: April 06, 2018, 01:49:42 am »

How's this?
 
Code: [Select]
ListBuild(
1,
/ -/ ,
If(Compare([Total Discs], >, 1), [Disc #], ),
PadNumber([Track #], 2),
[Name],
)
Logged

jeffcdo

  • Recent member
  • *
  • Posts: 41
Re: Multiple Disc File Naming Expression
« Reply #5 on: April 06, 2018, 07:10:19 pm »

How's this?
 
Code: [Select]
ListBuild(
1,
/ -/ ,
If(Compare([Total Discs], >, 1), [Disc #], ),
PadNumber([Track #], 2),
[Name],
)

I tried this but it seems to put the slashes and dashes in the wrong place(s). It's the right idea though. For now my solution has been using a separate preset for multi-disc sets.
Logged

RD James

  • Citizen of the Universe
  • *****
  • Posts: 1871
Re: Multiple Disc File Naming Expression
« Reply #6 on: April 07, 2018, 12:15:32 am »

That's strange, there shouldn't be any slashes in the output, they're only escaping the spaces around the dash.
The previous expression just added everything as separate list items, this groups [Disc #] and [Track #] together.
 
Code: [Select]
ListBuild(
1,
/ -/ ,
If(Compare([Total Discs], >, 1), [Disc #]-, )PadNumber([Track #], 2),
[Name],
)
Logged

RoderickGI

  • MC Beta Team
  • Citizen of the Universe
  • *****
  • Posts: 8186
Re: Multiple Disc File Naming Expression
« Reply #7 on: April 07, 2018, 05:46:13 pm »

RD, I ran both those expressions in an Expression Column of a View I have for 7 albums which have 2 discs each. In fact, the View shows two copies of each Track, one being the original FLAC rip from the CD, and the other being a conversion to M4A done using MC, for use in a vehicle.

Neither expression gave the wanted result of "[Disc #]-[Track #] - [Name]" for most of the albums. Only the last album and only the FLAC files did. So I had a look at the [Total Discs] tag, which I haven't played around with before, and found only the last album had values in the tag, which explained the expression result. So I checked the [Total Tracks] and found values in it for all FLAC files, but none of the M4A files.

So now I am wondering how and when those tags get populated, since I didn't manually populate them. I always thought they were manually populated, which is why I haven't mucked around with them. Obviously you use them, since you included [Total Discs] in your expression, so do you know when they are populated, or do you manually populate them?

They are the correct fields to use in this sort of expression. If they were auto-populated they would be very useful.
Logged
What specific version of MC you are running:MC27.0.27 @ Oct 27, 2020 and updating regularly Jim!                        MC Release Notes: https://wiki.jriver.com/index.php/Release_Notes
What OS(s) and Version you are running:     Windows 10 Pro 64bit Version 2004 (OS Build 19041.572).
The JRMark score of the PC with an issue:    JRMark (version 26.0.52 64 bit): 3419
Important relevant info about your environment:     
  Using the HTPC as a MC Server & a Workstation as a MC Client plus some DLNA clients.
  Running JRiver for Android, JRemote2, Gizmo, & MO 4Media on a Sony Xperia XZ Premium Android 9.
  Playing video out to a Sony 65" TV connected via HDMI, playing digital audio out via motherboard sound card, PCIe TV tuner

RoderickGI

  • MC Beta Team
  • Citizen of the Universe
  • *****
  • Posts: 8186
Re: Multiple Disc File Naming Expression
« Reply #8 on: April 07, 2018, 06:30:56 pm »

I think I answered my own question, after falling down the rabbit hole which results from searching the forum for "Total Discs".

It looks like that values in the [Total Discs] and [Total Tracks] tags have come from YADB when I ripped the CDs, and of course they are not carried over to the converted files.

What a shame they aren't auto-calculated, with the ability to manually override of course. But I guess manually entering them wouldn't be too much work, and would be of value.
Logged
What specific version of MC you are running:MC27.0.27 @ Oct 27, 2020 and updating regularly Jim!                        MC Release Notes: https://wiki.jriver.com/index.php/Release_Notes
What OS(s) and Version you are running:     Windows 10 Pro 64bit Version 2004 (OS Build 19041.572).
The JRMark score of the PC with an issue:    JRMark (version 26.0.52 64 bit): 3419
Important relevant info about your environment:     
  Using the HTPC as a MC Server & a Workstation as a MC Client plus some DLNA clients.
  Running JRiver for Android, JRemote2, Gizmo, & MO 4Media on a Sony Xperia XZ Premium Android 9.
  Playing video out to a Sony 65" TV connected via HDMI, playing digital audio out via motherboard sound card, PCIe TV tuner

RD James

  • Citizen of the Universe
  • *****
  • Posts: 1871
Re: Multiple Disc File Naming Expression
« Reply #9 on: April 07, 2018, 07:18:54 pm »

If I recall correctly, [Total Discs] was added to Media Center 1-2 years ago, so anything imported prior to that will need updating.
I'm not sure whether Media Center's "update library from tags" function will pull that in for existing files - some tag changes require that you remove and re-import an album.
 
Unfortunately I ran some tests and it only seems to fill this information out if your [Disc #] tag is in the format "2/4" for disc 2 of a 4-disc album for example.
If it's just "2" in a directory with three other discs, Media Center doesn't give you a total.
 
And if you fill out the [Total Discs] field manually, it does not write any tags to the file at all - even if you use the "write tags to files" feature. It does not use the "2/4" format or store it in a unique tag.
So if you convert the tracks externally from Media Center - or perhaps even using Media Center - that information will be lost.
 
 
That said - and it's partially due to Media Center's prior lack of [Total Discs] support whatsoever until recently - I have largely switched to using Media Center's "fill track numbers from list order" tool on multi-disc albums.
In my library at least, I see very little reason for the concept of "discs" to actually exist any more. I don't clear out the [Disc #] tag, but rather than naming files: "1-14", "1-15", "2-01", "2-02" I have tracks: "14", "15", "16", "17" etc.
 
What I do rather than clearing out the original information is have the "fill track number from list order" use the [Episode] tag. I then use expressions which rename files or sort by [Episode] rather than [Track #] if it is not empty.
 
I also do this in reverse for TV shows. Rather than "[Season]-[Episode] - [Name]" I use [Track #] as a prefix which is a continually incrementing number rather than starting over again for each season.
As a bonus, this works better for shows which have a movie or two in-between seasons.
 
For example: Battlestar Galactica (2003) essentially has:
  • Miniseries - 2 episodes
  • Season 1 - 13 episodes
  • Season 2 - 20 episodes
  • Season 3 - 20 episodes
  • Movie / Special 1
  • Season 4 - 20 episodes
  • Movie / Special 2
That's a nightmare to try and tag and sort correctly in a single list view. You have to trick it by using intentionally wrong [Season] and [Episode] tags, which I don't like.
What I do is keep the correct information in the [Season] and [Episode] tags for file naming, but use [Track #] as a prefix, which makes managing file sorting or playback order far easier.
That way I don't have to call the Miniseries "Season 0" or the specials "Episode 21".
Logged

RoderickGI

  • MC Beta Team
  • Citizen of the Universe
  • *****
  • Posts: 8186
Re: Multiple Disc File Naming Expression
« Reply #10 on: April 07, 2018, 09:37:41 pm »

Not bad recollection. Three years ago!

Quote
20.0.72 (2/17/2015)

4. NEW: Added a 'Total Tracks' field to the library. Currently updated from MP3 files, MP4 files, FLAC files, and during CD ripping.
5. NEW: Added a 'Total Discs' field to the library, which is updated from MP3, MP4, and FLAC files.

Not a mention since, so I assume that the functionality hasn't changed.

I was going to ask if you had the "Save in file tags" setting in Manage Library Fields for those tags when you tried to "Update tags from library", but it looks like this is a one-way feature.

I did check the Tag Dump and found the album that worked for me had several related tags;
TOTALTRACKS
TRACKTOTAL
TOTALDISCS
DISCTOTAL

In addition to the data for the actual track;
DISCNUMBER
TRACKNUMBER

Also, the album had been updated from Musicbrainz, so that may have been where the additional tags came from.

I still keep using the Disc number concept because tools like Musicbrainz use it. Basically, I use the method used by the data source I use. JRiver's Album database on YADB is quite good, but its Track Database leaves a lot to be desired. As I have inherited a lot of unsorted or managed digital music from my brother, I need to be able to do reliable track Metadata lookups. I couldn't convert to using your "Full Album Sequence" methodology because it would confuse me too much. But that has merit for plain sorting, and using the [Episode] tag makes sense, as it won't affect MC functionality.

I haven't bothered to solve the Episode sequence and including Specials in sequence completely. I tend to use the standard functionality and View, but use the [date] field which comes from the "Originally Aired" data on TheTVDB if I want to sort in the correct sequence. That is usually pretty accurate. But your method certainly sounds like a good one, particularly as I also always use the data from TheTVDB as presented. Doing anything else just leads to problems. I don't really like TheTVDB's method of putting Specials in Season 00, but I would rather live with that than using decimal Season and Episode numbers, which is another option and probably my second choice.

Anyway, now that I am more aware I will probably have to start populating the [Total Discs] and [Total Tracks] tags in my library, if Musicbrainz hasn't done it for me.
Logged
What specific version of MC you are running:MC27.0.27 @ Oct 27, 2020 and updating regularly Jim!                        MC Release Notes: https://wiki.jriver.com/index.php/Release_Notes
What OS(s) and Version you are running:     Windows 10 Pro 64bit Version 2004 (OS Build 19041.572).
The JRMark score of the PC with an issue:    JRMark (version 26.0.52 64 bit): 3419
Important relevant info about your environment:     
  Using the HTPC as a MC Server & a Workstation as a MC Client plus some DLNA clients.
  Running JRiver for Android, JRemote2, Gizmo, & MO 4Media on a Sony Xperia XZ Premium Android 9.
  Playing video out to a Sony 65" TV connected via HDMI, playing digital audio out via motherboard sound card, PCIe TV tuner
Pages: [1]   Go Up