Thank you for your donation!


Cloudsmith graciously provides open-source package management and distribution for our project.


Jump from playlist to playlist
#1
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   Huh

i am using version 6.4.2

Thank You LATEST RELEASE IS 6.4.2 LATEST RELEASE IS 6.4.2
Reply
#2
(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   Huh

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
Reply
#3
(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   Huh

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
Enjoy the Music!
moodeaudio.org | Mastodon Feed | GitHub
Reply
#4
(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   Huh

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
Reply
#5
@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
Reply
#6
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'])
Enjoy the Music!
moodeaudio.org | Mastodon Feed | GitHub
Reply
#7
(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 Blush

Regards,
Kent
Reply
#8
(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 Blush

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
Reply
#9
@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
Reply
#10
(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
Enjoy the Music!
moodeaudio.org | Mastodon Feed | GitHub
Reply


Forum Jump: