Jump to content
C4 Forums | Control4

Shuffle and Repeat with Napster not working


Adidaswood

Recommended Posts

Hi All, 
Consider the following code:  When I get to my custom playlists they don't shuffle, don't skip, or repeat.  The logic part works perfectly, but I end up on the each playlist wth the same order and the same first song.  I'm on 2.9 in case that is a consideration.

MusicButton.PNG

Link to comment
Share on other sites


Native napster right? I'm not really familiar. 

 

2 things to try 

1. Try removing all the variable stuff and just set shuffle on, select playlist and see what happens. (You don't have to delete all that code - just goto double tap or something open and then hit execute on programming page)

2. Move the shuffle command to room condition when power state changes if power is on, set shuffle on, if off set off. 

 

i have not messed with rhapsody since it became napster. It has worked before I can tell you that!

Link to comment
Share on other sites

Ok, #1 works fine.  just turn on shuffle and turn on the playlist no other code

also,  if I set the variable to 4 and run the code, the Christmas Playlist will start on shuffle but if i click execute again to send it back the chillin playlist it goes back to the old behavior.  So we know that turning on shuffle is possible.  What is it about this code that won't turn shuffle on every time?

 

Link to comment
Share on other sites

Did you try moving the shuffle on command to room power? You should only have to turn it on once per session. You have it in there 3 times. Also not a fan of the duplicate code at the bottom under the xmas variable 

 

you could move all that programming to when music variable changes and under 5 non Christmas time do set to 1

 

i dunno I'd have to play with it

 

lastly I can't see under whatever pop up is there. You sure that says shuffle ON?

Link to comment
Share on other sites

Why do you have a repeat command if you want to shuffle?

i was always under the impression repeat will repeat the song playing, not the whole playlist. 

Also, why are you skipping forward?  Seems like that is not needed to me unless you have a specific reason.

Link to comment
Share on other sites

Let me try to address a few of the questions and comments.

5 hours ago, knowitall said:

Did you try moving the shuffle on command to room power? You should only have to turn it on once per session. You have it in there 3 times. Also not a fan of the duplicate code at the bottom under the xmas variable 

you could move all that programming to when music variable changes and under 5 non Christmas time do set to 1

i dunno I'd have to play with it

lastly I can't see under whatever pop up is there. You sure that says shuffle ON?

I tried moving the shuffle command to the power state change function.  Doesn't seem to help or make a difference.  I also cleaned up the code to remove all the extra calls to shuffle.  doesn't help either.  the idea was the i might have to call shuffle each time i landed on a new playlist.

as for the duplicate code at the bottom.  Since this isn't a real loop i if i let it cycle up from 4 to 5 and christmas is false nothing plays.  so i have to reset it to 1 and call the playlist from 1 so that on the next click it will go to 2 again.  if I don't do that it goes to a blackhole when it reaches 5 or i have to push it twice which results sometimes in a double tap that does something else entirely.  Happy to hear suggestions on make this more efficient.

sorry about the pop didn't notice it until you pointed it out. yes it said shuffle On under there.

as for moving the code to "when music selection changes".  I'll have to look into that, I haven't tried that one yet.

2 hours ago, lippavisual said:

Why do you have a repeat command if you want to shuffle?

i was always under the impression repeat will repeat the song playing, not the whole playlist. 

Also, why are you skipping forward?  Seems like that is not needed to me unless you have a specific reason.

for repeat.  I think it really depends on the specific app as to how their repeat function works.  In Apple you can do repeat song or repeat playlist or album depending how many times you click the function.  From what I have experienced in the c4 app i only get the repeat playlist function, and the behavior I get is that it will repeat the entire playlist once it has exhausted the list.

I added the skip as a test to try and mitigate the always landing on the same first song issue, hasn't seemed to help either.

Link to comment
Share on other sites

So I don't think putting it under the variable event is working out too well.  At the end of the cycle when I reset the variable it skips off the current playlist because the variable changed.  I'm gonna have to rethink the logic if I want to keep it there.  However it hasn't changed the behavior so....

I am back to the original problem.  I appreciate all the current thoughts on this, but I think we need to get to the root of what is going on here.

when i select a playlist in the app, I launch it by pushing the shuffle button and if I switch to a new one again I push the shuffle button.  It works great if I'm using the phone app.  I don't understand why this code would be any different for these quick selections on the keypad...:unsure:

I must be missing something about how this works.

 

Link to comment
Share on other sites

So it work with just shuffle on and select playlist. Correct?

lets start there. 

 

Set varibale to 0 in the variable itself. Then keep your first line of code as you have it adding 1  delete everything else

Goto the variable in the event page of programming 

when music variable changes, if = 1 set shuffle, pick playlist. 

 

Test

if it works, set variable back to 0 manually, add second line of code if = 2 select play list. 

 

test

anf keep going with that. Also make sure you have removed the shuffle command from room on off

Link to comment
Share on other sites

I'll help you, but I'm confused as to what the problem is. Shuffling and repeat works, correct? Do you mind explaining the problem again? Also, can you post a picture of the entire script without anything blocking it? What's the purpose of the skip forward command? I just programmed a custom button to play, shuffle, and repeat a playlist and it works without any issue. The playlist starts with a different song every time I press the button.

Eddy

Link to comment
Share on other sites

10 hours ago, etrochez said:

I'll help you, but I'm confused as to what the problem is. Shuffling and repeat works, correct? Do you mind explaining the problem again? Also, can you post a picture of the entire script without anything blocking it? What's the purpose of the skip forward command? I just programmed a custom button to play, shuffle, and repeat a playlist and it works without any issue. The playlist starts with a different song every time I press the button.

Eddy

Let me summarize the issue.  My wife wife asked for a button that will play her favorite playlists with one click.  The ideas was with each button click to cycle through those favorites.  So she can click the button and playlist 1 starts, click the button and channel x starts, click the button and playlist 2 starts.  Here's where the problem comes in,  on the custom playlists it doesn't do shuffle or repeat consistenly.  We have some oddities in testing where shuffle and repeat will come on once (usually the first time), but won't stay enabled the next time I land on a custom playlist.  Additionally the playlists always start on the same song, so the skip forward was a feeble attempt to trick it into starting on a different song, but without Shuffle it just start on song two.  Hope that helps.

 

10 hours ago, knowitall said:

So it work with just shuffle on and select playlist. Correct?

lets start there. 

Set varibale to 0 in the variable itself. Then keep your first line of code as you have it adding 1  delete everything else

Goto the variable in the event page of programming 

when music variable changes, if = 1 set shuffle, pick playlist. 

Test

if it works, set variable back to 0 manually, add second line of code if = 2 select play list. 

test

anf keep going with that. Also make sure you have removed the shuffle command from room on off

10 hours ago, knowitall said:

Now that I think of it, you need to add code when kitchen turns off set variable to 0. That's probably the issue all along

Thanks for sticking with me Knowitall.

Starting from the beginning.  The variable is set to 0 "when the variable power state in the Kitchen changes" AND IF the Kitchen Room Power is Off.  Since I'm not turn the room on and off with each click of the button it never would go back to zero, unless I specifically say so where needed in my code.  Its been this way all along.  Additionally there are no shuffle commands in the power off routine.  Sorry if I wasn't clear about that.  The logic part of this has been working, it does the cycle as expected, including skipping Christmas if that variable is false.  

Ok here we go. I've cleared the code as we know it. and starting from scratch.

TEST 1 - Single If statement for playlist 1 - Pass, work as expected.

Music Variable is set to 0, On button click increment variable to 1, If variable is 1, Set Shuffle and select playlist 1.  

TEST 2 - Added 2nd If statement for playlist 2  - Pass, works as expected, except it doesn't matter if I call shuffle again or not.  I tried both ways.  I end up on Shuffle and repeat in either scenario.

Music variable is set to 0, On button click increments music to 1, If variable is 1, Set Shuffle and select playlist 1. Click button a send time variable is incremented to 2 and second playlist is selected.

Test 3 - add Christmas routine - Works fine.  Just need to work out some logic issues with when the variable changes but Shuffle and Repeat work great.

Test 4 - add a Napster Channel - Breaks.  Took that channel out and put a different playlist in and in cycles through everything perfectly keeping shuffle on.  Put the Channel back in and boom when you cycle back to a playlist it won't turn on shuffle.  To say this a different way, there is no change in the working code and the broken code, it is simple a matter of what media I'm choosing within Napster, Playlist vs. Channel.

 

I'm a little taken aback by this, seems like such a simple thing, I wonder if this is a napster or a control4 issue.  Now that I know I can work around it and implement this in all the rooms where we set up music buttons.

 

Knowitall thanks again for steering me to rebuild the code in steps.  That method allowed me to see each change in the code on its own.  Let me know if you guys want to see the working code.  

Thanks for the help everyone.

Link to comment
Share on other sites

Just now, Adidaswood said:

That was helpful which is how I originally figured out what code to add to set shuffle, but ultimately wasn't the issue.

Here is one other idea...do a test if shuffle is enabled, if it is, disable it. then start the stream, then shuffle, then advance a track

Link to comment
Share on other sites

I don't see a condition for testing if shuffle is enabled in the Digital Media events.  Only if in a session or not.

your suggestion is what I was originally trying setting shuffle and advancing a track. didn't seem to fire, even when I added long pauses in between steps.

Based on the testing above, I really think something isn't right on this.  call it a bug if you want. I dunno

Link to comment
Share on other sites

OK, these are my thoughts: The very first picture you posted is the right way to do it. You only need one variable. Referring to the first picture, remove the skip forward and pulse forward  from all the "if" statements. Use button press instead of tap. Tap has a delay, and press executes with no delays. Channels are Stations? Add "Turn Off shuffle" and "Repeat Off" before a Channel selection. Channels cannot be shuffled and keeping Shuffle On might be messing things up when jumping to the next playlist. 

Keep us posted. 

Link to comment
Share on other sites

is the "press" event triggered when the "Single Tap" event is triggered?

I would think I'd want to avoid running "press" code when all I intended was a double tap.  Just asking, because I've always wondered where Press and Release come in vs Just using a single tap.  The only thing I've been able to come up with is increasing Volume like on the UP/Down buttons.

 

Yes Channels are stations, in napster they call them stations and they are under radio.  in the programming medial selection dialog they are called channels as I believe that is what Rhapsody used to call them.  In either case the dialog box hasn't been updated.

Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.