Skip to main content

Notice

Please note that most of the software linked on this forum is likely to be safe to use. If you are unsure, feel free to ask in the relevant topics, or send a private message to an administrator or moderator. To help curb the problems of false positives, or in the event that you do find actual malware, you can contribute through the article linked here.
Topic: Can graphic rating (star bars) value be set by clicking on star? (Read 4073 times) previous topic - next topic
0 Members and 1 Guest are viewing this topic.

Can graphic rating (star bars) value be set by clicking on star?

I am using Default User Interface and generally I don't wan't to change it as I don't need all that turbo-hyper-skins. But I got one question regarding Coulmns UI and its possible enhancements/extensions. In my DUI I got many coulmns representing tag values. One of them is a column with star bars representing arbitrary (not automaticaly) set rating, saved in custom tag RATING10. Values are between 0 and 10. The question is: Is it possible in CUI (with particular plugin/extension/script) to make this star bar clickable so the tag value can be set by clicking on one of the stars and automatically updated in file's metadata? I am asking about functionality similar to Windows Explorer (in Win7) for mp3 files (and for FLAC after installing property handler from AJD). As far as I know such feature was available also in Windows Media Player. So is it possible in foobar?

Can graphic rating (star bars) value be set by clicking on star?

Reply #1
it's possible to do it in both default UI and columns UI with a WSH panel mod script. i've already made one that uses foo_playcount - which is obviously limited to the 5 stars. but it should be fairly trivial to make it read/write custom file tags instead.

edit: try this: https://dl.dropbox.com/u/22801321/2013/marc...stom_rating.zip

extract the images folder into foobar2000 profile folder (or the main foobar directory if running portable). then install WSH panel mod and copy/paste the script into the panel. i've already set the tag to rating10 but you can edit the tag at the top of the script.


Can graphic rating (star bars) value be set by clicking on star?

Reply #2
Wow, thanks for answer  . Do I have to add some special UI element or can I use it as a regular column, but with clickable "values"? If I ever used id, then the best option would be to have such coulmn, placed between other columns, like it is configured now.

Can graphic rating (star bars) value be set by clicking on star?

Reply #3
just just need to add use layout editing mode and put WSH panel mod somewhere in your layout and then put that script in it.

it's unlikely you'll ever see clickable columns in a playlist with 10 stars.  both ESplaylist and simplaylist support clickable 5 stars but i don't know if the developers would ever consider 10 - it's pretty bespoke. you could ask  but i don't think you'll get very far. they aren't very active these days.

you can of course display the ratings in any playlist using a custom column.

Code: [Select]
$repeat(★,%rating10%)

Can graphic rating (star bars) value be set by clicking on star?

Reply #4
just just need to add use layout editing mode and put WSH panel mod somewhere in your layout and then put that script in it.

it's unlikely you'll ever see clickable columns in a playlist with 10 stars.  both ESplaylist and simplaylist support clickable 5 stars but i don't know if the developers would ever consider 10 - it's pretty bespoke. you could ask  but i don't think you'll get very far. they aren't very active these days.

you can of course display the ratings in any playlist using a custom column.

Code: [Select]
$repeat(?,%rating10%)


Is there anyway to use WSH to have the clickable stars as font? I use this for ratings

Quote
$if(%rating%,$repeat(?,%rating%)$repeat(?,$sub(5,%rating%)),?????)


Is there a WSH script about that works this way? I am currently using stars but it's from .png images and I change from stars, sqaures, circles etc in ELPlaylist so can't really keep redrawing the pngs for wsh panel mod.


EDIT*

Found this one but it's over 400 lines of code, mine is 69, is that bad?

http://pastebin.com/s2ByGKtF

Can graphic rating (star bars) value be set by clicking on star?

Reply #5
I was just using the built in %rating% tag and I ran into two problems.

1. It would not show the current rating (all tracks initially showed as zero)
2. When I moused over it and then moused out (without clicking), it would stay on however many stars I had highlighted, not the actual current rating

The first is because the way that TF retrieves metadata has changed ($meta(rating) instead of just %rating%). In any case, below is the modified panel code if you run into this trouble, too. Thanks go to marc2003, of course.

Code: [Select]
// ==PREPROCESSOR==
// @feature "v1.4"
// @feature "watch-metadb"
// ==/PREPROCESSOR==

//do not include %% here
var tag = "rating";
////////////////////////////////////////////////////
var r = new rating(0, 0, 24);
var ww = 0;
var wh = 0;
var metadb = fb.GetFocusItem();

on_item_focus_change();

function on_item_focus_change() {
metadb = fb.GetSelection();
if (metadb) on_metadb_changed();
}

function on_size() {
ww = window.Width;
wh = window.Height;
r.x = Math.round((ww - r.w) / 2);
r.y = Math.round((wh - r.bs) / 2);
}

function on_paint(gr) {
gr.FillSolidRect(0, 0, ww, wh, utils.GetSysColor(15));
r.draw(gr);
}

function on_metadb_changed() {
r.metadb_changed();
}

function on_mouse_move(x, y) {
r.move(x, y);
}

function on_mouse_lbtn_up(x, y) {
r.lbtn_up(x, y);
}

function rating(x, y, bs) {
this.draw = function(gr) {
if (metadb) {
this.rating = fb.TitleFormat("$meta(" + tag + ")").EvalWithMetadb(metadb);
if(this.rating == '?')
this.rating=0;
for (i = 1; i < 11; i++) {
this.img = i > (this.hover ? this.lrating : this.rating) ? this.off_img : this.on_img;
gr.DrawImage(this.img, this.x + this.bs * (i - 1), this.y, this.bs, this.bs, 0, 0, this.off_img.Width, this.off_img.Height);
}
}
}

this.metadb_changed = function() {
if (!metadb) return;
this.hover = false;
this.rating = fb.TitleFormat("$meta(" + tag + ")").EvalWithMetadb(metadb);
if(this.rating == '?')
this.rating=0;
if (this.rating == "?") this.rating = 0;
this.lrating = this.rating;
window.RepaintRect(this.x, this.y, this.w, this.bs);
}

this.trace = function(x, y) {
return x > this.x - this.bs && x < this.x + (this.bs * 10) && y > this.y && y < this.y + this.bs;
}

this.move = function(x, y) {
if (!this.trace(x, y)) {
if (this.hover) this.leave();
return false;
}
if (metadb) {
this.hover = true;
this.lrating = Math.ceil((x - this.x) / this.bs);
window.RepaintRect(this.x, this.y, this.w, this.bs);
}
return true;
}

this.lbtn_up = function(x, y) {
if (!this.trace(x, y)) return false;
if (this.lrating != this.rating && this.hover == 1) metadb.UpdateFileInfoSimple(tag, this.lrating == 0 ? "" : this.lrating);
return true;
}

this.leave = function() {
this.hover = false;
window.RepaintRect(this.x, this.y, this.w, this.bs);
}

this.x = x;
this.y = y;
this.bs = bs;
this.w = this.bs * 10;
this.hover = false;
this.rating = null;
this.lrating = null;
this.img = null;
this.off_img = gdi.Image("Z:\\home\\kevin\\.foobar2000\\images\\off.png");
this.on_img = gdi.Image("Z:\\home\\kevin\\.foobar2000\\images\\on.png");
}

Can graphic rating (star bars) value be set by clicking on star?

Reply #6
The first is because the way that TF retrieves metadata has changed ($meta(rating) instead of just %rating%).


this only applies if you have playback statistics (foo_playcount) installed.