INTERACT FORUM

Please login or register.

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

Author Topic: I am not getting somthing with this expression I would appreciate a little help.  (Read 737 times)

666JTK666

  • Junior Woodchuck
  • **
  • Posts: 75

A little context I am working on an expression for directory structure for my files.

ifElse([media sub type]=Audiobook , true [ab author]\[Genre]\ , !isempty([ab series]) , not empty\ , isempty([ab series]), empty\)

I am useing zelda to test out the expression and my output looks like this.
true Actus\LitRPG\

the is empty stuff seems to be just ignored.
ty vmuch in advance!! any suggestions appreciated!!
Logged

lepa

  • MC Beta Team
  • Citizen of the Universe
  • *****
  • Posts: 2033

It would help if you could tell what you are trying to achieve. Without context it is a little hard to guess from that example.

Are you trying to determine that if file is audiobook then use " [ab author]\[Genre]\" and if [ab series] is empty for it then append "empty\" to it and otherwise append "not empty"?

that would be something like this:
Code: [Select]
If(IsEqual([media sub type],Audiobook),
    [ab author]\[Genre]\/
    If(IsEmpty([ab series,0]),
        empty\,
        not empty\
    ),
)
Logged

666JTK666

  • Junior Woodchuck
  • **
  • Posts: 75

ok so first thing, does this not work as i think it does ?  this little code snipit should test to see if [media sub type] contains "audiobook"
ifelse([media sub type]=audiobook
this is supposed to the the first test of the ifelse statement i have a sinking feeling that this is wrong.
ifelse is supposed to test1,action1,test2,action2 ect allegedly be cleaner/easier than a bunch of nested if statements.
ok so I need to use isequal instead of this [media sub type]=audiobook.
sorry for the confusion i just really suck at this . I will fiddle around some more and I will post my new code if i can get this at least sort of working.

Logged

666JTK666

  • Junior Woodchuck
  • **
  • Posts: 75

so trying to get the basic function and syntax down for the ifelse statement.

ifElse(IsEqual([media sub type],Audiobook, 1),action1)

in zelda the above statement outputs nothing at all. I am useing zelda because I dont want to take the chance of screwing up my library worse than it is right now.
does anyone see somthing wrong with the above code snipit?

EDIT this seems to be working now I had to refresh the playlist in zelda when i did "action1" showed as the output.
Logged

666JTK666

  • Junior Woodchuck
  • **
  • Posts: 75

ok now lets try more than one test action pair.

ifElse( IsEqual([media sub type],Audiobook, 1), action1 ,!IsEmpty([ab series]),action2)

my output in zelda is "action1" and nothing else. i hit the reload playlist button that worked last time but no change.
i know for a fact that [ab series] is populated so action2 should show on my output.

(action1 and action2 are just place holders for testing.)

Logged

lepa

  • MC Beta Team
  • Citizen of the Universe
  • *****
  • Posts: 2033

if the file is audiobook then action1 is always selected as it is the first matching statement. IfElse exits after first match. To get action2 printed the file must be something else than audiobook AND have value in the [ab series].
Logged

666JTK666

  • Junior Woodchuck
  • **
  • Posts: 75

if the file is audiobook then action1 is always selected as it is the first matching statement. IfElse exits after first match. To get action2 printed the file must be something else than audiobook AND have value in the [ab series].

Well if you are correct then I need to go back to nested if statements. gonna have to rethink what i need to do.
Logged

lepa

  • MC Beta Team
  • Citizen of the Universe
  • *****
  • Posts: 2033

I am. Choosing correct or suitable function(s) really depends on what you are trying to do. You can also of course combine IfElse() and iIf()

Code: [Select]
IfElse(
    IsEqual([media type],Audio),
        Music\If(IsEmpty([album]),non-album,[album]),
    Compare([Rating],>,3),
        4-5 star rating,
    IsEqual([media sub type],TV Show),
        tv show,
    IsEqual([media sub type],Podcast),
        podcast
    IsEmpty([genre,0]),
        genre empty,
    1,
        anything else
)
Logged

blgentry

  • Regular Member
  • Citizen of the Universe
  • *****
  • Posts: 8014

Reading your original post, it looks like you are going to Rename files using this expression for the directory path.

It might be smart to just develop an expression only for Audio Books and not use any if logic to determine that.  Instead, you would just select all files with the Audiobook media subtype, then use RM&C and paste in your expression.  Selecting files of a particular media subtype is very easy.  In a Panes view, just make a pane with Media Subtype.  Then click on Audiobook in that Pane.  That should select every file in your library that has that type.

I am suggesting this to try to make your expression easier to write and easier to understand.  Please proceed however you would like.

Best of luck.
Brian.
Logged

666JTK666

  • Junior Woodchuck
  • **
  • Posts: 75

It's taken me a few days with my small smooth brain but here is where i am right now.

if( IsEqual([media sub type],Audiobook, 1), \AudioBooks\[ab author]\[genre]\if(IsEmpty([ab series]),[AB NSFT]\,[ab series]\[AB NSFT]\),)

and i still have to work on the fail condition for "music" subtypes.
I am just finding it really difficult to keep track of what is happening and why in this "," delimited horror show. But not giving up , just slowly grinding away at it.
Logged
Pages: [1]   Go Up