INTERACT FORUM

Please login or register.

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

Author Topic: ifnotempty for Disc# when renaming folders  (Read 4261 times)

HiFiTubes

  • Citizen of the Universe
  • *****
  • Posts: 1123
ifnotempty for Disc# when renaming folders
« on: February 26, 2014, 12:43:46 am »

I have decided to get my folder structure on disk more organized, even though I feel MC handles the brunt of all my organizational needs.

I'm trying to find a way to add the Disc#, but only if it is not empty, other I get:

(Multiple Artists) - (1991) - Atlantic Rhythm & Blues 1947-1974 Disc 4 (1958-1960) - Unknown Disc # - [mp3]



On another, but similar note, I was trying to find a way to get sample rate truncated and displayed in kHz so I can display it in folder name e.g. 44kHz. Or a way to similarly translate the display of high sample rates in mHz...too many zeros.

I wouldn't bother with the latter, but I do now have over 30K files over 44kHz and would like to identify them on disk.

I may just make a custom field for this wouldn't be too hard. Unless someone can suggest an existing field to use. I browsed through but nothing grabbed my attention. MusicBrainz uses some different fields and had Release Type which got me thinking. Strangely, they don't use Publisher which I though was a standard, and use Label instead. But I digress...
Logged

6233638

  • Regular Member
  • Citizen of the Universe
  • *****
  • Posts: 5353
Re: ifnotempty for Disc# when renaming folders
« Reply #1 on: February 26, 2014, 01:25:36 am »

Delimit() will do what you need for the disc number.

Code: [Select]
Delimit([Disc #],/ -,/ -/ )
Logged

6233638

  • Regular Member
  • Citizen of the Universe
  • *****
  • Posts: 5353
Re: ifnotempty for Disc# when renaming folders
« Reply #2 on: February 26, 2014, 01:34:41 am »

And this should cover the sample rate:

Code: [Select]
If(IsRange([Sample Rate,0],1000-384000),
Delimit(Math([Sample Rate,0]/1000),/ kHz,),
)
Logged

MrC

  • Citizen of the Universe
  • *****
  • Posts: 10462
  • Your life is short. Give me your money.
Re: ifnotempty for Disc# when renaming folders
« Reply #3 on: February 26, 2014, 01:47:00 am »

Be sure to use [Disc #,0].
Logged
The opinions I express represent my own folly.

6233638

  • Regular Member
  • Citizen of the Universe
  • *****
  • Posts: 5353
Re: ifnotempty for Disc# when renaming folders
« Reply #4 on: February 26, 2014, 01:48:40 am »

Be sure to use [Disc #,0].
I didn't think it mattered with Disc # but I suppose I should just use ,0 pretty much everywhere in expressions?
Logged

MrC

  • Citizen of the Universe
  • *****
  • Posts: 10462
  • Your life is short. Give me your money.
Re: ifnotempty for Disc# when renaming folders
« Reply #5 on: February 26, 2014, 01:53:52 am »

Only when you don't want to get the Display format.

The Rename, Move & Copy tool always uses the Display format of a field (that's where the Unknown Disc # comes from), so that a field cannot collapse away leaving an empty path component or filename.  So you want to force the raw format.

Also, to truncate the 44.1 into 44:

math(trunc([Sample Rate,0] / 1000, 0))
Logged
The opinions I express represent my own folly.

HiFiTubes

  • Citizen of the Universe
  • *****
  • Posts: 1123
Re: ifnotempty for Disc# when renaming folders
« Reply #6 on: February 26, 2014, 01:58:16 am »

Be sure to use [Disc #,0].

Thanks!

I am working with :

Code: [Select]
[Genre]\[Album Artist (auto)] - ([Year]) - Delimit([Disc #,0],/ -,/ -/ )[Album] - [[File Type]]
and seeing this crop at times:

Mose Allison - (1994) -  - 1 -Allison Wonderland_ Anthology - Disc 1 - [mp3]
Logged

HiFiTubes

  • Citizen of the Universe
  • *****
  • Posts: 1123
Re: ifnotempty for Disc# when renaming folders
« Reply #7 on: February 26, 2014, 02:03:46 am »

Code: [Select]
[Genre]\[Artist] - ([Year]) -Delimit([Disc #,0],/ -,/ -/ ) [Album] - [[File Type]] - math(trunc([Sample Rate,0] / 1000, 0))kHz
this seems to work, thanks!
Logged

MrC

  • Citizen of the Universe
  • *****
  • Posts: 10462
  • Your life is short. Give me your money.
Re: ifnotempty for Disc# when renaming folders
« Reply #8 on: February 26, 2014, 02:20:29 am »

Since you're not concerned about missing items (the expression doesn't provide any alternates when something is empty, except for disc #), you can use the ListBuild() function to build up your dash/space separated components:

   listbuild(1, / -/ , [Artist], /([Year]/), [Disc #,0], [Album], /[File Type]/], math(trunc([Sample Rate,0] / 1000, 0))kHz)
Logged
The opinions I express represent my own folly.

HiFiTubes

  • Citizen of the Universe
  • *****
  • Posts: 1123
Re: ifnotempty for Disc# when renaming folders
« Reply #9 on: February 26, 2014, 02:23:27 am »

This is what I have settled on, and I'll try to tweak it with Listbuild. thanks Mr. C!

Code: [Select]
[Genre]\[Album Artist (auto)] ([Year]) -Delimit([Disc #,0],/ -,/ -/ ) [Album] [math(trunc([Sample Rate,0] / 1000, 0))kHz [File Type]]
Logged

6233638

  • Regular Member
  • Citizen of the Universe
  • *****
  • Posts: 5353
Re: ifnotempty for Disc# when renaming folders
« Reply #10 on: February 26, 2014, 02:23:56 am »

I hate you MrC. ;D
 
Since I like my renaming expressions to cover every eventuality, I came up with…
 
Code: [Select]
[Genre]\[Album Artist (auto)]Delimit([Year,0],/),/ -/ /()Delimit([Disc #,0],,/ -/ Disc/ )Delimit([Album],,/ -/ )Delimit([File Type],/],/ -/ /[)If(IsRange([Sample Rate,0],1000-999999),Delimit(Math([Sample Rate,0]/1000),/ kHz,/ -/ ),
If(IsRange([Sample Rate,0],1000000-9999999),Delimit(Math(trunc([Sample Rate,0]/1000000,1)),/ MHz,/ -/ ),
))

And you will probably also find a much cleaner solution for that as well.
Edit: Looking at it again, some of the "Delimits" are redundant. File Type is never going to be empty, is it?
Logged

MrC

  • Citizen of the Universe
  • *****
  • Posts: 10462
  • Your life is short. Give me your money.
Re: ifnotempty for Disc# when renaming folders
« Reply #11 on: February 26, 2014, 02:29:59 am »

I'd agree, File Type is probably safe.

You can probably eliminate several of your Delimits by allowing ListBuild() to add the separator.  In mode 1, it won't output empty fields.
Logged
The opinions I express represent my own folly.

HiFiTubes

  • Citizen of the Universe
  • *****
  • Posts: 1123
Re: ifnotempty for Disc# when renaming folders
« Reply #12 on: February 26, 2014, 02:36:13 am »

I tried to change the formatting a bit and screwed something up, I wanted to remove some hyphens and:

Code: [Select]
[Genre]\listbuild(1, / -/ ,[Artist] /([Year]/), [Disc #,0], [Album] /[[File Type]/ math(trunc([Sample Rate,0] / 1000, 0))kHz)]

Makeba, Miriam (Unknown Year) - Homeland [mp3 44kHz]
Logged

MrC

  • Citizen of the Universe
  • *****
  • Posts: 10462
  • Your life is short. Give me your money.
Re: ifnotempty for Disc# when renaming folders
« Reply #13 on: February 26, 2014, 02:41:20 am »

[Year,0].

But this is a case, where you might want Delimit() for the parens.

   Delimit([year,0], /), /()
Logged
The opinions I express represent my own folly.

6233638

  • Regular Member
  • Citizen of the Universe
  • *****
  • Posts: 5353
Re: ifnotempty for Disc# when renaming folders
« Reply #14 on: February 26, 2014, 02:46:22 am »

How is this?
 
Code: [Select]
ListBuild(1,/ -/ ,[Album Artist (auto)],Delimit([Year,0],/),/(),Delimit([Disc #,0],,Disc/ ),[Album],/[FixCase([File Type],3)Delimit(If(IsRange([Sample Rate,0],1000-999999),Delimit(Math([Sample Rate,0]/1000),/ kHz,),
If(IsRange([Sample Rate,0],1000000-9999999),Delimit(Math(trunc([Sample Rate,0]/1000000,1)),/ MHz,),)),,/ -/ )/])
Logged

MrC

  • Citizen of the Universe
  • *****
  • Posts: 10462
  • Your life is short. Give me your money.
Re: ifnotempty for Disc# when renaming folders
« Reply #15 on: February 26, 2014, 02:50:22 am »

Nifty.
Logged
The opinions I express represent my own folly.

HiFiTubes

  • Citizen of the Universe
  • *****
  • Posts: 1123
Re: ifnotempty for Disc# when renaming folders
« Reply #16 on: February 26, 2014, 02:56:02 am »

How is this?
 
Code: [Select]
ListBuild(1,/ -/ ,[Album Artist (auto)],Delimit([Year,0],/),/(),Delimit([Disc #,0],,Disc/ ),[Album],/[FixCase([File Type],3)Delimit(If(IsRange([Sample Rate,0],1000-999999),Delimit(Math([Sample Rate,0]/1000),kHz,),
If(IsRange([Sample Rate,0],1000000-9999999),Delimit(Math(trunc([Sample Rate,0]/1000000,1)),MHz,),)),,/ -/ )/])


Expression Error (Unknown)
Logged

6233638

  • Regular Member
  • Citizen of the Universe
  • *****
  • Posts: 5353
Re: ifnotempty for Disc# when renaming folders
« Reply #17 on: February 26, 2014, 02:58:34 am »

Be sure to paste it into the "Expression Editor" (multi-line) rather than the "Rule" box. (which is single line)
 
Edit: Actually since it's multi-line, it might be easier to follow something like:
Code: [Select]
ListBuild(1,/ -/ ,
[Album Artist (auto)],
Delimit([Year,0],/),/(),
Delimit([Disc #,0],,Disc/ ),
[Album],
/[FixCase([File Type],3)Delimit(If(IsRange([Sample Rate,0],1000-999999),
   Delimit(Math([Sample Rate,0]/1000),/ kHz,),
   If(IsRange([Sample Rate,0],1000000-9999999),
   Delimit(Math(trunc([Sample Rate,0]/1000000,1)),/ MHz,),)),,/ -/ )/])

Anyone that does, will be able to tell that I clearly don't write code for a living… :P
Logged

HiFiTubes

  • Citizen of the Universe
  • *****
  • Posts: 1123
Re: ifnotempty for Disc# when renaming folders
« Reply #18 on: February 26, 2014, 03:26:36 am »

doh, thanks!

The reason I am doing this is two-fold. I feel it is good practice, but I also want to play with MC side and see if I can start to weed out duplicates, mainly MP3s.

I know MC can show Dups, but are there any good strategies for View Schemes with Expressions with could help list out Album dups (using just Album field), and display them in a way where it would be easy to delete mp3 copies.Like a "Show only Duplicates" modifier of "Album". I guess that might do the trick, but I'm nervous about it as I am not an expert at this stuff for sure.
Logged

6233638

  • Regular Member
  • Citizen of the Universe
  • *****
  • Posts: 5353
Re: ifnotempty for Disc# when renaming folders
« Reply #19 on: February 26, 2014, 03:37:46 am »

The reason I am doing this is two-fold. I feel it is good practice…
Because there are limits on filename length, I actually try to keep my file structure as simple and to the point as possible.
 
I simply have \Audio\Music\Album Artist\[Year] - Album (Description)\ for my file structure.
I don't see the point in splitting up by genre, file type, sample rate etc.
If I ever have to navigate the directory structure outside of Media Center, this is the easiest way to find what I am looking for - some artists have works that belong in different Genres, I may not remember whether I ripped the album I'm looking for to MP3, FLAC, AAC etc.
 
If I only have one version of an album, the description field is normally left blank if it's the regular CD release.
If I have multiple versions or something which is not the standard CD release, the description field will include something like "1986 Original Release", "1991 Remaster", "2011 SACD", "HDtracks" etc.

…I also want to play with MC side and see if I can start to weed out duplicates, mainly MP3s.
I don't really have anything specific that I could recommend, but I think you would be able to sort through it much easier using library views rather than through renaming files.
Logged

HiFiTubes

  • Citizen of the Universe
  • *****
  • Posts: 1123
Re: ifnotempty for Disc# when renaming folders
« Reply #20 on: February 26, 2014, 03:41:33 am »

Half-way there. I have been at this before, and I was able to use it to some extent in the past with SACD ISO vs.DFF extracts, but now I can't seem to get a View Scheme I want.

Ideally...one scheme showing a sort by Artist or Album Artist (auto) and a list of Albums which:

Share same exact Album field
File Type is different file type, or at least one of same File Type
Displays the list of albums so I can see all versions e.g. MP3 FLAC DFF SACD-ISO

or...some way to display a view of all duplicate albums which are MP3 that can be safely deleted because there exists at least one other album with same Album field and same/different file type.

I think you guys see what I am getting it, hopefully my non-coding langauge doesn't throw you off.
Logged

HiFiTubes

  • Citizen of the Universe
  • *****
  • Posts: 1123
Re: ifnotempty for Disc# when renaming folders
« Reply #21 on: February 26, 2014, 07:34:41 am »

Because there are limits on filename length, I actually try to keep my file structure as simple and to the point as possible.
 
I simply have \Audio\Music\Album Artist\[Year] - Album (Description)\ for my file structure.
I don't see the point in splitting up by genre, file type, sample rate etc.
If I ever have to navigate the directory structure outside of Media Center, this is the easiest way to find what I am looking for - some artists have works that belong in different Genres, I may not remember whether I ripped the album I'm looking for to MP3, FLAC, AAC etc.
 
If I only have one version of an album, the description field is normally left blank if it's the regular CD release.
If I have multiple versions or something which is not the standard CD release, the description field will include something like "1986 Original Release", "1991 Remaster", "2011 SACD", "HDtracks" etc.
I don't really have anything specific that I could recommend, but I think you would be able to sort through it much easier using library views rather than through renaming files.

I agree and I operate pretty much like you and I'm really just cleaning things up on disc.

I'm after \Audio\Music\Artist [Year] - Album (Description)\.I kind of enjoy not having artists nested in their own folders
Logged

HiFiTubes

  • Citizen of the Universe
  • *****
  • Posts: 1123
Re: ifnotempty for Disc# when renaming folders
« Reply #22 on: February 26, 2014, 07:53:56 am »

I noted some problems.

If songs on the same album have been tagged with various data for [Year], you will get a folder for each song.

Also, I see some folders turning up with Disc 1 even though there is an empty field.

Guitar Blues (The Blues Collection Vol.74) for example even though this has no Disc# entry.
Logged

6233638

  • Regular Member
  • Citizen of the Universe
  • *****
  • Posts: 5353
Re: ifnotempty for Disc# when renaming folders
« Reply #23 on: February 26, 2014, 08:19:34 am »

If songs on the same album have been tagged with various data for [Year], you will get a folder for each song.
I would suggest using the album date in the [Date] field, and not using different data for each track. You can create a custom field if you want that.
 
I use [Date] for the original release date for an album and a custom [Release Date] field for when this version of the album was released, for example.

Also, I see some folders turning up with Disc 1 even though there is an empty field.
Are you sure that the tags are empty, or that you copied the expression correctly?

Delimit([Disc #,0],,Disc/ ) should not display anything if [Disc #] is empty.
Logged

HiFiTubes

  • Citizen of the Universe
  • *****
  • Posts: 1123
Re: ifnotempty for Disc# when renaming folders
« Reply #24 on: February 26, 2014, 09:11:11 am »

I would suggest using the album date in the [Date] field, and not using different data for each track. You can create a custom field if you want that.
 
I use [Date] for the original release date for an album and a custom [Release Date] field for when this version of the album was released, for example.
Are you sure that the tags are empty, or that you copied the expression correctly?

Delimit([Disc #,0],,Disc/ ) should not display anything if [Disc #] is empty.

Thanks, I noted MusicBrainz (and Jaikoz) have some options about Release Date. I'll work on it.

Do you think I should report the Show Only Duplicates? It's just giving me a long list of Pane view Ablums, not just Duplicates. It's making me dizzy scrolling down looking for mixed File Types in the File Lists....

Logged

6233638

  • Regular Member
  • Citizen of the Universe
  • *****
  • Posts: 5353
Re: ifnotempty for Disc# when renaming folders
« Reply #25 on: February 26, 2014, 10:12:36 am »

Well if you're only comparing duplicates on the album name, every track on any album will be considered a duplicate.
 
 
You probably want to set up a panes view with Artist, Album, File Type across the top, and group files by File Type.
 
For your duplicates, maybe try a rule comparing something like Album, Name, and Channels.
Logged

HiFiTubes

  • Citizen of the Universe
  • *****
  • Posts: 1123
Re: ifnotempty for Disc# when renaming folders
« Reply #26 on: February 26, 2014, 11:16:07 pm »

I've done that before, and thanks for reminding me.

I keep thinking Sort>Duplicates is more advanced than it actually is, and that is applying to FILES and Album is just one criteria, and it is a FIELD. I was assuming it was more of an algorithm and comparing more fields, thus showing me Albums that have a Dup.

Sounds like AlbumKey and/or and Acoustic Fingerprint would be helpful. thanks
Logged

MrC

  • Citizen of the Universe
  • *****
  • Posts: 10462
  • Your life is short. Give me your money.
Re: ifnotempty for Disc# when renaming folders
« Reply #27 on: February 26, 2014, 11:19:19 pm »

The ~dup modifier, for each file, just concatenates the listed fields into a long string, and does string comparisons.  Matching strings are considered "duplicates".  This is a poor mans duplicate detection mechanism.
Logged
The opinions I express represent my own folly.

HiFiTubes

  • Citizen of the Universe
  • *****
  • Posts: 1123
Re: ifnotempty for Disc# when renaming folders
« Reply #28 on: March 03, 2014, 04:02:33 am »

Yeah, I do wish there was a little more functionality...

The Dup view using Duplicates = Duration, Name, Channel works pretty well, but quite often there are 1-2 files that don't match, so when you want to delete a Dup Album, you really need to go into Windows Explorer to delete the whole folder. I guess you could do Locate Internally too though. I toggle Album on/off because quite often you'll find subtle differences in Album name whereas these other fields will mirror.

I custom layout would be nice too but so far so good I guess. It a lot of work no matter what. I checked out an amp named Simplify? but it looks to be a bit much when MC can do the job.

This view was a sort that removed Grouping by Album which worked well to scroll through and work at deleting out the duplicate albums.

Logged
Pages: [1]   Go Up