Rate songs and display their rating?

Posted on
Sat May 07, 2016 7:34 am
Different Computers offline
User avatar
Posts: 2533
Joined: Jan 02, 2016
Location: East Coast

Rate songs and display their rating?

I have an idea on how to do this so it looks more elegant than I'm doing now, but the back end would end up being pretty ugly. To whit:

5 variables, 1 each for 1-5 stars.
These variable states on the control page in a nice line next to each other.
Add graphic to the control pages library that's On=star emoji and Off = greyed out star.
Triggers that turn on <N stars if you turn on N stars.
And of course, those same triggers set the rating in iTunes, which I already know how to do.

Anyone have something more elegant in place?

See attached for how I do it now, which is ugly and doesn't actually show the rating, just lets me set it.
Attachments
Screen Shot 2016-05-07 at 9.35.14 AM.png
Screen Shot 2016-05-07 at 9.35.14 AM.png (146.78 KiB) Viewed 2796 times

SmartThings refugee, so happy to be on Indigo. Monterey on a base M1 Mini w/Harmony Hub, Hue, DomoPad, Dynamic URL, Device Extensions, HomeKitLink, Grafana, Plex, uniFAP, Fantastic Weather, Nanoleaf, LED Simple Effects, Bond Home, Camect.

Posted on
Sat May 07, 2016 8:49 am
RogueProeliator offline
User avatar
Posts: 2501
Joined: Nov 13, 2012
Location: Baton Rouge, LA

Re: Rate songs and display their rating?

I would personally have 1 variable or state for the rating, then 5 separate "sets" of rating images - one each for 1, 2, 3, 4, and 5 stars in the "off" and "on" state. With image heuristics you can do something like:

OneStar+.png
OneStar+1s.png

TwoStars+.png
TwoStars+2s.png

...

So by default the would be gray (for the image without a value specification) and one colored. Then when the value goes to "1s", the selected star one would be shown. You could do this in many ways, of course, such as a single star for each "slot" similar to iTunes (i.e. 5 stars in a row and you could and it "highlights" up to that star). It would be the same as above but each image would be a single star.

I find it better to handle the display w/ the image heuristics rather than adding triggers and additional logic all over the place, but of course your opinion and preference may vary. It is similar to programming with breaking up the business logic and view so that each is as simple as possible.

Adam

Posted on
Sat May 07, 2016 9:14 am
Different Computers offline
User avatar
Posts: 2533
Joined: Jan 02, 2016
Location: East Coast

Re: Rate songs and display their rating?

I see what you're getting at and will think about how to do it.
With this approach I could have a single variable that I'm using Modify Variable actions to increment or decrement based on where I'm tapping in the control page.
Thanks!

SmartThings refugee, so happy to be on Indigo. Monterey on a base M1 Mini w/Harmony Hub, Hue, DomoPad, Dynamic URL, Device Extensions, HomeKitLink, Grafana, Plex, uniFAP, Fantastic Weather, Nanoleaf, LED Simple Effects, Bond Home, Camect.

Posted on
Tue May 10, 2016 1:33 pm
Different Computers offline
User avatar
Posts: 2533
Joined: Jan 02, 2016
Location: East Coast

Re: Rate songs and display their rating?

Ok, made up all my star graphics. (If anyone wants a the 5 files of a line of grey stars that turn to a line of gold stars one by one, let me know)

Now I'm trying to script this thing.

I have a variable called iTunesStars.

This script is supposed to be the "add a star" script. As part of an Action Group, it compiles and runs without any problem, but does nothing:

Code: Select all
tell application "iTunes"
   if player state = playing then
      copy (get rating of current track) to trackRating
      -- repeat with theTrack in (get selection)
      set the rating of current track to trackRating + 20
      tell application "IndigoServer"
         set value of variable "iTunesStars" to trackRating
      end tell
      -- end repeat
   end if
end tell


I've manually changed the value of iTunesStars to check, and nada.

Any help?

SmartThings refugee, so happy to be on Indigo. Monterey on a base M1 Mini w/Harmony Hub, Hue, DomoPad, Dynamic URL, Device Extensions, HomeKitLink, Grafana, Plex, uniFAP, Fantastic Weather, Nanoleaf, LED Simple Effects, Bond Home, Camect.

Posted on
Tue May 10, 2016 7:53 pm
RogueProeliator offline
User avatar
Posts: 2501
Joined: Nov 13, 2012
Location: Baton Rouge, LA

Re: Rate songs and display their rating?

Did you name your image with a plus sign at the end?

iTuneStars+.png
iTuneStars+1.png
iTuneStars+2.png...
etc.

And in the control page make sure the one with the + but no value is selected.

Posted on
Wed May 11, 2016 6:46 am
Different Computers offline
User avatar
Posts: 2533
Joined: Jan 02, 2016
Location: East Coast

Re: Rate songs and display their rating?

Pretty sure I did. I'll double check.

But the other thing is that the variable iTunesStars doesn't change when this script runs.

SmartThings refugee, so happy to be on Indigo. Monterey on a base M1 Mini w/Harmony Hub, Hue, DomoPad, Dynamic URL, Device Extensions, HomeKitLink, Grafana, Plex, uniFAP, Fantastic Weather, Nanoleaf, LED Simple Effects, Bond Home, Camect.

Posted on
Sat May 14, 2016 4:36 pm
Different Computers offline
User avatar
Posts: 2533
Joined: Jan 02, 2016
Location: East Coast

Re: Rate songs and display their rating?

I fiddled with the applescript until I got it to work.

There's not much in the way of error checking in them, but if anyone wants them, I'll post them.

SmartThings refugee, so happy to be on Indigo. Monterey on a base M1 Mini w/Harmony Hub, Hue, DomoPad, Dynamic URL, Device Extensions, HomeKitLink, Grafana, Plex, uniFAP, Fantastic Weather, Nanoleaf, LED Simple Effects, Bond Home, Camect.

Page 1 of 1

Who is online

Users browsing this forum: No registered users and 8 guests