Skip to Content
It is currently December 4th, 2023, 3:06 pm

All times are UTC - 6 hours [ DST ]




 [ 8 posts ] 
Author Message
PostPosted: October 3rd, 2019, 2:10 am 
Offline
New User
New User

Joined: October 3rd, 2019, 1:36 am
Posts: 12
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  
 
PostPosted: May 1st, 2020, 1:06 pm 
Offline
Junior User
Junior User

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

(!empty($user->lang['CODE'])) ? $user->lang['CODE'] : ucwords(strtolower(str_replace('_', ' ', '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  
 
PostPosted: May 1st, 2020, 9:33 pm 
Offline
SVS Member
SVS Member

Joined: December 6th, 2004, 9:00 am
Posts: 8306
Location: Cologne (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  
 
PostPosted: May 2nd, 2020, 12:38 am 
Offline
New User
New User

Joined: October 3rd, 2019, 1:36 am
Posts: 12
Mastacheata (!empty($user->lang['WROTE'])) ? $user->lang['WROTE'] : ucwords(strtolower(str_replace('_', ' ', '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  
 
PostPosted: May 2nd, 2020, 3:09 pm 
Offline
SVS Member
SVS Member

Joined: December 6th, 2004, 9:00 am
Posts: 8306
Location: Cologne (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  
 
PostPosted: May 3rd, 2020, 8:26 am 
Offline
SVS Member
SVS Member

Joined: May 8th, 2004, 9:00 am
Posts: 10572
Location: Denver, CO
Columban (!empty($user->lang['WROTE'])) ? $user->lang['WROTE'] : ucwords(strtolower(str_replace('_', ' ', '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  
 
PostPosted: March 21st, 2022, 11:20 pm 
Offline
New User
New User

Joined: May 9th, 2014, 10:36 pm
Posts: 2
Good day Graceway

I just need help with your JSON code, do i have to add SB SQL information in this code or just simply add this code in SAM server in .json extention and upload via FTP to web server?

graceway (!empty($user->lang['WROTE'])) ? $user->lang['WROTE'] : ucwords(strtolower(str_replace('_', ' ', 'WROTE'))):
Depending on your parameters, you could setup a JSON file to generate on song change.. something like this -

(!empty($user->lang['CODE'])) ? $user->lang['CODE'] : ucwords(strtolower(str_replace('_', ' ', '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.


Top
 Profile  
 
PostPosted: September 28th, 2022, 12:35 am 
Offline
Junior User
Junior User

Joined: April 27th, 2020, 6:15 pm
Posts: 44
These files live in your samHTMweb folder. The input files all start with _ .
In Config->HTML output->Generate HTML
select the files, one for input (in some sort of format i suggested), then any output file in any location named whatever you want. At that point the file will live on your computer and be updated on every song change.
You can also FTP the output file to where ever. Depending on your aptitude, you could watch the output file for changes with something like Chokidar and onChange, fire a script to have the output file sent somewhere with what ever means you desire, i.e. - mongoDB to hold the JSON file as a document.

Hope that made sense. The possibilities are endless once you get to know the input file syntax.


Top
 Profile  
 
Display posts from previous:  Sort by  
 [ 8 posts ] 

All times are UTC - 6 hours [ DST ]


Who is online

Users browsing this forum: No registered users and 16 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:  
cron
Powered by phpBB® Forum Software © phpBB Group