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.

 
Reply to this topicStart new topic
Question on editing coding for this album rating display
sh4d0wscr34m
post Feb 10 2013, 15:36
Post #1





Group: Members
Posts: 24
Joined: 13-April 09
Member No.: 68925



I am virtually incompetent when it comes to changing these types of things. Basically, I've got my foobar set up to display album ratings from 1-10 via an album rating tag, the display code for which I pieced together a couple of years ago from various user contributions. An album rating of 7/10 would have 7 yellow stars and 3 grey stars:



I've been leaving %album rating% blank for albums I haven't rated but I decided that I prefer to be able to sort in to just my unrated albums via my top left window, which means I need to start using %album rating% = 0. The issue is when I set this it displays red x's instead of ten blank (grey) stars, though it did used to have 10 grey stars if the tag was simply blank:



I'm wondering how I can adjust the code so that it will display ten grey stars for an %album rating% of 0 rather than the x's. Here's the current code:
CODE
$puts(mychar,$char(9733)$char(8202))

$rgb(245,175,92,225,155,72)

$if(%album rating%,
$ifgreater(%album rating%,0,
$repeat($get(mychar),%album rating%)
$repeat($rgb(230,230,230,210,210,210)$get(mychar),$sub(10,%album rating%))
,
$repeat($rgb(204,13,62,204,13,62)$char(215)'     ',10)$char(215))
,
$repeat($rgb(230,230,230,210,210,210)$get(mychar),10)

)

Go to the top of the page
+Quote Post
BenB
post Feb 10 2013, 23:32
Post #2





Group: Members
Posts: 730
Joined: 17-April 12
Member No.: 98921



The problem with the display appears to be rooted in the script you're using for that view in Album List Panel. Post that script if you want help figuring out what's causing it.

There doesn't appear to be any problem with the script you posted. I tested it in Grouping and as a column and it displayed correctly. I couldn't test it in Album List Panel, obviously, as I would need the entire script.

QUOTE (sh4d0wscr34m @ Feb 10 2013, 08:36) *
I'm wondering how I can adjust the code so that it will display ten grey stars for an %album rating% of 0 rather than the x's. Here's the current code:

CODE
$puts(mychar,$char(9733)$char(8202))

$rgb(245,175,92,225,155,72)

$ifgreater(%album rating%,0,
$repeat($get(mychar),%album rating%)
$repeat($rgb(230,230,230,210,210,210)$get(mychar),$sub(10,%album rating%))
,
$repeat($rgb(230,230,230,210,210,210)$get(mychar),10)
)

That works because a nonexistent tag essentially evaluates to 0. However, there will no longer be any differentiation between unrated albums and albums rated "0". Two different conditions evaluating to 'unrated' might lead to unnecessarily complex scripts. I suggest removing the "0" ratings and allow your unrated albums to be truly unrated. You could use the following script instead:

CODE
$puts(mychar,$char(9733)$char(8202))

$rgb(245,175,92,225,155,72)

$if(%album rating%,
$repeat($get(mychar),%album rating%)
$repeat($rgb(230,230,230,210,210,210)$get(mychar),$sub(10,%album rating%))
,
$repeat($rgb(230,230,230,210,210,210)$get(mychar),10)
)

As far as the script for Album List Panel is concerned, as a first tier you could simply use:
CODE
$if2(%album rating%,0)|

And as far as querying for unrated albums in a search is concerned, you can use:
CODE
%album rating% MISSING


This post has been edited by BenB: Feb 10 2013, 23:40
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: 27th August 2014 - 16:54