INTERACT FORUM

Please login or register.

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

Author Topic: artist info and artwork - how to detect missing?  (Read 3824 times)

rjm

  • Regular Member
  • Citizen of the Universe
  • *****
  • Posts: 2699
artist info and artwork - how to detect missing?
« on: March 30, 2012, 10:44:53 pm »

For each artist in my music collection I try to create an info file. I also intend to get artwork for each artist.

I am trying to figure out how to find artists that are missing info or artwork.

When trying to solve a similar problem for missing album info we can use the amazing smartlist option "expand to full albums" and then subtract this smartlist from the set of all albums. Unfortunately we do not seem to have an "expand to full artists" option so I am stumped.

Any ideas from the smartlist/expression gurus out there?
Logged

MrC

  • Citizen of the Universe
  • *****
  • Posts: 10462
  • Your life is short. Give me your money.
Re: artist info and artwork - how to detect missing?
« Reply #1 on: March 30, 2012, 11:10:56 pm »

Create a new panes view.  Add an expression column:

If(IsMissing(C:\Users\you\AppData\Roaming\J River\Media Center 17\Cover Art\Artists\[Artist].jpg),
   [Artist],
  /(HAS ART/))

replacing the green path as relevant for your system.

This will check to see if the artist artwork is missing for a given artist and will list out those artists.  Tailor the expression to your needs.  You can use a similar technique for your info files.

Note: this is slow, as it is going out to the file system I believe.
Logged
The opinions I express represent my own folly.

rjm

  • Regular Member
  • Citizen of the Universe
  • *****
  • Posts: 2699
Re: artist info and artwork - how to detect missing?
« Reply #2 on: March 31, 2012, 12:06:53 am »

Thanks! That worked great, and it is surprisingly fast.

Can you please illuminate how this expression in a pane feature works for a more complicated example?

How is the pane column populated if the IsMissing file uses two or more fields? For example,

[Artist] - [Name].jpg

Does MC test for every permutation of [Artist] and [Name]? Or what?

I tried it but do not understand the results I am getting.
Logged

MrC

  • Citizen of the Universe
  • *****
  • Posts: 10462
  • Your life is short. Give me your money.
Re: artist info and artwork - how to detect missing?
« Reply #3 on: March 31, 2012, 12:51:31 am »

Here's the way to think about how output occurs in a pane (expression or field, it doesn't really matter, ultimately it becomes a sequence of characters dumped to the column after sorting).

Think about a list of all your tracks and their tags, one track at a time:

1) For each and every track in a view...
   ...Run (evaluate) the expression using the fields from this current track and add the output to a list
2) Sort the list, omitting duplicates, and output to the column

So, this should make it clearer that the [Artist], [Name], etc. fields used in an expression are replaced by the current track's values (not all permutations).
Logged
The opinions I express represent my own folly.

rjm

  • Regular Member
  • Citizen of the Universe
  • *****
  • Posts: 2699
Re: artist info and artwork - how to detect missing?
« Reply #4 on: March 31, 2012, 01:27:52 am »

Thanks.

1) What you say makes sense except it is not what I am observing.

My artist info files are named [Artist] - [Name].mht and for 95% of the time [Name] = info.

So based on your explanation if I use "[Artist] - [Name].mht" or "[Artist] - info.mht" in the IsMissing expression I should get roughly the same results. But I don't. I get completely different results with the former being wrong and the latter being right. Any insight here?

2) How can this technique be modified to handle varying file extensions? This is important because the automated get artist artwork from LastFM feature returns files in jpg, gif, png and possibly other formats.
Logged

MrC

  • Citizen of the Universe
  • *****
  • Posts: 10462
  • Your life is short. Give me your money.
Re: artist info and artwork - how to detect missing?
« Reply #5 on: March 31, 2012, 01:44:39 am »

1) What you say makes sense except it is not what I am observing.

My artist info files are named [Artist] - [Name].mht and for 95% of the time [Name] = info.

So based on your explanation if I use "[Artist] - [Name].mht" or "[Artist] - info.mht" in the IsMissing expression I should get roughly the same results. But I don't. I get completely different results with the former being wrong and the latter being right. Any insight here?

Case differences?  Compare the generated textual string against and file names.

2) How can this technique be modified to handle varying file extensions? This is important because the automated get artist artwork from LastFM feature returns files in jpg, gif, png and possibly other formats.

I suppose you'll have to check for the existence of any vs. none, and to check for none you'll have to check all possible types of jpg, gif, png.  So the test will be:

  if IsMissing jpg and IsMissing gif and IsMissing png
     no artwork
  else
     art exists

You can emulate AND as described here:
   http://wiki.jriver.com/index.php/Database_Expressions_AND_OR_And_XOR

I'm headed for some sleep now.  Let us know how it works out...
Logged
The opinions I express represent my own folly.

rjm

  • Regular Member
  • Citizen of the Universe
  • *****
  • Posts: 2699
Re: artist info and artwork - how to detect missing?
« Reply #6 on: March 31, 2012, 03:02:07 am »

1) Case is correct. It seems [Artist] - [Name] may not be behaving as you describe.

2) I tried math function as follows:

If(Math(IsMissing(D:\Media Center\Cover Art\Artists\[Artist].jpg) &
IsMissing(D:\Media Center\Cover Art\Artists\[Artist].png) &
IsMissing(D:\Media Center\Cover Art\Artists\[Artist].gif))
,[Artist],/ not missing)

Makes perfect sense except it does not work.

If I remove Math and only test for one file type then it works correctly.
Logged

MrC

  • Citizen of the Universe
  • *****
  • Posts: 10462
  • Your life is short. Give me your money.
Re: artist info and artwork - how to detect missing?
« Reply #7 on: March 31, 2012, 10:06:40 am »

Re: (1)

The algorithm works as I've described.  Prove it to yourself by building up a number of columns, each with portions of the expression.

If it is not working for your situation, examine the cases where you find problems.  You recall from our other conversations that Clean() is necessary for file system paths, right?

This works just fine for me:

If(IsMissing([_fCoverArt]\Artists\clean([Artist] - [Name].txt, 3)),
      clean([Artist] - [Name].txt, 3), /(HAS txt/))

Re: (2)

This works just fine.  I've tested in multiple ways:

If(
  math(
      IsMissing([_fCoverArt]\Artists\[Artist].gif)  &
      IsMissing([_fCoverArt]\Artists\[Artist].png) &
      IsMissing([_fCoverArt]\Artists\[Artist].jpg)
  ),
[Artist], /(HAS ART/))

Again, you may need to clean the paths since there are 9 illegal Windows file system characters.
Logged
The opinions I express represent my own folly.

rjm

  • Regular Member
  • Citizen of the Universe
  • *****
  • Posts: 2699
Re: artist info and artwork - how to detect missing?
« Reply #8 on: March 31, 2012, 01:36:20 pm »

Thanks again, much appreciated.

1) Figured it out. My Album info is named "[Artist] - [Album] - info" and this was creating a bunch of false positives. Solution is to use "[Artist] - info.mht" in IsMissing.

2) I got it to work. Seems it objected to my text formatting.

This works:

If(Math(IsMissing(D:\Media Center\Cover Art\Artists\[Artist].jpg) & IsMissing(D:\Media Center\Cover Art\Artists\[Artist].png) & IsMissing(D:\Media Center\Cover Art\Artists\[Artist].gif)),[Artist],/ not missing)

This does not work:

If(
  Math(
     IsMissing(D:\Media Center\Cover Art\Artists\[Artist].jpg) &
     IsMissing(D:\Media Center\Cover Art\Artists\[Artist].png) &
     IsMissing(D:\Media Center\Cover Art\Artists\[Artist].gif)
  )
,[Artist],/ not missing)
Logged

MrC

  • Citizen of the Universe
  • *****
  • Posts: 10462
  • Your life is short. Give me your money.
Re: artist info and artwork - how to detect missing?
« Reply #9 on: March 31, 2012, 01:44:19 pm »

Maybe you have an older version of MC17 where the newline escapement has bugs still?

Anyway, the exact expression I posted (and I think you're is the same) works correctly here.
Logged
The opinions I express represent my own folly.

rjm

  • Regular Member
  • Citizen of the Universe
  • *****
  • Posts: 2699
Re: artist info and artwork - how to detect missing?
« Reply #10 on: March 31, 2012, 02:46:54 pm »

I'm running 17.0.118. Do you know what is the permitted method to start a new line?
Logged

MrC

  • Citizen of the Universe
  • *****
  • Posts: 10462
  • Your life is short. Give me your money.
Re: artist info and artwork - how to detect missing?
« Reply #11 on: March 31, 2012, 02:58:52 pm »

A quick cheat sheet:

*) after an opening paren, before the first param in a function
*) before the closing paren, after the last param in a function
*) after a comma separating arguments in a function
*) if / is the last character of a line
*) inside of Math()
Logged
The opinions I express represent my own folly.

rjm

  • Regular Member
  • Citizen of the Universe
  • *****
  • Posts: 2699
Re: artist info and artwork - how to detect missing?
« Reply #12 on: March 31, 2012, 04:22:24 pm »

mmm...

I seem to be following these rules. Anything rules related to multiple spaces or tabs?
Logged

MrC

  • Citizen of the Universe
  • *****
  • Posts: 10462
  • Your life is short. Give me your money.
Re: artist info and artwork - how to detect missing?
« Reply #13 on: March 31, 2012, 04:25:55 pm »

I see the problem.  You've moved a comma

  )
,[Artist],/ not missing)

Compare against my version and the cheatsheet.
Logged
The opinions I express represent my own folly.

rjm

  • Regular Member
  • Citizen of the Universe
  • *****
  • Posts: 2699
Re: artist info and artwork - how to detect missing?
« Reply #14 on: March 31, 2012, 05:03:00 pm »

Got it. Thanks for your patience.
Logged

vagskal

  • Citizen of the Universe
  • *****
  • Posts: 1227
Re: artist info and artwork - how to detect missing?
« Reply #15 on: April 01, 2012, 05:28:37 am »

Any idea how to handle lists of artists?
Logged

MrC

  • Citizen of the Universe
  • *****
  • Posts: 10462
  • Your life is short. Give me your money.
Re: artist info and artwork - how to detect missing?
« Reply #16 on: April 01, 2012, 02:44:11 pm »

Any idea how to handle lists of artists?

You mean check for artwork for each artist in the list?
Logged
The opinions I express represent my own folly.

vagskal

  • Citizen of the Universe
  • *****
  • Posts: 1227
Re: artist info and artwork - how to detect missing?
« Reply #17 on: April 01, 2012, 02:48:40 pm »

You mean check for artwork for each artist in the list?

Yes.
Logged

rjm

  • Regular Member
  • Citizen of the Universe
  • *****
  • Posts: 2699
Re: artist info and artwork - how to detect missing?
« Reply #18 on: April 01, 2012, 06:39:56 pm »

Any idea how to handle lists of artists?

Not yet. I have a long list of tests that I intend to do before implementing artist lists:
- artist artwork implications
- artist info implications
- sort order implications
- impact on existing view designs
- impact on existing smartlists
- folder/file renaming implications
- compatibility with other apps (iTunes, VLC, MP3Tag)
- compatibility with devices (iPod etc.)
Logged

rjm

  • Regular Member
  • Citizen of the Universe
  • *****
  • Posts: 2699
Re: artist info and artwork - how to detect missing?
« Reply #19 on: April 01, 2012, 10:52:49 pm »

You recall from our other conversations that Clean() is necessary for file system paths, right?

I don't see a reasonable way to make IsMissing work in all cases. For example,

IsMissing(D:\Media Center\Cover Art\Artists\Replace(Clean([Artist],3),-,_).jpg)

works for Artist AC/DC but not 54-40.

It looks like we do need a 4th option for Clean.

Matt, when you've got a free minute, please.
Logged

vagskal

  • Citizen of the Universe
  • *****
  • Posts: 1227
Re: artist info and artwork - how to detect missing?
« Reply #20 on: April 02, 2012, 02:19:03 am »

No need to clean(), since that functions makes a mess with -. This worked for me:
Code: [Select]
If(math(IsMissing(F:...\Artists\Replace(Replace(Replace(Replace(Replace(Replace(Replace(Replace(Replace([Primary Artist].gif,",_),*,_),//,_),:,_),?,_),\,_),<,_),>,_),|,_)) & IsMissing(F:...\Artists\Replace(Replace(Replace(Replace(Replace(Replace(Replace(Replace(Replace([Primary Artist].png,",_),*,_),//,_),:,_),?,_),\,_),<,_),>,_),|,_),) & IsMissing(F:...\Artists\Replace(Replace(Replace(Replace(Replace(Replace(Replace(Replace(Replace([Primary Artist].jpg,",_),*,_),//,_),:,_),?,_),\,_),<,_),>,_),|,_))),[Primary Artist]; /(Missing Artist Art:/), /(Has Artist Art/))&datatype=[list]
The [Primary Artist] field is a custom field where I just have picked the first artist in a list of artists. Use [Artist] if you do not have a list of artists in that field.
Logged

rjm

  • Regular Member
  • Citizen of the Universe
  • *****
  • Posts: 2699
Re: artist info and artwork - how to detect missing?
« Reply #21 on: April 02, 2012, 10:29:01 am »

    No need to clean(), since that functions makes a mess with -. This worked for me:

    If(math(IsMissing(F:...\Artists\Replace(Replace(Replace(Replace(Replace(Replace(Replace(Replace(Replace([Primary Artist].gif,",_),*,_),//,_),:,_),?,_),\,_),<,_),>,_),|,_)) & IsMissing(F:...\Artists\Replace(Replace(Replace(Replace(Replace(Replace(Replace(Replace(Replace([Primary Artist].png,",_),*,_),//,_),:,_),?,_),\,_),<,_),>,_),|,_),) & IsMissing(F:...\Artists\Replace(Replace(Replace(Replace(Replace(Replace(Replace(Replace(Replace([Primary Artist].jpg,",_),*,_),//,_),:,_),?,_),\,_),<,_),>,_),|,_))),[Primary Artist]; /(Missing Artist Art:/), /(Has Artist Art/))&datatype=[list.]


    Way too funny. Notice I carefully chose the word "reasonable" above. Think I'll wait for a 4th Clean option. :)[/list]

    <edit>

    I tried it and it works without having to upgrade my system to a Cray.

    What is the purpose of the "&datatype=[list.]" appended to the expression? I did not use it because I don't understand it.
    Logged

    vagskal

    • Citizen of the Universe
    • *****
    • Posts: 1227
    Re: artist info and artwork - how to detect missing?
    « Reply #22 on: April 02, 2012, 11:39:40 am »

    What is the purpose of the "&datatype=[list.]" appended to the expression? I did not use it because I don't understand it.

    Sorry about that. You do not need it, but it is harmless here. It was a leftover from my futile attempt to handle lists of artists. Now I just check art for the primary (first in a list) artist.
    Logged

    vagskal

    • Citizen of the Universe
    • *****
    • Posts: 1227
    Re: artist info and artwork - how to detect missing?
    « Reply #23 on: April 02, 2012, 11:48:51 am »

    A quick cheat sheet:

    *) after an opening paren, before the first param in a function
    *) before the closing paren, after the last param in a function
    *) after a comma separating arguments in a function
    *) if / is the last character of a line
    *) inside of Math()

    I think a new line should be ignored also if it is the very first line. By accident I started with a new line in the expression editor and did not see it was there. It took a while for me to figure out why my expression did not produce any result.
    Logged

    Fabricio

    • Citizen of the Universe
    • *****
    • Posts: 685
    • No one has patience with me.
    Re: artist info and artwork - how to detect missing?
    « Reply #24 on: April 02, 2012, 12:07:47 pm »

    I'm running 17.0.118. Do you know what is the permitted method to start a new line?


    v.17.0.118? Where?

    rjm

    • Regular Member
    • Citizen of the Universe
    • *****
    • Posts: 2699
    Re: artist info and artwork - how to detect missing?
    « Reply #25 on: April 02, 2012, 12:10:56 pm »

    Logged

    MrC

    • Citizen of the Universe
    • *****
    • Posts: 10462
    • Your life is short. Give me your money.
    Re: artist info and artwork - how to detect missing?
    « Reply #26 on: April 02, 2012, 12:13:30 pm »

    Any idea how to handle lists of artists?

    Sorry for the delay on this... I needed to test if I could get embedded expressions to evaluate... but they don't, so I don't see a way to do this currently.  

    You could use a brute force method where you test the list count, and have clauses in the expression to check IsMissing() for each item in the list:

      if list count >= 9
         ismissing (9th list item)
      if list count >= 8
         ismissing (8th list item)
       ...
      if list count >= 1
         ismissing (1st list item)

    So you'd need as many clauses as the maximum list size you'd have.  You could place a clause at the front to warn if the list count was greater than your expression currently handles - so you could add another clause or two as necessary over time.

    A more elegant solution would be to allow IsMissing() to support a list of files, but its return value (true / false) would be less informative than ideal.  It could return 0 (false) for all files present, or as true, the first item from the missing list, or all missing items in a list.

    But short of that, what is necessary is a list iterator function, such as ListIterate() or ListForeach(), that would allow running sub-expressions on each item in the list:

    Warning: pseudo-code ahead...

      ListIterate(<list>, ;,
           expression using special token such as [CURVAL] as the current list item
       )

    Example:
      ListIterate([Artist], ;,
           If(IsMissing(\path\to\artwork\folder\[CURVAL].jpg), ...
       )
    Logged
    The opinions I express represent my own folly.

    MrC

    • Citizen of the Universe
    • *****
    • Posts: 10462
    • Your life is short. Give me your money.
    Re: artist info and artwork - how to detect missing?
    « Reply #27 on: April 02, 2012, 12:14:44 pm »

    I think a new line should be ignored also if it is the very first line. By accident I started with a new line in the expression editor and did not see it was there. It took a while for me to figure out why my expression did not produce any result.

    I agree - all leading and trailing whitespace in the Expression Editor should be stripped.
    Logged
    The opinions I express represent my own folly.

    vagskal

    • Citizen of the Universe
    • *****
    • Posts: 1227
    Re: artist info and artwork - how to detect missing?
    « Reply #28 on: April 02, 2012, 12:33:44 pm »

    Thanks for the reply! I could not figure it out either. I think I abstain from using your proposed solution. The expression is complicated and slow already. I thought of making custom calculated fields for each itemcount and then use listcombine() to unite them, to possibly speed things up a bit. But that seemed a lot of work.

    what is necessary is a list iterator function, such as ListIterate() or ListForeach(), that would allow running sub-expressions on each item in the list:

    Yes, that would be nice and useful!

    Another thing this exercise got me to think of was having the Replace() function accept a list of values to change to one value.
    Logged

    MrC

    • Citizen of the Universe
    • *****
    • Posts: 10462
    • Your life is short. Give me your money.
    Re: artist info and artwork - how to detect missing?
    « Reply #29 on: April 02, 2012, 12:54:44 pm »

    Agreed on all points.  It is too clumsy to try to force a solution here, so a better approach might be to periodically export an Artist list and have a script that outputs a list of missing artwork.  This is simple enough I suppose as a workaround.
    Logged
    The opinions I express represent my own folly.

    vagskal

    • Citizen of the Universe
    • *****
    • Posts: 1227
    Re: artist info and artwork - how to detect missing?
    « Reply #30 on: April 03, 2012, 05:05:56 am »

    What is the purpose of the "&datatype=[list.]" appended to the expression? I did not use it because I don't understand it.

    My earlier answer was not entirely accurate. You do need &datatype=[list] if you want to use the expression exactly as I posted it. It is this part that requires it: [Primary Artist]; /(Missing Artist Art:/). It will give you one item in the pane to select to get all files where [Primary Artist] is missing cover art. If you just use [Primary Artist], or [Artist] if you do not have lists of artists, you do not need &datatype=[list].

    ---

    I could not resist checking if cover art is missing for any artist in lists of artists (I have up to 10 items in those lists), but the required expression completely choked MC and it was not even possible to paste it into a smartlist.
    Logged

    rjm

    • Regular Member
    • Citizen of the Universe
    • *****
    • Posts: 2699
    Re: artist info and artwork - how to detect missing?
    « Reply #31 on: April 03, 2012, 10:08:45 am »

    My earlier answer was not entirely accurate. You do need &datatype=[list.] if you want to use the expression exactly as I posted it.

    Thanks for the follow-up. I've filed this for the day when I have some spare time to thoroughly test artist lists.
    Logged
    Pages: [1]   Go Up