Home of the Squeezebox™ & Transporter® network music players.
Page 3 of 3 FirstFirst 123
Results 21 to 24 of 24
  1. #21
    Junior Member
    Join Date
    Mar 2017
    Posts
    9
    Quote Originally Posted by pippin View Post
    How does the IR control work? Does it change the player volume and the player reports it back to the server or does it send volume commands to the server? The latter ones are what gets aggregated for me.

    That said: there's a difference whether you subscribe to volume change events (which will mirror back all volume commands to your client immediately) or whether you subscribe to status updates for a specific player, these get delayed, especially if you e.g. do several volume changes quickly after another
    Here's my code for volume change (volume up 10%), done via bash script, which is invoked by IR remote via lirc:

    Code:
    #!/bin/bash
    (echo "mixer volume +10")|nc -w1 localhost 9090
    So, I'm issuing commands directly to the server.

    However, in order to avoid "aggregating" multiple volume commands, I disable the repeat on the volume keys, and have two (sometimes even three) sets of volume keys:
    - one for "fine" volume adjustment (5% or 10%); and
    - one for large volume change (20% or even 30%).

    So, basically, I have two sets of volume keys - one set changes folume by 10 percent, and the other is for 30%. That way there's no need for repeating keys - which would lead to problems with LCD feedback.

    Rgds,
    Denis

  2. #22
    Junior Member
    Join Date
    Oct 2013
    Posts
    2

    Python jsonrpc

    I know that trying to get jsonrpc and comet to work with python can be a bit intimidating but it is possible and can work extremely well. I dont have time today to do a comet example but if you get stuck I can help over the next few weeks.

    1) See below for a few lines of python that can do a jsonrpc. It is lightly tested and uses a library ( python-jsonrpc ) that I found today. When I did this the first time about 5 years ago I had to write it from very low level python. I remember that there were some things where slim did not respond as I would have expected a standard jsonrpc to respond. If you have trouble let me know I can try to figure it out.

    2) squeezebox server logging is your firend. turn on debug logging for jsonrpc and cometd. Then you should be able to see the jsonrpcs required to make comet work. If you get stuck let me know, agian I can try to help.

    If it can wait a few weeks I can write a proper python lib for this.

    FYI, use of python -> squeezebox jsonrpc and cometd is used in the comercial prodiucts I developed for VOCO http://www.myvoco.com You will be able to make it work and it can be very robust.

    Good Luck
    Michael Frank



    #!/usr/bin/python

    import pyjsonrpc #pip install python-jsonrpc
    import json
    import pprint

    server_ip = '192.168.10.4'
    request = {"method": "slim.request",
    "params": ["",["players",0,999]],
    "id": "1"}
    jrequest = json.dumps(request)
    http_client = pyjsonrpc.HttpClient(url = "http://%s:9000/jsonrpc.js" % server_ip)
    result = http_client.call("slim.request","",["players",0,10])

    pprint.pprint(result)


    Quote Originally Posted by pippin View Post
    OP wants to run this code on the server

  3. #23
    Senior Member DJanGo's Avatar
    Join Date
    Sep 2005
    Location
    Germany
    Posts
    2,372
    Quote Originally Posted by Den_HR View Post
    Update....
    Code:
    p = subprocess.Popen('telnet 127.0.0.1 9090'...
    Haven't really found anything more elegant...
    You didnt search enough

    "subprocess.Popen('telnet 127.0.0.1 9090'" has nothing to do with elegant .

    Search for the lcd Threads here - there are tons of it.

  4. #24
    Junior Member
    Join Date
    Mar 2010
    Posts
    24
    There's a python library built on the telnet interface that you could perhaps use:

    https://github.com/jinglemansweep/PyLMS

    If you're going down the cometd route, these two could be relevant:

    https://github.com/dkmadigan/python-.../master/bayeux

    https://github.com/SalesforceFoundation/python-bayeux

    Possibly with JSON-RPC for controlling.

    tor arne

Posting Permissions

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