Posts: 25
Threads: 12
Joined: Feb 2020
Reputation:
0
02-29-2020, 01:54 PM
(This post was last modified: 02-29-2020, 01:57 PM by avior.)
Can someone please tell if is possible to move from playlist to playlist ? is there a cmd command or am i missing something ?
at the moment i am trying to use this command on momentary switches
mpc toggle this works
mpc next this works
mpc prev this works
/var/www/vol.sh up 10 this works
/var/www/vol.sh dn 10 this works
sudo poweroff this works
mpc load playlist1 dont work
mpc load playlist2 dont work
any idea what am doing wrong
i am using version 6.4.2
Thank You LATEST RELEASE IS 6.4.2 LATEST RELEASE IS 6.4.2
Posts: 6,218
Threads: 185
Joined: Apr 2018
Reputation:
251
(02-29-2020, 01:54 PM)avior Wrote: Can someone please tell if is possible to move from playlist to playlist ? is there a cmd command or am i missing something ?
at the moment i am trying to use this command on momentary switches
mpc toggle this works
mpc next this works
mpc prev this works
/var/www/vol.sh up 10 this works
/var/www/vol.sh dn 10 this works
sudo poweroff this works
mpc load playlist1 dont work
mpc load playlist2 dont work
any idea what am doing wrong 
i am using version 6.4.2
Thank You LATEST RELEASE IS 6.4.2 LATEST RELEASE IS 6.4.2
Do these playlists exist? You could ask mpc to be sure:
Code: pi@moodevu:~ $ mpc lsplaylists
Default Playlist
Favorites
pi@moodevu:~ $ mpc load Favorites
loading: Favorites
Regards,
Kent
Posts: 14,019
Threads: 319
Joined: Mar 2018
Reputation:
571
02-29-2020, 02:58 PM
(This post was last modified: 02-29-2020, 03:01 PM by Tim Curtis.
Edit Reason: eta
)
(02-29-2020, 01:54 PM)avior Wrote: Can someone please tell if is possible to move from playlist to playlist ? is there a cmd command or am i missing something ?
at the moment i am trying to use this command on momentary switches
mpc toggle this works
mpc next this works
mpc prev this works
/var/www/vol.sh up 10 this works
/var/www/vol.sh dn 10 this works
sudo poweroff this works
mpc load playlist1 dont work
mpc load playlist2 dont work
any idea what am doing wrong 
i am using version 6.4.2
Thank You LATEST RELEASE IS 6.4.2 LATEST RELEASE IS 6.4.2
U are using the GPIO button handler correct?
If the playlist name has embedded spaces it will not be parsed correctly because the code is splitting the CMD string using space as the delimiter. For example.
Code: >>>
>>> str = 'mpc load My Playlist'
>>> strList = str.split(' ')
>>> print strList
['mpc', 'load', 'My', 'Playlist']
>>>
For the upcoming r650 release I should probably change to a specific delimiter for CMD. Something like comma perhaps.
In the meantime use underscore instead of space. For example My_Playlist
-Tim
Posts: 25
Threads: 12
Joined: Feb 2020
Reputation:
0
02-29-2020, 05:48 PM
(This post was last modified: 02-29-2020, 05:52 PM by avior.)
(02-29-2020, 02:10 PM)TheOldPresbyope Wrote: (02-29-2020, 01:54 PM)avior Wrote: Can someone please tell if is possible to move from playlist to playlist ? is there a cmd command or am i missing something ?
at the moment i am trying to use this command on momentary switches
mpc toggle this works
mpc next this works
mpc prev this works
/var/www/vol.sh up 10 this works
/var/www/vol.sh dn 10 this works
sudo poweroff this works
mpc load playlist1 dont work
mpc load playlist2 dont work
any idea what am doing wrong 
i am using version 6.4.2
Thank You LATEST RELEASE IS 6.4.2 LATEST RELEASE IS 6.4.2
Do these playlists exist? You could ask mpc to be sure:
Code: pi@moodevu:~ $ mpc lsplaylists
Default Playlist
Favorites
pi@moodevu:~ $ mpc load Favorites
loading: Favorites
Regards,
Kent
thank you for your quick response
I have checked with mpc lsplaylists and it show all the lists
that i ve made
I have also change the number of the switch in the ui to see i not got faulty connection
but still the same thing it just wouldnt change
i ve tried
mpc load Default Playlist
mpc_load_Default Playlist
mpc_load_Default_Playlist
mpc load_Default_playlist
mpc load default_playlist
and same with just "Playlist"
but still no good yet the other cmd work
maybe i ll have wait for next version
Posts: 6,218
Threads: 185
Joined: Apr 2018
Reputation:
251
02-29-2020, 05:54 PM
(This post was last modified: 02-29-2020, 05:57 PM by TheOldPresbyope.)
@ avior
My apology for overlooking the dreaded space-character issue. Thank Tim for catching it.
<oops, hit return too soon>
Try, for example,
Code: mpc load "Default Playlist"
Regards,
Kent
Posts: 14,019
Threads: 319
Joined: Mar 2018
Reputation:
571
I don't think that will work. You prolly end up with below after string.split(' ')
Code: ['mpc', 'load', '"My', 'Playlist"']
OP could try the following to see if an error occurs
Code: pi@rp3:~ $ python
Python 2.7.16 (default, Oct 10 2019, 22:02:15)
[GCC 8.3.0] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> import os
>>> import subprocess
>>> subprocess.call(['mpc', 'load', 'Default Playlist'])
Posts: 6,218
Threads: 185
Joined: Apr 2018
Reputation:
251
(02-29-2020, 06:16 PM)Tim Curtis Wrote: I don't think that will work. ...
...
OP could try the following to see if an error occurs
Code: pi@rp3:~ $ python
Python 2.7.16 (default, Oct 10 2019, 22:02:15)
[GCC 8.3.0] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> import os
>>> import subprocess
>>> subprocess.call(['mpc', 'load', 'Default Playlist'])
Yeah, my bad twice-over. I was thinking only of the command line.
What you suggest at the end of your post is exactly what is in the code in my guide (so is the use of vol.sh)
I'm having a bad day wrestling a real-world problem. I should just ignore this distracting computer for a while
Regards,
Kent
Posts: 25
Threads: 12
Joined: Feb 2020
Reputation:
0
(02-29-2020, 06:35 PM)TheOldPresbyope Wrote: (02-29-2020, 06:16 PM)Tim Curtis Wrote: I don't think that will work. ...
...
OP could try the following to see if an error occurs
Code: pi@rp3:~ $ python
Python 2.7.16 (default, Oct 10 2019, 22:02:15)
[GCC 8.3.0] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> import os
>>> import subprocess
>>> subprocess.call(['mpc', 'load', 'Default Playlist'])
Yeah, my bad twice-over. I was thinking only of the command line.
What you suggest at the end of your post is exactly what is in the code in my guide (so is the use of vol.sh)
I'm having a bad day wrestling a real-world problem. I should just ignore this distracting computer for a while 
Regards,
Kent
thank you for reply this what i got
pi@moode:~ $ python
Python 2.7.16 (default, Oct 10 2019, 22:02:15)
[GCC 8.3.0] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> import os
>>> import subprocess
>>> subprocess.call(['mpc', 'load', 'Default Playlist'])
loading: Default Playlist
0
Posts: 6,218
Threads: 185
Joined: Apr 2018
Reputation:
251
03-01-2020, 01:49 PM
(This post was last modified: 03-01-2020, 01:53 PM by TheOldPresbyope.)
@ avior
Ok, that test returned 0 which means it was successful. You should have seen the tracks in the Default Playlist appear on the playback screen.
It's been difficult to determine how you are going wrong because you reference Remy's Python script for momentary switches but you keep showing us command line syntax instead of your code in your posts.
In Remy's script, switch "pl2" is programmed to load his example playlist named "MUSIC_STREAM"
Code: ...
elif pl2_switch == False:
subprocess.call(['mpc','clear' ])
subprocess.call(['mpc','load','MUSIC_STREAM' ])
...
If you change that 'MUSIC_STREAM' to 'Default Playlist' you should get the behavior you want for switch "pl2". Obviously this can be done for the switch of choice.
Note that Remy was a bit overcautious with his admonition to "Make sure no spaces on playlists names."
Regards,
Kent
Posts: 14,019
Threads: 319
Joined: Mar 2018
Reputation:
571
(03-01-2020, 12:31 PM)avior Wrote: thank you for reply this what i got
pi@moode:~ $ python
Python 2.7.16 (default, Oct 10 2019, 22:02:15)
[GCC 8.3.0] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> import os
>>> import subprocess
>>> subprocess.call(['mpc', 'load', 'Default Playlist'])
loading: Default Playlist
0
Now try below with underscore in the playlist name.
Code: subprocess.call(['mpc', 'load', 'Default_Playlist'])
If this works then in GPIO button handler CMD field specify the string below substituting your own playlist name. Just make sure it does not contain any embedded spaces for example DefaultPlaylist, Default_Playlist, My_Playlist, MyPlaylist, etc.
Code: mpc load Default_Playlist
|