Coder Social home page Coder Social logo

heospy's People

Contributors

ping13 avatar ssbarnea avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar

heospy's Issues

Command not working

Hi,

Great plugin! But I can't get something to work. I would like to use this command:

heos://browse/play_input?pid=xxxx&input=inputs/hdmi_in_1
With Putty this command works.

The command I need to use with this Python script I think is:
heos_player browse/play_input -p input=inputs/hdmi_in_1

This results in a Missing Command arguments error.
Am I doing something wrong?

Greetings.

heos_player fails when performing any commands because of a lack of group ID

heos_player fails when performing any commands because of a lack of group ID failing at line 215, in _update_groups_players.

for example

2019-04-17 07:43:08,254 DEBUG telnet request heos://player/get_groups
2019-04-17 07:43:08,255 DEBUG starting response loop
2019-04-17 07:43:08,262 DEBUG ... unfinished response: {"heos": {"command": "player/get_groups", "result"
2019-04-17 07:43:08,264 DEBUG found valid JSON: {"payload": [], "heos": {"message": "", "command": "player/get_groups", "result": "success"}}
2019-04-17 07:43:08,265 DEBUG I assume this is the final response: {u'payload': [], u'heos': {u'message': u'', u'command': u'player/get_groups', u'result': u'success'}}
2019-04-17 07:43:08,266 DEBUG found valid response: {"payload": [], "heos": {"message": "", "command": "player/get_groups", "result": "success"}}
2019-04-17 07:43:08,267 ERROR I couldn't find a list of groups.
Traceback (most recent call last):
File "/usr/local/bin/heos_player", line 11, in <module>
load_entry_point('heospy==0.1.3', 'console_scripts', 'heos_player')()
File "build/bdist.linux-armv7l/egg/heospy/heos_player.py", line 385, in main
File "build/bdist.linux-armv7l/egg/heospy/heos_player.py", line 117, in __init__
File "build/bdist.linux-armv7l/egg/heospy/heos_player.py", line 215, in _update_groups_players
heospy.heos_player.HeosPlayerGeneralException: I couldn't find a list of groups.

(Thanks, Ian)

Error 1 with the install of heospy

Running: pip3 install heospy or python3 -m pip install heospy results in the same error.
There is something wrong in line 19 of setup.py See error log below.
No such file or directory: 'Readme.md'
What can be changed in setup.py?

pi@mcmellow-pi:~ $ python3 -m pip install heospy
Defaulting to user installation because normal site-packages is not writeable
Looking in indexes: https://pypi.org/simple, https://www.piwheels.org/simple
Collecting heospy
  Using cached heospy-0.1.4.tar.gz (13 kB)
    ERROR: Command errored out with exit status 1:
     command: /usr/bin/python3 -c 'import sys, setuptools, tokenize; sys.argv[0] = '"'"'/tmp/pip-install-bk3_spkt/heospy/setup.py'"'"'; __file__='"'"'/tmp/pip-install-bk3_spkt/heospy/setup.py'"'"';f=getattr(tokenize, '"'"'open'"'"', open)(__file__);code=f.read().replace('"'"'\r\n'"'"', '"'"'\n'"'"');f.close();exec(compile(code, __file__, '"'"'exec'"'"'))' egg_info --egg-base /tmp/pip-install-bk3_spkt/heospy/pip-egg-info
         cwd: /tmp/pip-install-bk3_spkt/heospy/
    Complete output (5 lines):
    Traceback (most recent call last):
      File "<string>", line 1, in <module>
      File "/tmp/pip-install-bk3_spkt/heospy/setup.py", line 19, in <module>
        long_description=open('Readme.md').read(),
    FileNotFoundError: [Errno 2] No such file or directory: 'Readme.md'
    ----------------------------------------
ERROR: Command errored out with exit status 1: python setup.py egg_info Check the logs for full command output.

errors in Python 2 and Python 3

orginal source: personal email

I trying to use heospy but I bump in to same error all the time.
I running heospy on a raspberry pi 3 and I have tried both python 2 and 3.
I have created a heos account and configured the config.json file.

##
python2 heos_player.py
Traceback (most recent call last):
  File "heos_player.py", line 18, in <module>
    import ssdp # Simple Service Discovery Protocol (SSDP), https://gist.github.com/dankrause/6000248
  File "/home/pi/scripts/heospy/ssdp.py", line 18, in <module>
    import http.client
ImportError: No module named http.client

##
python3 heos_player.py
  File "heos_player.py", line 312
    print json.dumps(all_results, indent=2)
             ^
SyntaxError: invalid syntax

eid=7&text=no proxy device provided error after firmware update

Hi, first of all thanks for writing such a nice wrapper!

I tried to run it when my leading device was a HEOS AMP HS2 but I kept getting the following error:

{
  "heos": {
    "command": "",
    "result": "fail",
    "message": "eid=7&text=no proxy device provided"
  },
  "heos_message_parsed": {
    "eid": "7",
    "text": "no proxy device provided"
  }
}

Then I switched to my HEOS Link and it worked perfectly, also on my HEOS 5.
However, when I updated the firmware of HEOS Link to latest I started getting the exact same error, no matter which command I tried to run.

I was wondering if anyone also faced the same issue, if yes I'd be interested in hearing how to fix it.
Thanks in advance!

Printing speaker name leads to malformatted json?

I'm trying to pipe data to "jq" as suggested in the Readme, but when I try I get 'Living Room' printed out and then an error from JQ telling me invalid character at line 1 char 8 (which is the space of 'Living Room').

I think this print is happening in heos_player.py line 120. Should this be a log message instead?

Work with more than one player.

The class HeosPlayer currently works with one HEOS player (as I only have one HEOS speaker). One should extend this to support multiple players, preferably with a default player for issuing commands.

The cache in the config.json file should contain the players, groups and sources.

default pid and default gid

python3 -m heospy.heos_player browse/play_stream -p url=....

this command fails because it missed a pid.
heos_player adds a gid (for all browse) commands, while this one requires a pid.

If I pass a pid it works, but what it means is that passing both a pid and a gid works too.
Can this be automated?

Moreover my player does not even have a group as it is alone, so the code is passing a pid as a gid. Is this correct?

Thumbs Up/Down

Is there any command to put a Thumbs Up or Thumbs Down to the playing file ?

Telnet timeout with python3

With python3, there is a telnet timeout:

osmc@osmc:~/dev/heospy$ python heos_player.py --rediscover --l DEBUG
2018-08-17 23:32:44,091 INFO Starting to discover your HEOS player 'Wohnzimmer' in your local network
2018-08-17 23:32:51,034 DEBUG Testing host '192.168.1.152'
2018-08-17 23:32:51,038 DEBUG Telnet '<telnetlib.Telnet instance at 0x76752ee0>'
2018-08-17 23:32:51,039 DEBUG telnet request heos://player/get_players
2018-08-17 23:32:51,061 DEBUG I assume this is the final response: {u'payload': [{u'name': u'Wohnzimmer', u'ip': u'192.168.1.115', u'pid': -1352658342, u'lineout': 0, u'gid': 941891005, u'version': u'1.466.190', u'model': u'HEOS 3', u'network': u'wifi'}, {u'name': u'K\xfcche', u'ip': u'192.168.1.152', u'pid': 941891005, u'lineout': 0, u'gid': 941891005, u'version': u'1.466.190', u'model': u'HEOS 1', u'network': u'wifi'}], u'heos': {u'message': u'', u'command': u'player/get_players', u'result': u'success'}}
2018-08-17 23:32:51,062 DEBUG found 'Wohnzimmer', looking for 'Wohnzimmer'
2018-08-17 23:32:51,063 DEBUG pid '-1352658342'
2018-08-17 23:32:51,064 INFO Found 'Wohnzimmer' in your local network
2018-08-17 23:32:51,064 DEBUG telnet request heos://system/check_account
2018-08-17 23:32:51,075 DEBUG I assume this is the final response: {u'heos': {u'message': u'signed_in&[email protected]', u'command': u'system/check_account', u'result': u'success'}}
2018-08-17 23:32:51,076 INFO Already signed in as [email protected]
2018-08-17 23:32:51,076 INFO Save host and pid in config.json
2018-08-17 23:32:51,078 INFO Nothing to do.
osmc@osmc:~/dev/heospy$ python3 heos_player.py --rediscover --l DEBUG
2018-08-17 23:32:58,297 INFO Starting to discover your HEOS player 'Wohnzimmer' in your local network
2018-08-17 23:33:04,791 DEBUG Testing host '192.168.1.115'
2018-08-17 23:33:04,818 DEBUG Telnet '<telnetlib.Telnet object at 0x765e4f10>'
2018-08-17 23:33:04,819 DEBUG telnet request heos://player/get_players
2018-08-17 23:33:09,840 ERROR timed out
2018-08-17 23:33:09,841 DEBUG Testing host '192.168.1.152'
2018-08-17 23:33:09,847 DEBUG Telnet '<telnetlib.Telnet object at 0x765e4f50>'
2018-08-17 23:33:09,848 DEBUG telnet request heos://player/get_players
2018-08-17 23:33:14,874 ERROR timed out
2018-08-17 23:33:14,875 DEBUG telnet request heos://system/check_account
2018-08-17 23:33:19,891 INFO Nothing to do.

Missing default pid for some browse commands

Try this

heos_player browser/play_stream -p url=http://direct.franceinfo.fr/live/franceinfo-midfi.mp3

it will fail because pid is missing.
The logic in

heospy/heospy/__init__.py

Lines 303 to 311 in f1ddeca

if ("groups/" in cmd or "group/" in cmd) and not gid_explicitly_given:
logging.info("I assume default group with id {0}".format(self.pid))
s = '{0}?gid={1}'.format(cmd, self.pid)
elif ("player/" in cmd or "players" in cmd) and not pid_explicitly_given:
logging.info("I assume default player with id {0}".format(self.pid))
s = '{0}?pid={1}'.format(cmd, self.pid)
else:
s = '{0}?dummy=1'.format(cmd) # use dummy so that
# args_concatenated is correctly attached
does not handle correctly browse commands.

I had already opened an issue a while ago #16 but it was not really fixed.

If it is too complicated to know which commands need a pid or a gid, why dont you add 2 flags to add default pid / gid. The user will know which commands need it.

heospy should be a pypi published package

heospy should be published on PYPI and installable from there.

I already made the required changes to do this and published the current version but I was not able to add @ping13 to owners. Please post you PYPI username (or register with the same github user) so I can add you.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.