INTERACT FORUM

Please login or register.

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

Author Topic: Remove Hung Closing Parenthesis From Renamed Folder  (Read 6245 times)

AudibleImagery

  • World Citizen
  • ***
  • Posts: 108
Remove Hung Closing Parenthesis From Renamed Folder
« on: February 17, 2023, 12:24:16 am »

Hello Interact,

I'm trying to write a Directory Rule for the Rename, Move, & Copy Files library tool. I want my folder structures to look like this: [Album Artist]/[Date] - [Album] [Catalog #] resulting in folder structures like this: Hawkwind/1977 - Quark, Strangeness and Charm (2009 Atomhenge (Europe) - ATOMCD 2009)/. I want the rule to make it so that the [Date] and [Catalog #] values only appear in the folder name when there are numbers in the [Date] field and characters in the [Catalog #] field, respectively. The current rule that I've come up with is as follows: [Album Artist]/if(isempty([Date],1),,[Date] -) [Album] if(isempty([Catalog #],1),,([Catalog #])). This rule works fine when there is a [Catalog #] value but when there isn't one it results in a folder structure like this: Hawkwind/1975 - Warrior on the Edge of Time )/. As you can see, there is a hung closing parenthesis that I have been unable to remove despite banging my head against the wall for the better part of eight hours. I can't simply remove a parenthesis from the end of the Directory Rule because that results in a folder name that is missing a parenthesis at the end of the catalog number like this: Hawkwind/1977 - Quark, Strangeness and Charm (2009 Atomhenge (Europe) - ATOMCD 2009 and so I'm I'm stuck between a rock and a hard place. Could someone please advise me on how to remove this hung parenthesis from my folder names?

Here is a photo of my Rename, Move, & Copy Files library tool for reference:


Regards in advance,
Audible
Logged

lepa

  • MC Beta Team
  • Citizen of the Universe
  • *****
  • Posts: 2033
Re: Remove Hung Closing Parenthesis From Renamed Folder
« Reply #1 on: February 17, 2023, 02:51:12 am »

Hello there,
There is no photo included but from your expression i can see that you need escape characters / before parenthesis when parenthesis are not belonging to function but you want to display those.

if(isempty([Catalog #],1),,/([Catalog #]/))
Logged

AudibleImagery

  • World Citizen
  • ***
  • Posts: 108
Re: Remove Hung Closing Parenthesis From Renamed Folder
« Reply #2 on: February 17, 2023, 04:14:49 am »

Hello there,
There is no photo included but from your expression i can see that you need escape characters / before parenthesis when parenthesis are not belonging to function but you want to display those.

if(isempty([Catalog #],1),,/([Catalog #]/))

Hey leap,

I'm sorry about the image not displaying, I reformatted it and so it should display properly now.

I tried your Rule suggestion and it gave me the following result:

I appreciate your effort but unfortunately this isn't what I'm looking for. I'm trying to get it to look like this so that the [Catalog #] comes after the [Album] in the folder name: but it has to be formatted so that albums without a [Catalog #] aren't left with a hanging closing parenthesis as in the image below:
Logged

zybex

  • MC Beta Team
  • Citizen of the Universe
  • *****
  • Posts: 2616
Re: Remove Hung Closing Parenthesis From Renamed Folder
« Reply #3 on: February 17, 2023, 05:04:47 am »

Links to images must start with HTTPS - HTTP won't work (it may be visible to you alone)
You can also attach the image directly to the post, click on the "attachments" button.
Logged

lepa

  • MC Beta Team
  • Citizen of the Universe
  • *****
  • Posts: 2033
Re: Remove Hung Closing Parenthesis From Renamed Folder
« Reply #4 on: February 17, 2023, 05:05:57 am »

On Windows following gives me folders like this
Code: [Select]
[Album Artist]//If(IsEmpty([Year],1),,[Year] -) [Album] If(IsEmpty([Catalog #,0]),,/([Catalog #]/))Ram Jam\1978 - Portrait Of The Artist As A Young Ram (EPIC - EPC 82628)
and if there is no catalog
Ram Jam\1978 - Portrait Of The Artist As A Young Ram

Above is following the folder format like below. Is this structure you are after?
[Album Artist]/[Year] - [Album] ([Catalog])\[Filename (name)]
[Album Artist]/[Year] - [Album]
Logged

AudibleImagery

  • World Citizen
  • ***
  • Posts: 108
Re: Remove Hung Closing Parenthesis From Renamed Folder
« Reply #5 on: February 17, 2023, 05:55:55 am »

Links to images must start with HTTPS - HTTP won't work (it may be visible to you alone)
You can also attach the image directly to the post, click on the "attachments" button.

Hey zybex,

I reformatted the images again. Are you able to view them now?
Logged

AudibleImagery

  • World Citizen
  • ***
  • Posts: 108
Re: Remove Hung Closing Parenthesis From Renamed Folder
« Reply #6 on: February 17, 2023, 06:02:55 am »

On Windows following gives me folders like this
Code: [Select]
[Album Artist]//If(IsEmpty([Year],1),,[Year] -) [Album] If(IsEmpty([Catalog #,0]),,/([Catalog #]/))Ram Jam\1978 - Portrait Of The Artist As A Young Ram (EPIC - EPC 82628)
and if there is no catalog
Ram Jam\1978 - Portrait Of The Artist As A Young Ram

Above is following the folder format like below. Is this structure you are after?
[Album Artist]/[Year] - [Album] ([Catalog])\[Filename (name)]
[Album Artist]/[Year] - [Album]

Hey Lepa,

Yes these are the structures I’m after:
Quote
[Album Artist]/[Year] - [Album] ([Catalog])\[Filename (name)]
[Album Artist]/[Year] - [Album]

I’m on Mac OS. I have “Replaces slashes in expressions” checked. I copied and pasted your newest Rules into the Directory field and the folder structure that I got back was: [Album Artist]/[Year] - [Album]/([Catalog #]/)\[Filename (name)]. Note the slash splitting [Album] and [Catalog #] and note the slash inside of the parentheses that [Catalog #] is in: ([Catalog #]/). It's creating three separate folders for [Album], [Catalog #], and the closing parenthesis symbol instead of just creating one folder.
Logged

zybex

  • MC Beta Team
  • Citizen of the Universe
  • *****
  • Posts: 2616
Re: Remove Hung Closing Parenthesis From Renamed Folder
« Reply #7 on: February 17, 2023, 06:14:09 am »

Hey zybex,

I reformatted the images again. Are you able to view them now?

Nevermind, it was my corporate firewall blocking them - I was on the company VPN  ::)
Logged

zybex

  • MC Beta Team
  • Citizen of the Universe
  • *****
  • Posts: 2616
Re: Remove Hung Closing Parenthesis From Renamed Folder
« Reply #8 on: February 17, 2023, 06:31:55 am »

Sorry for the silly question, but are you pasting the expression as is or are you replacing the forward-slashes with backslashes?
What MC version do you have?
Try without the "replace slashes" option. MC shows you what it will do to each filename, so you don't actually need to run the Rename do see the results.
Logged

lepa

  • MC Beta Team
  • Citizen of the Universe
  • *****
  • Posts: 2033
Re: Remove Hung Closing Parenthesis From Renamed Folder
« Reply #9 on: February 17, 2023, 06:35:17 am »

I'm also working  ::)

Lose this:
I have “Replaces slashes in expressions” checked.
EDIT: no need to lose Mac but just that replace check  :D

REF:
https://wiki.jriver.com/index.php/Rename,_Move,_and_Copy_Files
"If you are intentionally using a calculated field to create directory structures in your Directories Template, you can uncheck the Replace slashes in expressions option to pass through any slashes found in an expression or field as-is. "
Logged

AudibleImagery

  • World Citizen
  • ***
  • Posts: 108
Re: Remove Hung Closing Parenthesis From Renamed Folder
« Reply #10 on: February 17, 2023, 02:58:00 pm »

Sorry for the silly question, but are you pasting the expression as is or are you replacing the forward-slashes with backslashes?
What MC version do you have?
Try without the "replace slashes" option. MC shows you what it will do to each filename, so you don't actually need to run the Rename do see the results.

I'm also working  ::)

Lose this:EDIT: no need to lose Mac but just that replace check  :D

REF:
https://wiki.jriver.com/index.php/Rename,_Move,_and_Copy_Files
"If you are intentionally using a calculated field to create directory structures in your Directories Template, you can uncheck the Replace slashes in expressions option to pass through any slashes found in an expression or field as-is. "

I'm using Media Center 30.0.41 (Intel). I'm pasting the expression as is. The only difference is that I'm using the [Date] field instead of [Year] but other than that the expressions are identical. I unchecked the "replace slashes" option and am still experiencing the same issue. Here's a screenshot of the Rename, Move, and Copy Files window:



The photo is a little grainy but I used the code Lepa gave me:
Code: [Select]
[Album Artist]//If(IsEmpty([Date],1),,[Date] -) [Album] If(IsEmpty([Catalog #,0]),,/([Catalog #]/))
The folder structure is formatting as follows: [Album Artist]/[Date] - [Album]/[Catalog #]/)/[Filename (name)] which results in a folder structure like this:
Code: [Select]
Hawkwind/1978 - 25 Years on (Disc Two)/(2009 Atomhenge (UK) - ATOMCD 2006/)/[Filename (name)]
Logged

lepa

  • MC Beta Team
  • Citizen of the Universe
  • *****
  • Posts: 2033
Re: Remove Hung Closing Parenthesis From Renamed Folder
« Reply #11 on: February 17, 2023, 03:30:58 pm »

You could try without escapes (keep the replace slash.. unchecked), maybe Mac version is handling that escaping differently. seems to me that in your system escapes instead just creates new folders. Maybe some Mac guys could chime in if it doesn't work or MC devs if this a bug in Mac version...
Code: [Select]
[Album Artist]//If(IsEmpty([Date],1),,[Date] -) [Album] If(IsEmpty([Catalog #,0]),,([Catalog #]))
Logged

zybex

  • MC Beta Team
  • Citizen of the Universe
  • *****
  • Posts: 2616
Re: Remove Hung Closing Parenthesis From Renamed Folder
« Reply #12 on: February 17, 2023, 03:32:11 pm »

I could briefly reproduce your problem - MC showed and extra ")" but only once, then it started working correctly again ? Looks like there's some sort of bug handling the forward slashes, but I can't reproduce it now. It showed the bug when I was typing an expression, but it worked correctly when I pasted the full expression in one go... weird.

EDIT: ninja'd by Lepa

Try pasting this with the "replace shashes" option enabled:
[Album Artist]\If(IsEmpty([Date],1),,[Date] -) [Album]If(IsEmpty([Catalog #,0]),,/([Catalog #]/))
Or this with that option OFF:
[Album Artist]//If(IsEmpty([Date],1),,[Date] -) [Album]If(IsEmpty([Catalog #,0]),,/([Catalog #]/))
Logged

AudibleImagery

  • World Citizen
  • ***
  • Posts: 108
Re: Remove Hung Closing Parenthesis From Renamed Folder
« Reply #13 on: February 17, 2023, 03:56:56 pm »

You could try without escapes (keep the replace slash.. unchecked), maybe Mac version is handling that escaping differently. seems to me that in your system escapes instead just creates new folders. Maybe some Mac guys could chime in if it doesn't work or MC devs if this a bug in Mac version...
Code: [Select]
[Album Artist]//If(IsEmpty([Date],1),,[Date] -) [Album] If(IsEmpty([Catalog #,0]),,([Catalog #]))

This works for albums with a catalog number but for albums without one it still leaves a closing parenthesis at the end of an album title " )" such as "2008 - The Dream Goes On - An Anthology 1985-1997 (Disc One) )"
Logged

AudibleImagery

  • World Citizen
  • ***
  • Posts: 108
Re: Remove Hung Closing Parenthesis From Renamed Folder
« Reply #14 on: February 17, 2023, 04:10:25 pm »

Try pasting this with the "replace shashes" option enabled:
[Album Artist]\If(IsEmpty([Date],1),,[Date] -) [Album]If(IsEmpty([Catalog #,0]),,/([Catalog #]/))
[/font]

This expression is the closest we've gotten so far but it still leaves a closing parenthesis at the end of an album title ")" such as "2008 - The Dream Goes On - An Anthology 1985-1997 (Disc One))"
Logged

zybex

  • MC Beta Team
  • Citizen of the Universe
  • *****
  • Posts: 2616
Re: Remove Hung Closing Parenthesis From Renamed Folder
« Reply #15 on: February 17, 2023, 04:14:15 pm »

That's expected when not escaping the closing parenthesis. The problem is the escaping leaves the slash (bug?):

What about a workaround:
[Album Artist]//If(IsEmpty([Date],1),,[Date] -) [Album] If(IsEmpty([Catalog #,0]),,char(40)[Catalog #]char(41))
Logged

AudibleImagery

  • World Citizen
  • ***
  • Posts: 108
Re: Remove Hung Closing Parenthesis From Renamed Folder
« Reply #16 on: February 17, 2023, 11:11:58 pm »

That's expected when not escaping the closing parenthesis. The problem is the escaping leaves the slash (bug?):

What about a workaround:
[Album Artist]//If(IsEmpty([Date],1),,[Date] -) [Album] If(IsEmpty([Catalog #,0]),,char(40)[Catalog #]char(41))


Zybex and Lepa,

Thank you so much for taking the time to help me.

I'm all for a workaround at this point and it worked like a charm. Thanks again! Could you explain how the char function is supposed to work? I tried to look it up but the information on the JRiver wiki is sparse.

Regards,
John
Logged

zybex

  • MC Beta Team
  • Citizen of the Universe
  • *****
  • Posts: 2616
Re: Remove Hung Closing Parenthesis From Renamed Folder
« Reply #17 on: February 18, 2023, 02:15:00 am »

https://wiki.jriver.com/index.php/Miscellaneous_Functions#Char

The Char() function prints a single symbol corresponding to the given ASCII/Unicode character. Here's a table for the common values:
https://www.rapidtables.com/code/text/ascii-table.html

You can see 40 = open parenthesis and 41 = closing. Since MC isn't handling the /( and /) correctly in the rename tool on Mac, the function gives us another way of inserting those same symbols without breaking MC.
Logged

marko

  • MC Beta Team
  • Citizen of the Universe
  • *****
  • Posts: 9139
Re: Remove Hung Closing Parenthesis From Renamed Folder
« Reply #18 on: February 18, 2023, 03:54:10 am »

I have a quick question relating to text case...

I personally like things to be properly capitalised, but I'm also lazy... so, when I'm writing expressions, as they're never going to be displayed anywhere, and Windows is not case-sensitive, the expression functions and library fields are more often than not written 'all lower case'.

When using Mac (or Linux) do the expression functions and [library fields] all need to be cased correctly to work?

My laziness recently caused me much pain as I needed to go through all of my skin xml files and correct the case of the referenced image filenames. I did not enjoy that very much, at all :)

JimH

  • Administrator
  • Citizen of the Universe
  • *****
  • Posts: 72438
  • Where did I put my teeth?
Re: Remove Hung Closing Parenthesis From Renamed Folder
« Reply #19 on: February 18, 2023, 07:56:36 am »

As you found, file names on linux and Mac need to be explicit with respect to capitalization.  The same is true for directories.

You can have files or directories named AA, Aa, aA, and aa and they are all different. 

Anything MC doesn't.  An expression, for example.
Logged

AudibleImagery

  • World Citizen
  • ***
  • Posts: 108
Re: Remove Hung Closing Parenthesis From Renamed Folder
« Reply #20 on: March 04, 2023, 05:58:49 pm »

That's expected when not escaping the closing parenthesis. The problem is the escaping leaves the slash (bug?):

What about a workaround:
[Album Artist]//If(IsEmpty([Date],1),,[Date] -) [Album] If(IsEmpty([Catalog #,0]),,char(40)[Catalog #]char(41))


Hey Zybex,

I've evolved this renaming convention using the code you gave me from the album column thread. Here's what it is currently:
Code: [Select]
[Album Artist]//trim(replace(replace([Album, 1],[Lossy],),[Incomplete],)) If(IsEmpty([Catalog #,0]),,char(40)[Catalog #]char(41))
This is a step in the right direction for the folder structure I'm trying to create but a problem has arisen with the catalogue number that I don't know how to resolve. I sometimes combine different album presses for a variety of reasons, such as when I add Japanese bonus tracks to an American press to a create a fuller, more complete album. This is creating a problem where multiple folders are being created for one album because of there being multiple catalogue numbers for a single album. Other than throwing out the catalogue number renaming expression, can you offer a solution that could fix this problem?
Logged

lepa

  • MC Beta Team
  • Citizen of the Universe
  • *****
  • Posts: 2033
Re: Remove Hung Closing Parenthesis From Renamed Folder
« Reply #21 on: March 05, 2023, 01:22:05 am »

You could make a new field, say [Hybrid] and check it for this kind of hybrid albums. Then in your rename expression check also that if [hybrid] has a value, then don't use catalog # in the filename but use e.g. text (Hybrid) instead or nothing at all.
Logged

zybex

  • MC Beta Team
  • Citizen of the Universe
  • *****
  • Posts: 2616
Re: Remove Hung Closing Parenthesis From Renamed Folder
« Reply #22 on: March 05, 2023, 04:52:24 am »

What Lepa said :)

Just a minor edit to your expression - the Trim() should apply to the entire expression in order to remove the ending space when the Catalog# is empty:

[Album Artist]//trim(replace(replace([Album, 1],[Lossy],),[Incomplete],) If(IsEmpty([Catalog #,0]),,char(40)[Catalog #]char(41)))
Logged

AudibleImagery

  • World Citizen
  • ***
  • Posts: 108
Re: Remove Hung Closing Parenthesis From Renamed Folder
« Reply #23 on: March 15, 2023, 05:29:41 pm »

You could make a new field, say [Hybrid] and check it for this kind of hybrid albums. Then in your rename expression check also that if [hybrid] has a value, then don't use catalog # in the filename but use e.g. text (Hybrid) instead or nothing at all.

I'm still new to these expressions and so how would I go about implementing this according to my current renaming expression?:
[Album Artist]//trim(replace(replace([Album, 1],[Lossy],),[Incomplete],) If(IsEmpty([Catalog #,0]),,char(40)[Catalog #]char(41)))

How would I tell the [Hybrid] field to 'check' for hybrid albums? Also, how would I tell the renaming expression to use the [Hybrid] value instead of the catalog # value?

What Lepa said :)

Just a minor edit to your expression - the Trim() should apply to the entire expression in order to remove the ending space when the Catalog# is empty:

[Album Artist]//trim(replace(replace([Album, 1],[Lossy],),[Incomplete],) If(IsEmpty([Catalog #,0]),,char(40)[Catalog #]char(41)))

Hey zybex, this expression is adding an extra space at the beginning of the [catalogue #] field and so catalogue #'s are coming out like "Ink is My Drink  (Bandcamp)" (note the two spaces between the album title and catalogue #). The unedited expression is giving me no trouble.
Logged

zybex

  • MC Beta Team
  • Citizen of the Universe
  • *****
  • Posts: 2616
Re: Remove Hung Closing Parenthesis From Renamed Folder
« Reply #24 on: March 15, 2023, 06:52:28 pm »

You're right, you actually need 2 trims to also remove the leftover space in [Album] after the "[Lossy]" is removed:

[Album Artist]//trim(trim(replace(replace([Album, 1],[Lossy],),[Incomplete],)) If(IsEmpty([Catalog #,0]),,char(40)[Catalog #]char(41)))

or moving the space around:
[Album Artist]//trim(replace(replace([Album, 1],[Lossy],),[Incomplete],))If(IsEmpty([Catalog #,0]),,/ char(40)[Catalog #]char(41))
Logged

AudibleImagery

  • World Citizen
  • ***
  • Posts: 108
Re: Remove Hung Closing Parenthesis From Renamed Folder
« Reply #25 on: March 17, 2023, 07:38:56 pm »

You're right, you actually need 2 trims to also remove the leftover space in [Album] after the "[Lossy]" is removed:

[Album Artist]//trim(trim(replace(replace([Album, 1],[Lossy],),[Incomplete],)) If(IsEmpty([Catalog #,0]),,char(40)[Catalog #]char(41)))

or moving the space around:
[Album Artist]//trim(replace(replace([Album, 1],[Lossy],),[Incomplete],))If(IsEmpty([Catalog #,0]),,/ char(40)[Catalog #]char(41))

Hey zybex,

Thank you for this amendment. I still didn't seem to have any trailing spaces after using the old expression but I appreciate this expression as a failsafe.
Logged

AudibleImagery

  • World Citizen
  • ***
  • Posts: 108
Re: Remove Hung Closing Parenthesis From Renamed Folder
« Reply #26 on: March 17, 2023, 07:54:25 pm »

You could make a new field, say [Hybrid] and check it for this kind of hybrid albums. Then in your rename expression check also that if [hybrid] has a value, then don't use catalog # in the filename but use e.g. text (Hybrid) instead or nothing at all.

Hey lepa and zybex,

I'm having trouble deriving all catalogue numbers from a given album for the [Hybrid] field. For the past fews hours I've tested innumerable combinations from this list https://wiki.jriver.com/index.php/List_Manipulation_Functions#ListFind while also referring to this recent post about list manipulation that you both participated in https://yabb.jriver.com/interact/index.php/topic,134242 but I'm not getting anywhere due in large part to my computer and coding illiteracy. What do you suggest? Any help would be greatly appreciated because I'm almost done with this renaming expression.
Logged

lepa

  • MC Beta Team
  • Citizen of the Universe
  • *****
  • Posts: 2033
Re: Remove Hung Closing Parenthesis From Renamed Folder
« Reply #27 on: March 18, 2023, 02:50:11 am »

Assuming you have created the Hybrid field: Then you could use e.g. IfElse() to first check that if hybrid exist (display hybrid) and if not then check if there is catalog # (display catalog #) and last as neither exist then do nothing. Last part is not probably needed but it helps to visualize the example. Like this:

Code: [Select]
IfElse(
    Not(IsEmpty([Hybrid,0])),
        / char(40)Hybridchar(41),
    Not(IsEmpty([Catalog #,0])),
        / char(40)[Catalog #]char(41),
    1,
)

The whole thingy would then be:
Code: [Select]
[Album Artist]//trim(replace(replace([Album, 1],[Lossy],),[Incomplete],))/
IfElse(
    Not(IsEmpty([Hybrid,0])),
        / char(40)Hybridchar(41),
    Not(IsEmpty([Catalog #,0])),
        / char(40)[Catalog #]char(41),
    1,
)
Logged

zybex

  • MC Beta Team
  • Citizen of the Universe
  • *****
  • Posts: 2616
Re: Remove Hung Closing Parenthesis From Renamed Folder
« Reply #28 on: March 18, 2023, 04:49:27 am »

That screenshot is really foggy and unreadable :P HDR?

The missing link is, I think: you need to create an [Hybrid] field with the "Relational" type set to "Store one value for each Album Artist (auto)". Then go to hybrid albums and set that field to "1" (or "yes", or anything really). You just need to set the value for a single file of each hybrid value and, because it's a relational field, all tracks of the same album will have that same value.

Then Lepa's expression will work - it checks if the [Hybrid] has a value for any given file, and renames the file accordingly.
Logged

lepa

  • MC Beta Team
  • Citizen of the Universe
  • *****
  • Posts: 2033
Re: Remove Hung Closing Parenthesis From Renamed Folder
« Reply #29 on: March 18, 2023, 05:54:20 am »

Yep, field can be relational also. If it is relational then I guess you need to be sure that you set it to hybrid only after you have set album name for that new hybrid album. If not relational then you need to mark every track individually.

Image looks little bland but still readable to me
Logged

zybex

  • MC Beta Team
  • Citizen of the Universe
  • *****
  • Posts: 2616
Re: Remove Hung Closing Parenthesis From Renamed Folder
« Reply #30 on: March 18, 2023, 06:10:51 am »

This is what I [don't] see.
Logged

lepa

  • MC Beta Team
  • Citizen of the Universe
  • *****
  • Posts: 2033
Re: Remove Hung Closing Parenthesis From Renamed Folder
« Reply #31 on: March 18, 2023, 06:22:36 am »

Strange. looks like this for me (thumbnail so blurry now. dark gray bg). HDR is not active
Logged

zybex

  • MC Beta Team
  • Citizen of the Universe
  • *****
  • Posts: 2616
Re: Remove Hung Closing Parenthesis From Renamed Folder
« Reply #32 on: March 18, 2023, 07:07:12 am »

Your PNG is actually transparent! So with the default lightblue-ish background of this forum, it renders almost blank. So it's probably your screenshot tool doing that?

How come you have the forum in black, I don't see any dark theme... is it a CSS plugin in the browser?
Logged

lepa

  • MC Beta Team
  • Citizen of the Universe
  • *****
  • Posts: 2033
Re: Remove Hung Closing Parenthesis From Renamed Folder
« Reply #33 on: March 18, 2023, 07:31:08 am »

I'm using dark reader firefox plugin to get dark mode where it is not available. Screenshot is taken with win10 internal shift+win+c. Resized/replaced image with irfaview so it probably have some transparency settings on for png then by default i'd guess
Logged

AudibleImagery

  • World Citizen
  • ***
  • Posts: 108
Re: Remove Hung Closing Parenthesis From Renamed Folder
« Reply #34 on: March 19, 2023, 02:33:51 am »

Assuming you have created the Hybrid field: Then you could use e.g. IfElse() to first check that if hybrid exist (display hybrid) and if not then check if there is catalog # (display catalog #) and last as neither exist then do nothing. Last part is not probably needed but it helps to visualize the example.

The missing link is, I think: you need to create an [Hybrid] field with the "Relational" type set to "Store one value for each Album Artist (auto)". Then go to hybrid albums and set that field to "1" (or "yes", or anything really). You just need to set the value for a single file of each hybrid value and, because it's a relational field, all tracks of the same album will have that same value.

Then Lepa's expression will work - it checks if the [Hybrid] has a value for any given file, and renames the file accordingly.

Hi again lepa and zybex,

First of all thank you for taking the time to help me, I really appreciate it.

The solution that you provided took me awhile to setup but once I figured it out it made sense how it is intended to work. Your solution isn't exactly what I'm trying to achieve though. In my library, the tracks in the album "And the Anonymous Nobody" by De La Soul use two different 'catalog numbers'—in this case they're Qobuz (17 of the tracks) and Kickstarter (1 track). Please see the attached photo. And so I want the album folder to display as "And the Anonymous Nobody (Kickstarter/Qobuz)" rather than "And the Anonymous Nobody (Hybrid)". If there are no possible solutions for what I'm trying to do the [Hybrid] solution will work but I'm hoping there are other options.

Logged

lepa

  • MC Beta Team
  • Citizen of the Universe
  • *****
  • Posts: 2033
Re: Remove Hung Closing Parenthesis From Renamed Folder
« Reply #35 on: March 19, 2023, 02:47:16 am »

You could change [hybrid] field editable property from check mark to standard editable. Then you can insert whatever value to that field and display it by changing hard coded Hybrid to field [Hybrid]. So I guess normally you would insert text "Hybrid" or whatever suits you to field [Hybrid] (when album is hybrid type) but in your de la soul you'd set Hybrid field value to be that "Kickstarter/Qobuz"

e.g.


[Album Artist]//trim(replace(replace([Album, 1],[Lossy],),[Incomplete],))/
IfElse(
    Not(IsEmpty([Hybrid,0])),
        / char(40)[Hybrid]char(41),
    Not(IsEmpty([Catalog #,0])),
        / char(40)[Catalog #]char(41),
    1,
)
Logged

AudibleImagery

  • World Citizen
  • ***
  • Posts: 108
Re: Remove Hung Closing Parenthesis From Renamed Folder
« Reply #36 on: March 19, 2023, 12:20:55 pm »

You could change [hybrid] field editable property from check mark to standard editable. Then you can insert whatever value to that field and display it by changing hard coded Hybrid to field [Hybrid]. So I guess normally you would insert text "Hybrid" or whatever suits you to field [Hybrid] (when album is hybrid type) but in your de la soul you'd set Hybrid field value to be that "Kickstarter/Qobuz"

e.g.


[Album Artist]//trim(replace(replace([Album, 1],[Lossy],),[Incomplete],))/
IfElse(
    Not(IsEmpty([Hybrid,0])),
        / char(40)[Hybrid]char(41),
    Not(IsEmpty([Catalog #,0])),
        / char(40)[Catalog #]char(41),
    1,
)

So is it not possible to automatically (using an expression) list all possible [Catalog #] values for a given album with the [Hybrid] field? The reason why I'm asking is because I have 1000s of "hybrid" albums each with varying catalog numbers and I don't want to have to sift through all of them by hand because it will take weeks.
Logged

lepa

  • MC Beta Team
  • Citizen of the Universe
  • *****
  • Posts: 2033
Re: Remove Hung Closing Parenthesis From Renamed Folder
« Reply #37 on: March 19, 2023, 12:48:37 pm »

First thought was that these hybrids are anomalies so they could be filled manually.

There is a way but it is getting more complicated and time consuming e.g. by using variables to fill the values. You can search examples where variables are used to calculate e.g. track count of the album and try to modify those to create rule to fill [hybrid]. Create smartlist or view which fills the values or use zybex's ZStats to calculate them in background.

Logged

zybex

  • MC Beta Team
  • Citizen of the Universe
  • *****
  • Posts: 2616
Re: Remove Hung Closing Parenthesis From Renamed Folder
« Reply #38 on: March 19, 2023, 05:59:11 pm »

In this case [Hybrid] doesn't seem like an adequate name. Perhaps [Album Catalogs]. You can make it a Calculated field with the below expression, but I don't recommend it - since you have thousands of albums it would likely make MC extremely slow.

You can set the value of [Album Catalogs] for all albums in one go with this expression (untested):
FieldQuery(Album Artist (auto),[Album Artist (auto)],Catalog #,1,0)

Or you can use it directly in the Rename expression.

It doesn't seem good to rename the actual files using this though - if you have an album with 10 different Catalog values, then the filename will be veeeery long. But it's your call.
Logged

AudibleImagery

  • World Citizen
  • ***
  • Posts: 108
Re: Remove Hung Closing Parenthesis From Renamed Folder
« Reply #39 on: March 21, 2023, 10:03:23 pm »

In this case [Hybrid] doesn't seem like an adequate name. Perhaps [Album Catalogs]. You can make it a Calculated field with the below expression, but I don't recommend it - since you have thousands of albums it would likely make MC extremely slow.

You can set the value of [Album Catalogs] for all albums in one go with this expression (untested):
FieldQuery(Album Artist (auto),[Album Artist (auto)],Catalog #,1,0)

Or you can use it directly in the Rename expression.

It doesn't seem good to rename the actual files using this though - if you have an album with 10 different Catalog values, then the filename will be veeeery long. But it's your call.

Hey zybex,

Thank you for offering this as a solution. This new Calculated field seems viable because the most catalog numbers I have for a release is like three. How would I incorporate it into my current renaming expression though?:

Code: [Select]
[Album Artist]//trim(trim(replace(replace([Album, 1],[Lossy],),[Incomplete],)) If(IsEmpty([Catalog #,0]),,char(40)[Catalog #]char(41)))
I don't know how I'm supposed to incorporate it. All of my attempts are resulting in an "Expression Error (Syntax Error)" where the [Album Artist] folder is supposed to be represented in the file path:

Logged

zybex

  • MC Beta Team
  • Citizen of the Universe
  • *****
  • Posts: 2616
Re: Remove Hung Closing Parenthesis From Renamed Folder
« Reply #40 on: March 22, 2023, 04:37:50 am »

The syntax error is likely because I didn't test it and forgot to escape the parenthesis of "Album Artist (auto)". It should be like this:

FieldQuery(Album Artist /(auto/),[Album Artist (auto)],Catalog #,1,0)

Then you can use it like so for renaming, after putting that into an [Album Catalog] calculated field:
[Album Artist]//trim(replace(replace(replace([Album] /([Album Catalog]/),[Lossy],),[Incomplete],),/(/),))

Or, as a combined expression, no extra field required:
[Album Artist]//trim(replace(replace(replace([Album] /(FieldQuery(Album Artist /(auto/),[Album Artist (auto)],Catalog #,1,0)/),[Lossy],),[Incomplete],),/(/),))

Try it in Zelda.
Logged

AudibleImagery

  • World Citizen
  • ***
  • Posts: 108
Re: Remove Hung Closing Parenthesis From Renamed Folder
« Reply #41 on: March 23, 2023, 09:24:58 pm »

The syntax error is likely because I didn't test it and forgot to escape the parenthesis of "Album Artist (auto)". It should be like this:

FieldQuery(Album Artist /(auto/),[Album Artist (auto)],Catalog #,1,0)

Then you can use it like so for renaming, after putting that into an [Album Catalog] calculated field:
[Album Artist]//trim(replace(replace(replace([Album] /([Album Catalog]/),[Lossy],),[Incomplete],),/(/),))

Or, as a combined expression, no extra field required:
[Album Artist]//trim(replace(replace(replace([Album] /(FieldQuery(Album Artist /(auto/),[Album Artist (auto)],Catalog #,1,0)/),[Lossy],),[Incomplete],),/(/),))

Try it in Zelda.

Hey Zybex,

Is Zelda available on Mac? I downloaded it in an attempt to try the combined expression in Zelda but I'm on Mac and so I don't think I can install it.

The combined renaming expression is of extreme interest to me but when I paste it as is I still get an "Expression Error (Syntax Error)" where the [Album Artist] folder is supposed to be represented in the file path. Could this have something to do with the JRiver for Mac bug that we previously discovered related to using slashes (/) to escape parentheses in renaming expressions?
Logged

zybex

  • MC Beta Team
  • Citizen of the Universe
  • *****
  • Posts: 2616
Re: Remove Hung Closing Parenthesis From Renamed Folder
« Reply #42 on: March 24, 2023, 04:09:58 am »

No, not available on Mac. The expression is fine, there's no syntax error. It's possible that the forward slashes cause some problem in the Rename&Copy tool in Mac though, it may be a bug. Did you try adding the expression as an Expression column in a Details view? See the screenshot below. If it works as an Expression Column but not on the rename tool, then it's a limitation/bug due to the fwd-slashes, which are also the escape character in an expression. We can try not using the fwd-slash:

Code: [Select]
[Album Artist (auto)]//replace(trim(replace(replace([Album],char(91)Lossychar(93),),char(91)Incompletechar(93),)) char(40)FieldQuery(Album Artist char(40)autochar(41),[Album Artist (auto)],Catalog #,1,0)char(41),char(32)char(40)char(41),)
That's the same as this one, but using no slashes (except the one after [Album Artist (auto)] to create a subfolder):
Code: [Select]
[Album Artist (auto)]//replace(trim(replace(replace([Album],/[Lossy/],),/[Incomplete/],)) /(FieldQuery(Album Artist /(auto/),[Album Artist (auto)],Catalog #,1,0)/),/ /(/),)
You can also try a single slash as the path divider:
Code: [Select]
[Album Artist (auto)]/replace(trim(replace(replace([Album],char(91)Lossychar(93),),char(91)Incompletechar(93),)) char(40)FieldQuery(Album Artist char(40)autochar(41),[Album Artist (auto)],Catalog #,1,0)char(41),char(32)char(40)char(41),)


Logged

zybex

  • MC Beta Team
  • Citizen of the Universe
  • *****
  • Posts: 2616
Re: Remove Hung Closing Parenthesis From Renamed Folder
« Reply #43 on: March 24, 2023, 04:11:59 am »

@Matt - unrelated bug: on the Rename/Move/Copy Files screen above, clicking the Original or New columns to sort does not work. The sort arrow shows up but the order does not change.
Logged

AudibleImagery

  • World Citizen
  • ***
  • Posts: 108
Re: Remove Hung Closing Parenthesis From Renamed Folder
« Reply #44 on: March 27, 2023, 12:21:47 am »

No, not available on Mac. The expression is fine, there's no syntax error. It's possible that the forward slashes cause some problem in the Rename&Copy tool in Mac though, it may be a bug. Did you try adding the expression as an Expression column in a Details view? See the screenshot below. If it works as an Expression Column but not on the rename tool, then it's a limitation/bug due to the fwd-slashes, which are also the escape character in an expression. We can try not using the fwd-slash:

Code: [Select]
[Album Artist (auto)]//replace(trim(replace(replace([Album],char(91)Lossychar(93),),char(91)Incompletechar(93),)) char(40)FieldQuery(Album Artist char(40)autochar(41),[Album Artist (auto)],Catalog #,1,0)char(41),char(32)char(40)char(41),)
That's the same as this one, but using no slashes (except the one after [Album Artist (auto)] to create a subfolder):
Code: [Select]
[Album Artist (auto)]//replace(trim(replace(replace([Album],/[Lossy/],),/[Incomplete/],)) /(FieldQuery(Album Artist /(auto/),[Album Artist (auto)],Catalog #,1,0)/),/ /(/),)
You can also try a single slash as the path divider:
Code: [Select]
[Album Artist (auto)]/replace(trim(replace(replace([Album],char(91)Lossychar(93),),char(91)Incompletechar(93),)) char(40)FieldQuery(Album Artist char(40)autochar(41),[Album Artist (auto)],Catalog #,1,0)char(41),char(32)char(40)char(41),)

The first and third expressions didn't return an expression error per se but they are exhibiting some weird behaviors in the Renaming tool. It's returning every catalog number used by an album artist and so this is what the 'Various' album artist value looks like even though there is no catalog number for this release:


and here's a single Hawkwind release with a catalog number but it lists every catalog number for any Hawkwind release in my library:
Logged

zybex

  • MC Beta Team
  • Citizen of the Universe
  • *****
  • Posts: 2616
Re: Remove Hung Closing Parenthesis From Renamed Folder
« Reply #45 on: March 27, 2023, 02:45:48 am »

Doh! that's because I don't use MC for audio and am only testing on a small test library with 5 or 6 albums.

The fieldQuery() requires a field that is unique for each album. [Album Artist (auto)] is obviously gonna be the same for many albums, so you get what you're seeing. Let's use [Artist - Album (Year)] instead, which should uniquely identify each album:

Code: [Select]
[Album Artist (auto)]//replace(trim(replace(replace([Album],char(91)Lossychar(93),),char(91)Incompletechar(93),)) char(40)FieldQuery(Artist - Album char(40)yearchar(41),[Artist - Album (year)],Catalog #,1,0)char(41),char(32)char(40)char(41),)
Without those char() functions, that's the same as:
Code: [Select]
[Album Artist (auto)]//replace(trim(replace(replace([Album],[Lossy],),[Incomplete],)) /(FieldQuery(Artist - Album /(year/),[Artist - Album (year)],Catalog #,1,0)/),/ /(/),)
Logged

AudibleImagery

  • World Citizen
  • ***
  • Posts: 108
Re: Remove Hung Closing Parenthesis From Renamed Folder
« Reply #46 on: March 28, 2023, 06:20:33 pm »

Doh! that's because I don't use MC for audio and am only testing on a small test library with 5 or 6 albums.

The fieldQuery() requires a field that is unique for each album. [Album Artist (auto)] is obviously gonna be the same for many albums, so you get what you're seeing. Let's use [Artist - Album (Year)] instead, which should uniquely identify each album:

Code: [Select]
[Album Artist (auto)]//replace(trim(replace(replace([Album],char(91)Lossychar(93),),char(91)Incompletechar(93),)) char(40)FieldQuery(Artist - Album char(40)yearchar(41),[Artist - Album (year)],Catalog #,1,0)char(41),char(32)char(40)char(41),)
Without those char() functions, that's the same as:
Code: [Select]
[Album Artist (auto)]//replace(trim(replace(replace([Album],[Lossy],),[Incomplete],)) /(FieldQuery(Artist - Album /(year/),[Artist - Album (year)],Catalog #,1,0)/),/ /(/),)

Thank you for your persistence, I feel like we're so close (yet so far) and you've been so patient which I really appreciate.

This new expression is writing catalog numbers to the folder name when there are two or more but deleting the catalog number from the folder name if there's only one catalog number for a given album.

It might also be worth mentioning that I'm still using this custom field to sort my album column:
Logged

zybex

  • MC Beta Team
  • Citizen of the Universe
  • *****
  • Posts: 2616
Re: Remove Hung Closing Parenthesis From Renamed Folder
« Reply #47 on: March 28, 2023, 06:30:01 pm »

Do all files in that album have the same exact value for [artist - album (year)] ?
The expression needs something in common to determine which files being to a given album. You can use just the album name instead, but that will also have problems if you have repeated album names.
Logged

AudibleImagery

  • World Citizen
  • ***
  • Posts: 108
Re: Remove Hung Closing Parenthesis From Renamed Folder
« Reply #48 on: March 28, 2023, 06:41:18 pm »

Do all files in that album have the same exact value for [artist - album (year)] ?

Yeah they have the same exact value for [artist - album (year)].
Logged

JimH

  • Administrator
  • Citizen of the Universe
  • *****
  • Posts: 72438
  • Where did I put my teeth?
Re: Remove Hung Closing Parenthesis From Renamed Folder
« Reply #49 on: March 28, 2023, 06:53:31 pm »

Look for trailing spaces.  Edit the entire group.
Logged
Pages: [1] 2   Go Up