Home of the Squeezebox™ & Transporter® network music players.
Page 41 of 43 FirstFirst ... 313940414243 LastLast
Results 401 to 410 of 422
  1. #401
    Junior Member
    Join Date
    May 2021
    Posts
    2

    How to play a favorite / preset

    Hi forum,

    as this is my first post here - I would like to thank you all for providing all this great software and ideas!

    I am currently trying to build a kitchen-radio based on piCoreplayer running on a Raspberry PI Zero with a mono amp HAT on it. It really works great so far - and the first steps with piCoreplayer were really easy as everything is really well made and documented.

    My current problem is as following. I successfully installed and configured sbpd to work with 2 rotary encoders for volume and track control.

    As a next step I would like to play 3 radio stations I stored in LMS favorites by pressing a button. I have no clue on how to do this? I saw some of you in this thread are doing this -can you please point me into the right direction?

    I saw in sbpd Github Readme, you can call a SCRIPT by pressing a button - is this the way to go? Or do I need the KEY functionality? How does playing a favorite work? Is this a local command to picoreplayer / squeezelite or is there some API on my LMS I need to talk with? But how? Is there a documentation for it?

    If you have a working example this would be really helpful.

    Many thanks in advance!

  2. #402
    Senior Member
    Join Date
    Jun 2009
    Posts
    115
    Hi nigl,
    what have you done so far for your rotary encoders?
    Please post the content of your scripts/files.
    Then it should be easy to add the radio buttons for the favourites.

  3. #403
    Senior Member chill's Avatar
    Join Date
    Mar 2007
    Location
    Nottingham, UK
    Posts
    2,101
    Quote Originally Posted by nigl View Post
    As a next step I would like to play 3 radio stations I stored in LMS favorites by pressing a button. I have no clue on how to do this? I saw some of you in this thread are doing this -can you please point me into the right direction?
    I have the following commands defined in sbpd_commands.cfg
    Code:
    PRE1=["button","preset_1.single"]
    PRE2=["button","preset_2.single"]
    PRE3=["button","preset_3.single"]               
    PRE4=["button","preset_4.single"]               
    PRE5=["button","preset_5.single"]               
    PRE6=["button","preset_6.single"]
    Then I use the LMS presets editor to set up the presets, and I use PRE1, PRE2 etc in the sbpd script to select the corresponding player preset.

  4. #404
    Junior Member
    Join Date
    May 2021
    Posts
    2
    Thanks a lot for your replies.

    To tell the truth - it was late yesterday evening and I have not read the full thread yesterday . The answers were somewhere on page 9-11... It now works! The post in this thread that pointed me into the right direction was this one: https://forums.slimdevices.com/showt...l=1#post911473

    It explains on how to use arbitrary commands in sbpd config file.

    I want to share my solution if anybody is interested in it - there is one strange thing in it. If I do not specify a config file for sbpd the default commands "POWR" and "PLAY" are working out-of-the-box. If I specify a config file I need to explicitly specify them in the config file, otherwise they would no longer work.

    This is my sbpd-config-conf

    Code:
    POWR=["button","power"]
    PLAY=["pause"]
    FAV1=["favorites","playlist","play","item_id:0"]
    FAV2=["favorites","playlist","play","item_id:1"]
    FAV3=["favorites","playlist","play","item_id:2"]
    I am starting sbpd using this CLI

    Code:
    sbpd  -d -f /home/tc/sbpd-commands.cfg  e,27,17,VOLU  e,24,23,TRAC  b,22,POWR  b,5,PLAY  b,6,FAV1  b,16,FAV2  b,26,FAV3
    I also will have a look at the LMS presets editor as chill suggests.
    Last edited by nigl; 2021-05-18 at 23:29.

  5. #405
    Junior Member
    Join Date
    Jun 2021
    Posts
    8
    Well, I just read all 41 pages and thank you to all have done this already.

    Silly question though that I didn't see mentioned anywhere. Do I need to do any resistor networks/debounce circuits for interfacing with the GPIOs for either the push buttons or rotary encoders?

    I've not hooked anything up yet (nor loaded the extensions), rather I'm just plotting things in my head at work. Off hand, my intent is 2 alps rotary encoders (1x volume, 1x jivelite menu navigation) and probably 4 physical push buttons (to be determined).

  6. #406
    Senior Member paul-'s Avatar
    Join Date
    Jan 2013
    Posts
    4,363
    Rpi has internal pull-up/down resistors, set by software.

    The safest way to wire the button is to set the resisors as pull-up, and then connect the gpio pin to ground with the button. Do the same with encodersů.connect the center to ground.

    You can still get contacT bounce, but the software has debounce timers in the setup.
    piCorePlayer a small player for the Raspberry Pi in RAM.
    Homepage: https://www.picoreplayer.org

    Please donate if you like the piCorePlayer

  7. #407
    Junior Member
    Join Date
    Jun 2021
    Posts
    8
    Quote Originally Posted by paul- View Post
    Rpi has internal pull-up/down resistors, set by software.

    The safest way to wire the button is to set the resisors as pull-up, and then connect the gpio pin to ground with the button. Do the same with encodersů.connect the center to ground.
    Ok, that's what I was leaning toward, but wasn't sure.

    You can still get contacT bounce, but the software has debounce timers in the setup.
    Ditto. Was pretty sure it was accounted for, but not 100%

    Thanks! Now just to get the time to put it together.

  8. #408
    Junior Member
    Join Date
    Jun 2021
    Posts
    8
    finally have everything laid out on the table, hardware connected, but I think I'm still missing something (and it may be from reading TOO much in the thread).

    Encoder 1 is connected to GPIO 17, GND, GPIO27, with button on GPIO22 and 3.3V
    Encoder 2 is connected to GPIO5, GND, GPIO6, with button on GPIO13 and 3.3V

    script location: ~/spd.sh

    Code:
    #!/bin/sh                                                                                                                                                                                     
                                                                                                                                                                                                  
    # start pigpiod daemon                                                                                                                                                                        
                                                                                                                                                                                                  
    pigpiod                                                                                                                                                                                       
                                                                                                                                                                                                  
    # give the daemon a moment to start up before issuing the sbpd command                                                                                                                        
                                                                                                                                                                                                  
    sleep 1                                                                                                                                                                                       
                                                                                                                                                                                                  
    # load uinput module, then set the permission to group writable, so you don't need to run sbpd with root permissions                                                                          
                                                                                                                                                                                                  
    sudo modprobe uinput                                                                                                                                                                          
                                                                                                                                                                                                  
    sudo chmod g+w /dev/uinput                                                                                                                                                                    
                                                                                                                                                                                                  
    # issue the sbpd command                                                                                                                                                                      
                                                                                                                                                                                                  
    # This command will cause encoder to move selection right or left; Press=Enter; long press=down                                                                                               
                                                                                                                                                                                                  
    sbpd e,17,27,KEY:KEY_LEFT-KEY_RIGHT,4  b,22,KEY:KEY_ENTER,4,0,KEY:KEY_DOWN,500


    I get the following error:


    Code:
    tc@pCP:~$ ./spd.sh 
    2021-06-26 23:43:58 initCheckPermitted: 
    +---------------------------------------------------------+
    |Sorry, you don't have permission to run this program.    |
    |Try running as root, e.g. precede the command with sudo. |
    +---------------------------------------------------------+
    
    
    Can't initialise pigpio library
    sbpd: error while loading shared libraries: libcurl.so.4: cannot open shared object file: No such file or directory
    
    
    tc@pCP:~$ sudo ./spd.sh 
    2021-06-26 23:44:05 initInitialise: Can't lock /var/run/pigpio.pid
    Can't initialise pigpio library
    sbpd: error while loading shared libraries: libcurl.so.4: cannot open shared object file: No such file or directory
    tc@pCP:~$

  9. #409
    Senior Member paul-'s Avatar
    Join Date
    Jan 2013
    Posts
    4,363
    Make sure you used the extension provided by pCP. pcp-sbpd.tcz

    curl is a dependency of sbpd, and is loaded if you use our extension.
    piCorePlayer a small player for the Raspberry Pi in RAM.
    Homepage: https://www.picoreplayer.org

    Please donate if you like the piCorePlayer

  10. #410
    Junior Member
    Join Date
    Jun 2021
    Posts
    8
    Quote Originally Posted by paul- View Post
    Make sure you used the extension provided by pCP. pcp-sbpd.tcz

    curl is a dependency of sbpd, and is loaded if you use our extension.
    that might be the error then. I *think* I (originally) manually loaded sbpd without grabbing the pCP extension. I'll try purging and reinstalling in a bit.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •