Skip to main content


Please be aware that much of the software linked to or mentioned on this forum is niche and therefore infrequently downloaded. Lots of anti-virus scanners and so-called malware detectors like to flag infrequently downloaded software as bad until it is either downloaded enough times, or its developer actually bothers with getting each individual release allow listed by every single AV vendor. You can do many people a great favor when encountering such a "problem" example by submitting them to your AV vendor for examination. For almost everything on this forum, it is a false positive.
Topic: Need help with Media Library Album List script (Read 202 times) previous topic - next topic
0 Members and 1 Guest are viewing this topic.

Need help with Media Library Album List script

I have Classical albums in their own tree alphabetically by composer.  As you probably know, many classical albums have more than one composer's work in the album.  Plus there may be classical pieces on albums not cataloged as classical.  To enable finding all works of any composer I have a View that is 'Classical By Composer'.  It presents a hierarchical view alphabetically by last name.  Everything worked fine except when there are multiple composers for a piece of music.  So I re-wrote the script to isolate the first name in the list and sort on that.  When that's working 100% I'll add the rest of the composer's name(s) to the view.  It's working 99% now.

I've standardized on tags having multiple entries to be either 'Entry 1 & Entry 2' or 'Entry 1, Entry 2 & Entry 3'.  This script successfully figures out if there are multiple entries and isolates the first.  It then successfully switches the last word to be the first word of the string and adds a comma and space after it.  I'm old school and sort by last name.  The only glitch I'm running into is if there is a comma in the composer field it appears that a space that is usually before the string that is output to the view is eliminated.  This puts the tracks with more than two composers in a second list below everything else.  Fields with ampersands but no comma work fine.   Here's the script:

      $puts(comp,$trim($left(%composer%,$sub($strstr(%composer%,', '),1)))),
         $puts(comp,$trim($left(%composer%,$strstr(%composer%,' & ')))),
         $left($right($get(comp),$sub($len($get(comp)),$strrchr($get(comp),' '))),1)
   $trim($right($get(comp),$sub($len($get(comp)),$strrchr($get(comp),' '))))', '$trim($left($get(comp),$sub($strrchr($get(comp),' '),1)))
   $if($greater($strstr(%title%,' - '),0),$trim($substr(%title%,1,$sub($strstr(%title%,' - '),1))),%title%)|%artist% > %album%|%track% - %title%,)

Here's a screenshot showing the last of the "correct" list and the list with commas in the composer field.  Note that there appears to be an extra space before the Z as opposed to the following category letters.

Any help would be greatly appreciated!


Re: Need help with Media Library Album List script

Reply #1

SimplePortal 1.0.0 RC1 © 2008-2021