Giter Site home page Giter Site logo

Comments (11)

balloob avatar balloob commented on August 15, 2024

That's interesting, that means that zeroconf returned a tuple instead of a string.

Locally on your machine, could you change /home/dobrien/pychromecast-master/pychromecast/init.py and add a new line before line 151 that says print(host) and tell me the output ?

from pychromecast.

CWempe avatar CWempe commented on August 15, 2024

I have the same issue.
So I added the print(host) you asked for.

root@htpc:/tmp/pychromecast-master# python ./example.py
(u'Wohnzimmer.local.', 8009)
Traceback (most recent call last):
File "./example.py", line 16, in
cast = pychromecast.get_chromecast()
File "/tmp/pychromecast-master/pychromecast/init.py", line 121, in get_chromecast
for ip in discover_chromecasts(1)]
File "/tmp/pychromecast-master/pychromecast/init.py", line 152, in init
self.host = socket.gethostbyname(host)
TypeError: must be string, not tuple
Exception AttributeError: "'Chromecast' object has no attribute 'socket_client'" in ignored

"Wohnzimmer" means "living room" in german and is the name of my chromecast.

from pychromecast.

balloob avatar balloob commented on August 15, 2024

For now, if you want to play with it, add a line before line 151 that says host = host[0]. I'll push a proper fix when I get back home tonight.

from pychromecast.

CWempe avatar CWempe commented on August 15, 2024

Thanks.

Now I get this:

root@htpc:/tmp/pychromecast-master# python ./example.py

DeviceStatus(friendly_name='Wohnzimmer', model_name='Eureka Dongle', manufacturer='Google Inc.', api_version=(1, 0))

CastStatus(is_active_input=False, is_stand_by=True, volume_level=1.0, volume_muted=False, app_id=u'E8C28D3C', display_name=u'Backdrop', namespaces=[u'urn:x-cast:com.google.cast.sse'], session_id=u'ED627B11-7A05-4A6E-0B1D-BE6DBEAC297C', transport_id=u'web-0', status_text='')

None

Playing media
No handlers could be found for logger "pychromecast.socket_client"
Traceback (most recent call last):
File "./example.py", line 40, in
"sample/BigBuckBunny.mp4"), "video/mp4")
File "/tmp/pychromecast-master/pychromecast/controllers/media.py", line 185, in play_media
self.send_message(msg, inc_session_id=True)
File "/tmp/pychromecast-master/pychromecast/controllers/init.py", line 77, in send_message
"application.").format(self.namespace))
pychromecast.error.UnsupportedNamespace: Namespace urn:x-cast:com.google.cast.media is not supported by runningapplication.

Do you want me to create a separate issue for this?
You may want to add some checks to prevent this error messages. :)

But no hurry.
I am not at home either. ;)

from pychromecast.

DanOBrien avatar DanOBrien commented on August 15, 2024

Here's what I've added to the init.py

    # Resolve host to IP address (line 150)
    print(host)
    host = host[0]
    print(host)
    self.host = socket.gethostbyname(host)

And here's the output:
~/pychromecast-master$ python example.py
(u'Living room.local.', 8009)
Living room.local.
Traceback (most recent call last):
File "example.py", line 16, in
cast = pychromecast.get_chromecast()
File "/home/dobrien/pychromecast-master/pychromecast/init.py", line 121, in get_chromecast
for ip in discover_chromecasts(1)]
File "/home/dobrien/pychromecast-master/pychromecast/init.py", line 154, in init
self.host = socket.gethostbyname(host)
socket.gaierror: [Errno -2] Name or service not known
Exception AttributeError: "'Chromecast' object has no attribute 'socket_client'" in ignored

from pychromecast.

balloob avatar balloob commented on August 15, 2024

Which platform are you running this on?

from pychromecast.

DanOBrien avatar DanOBrien commented on August 15, 2024

I'm on Ubuntu 12.04.5 LTS (GNU/Linux 3.2.0-74-generic i686)

from pychromecast.

CWempe avatar CWempe commented on August 15, 2024

Me too.

Ubuntu 12.04.5 LTS
3.2.0-74-generic
Python 2.7.3

btw: This time the example.py (with your modification) worked without errors.

from pychromecast.

balloob avatar balloob commented on August 15, 2024

It seems that zeroconf is enabled by default since Ubuntu version 9.04 but just as a sanity check, do you guys have zeroconf disabled maybe?

from pychromecast.

CWempe avatar CWempe commented on August 15, 2024

I am not sure how to check this.

But I am using an htpc (yaVDR with XBMC) and my nfs-shares are mounted via avahi.
I think it is like zeroconfig or uses it.

from pychromecast.

balloob avatar balloob commented on August 15, 2024

Avahi is the same, so that shouldn't be an issue then.

I have just pushed 2bee546 that should fix the discovery and make the example script work again, sorry about that.

I'll open a different issue for being unable to resolve the Chromecast hostname

from pychromecast.

Related Issues (20)

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.