IPB

Welcome Guest ( Log In | Register )

> foobar2000 General Forum Rules

This is NOT a tech support forum.
Tech support questions go to foobar2000 Tech Support forum instead.

See also: Hydrogenaudio Terms of Service.

new view via ›Preferences: Album List‹ won't work as it should, construction of $substring-$strstr give wrong output
nonsinn
post Jan 30 2013, 18:29
Post #1





Group: Members
Posts: 3
Joined: 30-January 13
Member No.: 106296



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 sad.gif

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
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
$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:
  1. How to get the stings (… cd …) and (… vol …) or (… cd … vol …) or (… vol … cd …) more precise?
  2. 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
Go to the top of the page
+Quote Post
 
Start new topic
Replies (1 - 3)
foosion
post Jan 30 2013, 20:20
Post #2





Group: FB2K Moderator (Donating)
Posts: 4411
Joined: 24-February 03
Member No.: 5153



QUOTE (nonsinn @ Jan 30 2013, 18:29) *
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
$if($puts(n,$strstr(%album%,'(cd')),$substr(%album%,$get(n),$add($get(n),5)))


--------------------
http://foosion.foobar2000.org/ - my components for foobar2000
Go to the top of the page
+Quote Post
nonsinn
post Jan 30 2013, 21:35
Post #3





Group: Members
Posts: 3
Joined: 30-January 13
Member No.: 106296



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' smile.gif .

I would be happy, if someone has another hint for me. But for now it's cool to have a fixed $left-string cool.gif .
Go to the top of the page
+Quote Post
nonsinn
post Feb 1 2013, 16:45
Post #4





Group: Members
Posts: 3
Joined: 30-January 13
Member No.: 106296



Hi again,
at the moment I'm using a workaround and simplified the code — after I learned how to use the $puts and $get rolleyes.gif

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

CODE
$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 wink.gif

Finally if here any 'solved' button?
Go to the top of the page
+Quote Post

Reply to this topicStart new topic
1 User(s) are reading this topic (1 Guests and 0 Anonymous Users)
0 Members:

 



RSS Lo-Fi Version Time is now: 30th July 2014 - 13:13