INTERACT FORUM

Please login or register.

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

Author Topic: Re: Bug: Smartlist Media Type = Playlist doesn't work  (Read 4803 times)

chrisjj

  • Citizen of the Universe
  • *****
  • Posts: 750
Re: Bug: Smartlist Media Type = Playlist doesn't work
« on: February 03, 2013, 06:43:00 am »

(Discussion of http://yabb.jriver.com/interact/index.php?topic=77862.msg528969#msg528969 )

1 Create a playlist
2 Create a Smartlist having a rule Media Type is Playlist (manually, or Import [Media Type]=[Playlist])
3 In the tree, click the Smartlist and inspect the filelist

Expected: the playlist
Observed: no playlist

I can find no circumstances in which Media Type is Playlist succeeds in matching playlists.

Smartlists search files in the library.  Playlists in the tree aren't files in the library.

Thanks Matt - so is there some other location for playlists on which Media Type is Playlist does work?
Logged

chrisjj

  • Citizen of the Universe
  • *****
  • Posts: 750
Re: Bug: Smartlist Media Type = Playlist doesn't work
« Reply #1 on: February 12, 2013, 10:54:03 am »

Thanks Matt - so is there some other location for playlists on which Media Type is Playlist does work?

Please?
Logged

JimH

  • Administrator
  • Citizen of the Universe
  • *****
  • Posts: 72538
  • Where did I put my teeth?
Re: Re: Bug: Smartlist Media Type = Playlist doesn't work
« Reply #2 on: February 12, 2013, 11:00:21 am »

I'm sorry, Chris, but we don't have time to pursue all the little problems you have.
Logged

chrisjj

  • Citizen of the Universe
  • *****
  • Posts: 750
Re: Re: Bug: Smartlist Media Type = Playlist doesn't work
« Reply #3 on: February 12, 2013, 11:01:58 am »

I'm sorry, Chris, but we don't have time to pursue all the little problems you have.

I'm OK with that, Jim. Does anyone else have the answer to this? If anyone has found a playlist location for which [Media Type]=[Playlist] does work, I'd be grateful to hear.
Logged

chrisjj

  • Citizen of the Universe
  • *****
  • Posts: 750
Re: Bug: Smartlist Media Type = Playlist doesn't work
« Reply #4 on: March 21, 2013, 09:35:15 pm »

Quote from: Matt
Playlists in the tree aren't files in the library.

FTR, I see MC IDs the following playlists in the tree as files in the library:



and this is an example of:

Quote from: chrisjj
a playlist location for which [Media Type]=[Playlist] does work

.

FTR, that "Removed playlists" is a smartlist having rules data [Media Type]=[Playlist] ~d=r .


Logged

Matt

  • Administrator
  • Citizen of the Universe
  • *****
  • Posts: 42441
  • Shoes gone again!
Re: Bug: Smartlist Media Type = Playlist doesn't work
« Reply #5 on: March 22, 2013, 11:37:58 am »

Your screenshot shows file records.  When auto-import sees a playlist, it creates a file record with media type of playlist.  It can use this to detect changes to external playlists.
Logged
Matt Ashland, JRiver Media Center

chrisjj

  • Citizen of the Universe
  • *****
  • Posts: 750
Re: Bug: Smartlist Media Type = Playlist doesn't work
« Reply #6 on: March 22, 2013, 08:45:21 pm »

Your screenshot shows file records.  When auto-import sees a playlist, it creates a file record with media type of playlist.  It can use this to detect changes to external playlists.

Thanks for the explanation. I find manual import does this too. These records seem to be stored in a secret database that is included in smartlist rule ~d=a but not in ~d=bcdefghijklmnopqrstuvwxyz .

I find this form of playlist (and playlist group) works perfectly with smartlists e.g. to filter my historical DJ setlists by playlist name, playlist rating.

It would be Soooo good if regular playlists did the same!

To other users wanting to try out these file record playlists, here's a starter recipe:

1 Create a new library
2 Import some playlists
3 Create a smartlist, name playlists, rule [Media Type]=[Playlist] -[=FileDBLocation(1)]=4352 ~d=a - see all your playlists appear in the file list
4 Create a second smartlist, name five-starred thus
5 Select playlists and set one playlist to five stars
6 Select five-starred - see it now presents just the five-starred playlist. Ace!

Note: To play a file record playlist, right-click and click Play. Double-click plays the whole list of lists!
Note: -[=FileDBLocation(1)]=4352 is MrC magic to exclude removed playlists
Snags:
* I've found no way to edit these playlists in MC.
Logged

MrC

  • Citizen of the Universe
  • *****
  • Posts: 10462
  • Your life is short. Give me your money.
Re: Bug: Smartlist Media Type = Playlist doesn't work
« Reply #7 on: March 22, 2013, 09:37:25 pm »

Add the Custom Search rule:

   -[=FileDBLocation(1)]=4352

to your Playlists to exclude those that are deleted.
Logged
The opinions I express represent my own folly.

chrisjj

  • Citizen of the Universe
  • *****
  • Posts: 750
Re: Bug: Smartlist Media Type = Playlist doesn't work
« Reply #8 on: March 22, 2013, 09:51:06 pm »

Add the Custom Search rule:

   -[=FileDBLocation(1)]=4352

to your Playlists to exclude those that are deleted.
Works great - thanks. In what spellbook did you find that?
Logged

MrC

  • Citizen of the Universe
  • *****
  • Posts: 10462
  • Your life is short. Give me your money.
Re: Bug: Smartlist Media Type = Playlist doesn't work
« Reply #9 on: March 22, 2013, 10:32:54 pm »

Glynor calls me Batman in this aspect.

Look at an expression pane with DBFileLocation() without a value, and a view that has ~d=a.  And add it as a file list column.

I have a nice Databases view to figure out how stuff works.  Before Matt added the database names to the function above, I created a view that examined the bits in the database flags.

An panes expression column:

Code: [Select]
save(formatnumber(FileDBLocation(1)),val)/
listbuild(1, ;/ ,
  ifelse(math(d=load(val) // pow(2,0); (d - (d % 1)) % 2), Main),
  ifelse(math(d=load(val) // pow(2,1); (d - (d % 1)) % 2), Playing Now),
  ifelse(math(d=load(val) // pow(2,2); (d - (d % 1)) % 2), CD),
  ifelse(math(d=load(val) // pow(2,3); (d - (d % 1)) % 2), Explorer),
  ifelse(math(d=load(val) // pow(2,4); (d - (d % 1)) % 2), Other16),
  ifelse(math(d=load(val) // pow(2,5); (d - (d % 1)) % 2), Other6),
  ifelse(math(d=load(val) // pow(2,7); (d - (d % 1)) % 2), Grouping),
  ifelse(math(d=load(val) // pow(2,8); (d - (d % 1)) % 2), Removed),
  ifelse(math(d=load(val) // pow(2,9); (d - (d % 1)) % 2), Bit 10),
  ifelse(math(d=load(val) // pow(2,10); (d - (d % 1)) % 2), Podcast),
  ifelse(math(d=load(val) // pow(2,11); (d - (d % 1)) % 2), Bit 12),
  ifelse(math(d=load(val) // pow(2,12); (d - (d % 1)) % 2), Other4096),
  ifelse(math(d=load(val) // pow(2,13); (d - (d % 1)) % 2), Bit 14),
  ifelse(math(d=load(val) // pow(2,14); (d - (d % 1)) % 2), Stacks),
  ifelse(math(d=load(val) // pow(2,15); (d - (d % 1)) % 2), Bit 16),
  ifelse(math(d=load(val) // pow(2,16); (d - (d % 1)) % 2), Bit 17),
  ifelse(math(d=load(val) // pow(2,17); (d - (d % 1)) % 2), Bit 18),
  ifelse(math(d=load(val) // pow(2,18); (d - (d % 1)) % 2), Category Images),
  ifelse(math(d=load(val) // pow(2,19); (d - (d % 1)) % 2), Bad),
  ifelse(math(d=load(val) // pow(2,20); (d - (d % 1)) % 2), Bit 21),
  ifelse(math(d=load(val) // pow(2,21); (d - (d % 1)) % 2), Bit 22),
  ifelse(math(d=load(val) // pow(2,22); (d - (d % 1)) % 2), Bit 23),
  ifelse(math(d=load(val) // pow(2,23); (d - (d % 1)) % 2), Bit 24),
  ifelse(math(d=load(val) // pow(2,24); (d - (d % 1)) % 2), Bit 25),
  ifelse(math(d=load(val) // pow(2,25); (d - (d % 1)) % 2), Bit 26),
  ifelse(math(d=load(val) // pow(2,26); (d - (d % 1)) % 2), Bit 27),
  ifelse(math(d=load(val) // pow(2,27); (d - (d % 1)) % 2), Bit 28),
  ifelse(math(d=load(val) // pow(2,28); (d - (d % 1)) % 2), Bit 29),
  ifelse(math(d=load(val) // pow(2,29); (d - (d % 1)) % 2), Bit 30),
  ifelse(math(d=load(val) // pow(2,30); (d - (d % 1)) % 2), Bit 31),
  ifelse(math(d=load(val) // pow(2,31); (d - (d % 1)) % 2), Bit 32),
)&datatype=[list]
Logged
The opinions I express represent my own folly.

chrisjj

  • Citizen of the Universe
  • *****
  • Posts: 750
Re: Bug: Smartlist Media Type = Playlist doesn't work
« Reply #10 on: March 23, 2013, 04:45:05 pm »

Glynor calls me Batman in this aspect.

OK, then I guess that spellbook is exclusively for the use of superheroes ;)

... I created a view that examined the bits in the database flags.

OK, I see there that Other (4096) is the secret (unaddressable by ~d=) DB to which I referred. And that your expression to exclude those that are removed -[=FileDBLocation(1)]=4352 excludes only items that are in DB bit 8, mask 256, name Removed and DB bit 12, mask 4096, name Other (4096), and no other DB.  

I'm interested to know why you have Other (4096) in the DB spec of the removed. Is DB Removed not enough?

Look at an expression pane with DBFileLocation() without a value, and a view that has ~d=a

Thanks. In case it helps others, the interpretation that worked for me is:

1 Click menu bar View, Add View >, Add Library View... .
2 In the unnamed first control, select Empty View, and in Location, select (Root) .
3 Click Set rules for file display..., click Import / Export, in Smartlist rules data: enter ~d=a, click OK, click OK  .
4 Click Add..., ( ) Expression, and in Expression: enter FileDBLocation(), click OK, click OK.

I get this:



which I take to be a list of the database groups in use.

Interesting. It shows that the playlists found by my smartlist playlists below are all in the DB Other (4096), and no other. I guess the purpose of DB Other (4096) is to hold file records.

I have added FileDBLocation(...) to the wiki, based on MrC's info here. If anyone can verify the DB names containing (...), or provide a way for me to, please do. Thanks.
Logged

MrC

  • Citizen of the Universe
  • *****
  • Posts: 10462
  • Your life is short. Give me your money.
Re: Bug: Smartlist Media Type = Playlist doesn't work
« Reply #11 on: March 23, 2013, 07:17:15 pm »

I'm interested to know why you have Other (4096) in the DB spec of the removed. Is DB Removed not enough?

It would be, but it is much more difficult to obtain that value.  It requires using Math() like in the expression above to test the bit.

Thanks for adding the wiki entry.  I now recall forgetting to do this ages ago.  I'm made some minor changes to the wiki entry to generalize the parameter, and fix a math problem (Main + Other is 4096, not 4097, as bit 0 is 0 and bit 12 is 4096).  I also removed the note about Other (4096) because I don't think it was correct.  I think it is related to Playing Now playback in other zones or clients.  I'd figured this out once...
Logged
The opinions I express represent my own folly.

chrisjj

  • Citizen of the Universe
  • *****
  • Posts: 750
Re: Bug: Smartlist Media Type = Playlist doesn't work
« Reply #12 on: March 23, 2013, 07:39:54 pm »

It would be, but it is much more difficult to obtain that value.  It requires using Math() like in the expression above to test the bit.

Ah, I get it. Thanks.

Thanks for adding the wiki entry.  I now recall forgetting to do this ages ago.

You're welcome. Just call me Alfred :)

I'm made some minor changes to the wiki entry to generalize the parameter, and fix a math problem (Main + Other is 4096, not 4097, as bit 0 is 0 and bit 12 is 4096).

Thanks for the correction.

Note: I think your change to "semicolon-separated list of formatted database names" is inaccurate - the separator is indeed '; ' as originally stated.

I also removed the note about Other (4096) because I don't think it was correct.  I think it is related to Playing Now playback in other zones or clients.  I'd figured this out once...

Seems it changed since. Because on MC18, here on a fresh library, simply importing (not playing) playlists (and tracks) puts them all in DB Other (4096).

Logged

MrC

  • Citizen of the Universe
  • *****
  • Posts: 10462
  • Your life is short. Give me your money.
Re: Bug: Smartlist Media Type = Playlist doesn't work
« Reply #13 on: March 23, 2013, 07:49:17 pm »

It might be Recently Imported then.  I don't recall.  Anyway, until we discover (or learn) exactly what it is, probably best to not comment.

Whitespace after a semicolon in list presentations is just pretty-printing.  This is just a formatting thing.  MC also ignores these on input.
Logged
The opinions I express represent my own folly.

chrisjj

  • Citizen of the Universe
  • *****
  • Posts: 750
Re: Bug: Smartlist Media Type = Playlist doesn't work
« Reply #14 on: March 23, 2013, 08:32:54 pm »

It might be Recently Imported then.

It is not what Recently Imported shows. Deleting all of those Recently Imported does not change what's seen in Other (4096).

Whitespace after a semicolon in list presentations is just pretty-printing.  This is just a formatting thing. MC also ignores these on input.

Nevertheless the spaces are there, and the user might need to know that e.g. for handling the value in an expression.
Logged

MrC

  • Citizen of the Universe
  • *****
  • Posts: 10462
  • Your life is short. Give me your money.
Re: Bug: Smartlist Media Type = Playlist doesn't work
« Reply #15 on: March 24, 2013, 12:03:00 am »

Then you're going to have to update all the docs regarding list items, as MC outputs <separator string> followed by a space for all lists.  And this will create confusion, because when you build a list, you indicate a <separator string> without the space, but MC tacks on the space for you. Honestly, its not worth worrying about this.
Logged
The opinions I express represent my own folly.

chrisjj

  • Citizen of the Universe
  • *****
  • Posts: 750
Re: Bug: Smartlist Media Type = Playlist doesn't work
« Reply #16 on: March 24, 2013, 07:37:09 am »

Here's an example that requires knowledge of the true list separator value: Regex(FileDBLocation(), /#.*(; )?Other \(4096\)(; )?.*#/,0) (returns 1 if the file is in DB Other (4096), else returns 0).

It's confusing that MC adds a space to the separator that the user requests. I wonder why it does.

BTW, for testing a list of the presence of an item, is there a better alternative to the above? E.g. one that avoids the need to escape the item value (especially as there seems to be no function for escaping)? I see nothing like ListTest() in the docs. Thanks.
Logged

MrC

  • Citizen of the Universe
  • *****
  • Posts: 10462
  • Your life is short. Give me your money.
Re: Bug: Smartlist Media Type = Playlist doesn't work
« Reply #17 on: March 24, 2013, 11:57:00 am »

The space is called syntactic sugar, for human readability.

    Math(d=FileDBLocation(1) // pow(2,12); (d - (d % 1)) % 2)

    IsEqual(FileDBLocation(), Other /(4096/), 7)

    Regex(FileDBLocation(), /#\bOther \(4096\)(?:\b|$)#/)

    Regex(FileDBLocation()_, /#\bOther \(4096\)\b#/)

Remember, mountains and molehills are different things.
Logged
The opinions I express represent my own folly.

chrisjj

  • Citizen of the Universe
  • *****
  • Posts: 750
Re: Bug: Smartlist Media Type = Playlist doesn't work
« Reply #18 on: March 24, 2013, 01:02:36 pm »

The space is called syntactic sugar, for human readability.

Interesting. To me it looks like output formatting ... which sadly seems not yet to have a control mechanism as in the case of e.g. fields.

   Math(d=FileDBLocation(1) // pow(2,12); (d - (d % 1)) % 2)
    IsEqual(FileDBLocation(), Other /(4096/), 7)
    Regex(FileDBLocation(), /#\bOther \(4096\)(?:\b|$)#/)
    Regex(FileDBLocation()_, /#\bOther \(4096\)\b#/)

None meet the stated requirement, but thanks anyway.

Remember, mountains and molehills are different things.

Indeed - we can't flatten mountains. :)

Logged

MrC

  • Citizen of the Universe
  • *****
  • Posts: 10462
  • Your life is short. Give me your money.
Re: Bug: Smartlist Media Type = Playlist doesn't work
« Reply #19 on: March 24, 2013, 01:41:53 pm »

There's no way to avoid escapement somewhere, as the parens are part of what you're testing for, and they are reserved metacharacters in the MC expression language.  Maybe you mean "not have to escape individual characters"?  In that case, you already have the answer in front of you (and used it):

   IsEqual(FileDBLocation(), /#Other (4096)#/, 7)
Logged
The opinions I express represent my own folly.

chrisjj

  • Citizen of the Universe
  • *****
  • Posts: 750
Re: Bug: Smartlist Media Type = Playlist doesn't work
« Reply #20 on: March 26, 2013, 09:18:17 pm »

Maybe you mean "not have to escape individual characters"?

Yup.

In that case, you already have the answer in front of you (and used it):

   IsEqual(FileDBLocation(), /#Other (4096)#/, 7)

Thanks. I'd been unaware /# was available outside Regex(...) since I'd not seen it mentioned elsewhere in the wiki article. Perhaps it should be mentioned as a general facility?

I think that IsEqual(, 7) will work fine... until the fact it ignores the delimiters causes a fail when the sought string appears embedded in another item. Hopefully that's not going to happen soon! :)
Logged
Pages: [1]   Go Up