Skip to Content
It is currently May 25th, 2020, 12:57 am

All times are UTC - 6 hours [ DST ]




Post new topic Reply to topic  [ 6 posts ] 
Author Message
PostPosted: October 3rd, 2019, 2:10 am 
Offline
New User
New User

Joined: October 3rd, 2019, 1:36 am
Posts: 10
Currently we can show the request button on all songs.
User clicks on button, if song/artist (based on settings) qualifies, it simply is successful and request is made.
However, if not possible, user gets an error message saying they cannot.

My question is...
Can we simply not show the Request button if an error message would be generated?
So, only show the request button to any songs that would succesfully request?
It is not good for users to see error messages on a site. It would be better to simply not see the button if it would generate that failed request instead.

A while back, I remember seeing someone that had something similar, where they did show the Request button to all, but it was not clickable if it was not possible and on rollover (hover) of the button would say something like "Available for request in 2 minutes" or sometype of countdown that told the user when that song qualified for a request. That too would work, but I was not able to find that site or post again.

Any possible solutions here?

Thank you.


Top
 Profile  
Reply with quote  
PostPosted: May 1st, 2020, 1:06 pm 
Offline
New User
New User

Joined: April 27th, 2020, 6:15 pm
Posts: 13
Depending on your parameters, you could setup a JSON file to generate on song change.. something like this -

Code:
"history": [
<!--songlist.START=0-->
<!--songlist.LIMIT=2500-->
  <!--LOOP(songlist)-->
   {
      "title": "$songlist.title$",
      "artist": "$songlist.artist$",
      "album": "$songlist.album$",
      "minsec": "$songlist.mmss$",
      "combine": "$songlist.combine$",
     "duration": $songlist.duration$,
      "picture": "$songlist.picture$",
      "buycd": "$songlist.buycd$",
      "songid": "$songlist.songID$",
     "feedback": {
      "likes": 0,
      "dislikes": 0
     }
    },
  <!--LOOP_END-->
]



set the song limit to whatever your threshold of how long it must be before the song can be played again.

Then set up a watcher in your php script to check the output JSON file, and if the song id exists in the history, make the visibility: none, or have create a throw.warning that pops up to let them know why they can't choose that song.

anyway,
hope that helps.


Last edited by Mastacheata on May 1st, 2020, 9:29 pm, edited 1 time in total.
Please use CODE tags for pasting Code


Top
 Profile  
Reply with quote  
PostPosted: May 1st, 2020, 9:33 pm 
Offline
SVS Member
SVS Member

Joined: December 6th, 2004, 9:00 am
Posts: 7968
Location: Aachen (Germany)
That is not outputting valid JSON (trailing comma inside the array, missing curly brace around the outermost object), but the idea is not bad.

It might be simpler to just edit the PHP code itself. I got no idea how this post went unnoticed for so long.
If the original author is still interested and might want to tell us about his/her programming skills and whether they use PHP or HTML templates, we might want to help you find a more detailed solution.

_________________
Benedikt Bauer - SVS (Spacial Volunteer Support)

Shop for readymade PAL scripts by countrywesterndj - Or get a custom script made by me (or others)

My Project:
Send "Now Playing" from SAM to Twitter and/or Facebook | Sourcecode


Top
 Profile  
Reply with quote  
PostPosted: May 2nd, 2020, 12:38 am 
Offline
New User
New User

Joined: October 3rd, 2019, 1:36 am
Posts: 10
Mastacheata wrote:
If the original author is still interested and might want to tell us about his/her programming skills and whether they use PHP or HTML templates, we might want to help you find a more detailed solution.


We are using PHP templates and have experience with PHP but not with these templates or database so not sure how we would show or hide anything as we explained above. Any guide or support would be much appreciated.


Top
 Profile  
Reply with quote  
PostPosted: May 2nd, 2020, 3:09 pm 
Offline
SVS Member
SVS Member

Joined: December 6th, 2004, 9:00 am
Posts: 7968
Location: Aachen (Germany)
The problem with this request is that the PHP templates have no idea about your request rules.
You can modify the templates / the Song class to read the same information SAM uses for the repeat rules. (something like last_played, last_played_artist, last_played_album and last_played_title - Don't know the full column names from the top of my head)

So you modify the SQL query for fetching the songlist to include these fields and then add a new property to the Song Class to designate whether or not the song is requestable. You can either perform those calculations in SQL or PHP.
In the actual display/plalist.php you can then check the $song->requestable (or whatever you named the property) field and either display the request button or hide it/don't output it at all.

This is as deep as I can go from the top of my head. If you have any specific things you have problems with, feel free to ask.

The other option is to simply hand over some money for the script to be made/adapted for you. (I usually offer specific help for free no matter how long it takes, but will charge money for full scripts/hands-on support)

_________________
Benedikt Bauer - SVS (Spacial Volunteer Support)

Shop for readymade PAL scripts by countrywesterndj - Or get a custom script made by me (or others)

My Project:
Send "Now Playing" from SAM to Twitter and/or Facebook | Sourcecode


Top
 Profile  
Reply with quote  
PostPosted: May 3rd, 2020, 8:26 am 
Offline
SVS Member
SVS Member

Joined: May 8th, 2004, 9:00 am
Posts: 10488
Location: Denver, CO
Columban wrote:
A while back, I remember seeing someone that had something similar, where they did show the Request button to all, but it was not clickable if it was not possible and on rollover (hover) of the button would say something like "Available for request in 2 minutes" or sometype of countdown that told the user when that song qualified for a request. That too would work, but I was not able to find that site or post again.

Any possible solutions here?

Thank you.
That would be my site, https://5280jazz.com

You must be a registered user in order to request. Check out the request area for the currently playing artist and if my site is what you had in mind I can show the code behind it. It is not a stock SAM template however.

_________________
- Rob Oyler, SVS
Image


Top
 Profile  
Reply with quote  
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 6 posts ] 

All times are UTC - 6 hours [ DST ]


Who is online

Users browsing this forum: Google [Bot] and 7 guests


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
Powered by phpBB® Forum Software © phpBB Group