INTERACT FORUM

Please login or register.

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

Author Topic: Expression help please.  (Read 2382 times)

666JackTheKnife666

  • World Citizen
  • ***
  • Posts: 150
Expression help please.
« on: September 01, 2009, 03:07:08 am »

I thought that I had a handle on the if(IsEmpty) statement but I am missing something.

If(IsEmpty([AUTHOR][BOOKTITLE]),,\[Media Sub Type]\[genre]\[AUTHOR] If(IsEmpty([SERIESTITLE]),\[BOOKTITLE],\[SERIESTITLE]\[SERIESTITLE] Book [SERIESVOLUME] [BOOKTITLE]))

from what I understand this
If(IsEmpty([AUTHOR][BOOKTITLE]),,
check's to see if the author and booktitle fields are empty if they are it does nothing and if there is data in both fields then it start's processing the rest of the statement.
unfortunatly it doesnt seem to do that for me.  can somone take a look at my statement and see what I have screwed up. thank you!!
Logged

marko

  • MC Beta Team
  • Citizen of the Universe
  • *****
  • Posts: 9139
Re: Expression help please.
« Reply #1 on: September 01, 2009, 03:52:44 am »

Each case needs to be tested in turn, so, first ask if author is empty, and if yes, then ask if booktitle is empty, etc. etc.
I don't think the expression below is quite what you're after, but, providing it works, (I typed it off the top of my head without testing), it should give the possibility to move forwards:
We've asked the first two isempty questions, if they are both positive, we do nothing.
If Booktitle is empty, but Author is not empty, we do "\[Media Sub Type]\[genre]\[AUTHOR]" <--- this part may need some work as I don't think it's what you really want.
If Booktitle is not empty, it should jump to ask if SERIESTITLE is empty, and if yes, do "\[BOOKTITLE]"
and if SERIESTITLE is not empty, do "\[SERIESTITLE]\[SERIESTITLE] Book [SERIESVOLUME] [BOOKTITLE]"

if(isempty([booktitle]),if(isempty([author]),,\[Media Sub Type]\[genre]\[AUTHOR]),If(IsEmpty([SERIESTITLE]),\[BOOKTITLE],\[SERIESTITLE]\[SERIESTITLE] Book [SERIESVOLUME] [BOOKTITLE]))

Shout if you need anything else,
regards,
-marko.

666JackTheKnife666

  • World Citizen
  • ***
  • Posts: 150
Re: Expression help please.
« Reply #2 on: September 01, 2009, 05:25:50 am »

Ok here is my revised expression,

if(IsEmpty([BOOKTITLE]),,if(IsEmpty([AUTHOR]),,\[Media Sub Type]\[genre]\[AUTHOR])If(IsEmpty([SERIESTITLE,1]),\[BOOKTITLE],\[SERIESTITLE]\[SERIESTITLE] Book [SERIESVOLUME] [BOOKTITLE]))


I want nothing done if either BOOKTITLE or AUTHOR fields are empty so I added an extra comma.
I added a parenthesis and that seemed to be all it needed to Kinda work.
What's happening on files that don't pass the test is my path is set to \0 this makes sense cause most function's output is a 1 or 0.
What I would like it to do is to do nothing at all just bypass the file.
Maby I just need to isolate the if statements is this legal if(IsEmpty([BOOKTITLE],,)
Logged

marko

  • MC Beta Team
  • Citizen of the Universe
  • *****
  • Posts: 9139
Re: Expression help please.
« Reply #3 on: September 01, 2009, 01:03:28 pm »

If you move one of the closing parenthesis from the end, and place it after the 'Author' rule to close that off, does it take care of the '1 or 0' problem?

if(IsEmpty([BOOKTITLE]),,if(IsEmpty([AUTHOR]),,\[Media Sub Type]\[genre]\[AUTHOR]))If(IsEmpty([SERIESTITLE,1]),\[BOOKTITLE],\[SERIESTITLE]\[SERIESTITLE] Book [SERIESVOLUME] [BOOKTITLE])

-marko.

666JackTheKnife666

  • World Citizen
  • ***
  • Posts: 150
Re: Expression help please.
« Reply #4 on: September 02, 2009, 09:03:07 pm »

I am sorry I haven't got back to this sooner but the last 2 day's have been hectic.

I think I can simplify the problem with this question.
How do you make an expression abort processing the current file and go to the next file.
It would be great if there was a function just for that purpose.  Somthing like (Abort,x) x=0 stop all processing, x=2 stop processing current file and go to next, etc

the closest I have to somthing that functions correctly I get \0\0\0\0\unknown authorunknownbooktitleunknownseriestitle.mp3
Logged

marko

  • MC Beta Team
  • Citizen of the Universe
  • *****
  • Posts: 9139
Re: Expression help please.
« Reply #5 on: September 03, 2009, 02:22:49 am »

You're creating a directory path for the "rename, move and copy" tool right?

I do apologise for being so incredibly slow on the uptake!!

IsEmpty() is no good when applied this way, as by the time the expression evaluator gets a look at the data, the file renamer has already replaced the empty fields with "Unknown [Field Name]" in order to prevent illegal windows file paths from being created, sooo...

When using expressions for file renaming purposes, instead of asking "IsEmpty", we need to ask if the field contains "unknown"

be right back...
-marko.

666JackTheKnife666

  • World Citizen
  • ***
  • Posts: 150
Re: Expression help please.
« Reply #6 on: September 03, 2009, 04:37:15 am »

yes I am useing the "rename,move and copy" tool.  useing that tool seems like the best way to test expressions before I put them into an auto import rule.
So from what you were saying  about the file renamer I need to use  somthing like if(isequal([AUTHOR],Unknown AUTHOR,do nothing,do something))
Logged

marko

  • MC Beta Team
  • Citizen of the Universe
  • *****
  • Posts: 9139
Re: Expression help please.
« Reply #7 on: September 03, 2009, 04:57:58 am »

Yup. Try this for size:

if(isequal([BOOKTITLE],Unknown Booktitle,1),if(isequal([AUTHOR],Unknown Author,1),replace(removeleft([filename (path)],3),_,/\),\[Media Sub Type]\[genre]\[AUTHOR]),if(isequal([SERIESTITLE],Unknown Seriestitle,1),\[BOOKTITLE],\[SERIESTITLE]\[SERIESTITLE] Book [SERIESVOLUME] [BOOKTITLE]))

if both BOOKTITLE and AUTHOR are empty, MC should leave the files where they are, providing they are on the same drive as specified in the "base path" field. If you have specified a directory in the Base Path field, "X:\Directory" as opposed to "X:", the bold, red, '3' tells MC how many characters to remove from the start of the [filename (path)] field.

if BOOKTITLE is not empty, then jump directly to the SERIESTITLE questions

if BOOKTITLE is empty, but AUTHOR is not, then do the [media subtype] thing.

Note that [AUTHOR] is only queried if BOOKTITLE is empty, if you want to cover situations where [BOOKTITLE] and [AUTHOR] are both populated, you will need to add that as a new branch to the expression.

-marko.

666JackTheKnife666

  • World Citizen
  • ***
  • Posts: 150
Re: Expression help please.
« Reply #8 on: September 03, 2009, 05:49:28 pm »

OK a little background on my situation.

I currently have 1tb of mixed up badly tagged music and audio books  on drive \\BIGBITBUCKET\volume_1\steve's stuff\mm library\
for a long time I tried to clean up my audio files using  another program(<-hereafter referred to as MM)  sometimes it would work good other times when I tried to do more complicated things I ended up screwing up the album's and audiobooks into a hopelessly garbled mess. I stopped using MM completely and I searched for another media manager. I found Media Center and I rejoiced !! unlimited custom fields , intelligent tag processing, fantastic view customizing etc

I purchased another 1tb drive and setup my MC library at \\BIGBITBUCKET\volume_2\MC14 Media Library\
slowly and carefully I have been attempting to clean up my old library using the rename,move & copy tool.
Attempting to learn from my past mistakes with MM, I am trying to craft rules that will leave files that have incomplete tag information alone and those that have all the correct tag information be processed and moved to my new library.
I suppose I should ask this basic question is the rename,move & copy tool. the right way I should go about this process ?
So Ideally I need to figure out a way to make sure that the tag's of the file to be processed have data in them.  It get's more tricky because some books are standalone and some are part of a series.

Begin quote
if both BOOKTITLE and AUTHOR are empty, MC should leave the files where they are, providing they are on the same drive as specified in the "base path" field. If you have specified a directory in the Base Path field, "X:\Directory" as opposed to "X:", the bold, red, '3' tells MC how many characters to remove from the start of the [filename (path)] field.

if(isequal([BOOKTITLE],Unknown Booktitle,1),if(isequal([AUTHOR],Unknown Author,1),replace(removeleft([filename (path)],3),_,/\),\[Media Sub Type]\[genre]\[AUTHOR]),if(isequal([SERIESTITLE],Unknown Seriestitle,1),\[BOOKTITLE],\[SERIESTITLE]\[SERIESTITLE] Book [SERIESVOLUME] [BOOKTITLE]))

End quote

I don't think that this statement will work because of having media collections on 2 different drives.


I wonder if I could use the tag function in my if statements  I am going to play around with that for a bit and see what happens.

Marco I am deeply appreciative of your help and I hope this additional background on my situation will be helpful to your thinking about how to help me with my problem.
Logged

marko

  • MC Beta Team
  • Citizen of the Universe
  • *****
  • Posts: 9139
Re: Expression help please.
« Reply #9 on: September 05, 2009, 01:44:37 am »

Quote
Marco I am deeply appreciative of your help and I hope this additional background on my situation will be helpful to your thinking about how to help me with my problem.
You're welcome, and taking these new details into consideration, here are my new thoughts...

I don't think using the Tag() function will help you here. It's usage can be very slow (it has to parse the tags of every file as it goes), and can be a bit hit and miss as each tag must be referenced exactly as it appears in the file.

We could probably come up with an expression for the base path field that would force the base path based on specific tag contents (or lack of), but, having given this a little thought, I honestly think your best course of action to begin with is to create a view scheme to work in first. Here's why:

  • MC doesn't care where your files are, it will play them just the same, so it won't hurt to leave them where they are for now.
  • The rename, move & copy tool works from library fields, or expressions based around them, and is very powerful indeed, but it is counter productive to try using it on files that are not tagged correctly.


So first, get your tags in order, then set about using the rename tool to move the files to their final resting place.

Things to think about:
  • How are your files named? If you have library data contained in the filename, be it the folder path and/or the actual file name, you can use the "Fill properties from filename" tool to have that data imported into your library
  • You could create one or more view schemes geared specifically towards getting your tags in order.


I posted a walk-through for adding/customising views earlier this year, if there's anything you're unsure about, have a look at this, and if that still doesn't help, just ask.

  • The keys to your new views will be selecting the columns and panes that you need to work with. Use the "Set rules for file display" option to limit the view so that, for example, it only lists files that are stored at \\BIGBITBUCKET\volume_1\steve's stuff\mm library\. You could create a, or use an unused, field, and set that to "Done" for all files you've finished with, and set your view scheme to exclude all files that are "Done". When the list is empty, your job is finished and you could delete your view scheme and working library field.
  • You could have a smartlist that lists all files that are "Done" and periodically run the rename tool on those files to move them as you see fit.
  • When it comes to moving files around, there are other avenues open to you that you might consider, especially if you're happy with the filenames, such the "find and replace" option, or simple drag and drop using MC's own internal "My Computer" tree. When done internally, MC moves the files and keeps the library updated all in one go.


-marko

666JackTheKnife666

  • World Citizen
  • ***
  • Posts: 150
Re: Expression help please.
« Reply #10 on: September 08, 2009, 12:25:11 am »

You're welcome, and taking these new details into consideration, here are my new thoughts...


Things to think about:
  • How are your files named? If you have library data contained in the filename, be it the folder path and/or the actual file name, you can use the "Fill properties from filename" tool to have that data imported into your library
  • You could create one or more view schemes geared specifically towards getting your tags in order.


I posted a walk-through for adding/customising views earlier this year, if there's anything you're unsure about, have a look at this, and if that still doesn't help, just ask.

  • The keys to your new views will be selecting the columns and panes that you need to work with. Use the "Set rules for file display" option to limit the view so that, for example, it only lists files that are stored at \\BIGBITBUCKET\volume_1\steve's stuff\mm library\. You could create a, or use an unused, field, and set that to "Done" for all files you've finished with, and set your view scheme to exclude all files that are "Done". When the list is empty, your job is finished and you could delete your view scheme and working library field.
  • You could have a smartlist that lists all files that are "Done" and periodically run the rename tool on those files to move them as you see fit.
  • When it comes to moving files around, there are other avenues open to you that you might consider, especially if you're happy with the filenames, such the "find and replace" option, or simple drag and drop using MC's own internal "My Computer" tree. When done internally, MC moves the files and keeps the library updated all in one go.


-marko


I am going to heed your advice and get my tag's sorted out be for doing complicated expression, then I wont have to have all the paranoid checking in the expressions.

I do have another question for you tho if your not tired of helping out this newb..  :-\

in the file name section of the copy rename move tool can I add an expression to copy the actual filename to the name tag ? how would I do it. I have printed out all the expression stuff from the wiki and so far I am just not seeing the combination that would work. Thank you again for all the time and effort you have put into helping me!!
Logged

marko

  • MC Beta Team
  • Citizen of the Universe
  • *****
  • Posts: 9139
Re: Expression help please.
« Reply #11 on: September 08, 2009, 01:12:03 am »

I do have another question for you tho if your not tired of helping out this newb..  :-\
You keep firing away, it's not a problem.
in the file name section of the copy rename move tool can I add an expression to copy the actual filename to the name tag ? how would I do it. I have printed out all the expression stuff from the wiki and so far I am just not seeing the combination that would work. Thank you again for all the time and effort you have put into helping me!!
For this task, the good people at JRiver have provided us with the "Fill properties from filename" tool.
It's another really useful weapon to use against unruly tags, and is very easy to use.
To have the filename copied to the [name] tag, select a file(s), right click, library tools, fill properties from filename.
Uncheck "Directories"
Check "Filename" and in the field for filename, enter, [Name]
Press OK and the job is done. This will work just as well with several thousand files selected as it will with one, just be sure about your selection ;)
If you get something undesirable, press Ctrl+z to undo the last tagging operation.

Placing the actual filename into the [name] tag is as simple as it gets, so to give you a quick example of something a little more complex, take a file named something like:

Bob Dylan - Retail - Saved (not too good) [1980].06~Pressing On.flac

and fill the filename section of the fill from properties tool like so:

[artist] - [] - [Album] ([]) [[date]].[track #]~[name]

You should be able to see how you can get MC to pick the desired data out of the filename and add it to selected library tags. Note how MC has been told to just ignore "Retail" and "Not too good".

As files from the same album typically follow the same naming convention, they can, more often than not, all be selected together and passed through the tool at once.

Have fun,
regards,
-marko.
Pages: [1]   Go Up