Home of the Squeezebox™ & Transporter® network music players.
Page 2 of 3 FirstFirst 123 LastLast
Results 11 to 20 of 24
  1. #11
    Junior Member
    Join Date
    Mar 2017
    Posts
    9
    Quote Originally Posted by pippin View Post
    OP wants to run this code on the server
    Exactly.

    My setup is that both the LMS and software player (squeezelite) are running on the same Raspberry Pi - so I'm free to set up everything as a compact solution (no need to take into account any other possible players on the network...). See the attached image in my first post (the bottom enclosure is the amplifier, the server/player with LCD screen is on top).
    The LCD will respond to one server and only one (software) player on the same machine...

  2. #12
    Senior Member Greg Erskine's Avatar
    Join Date
    Sep 2006
    Location
    Sydney, Australia
    Posts
    1,174
    Quote Originally Posted by Den_HR View Post
    Exactly.

    My setup is that both the LMS and software player (squeezelite) are running on the same Raspberry Pi - so I'm free to set up everything as a compact solution (no need to take into account any other possible players on the network...). See the attached image in my first post (the bottom enclosure is the amplifier, the server/player with LCD screen is on top).
    The LCD will respond to one server and only one (software) player on the same machine...
    Hi Den_HR,

    But what happens WHEN you add a second player?

    I know you are doing a DIY solution to your requirements, but as soon as you get it going and talk about it, someone is going to ask.

    The Squeezebox/LMS environment is very much a client/server architecture, but this doesn't prevent you putting LMS and Squeezelite on the one RPi. Logitech started this trend on their Squeezebox Touch. Most, if not all, LMS/Squeezelite distributions allow you have the server and client on the one computer.

    regards
    Greg

  3. #13
    Senior Member pippin's Avatar
    Join Date
    Oct 2007
    Location
    Berlin
    Posts
    14,053
    Well. From what I can see as long as his player doesn't connect to another server it should still work if he'd just implement this as a plugin which strikes me most simple.
    Actually, I'd have a look at the server-side display rendering code for the ip3k players which does pretty much what the OP wants, just needs to be sent to this LCD instead of the player over SlimProto.
    @Den_HR have a look at the server-side code for Squeezebox, Squeezebox2, Transporter etc. all of their display content is rendered server-side.
    Also, there's Michael's NowPlaying display plugin (forgot the name, super alarm clock screen saver or something like that) which does similar things
    ---
    learn more about iPeng, the iPhone and iPad remote for the Squeezebox and
    Logitech UE Smart Radio as well as iPeng Party, the free Party-App,
    at penguinlovesmusic.com
    New: iPeng 9, the Universal App for iPhone, iPad and Apple Watch

  4. #14
    Junior Member
    Join Date
    Mar 2017
    Posts
    9
    Quote Originally Posted by Greg Erskine View Post
    Hi Den_HR,

    But what happens WHEN you add a second player?

    It doesn't really matter. The server will continue to serve music to a new player, but the built-in LCD will still show just the stuff that's intended for the local player (built-in Squeezelite)
    - or will it??? Haven't really thought about it.
    I guess I'll restrict the LCD display to the local (built-in) player only. From what I've seen by using telnet CLI, the feedback always starts with the player's MAC address - so I can always filter on that, and process only the subscription feedback that refers to the local (Squeezelite) player.
    The LMS server can always be used to serve other players (e.g. kitchen) - but there's no point in having the LCD showing what's playing on another player. For that, you just use a remote controller (smartphone, tablet, whatever...) in the room where the other player is located... At least that seems logical to me.
    Being able to use the same machine/device to "serve" other players on the network is a bonus, and this will probably be used in such scenario, but my main focus here is the LCD display on the LOCAL player (which also happens to be the server)

  5. #15
    Babelfish's Best Boy mherger's Avatar
    Join Date
    Apr 2005
    Location
    Switzerland
    Posts
    19,699

    Subscribing to server events from Python?

    > @Den_HR have a look at the server-side code for Squeezebox, Squeezebox2,
    > Transporter etc. all of their display content is rendered server-side.


    Before squeezelite Triode had an emulater called squeezeslave. This
    emulated a classic Squeezebox, incl. its UI. See eg. this thread:

    http://forums.slimdevices.com/showthread.php?98237

    It's in German, but you might follow some of the links to get further
    information.

    > Also, there's Michael's NowPlaying display plugin (forgot the name,
    > super alarm clock screen saver or something like that) which does
    > similar things


    Mine is called MusicInfo Screensaver (MusicInfoSCR, or MIS :-))

    --

    Michael

  6. #16
    Junior Member
    Join Date
    Mar 2017
    Posts
    9
    Seems to me I'm a bit over my head here, given my meagre programming skills

    I think I'll just start with what I have (telnet subscription + manual invocation of JSON data when necessary), and first have at least a semblance of a working notification system, and see what happens.

    The problems, as I can see now, will be parsing the telnet subscription feedback: but, like I said, I can always filter on feedback keywords (e.g. "mixer volume", "newsong", "pause"), and get the rest of the info in JSON format, if neccesary. We'll see how fast (or slow) it works.

    It would be nice to have some kind of a direct notification "hook" which lets me know when an event I'm interested in has happened, but I guess the above could work, too - in kind of a "roundabout" way

    Regards and thanks,

    Denis

  7. #17
    Senior Member pippin's Avatar
    Join Date
    Oct 2007
    Location
    Berlin
    Posts
    14,053

    Subscribing to server events from Python?

    But again: you did get the part that the subscriptions will NOT give you sub-second response times for volume, right? It will be delayed up to several seconds
    ---
    learn more about iPeng, the iPhone and iPad remote for the Squeezebox and
    Logitech UE Smart Radio as well as iPeng Party, the free Party-App,
    at penguinlovesmusic.com
    New: iPeng 9, the Universal App for iPhone, iPad and Apple Watch

  8. #18
    Junior Member
    Join Date
    Mar 2017
    Posts
    9
    Quote Originally Posted by pippin View Post
    But again: you did get the part that the subscriptions will NOT give you sub-second response times for volume, right? It will be delayed up to several seconds
    Hmmm, not sure about that...

    I've tested it with my IR remote, and the response/feedback on the subscribed telnet session in the console is pretty fast (less than a second - in any case fast enough for my purpose).

    I don't really care for the situation when the volume is changed using the web UI in another (web) client - in such situations the user is looking at the computer screen (or tablet or smartphone) anyway, so some lag on the LCD is acceptable.

    The main thing is that I'm doing this as a compact all-in-one solution, ant the LCD display is important when the whole thing is used "headless" - i.e. all commmands are issued via IR remote control. In this situation, it is important that the LCD response is as fast as possible. Any other situation (e.g. changing volume or song) using the web UI is not that critical, i.e. it's not a typical use case.

    In short, as I envision this: the user first creates a playlist using the web UI (or any of the available smartphone/tablet apps), and later controls everything using the IR remote control (start/stop, play/pause, next song, show extended info on LCD - bitrate, IP address, etc.). The system will also be shut down using the IR remote. So, basically, once you create a playlist, you don't need a remote client (app, web UI) any more for basic control.
    This is basically how I used my Squeezebox Classic for years

  9. #19
    Junior Member
    Join Date
    Mar 2017
    Posts
    9
    Update....

    I've managed to use telnet session to get the notifications I'm interested in (change of song playing, change of volume or pause/play), something like this (just the relevant part of the code, comments added for clarity):

    Code:
    # import libraries, preparation, definition of functions for later use
    
    # Now start main telnet session and listen
    p = subprocess.Popen('telnet 127.0.0.1 9090', stdin = subprocess.PIPE, stdout=subprocess.PIPE, stderr = None, shell=True)
    p.stdin.write("subscribe mixer,pause,stop,play,playlist newsong\n")
    # BTW, are there any other events one can subscribe to?
    
    for line in iter(p.stdout.readline, b''):
        # We got a new telnet socket event - see what it is
        line = line.rstrip()
        if (re.search('newsong', line) or re.search('volume', line) or re.search('pause', line) ) :  # use only the lines we're interested in, disregard other garbage
            # so, it's something we're subscribed to:
            print("Change detected!")
    
            if (re.search('newsong', line)): # check what has actually changed
    	      # use  string matching to get the title ('naslov')
    	      trash, naslx = line.split('newsong') # I'm getting just the part after "newsong", which is the actual title playing
    	      naslov = urllib.unquote(naslx.strip())
    	      print naslov
    	      # I'll send the title to LCD here, using LCD function
    
            if (re.search('volume', line)): # volume change
    	      # call volume show function
    
            if (re.search('pause', line)): # volume change
    	      # see whether it's paused or unpaused and act accordingly
    
    
    # other stuff goes here...
    This Python code runs as along as the server is on, and provides notification of change events, so that I can show them on LCD.

    Haven't really found anything more elegant...
    As far as volume change lag goes, the speed of reaction is quite OK, I'd say less than 1 second delay until the volume is shown on LCD - which is good enough for me

    So, this part of my problem is solved. Now I need to solve other stuff, but that shouldn't be much of a problem, since I already did a whole system for e.g. RuneAudio, and most of the code is reusable here...
    The code may seem rather primitive, which isn't surprising, since I'm not really a programmer: probably this could be more elegant, but what can I say - it works

    Regards,
    Denis

  10. #20
    Senior Member pippin's Avatar
    Join Date
    Oct 2007
    Location
    Berlin
    Posts
    14,053
    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
    ---
    learn more about iPeng, the iPhone and iPad remote for the Squeezebox and
    Logitech UE Smart Radio as well as iPeng Party, the free Party-App,
    at penguinlovesmusic.com
    New: iPeng 9, the Universal App for iPhone, iPad and Apple Watch

Posting Permissions

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