Skip to main content

Topic: new view via ›Preferences: Album List‹ won't work as it should (Read 1023 times) previous topic - next topic

0 Members and 1 Guest are viewing this topic.
  • nonsinn
  • [*]
new view via ›Preferences: Album List‹ won't work as it should
Hi all,
hope this post is in the right part of this forum.

Problem: I tried to create a new Album List, but the output isn't what i want 

Hard facts:
  • every cd saved as one wave (PCM)
  • using cue-sheet
  • can't store %cd%-value


Here what i wanna do (so it should be easy to follow what I wanna do…):
Code: [Select]
if album artist 
    then if %album artist% = various
        ⇒ sort like %sub-a%
        else if %album artist% ≠ various
        ⇒ sort like %sub-b% with %album artist%
    else if %artist%
        ⇒ sort like %sub-b% with %artist%

%sub-a%
    %album artist% ( ≙ various) |$left(%album%,7)|%date% - %album%,30 - (max. 30 letter and add [if they include »cd OR vol.«] all information between nearest '(' and ')')
for example: with original %album% = rock s'cool (a spanking good song collection) (vol.01 cd2)
⇒ various | rock s' | 2007 - rock s' cool (a - (vol.001 cd1)

%sub-b%
    first letter of %artist% (or %album artist%) | %artist% (or %album artist%)|%date% - %album%,30 - (max. 30 letter and add [if they include »cd OR vol.«] all information between nearest '(' and ')')
for example: with original %album% = the beginning (cd1) [deluxe 2cd edition]
⇒ b | black eyed peas the | 2010 - the beginning ( - (cd1)
for example: with original %album% = complete works (cd08) mazurkas (vol.02) [cor de groot, artur moreira, sofia philharmonic orchestra, dimiter manolov]
⇒ c | chopin | ~1830 - complete works  - (cd08)(vol.02)


so i wrote the following code (after hours and some tries and errors)
Code: [Select]
$ifequal($replace($meta(album artist),various,99999),99999,%album artist%|[$left(%album%,7)]|[$left(%date%,4) - ][$ifgreater($len(%album%),30,$left(%album%,15) $substr($meta(album),$strstr($meta(album),'('cd),$add($strstr($meta(album),'('cd),5)),%album%)]|[#%track% - ][%artist% - ][%title%],$if($meta(album artist),$left(%album artist%,1)|%album artist%|[$left(%date%,4) - ][$ifgreater($len(%album%),30,$left(%album%,15)  $substr($meta(album),$strstr($meta(album),'('cd),$add($strstr($meta(album),'('cd),5)),%album%)]|[#%track% - ][%title%],$if(%artist%,$left(%artist%,1))|%artist%|[$left(%date%,4) - ][$ifgreater($len(%album%),30,$left(%album%,15)  $substr($meta(album),$strstr($meta(album),'('cd),$add($strstr($meta(album),'('cd),5)),%album%)]|[#%track% - ][%title%]))


Here the problems:
  • How to get the stings (… cd …) and (… vol …) or (… cd … vol …) or (… vol … cd …) more precise?
  • Why adds foobar the first five letters to an $left15-string without (cd)?

Any ideas how I can get what I want? All the other stuff works at the moment as it should, therefore I would be happy if someone able to help.

With best regards,
nonsinn

  • foosion
  • [*][*][*][*][*]
  • Moderator
new view via ›Preferences: Album List‹ won't work as it should
Reply #1
Why adds foobar the first five letters to an $left15-string without (cd)?

The $strstr function returns 0 if the given pattern was not found. You'll need to check if the pattern was found:
Code: [Select]
$if($puts(n,$strstr(%album%,'(cd')),$substr(%album%,$get(n),$add($get(n),5)))
http://foosion.foobar2000.org/ - my components for foobar2000

  • nonsinn
  • [*]
new view via ›Preferences: Album List‹ won't work as it should
Reply #2
Hi foosion,
thanks for your hint — now it's nearly working as it should.

Just the (… cd …)-stuff is left — is there any way to fix this too, or not really?
For example, the library-search understand »album HAS "(cd" OR album HAS "(vol"« so I hope there is any why to fix it within the 'Album List'  .

I would be happy, if someone has another hint for me. But for now it's cool to have a fixed $left-string  .

  • nonsinn
  • [*]
new view via ›Preferences: Album List‹ won't work as it should
Reply #3
Hi again,
at the moment I'm using a workaround and simplified the code — after I learned how to use the $puts and $get 

If there is someone who wanna use the string I am using now…

Code: [Select]
$if($strstr(%album%,'(cd'),$puts(types,cd)$puts(numbers,$strstr(%album%,'(cd'))$puts(add,5))$if($strstr(%album%,'(vol'),$puts(types,vol)$puts(numbers,$strstr(%album%,'(vol'))$puts(add,12))$if($strstr(%album%,'(part'),$puts(types,part)$puts(numbers,$strstr(%album%,'(part'))$puts(add,10))$puts(fixedalbum,$ifgreater($len($get(types)),0,$ifgreater($len(%album%),8,[$left(%date%,4) - ][$left(%album%,8) $substr(%album%,$get(numbers),$add($get(numbers),$get(add)))],[$left(%date%,4) - ][%album%]),[$left(%date%,4) - ]$ifgreater($len(%album%),16,$left(%album%,16),[%album%])))$puts(trti,[#%track% - ][$ifgreater($len2(%title%),24,$left(%title%,24),%title%)])$ifequal($replace($meta(album artist),various,99999),99999,%album artist%|$left(%album%,15)|[$get(fixedalbum)]|$get(trti),$left(%album artist%,1)|%album artist%|[$get(fixedalbum)]|$get(trti))

Note: if you wanna use other strings from your %album%-file, copy and change the first $if-string (and/or remove the two others too).
Everything else should be self-explanatory 

Finally if here any 'solved' button?