elparaguayo / lmstools Goto Github PK
View Code? Open in Web Editor NEWPython library for interacting with Logitech Media Servers
License: Other
Python library for interacting with Logitech Media Servers
License: Other
I was unable to identify a property for the player power state. Have managed to work around by adding the following into player.py:
@property
def power(self):
"""
Player power state.
:getter: retrieve power state of player
:rtype: bool
:returns: True if on, False if off
:setter: set power state of player on server(True = On)
"""
if self.parse_request("power ?", "_power") == "1":
return True
else:
return False
@power.setter
def power(self, power):
try:
if power == True:
self.request("power {}".format("1"))
elif power == False:
self.request("power {}".format("0"))
self._power = power
except:
pass
I was super excited to find this code. It's exactly what I need for an ePaper/Rasperry Pi SqueezeBox that I'm building.
Is there any chance you are going to continue to maintain this and move it to Python 3?
I tried to migrate it to python 3, but failed miserably. The python 3 urllib2->urllib mess breaks something deep within the guts.
I haven't had the pythonFu to figure out what goes wrong, but the symptoms are pretty interesting:
server = LMSServer('media-server.local')
print(server.get_player_count())
>>> 0
The same code run under python2 works just fine. Clearly something's busted.
When attempting to use the LMSPlayer class directly with a MAC address that is not connected on the Logitech Media Server the following error occurs:
LMSTools/LMSTools/player.py", line 121, in parse_request
return self.request(command).get(key)
AttributeError: 'NoneType' object has no attribute 'get'
I have been able to resolve this by checking if the self.request(command) is None before attempting the attribute get(key):
rcommand = self.request(command)
if rcommand == None:
return None
else:
return rcommand.get(key)
However think this could be better resolved by checking if the player is present on the server during init
Player should be able to confirm if event refers to the specified player or a player in the same sync group.
Hi, thanks for the work you did on this project. It is very well done & documented. Is it possible to to interrupt the current playlist, play a song then revert back to the original playlist?
I want to integrate LMSTools into Domoticz and make an announcement when some event has happened. For example it's 10 pm and the garage is open or someone is ringing the door bell.
I have all my announcements in a playlist & I just need to select the particular song to play then I want to revert the squeezebox back to where & what it was doing before the announcement.
thanks
why wouldn't this return a list of player instances rather then the names and MACs?
and could player.get_synced_players() (optionally) also return the number of the sync group, assuming that is a static number.
Hi,
I tried to add an album to an playlist, which worked, but not with non-ascii-characters in the name....
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import os, sys
from LMSTools import LMSServer
# Define your server address
SERVER_IP = "192.168.120.4"
# create the server object
server = LMSServer(SERVER_IP)
# get the attached players
players = server.get_players()
# print players
sl = server.get_players()[1]
print sl
# sl.stop()
sl.play()
# Works :)
sl.request('playlist loadalbum * Metallica Load')
# Both do not work:
# sl.request('playlist loadalbum * Der%20Grüffelo Der%20Grüffelo')
# sl.request('playlist loadalbum * Der Grüffelo Der Grüffelo')
Any hints?
Thx,
ramon
Duplicate.
Apologies.
See issue #13
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.