Coder Social home page Coder Social logo

catt's Introduction

Cast All The Things

image image image

Cast All The Things allows you to send videos from many, many online sources (YouTube, Vimeo, and a few hundred others) to your Chromecast. It also allows you to cast local files or render websites.

Installation

You can install Cast All The Things with pipx:

pipx install catt

Or with pip, but that's not as good:

pip3 install catt

catt is only compatible with Python 3. If you need a Python 2-compatible version, please install 0.5.6, the last py2-compatible release.

Usage

To use Cast All The Things, just specify a URL:

catt cast "https://www.youtube.com/watch?v=dQw4w9WgXcQ"

catt supports any service that yt-dlp supports, which includes most online video hosting services.

catt can also cast local files (if they're in a format the Chromecast supports natively):

catt cast ./myvideo.mp4

You can also control your Chromecast through catt commands, for example with catt pause. Try running catt --help to see the full list of commands.

If you have subtitles and the name is similar to the name of the local file, catt will add them automatically. You can, of course, specify any other subtitle if you want. Although Chromecast only supports WEBVTT, TTML and Line 21 subtitles, catt conveniently converts SRTs to WEBVTT for you on the fly. Here is how to use it:

catt cast -s ./mysubtitle.srt /myvideo.mp4

catt can also tell your Chromecast to display any website:

catt cast_site https://en.wikipedia.org/wiki/Rickrolling

Please note that the Chromecast has a slow CPU but a reasonably recent version of Google Chrome. The display resolution is 1280x720.

If you want to pass yt-dlp options to catt through the [-y]{.title-ref} command-line flag, you need to use yt-dlp's internal option name, rather than its command-line name.

If you notice that catt stops working with video sites (YouTube, Vimeo, etc), just upgrade yt-dlp with [pip install -U yt-dlp]{.title-ref} and that will probably fix it. This is because sites keep changing and yt-dlp is updated very regularly to keep them all working.

You can also run catt in Docker, if you prefer:

docker run --net=host --rm -it python:3.7 /bin/bash -c "pip install catt; catt cast 'https://www.youtube.com/watch?v=dQw4w9WgXcQ'"

Configuration file

CATT can utilize a config-file stored at ~/.config/catt/catt.cfg (%APPDATA%\catt\catt.cfg on Windows, ~/Library/Application Support/catt/catt.cfg on macOS).

The format is as following:

[options]
device = chromecast_one

[aliases]
one = chromecast_one
two = chromecast_two

In the [options] section, device denotes the default device that will be selected, when you have not selected a device via the cli.

You can write your choice of default device to catt.cfg by doing:

catt -d <name_of_chromecast> set_default

In the [aliases] section, you can specify aliases for the names of your chromecasts. You can then select a device just by doing:

catt -d <alias> <command>

You can write an alias name for a device to catt.cfg by doing:

catt -d <name_of_chromecast> set_alias <alias>

Firewall

For the casting of local files to work you need to allow in the port range 45000-47000 over tcp.

Contributing

If you want to contribute a feature to catt, please open an issue (or comment on an existing one) first, to make sure it's something that the maintainers are interested in. Afterwards, just clone the repository and hack away!

To run catt in development, you can use the following command:

python -m catt.cli --help

Before committing, please make sure you install pre-commit and install its hooks:

pip install pre-commit
pre-commit install

That's all, now you can commit and the hooks will run. Black (which is used to format the code) requires Python 3.6 to run, but please make the effort, as our CI will yell at you if the code is not formatted, and nobody wants that.

Thanks!

Info

  • Free software: BSD license

Features

  • Casts videos to Chromecast
  • From many, many online sources
  • Casts local files (videos, photos and music)
  • Casts any website to Chromecast

Thanks

Catt would not be possible without these great projects:

  • pychromecast - Library for Python 3 to communicate with the Google Chromecast
  • yt-dlp - Command-line program to download videos from YouTube.com and other video sites
  • casttube - YouTube Chromecast API

catt's People

Contributors

anthonyrocom avatar bronikowski avatar choffee avatar edwardbetts avatar greatteacheroni avatar hamiltlr avatar hvdb avatar iancal avatar konubinix avatar l1l0l avatar m1k1o avatar marcosdiez avatar mk12 avatar mweinelt avatar neurodiv-eric avatar ofek avatar poorchop avatar skorokithakis avatar soreau avatar srd424 avatar theychx avatar vext01 avatar xybydy 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  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  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  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

catt's Issues

Traceback error

Traceback (most recent call last):
File "/usr/local/bin/catt", line 6, in
from catt.cli import main
File "/usr/local/lib/python2.7/dist-packages/catt/cli.py", line 7, in
from pathlib import Path
ImportError: No module named pathlib


What can I do to fix this??

make get_chromecasts accessible from the CLI

When I first installed catt I had an issue and the first thing I looked to do was to check if it was recognizing my chromecast. I looked to see if there was a way to ping for chromecasts using the cli and since there wasn't I ended up looking around until I found the get_chromecasts in controllers.py.

It would be helpful to extend get_chromecasts so that you can ask for that information straight from the CLI. This also has the advantage of being part of the --help documentation so users know what to do.

A suggested implementation would be:

catt get_chromecasts

to return a prettyprinted version of the info that the get_chromecasts already returns.

cast_site throws error

When trying to cast a URL, it produces the following error. Any idea what I might be missing?

catt cast_site "http://www.google.com"
Exception in thread Thread-1:
Traceback (most recent call last):
  File "/usr/lib/python3.5/threading.py", line 914, in _bootstrap_inner
    self.run()
  File "/home/pi/.local/lib/python3.5/site-packages/pychromecast/socket_client.py", line 341, in run
    if self.run_once() == 1:
  File "/home/pi/.local/lib/python3.5/site-packages/pychromecast/socket_client.py", line 406, in run_once
    function(data)
  File "/home/pi/.local/lib/python3.5/site-packages/pychromecast/socket_client.py", line 830, in <lambda>
    self._block_till_launched(app_id))
  File "/home/pi/.local/lib/python3.5/site-packages/pychromecast/socket_client.py", line 843, in _block_till_launched
    app_id, self.launch_failure.reason))
pychromecast.error.LaunchError: Failed to launch app: 84912283, Reason: NOT_FOUND

Local file casting issues

Howdy

Trying to cast this media file on my CC Ultra:
youtube-dl -f "best[width <=? 3840][height <=? 2160]" https://vimeo.com/225888984
as a local file, results in this traceback:

Traceback (most recent call last):
  File "/home/benno/projects/chromecast/catt/catt/http_server.py", line 40, in do_GET
    self.wfile.write(data)
  File "/usr/lib/python3.6/socketserver.py", line 775, in write
    self._sock.sendall(b)
BrokenPipeError: [Errno 32] Broken pipe
192.168.0.188 - - [27/Feb/2018 12:43:54] "GET / HTTP/1.1" 200 -
Traceback (most recent call last):
  File "/home/benno/projects/chromecast/catt/catt/http_server.py", line 40, in do_GET
    self.wfile.write(data)
  File "/usr/lib/python3.6/socketserver.py", line 775, in write
    self._sock.sendall(b)
ConnectionResetError: [Errno 104] Connection reset by peer

Served from a DLNA-server, the file plays fine (I did check transcoding settings).

It would be nice to have this fixed, before we axe py2 support. I tried tinkering a bit with the server module, but to no avail.

Upon further investigation, this does not appear to be bitrate related. The Chromecast and the server script are somehow confusing each other when trying to cast certain types of videos. Please note that all the media files that I have had issues with originated from Vimeo (and that regular casting of Vimeo videos with catt is also flakey).

Random playlist

Would it be possible to add the ability to play random video off a playlist?

rtsp support

catt is a gem! thx a lot.
I will use it in my home automation. I am using Home Assistant maybe I will try to integrate catt with it, with a customs component or addon.

I able to cast video from "Android IP Webcam app", with the build-in webserver in the app. Great!

I have others cam, streaming RTSP flux. I try to cast it, but i got this error
ERROR: Unable to download webpage: <urlopen error unknown url type: rtsp> (caused by URLError('unknown url type: rtsp',))
The flux should be convert in a format compatible for the ChromeCast I guest... maybe it's something catt can do on the fly ?

DefaultCastController object has no attribute clear

In v0.9.2, when I run:

catt clear

I get the following error:

Traceback (most recent call last):
  File "/usr/local/bin/catt", line 10, in <module>
    sys.exit(main())
  File "/usr/local/lib/python3.7/site-packages/catt/cli.py", line 472, in main
    return cli(obj={}, default_map=readconfig())
  File "/usr/local/lib/python3.7/site-packages/click/core.py", line 764, in __call__
    return self.main(*args, **kwargs)
  File "/usr/local/lib/python3.7/site-packages/click/core.py", line 717, in main
    rv = self.invoke(ctx)
  File "/usr/local/lib/python3.7/site-packages/click/core.py", line 1137, in invoke
    return _process_result(sub_ctx.command.invoke(sub_ctx))
  File "/usr/local/lib/python3.7/site-packages/click/core.py", line 956, in invoke
    return ctx.invoke(self.callback, **ctx.params)
  File "/usr/local/lib/python3.7/site-packages/click/core.py", line 555, in invoke
    return callback(*args, **kwargs)
  File "/usr/local/lib/python3.7/site-packages/click/decorators.py", line 27, in new_func
    return f(get_current_context().obj, *args, **kwargs)
  File "/usr/local/lib/python3.7/site-packages/catt/cli.py", line 256, in clear
    cst.clear()
AttributeError: 'DefaultCastController' object has no attribute 'clear'

readme - usage

The usage section of readme has an example of cast_site, but the actual command seems to be cast_url.

Cannot start

Just installed (on OSX 10.13.3).

% catt cast "https://www.youtube.com/watch?v=dQw4w9WgXcQ"
Traceback (most recent call last):
  File "/Library/Frameworks/Python.framework/Versions/3.5/bin/catt", line 11, in <module>
    sys.exit(main())
  File "/Library/Frameworks/Python.framework/Versions/3.5/lib/python3.5/site-packages/catt/cli.py", 
line 380, in main
    return cli(obj={}, default_map=readconfig())
  File "/Library/Frameworks/Python.framework/Versions/3.5/lib/python3.5/site-packages/catt/cli.py", line 370, in readconfig
    config.read(CONFIG_PATH)
  File "/Library/Frameworks/Python.framework/Versions/3.5/lib/python3.5/configparser.py", line 693, in read
    for filename in filenames:
TypeError: 'PosixPath' object is not iterable

YouTubeController: Error when launching youtube app

Hey,

I am using only your YouTubeController in an own python script.

Basically i have a NFC reader and launching videos depending on which nfc id (toy figures) is detected. (for the kid)

I have one problem, when the YouTube app is not launched on the ChromeCast yet. I get following output:

INFO:pychromecast.controllers:Receiver:Launching app 233637DE
DEBUG:pychromecast.socket_client:Sending: Message urn:x-cast:com.google.cast.receiver from sender-0 to receiver-0: {'type': 'LAUNCH', 'requestId': 3, 'appId': '233637DE'}
Traceback (most recent call last):
File "test_cast.py", line 51, in
yt.play_video("wOMwO5T3yT4")
File "/_code/yt_controller.py", line 330, in play_video
self.start_new_session(youtube_id)
File "/_code/yt_controller.py", line 318, in start_new_session
self.update_screen_id()
File "/_code/yt_controller.py", line 135, in update_screen_id
self.send_message({MESSAGE_TYPE: TYPE_GET_SCREEN_ID})
File "/usr/local/lib/python2.7/dist-packages/PyChromecast-1.0.3-py2.7.egg/pychromecast/controllers/init.py", line 84, in send_message
self.namespace, data, inc_session_id, callback_function)
File "/usr/local/lib/python2.7/dist-packages/PyChromecast-1.0.3-py2.7.egg/pychromecast/socket_client.py", line 618, in send_app_message
", ".join(self.app_namespaces)))
pychromecast.error.UnsupportedNamespace: Namespace urn:x-cast:com.google.youtube.mdx is not supported by current app. Supported are urn:x-cast:com.google.cast.debugoverlay, urn:x-cast:com.google.cast.cac, urn:x-cast:com.google.cast.sse

The YT App launches but no video is played. When YT App is already launched, everything is fine.

From the trace I don't get what could be wrong. Any ideas?

Thanks in advance.

Can't assign requested address

Does catt need to be run as root? Wasn't able to get this successfully running after install. Happy to provide more info!

$ catt -d RevTV cast ~/Downloads/VID_20180308_085122.mp4

Traceback (most recent call last):
  File "/usr/local/bin/catt", line 11, in <module>
    sys.exit(main())
  File "/usr/local/lib/python3.6/site-packages/catt/cli.py", line 381, in main
    return cli(obj={}, default_map=readconfig())
  File "/usr/local/lib/python3.6/site-packages/click/core.py", line 716, in __call__
    return self.main(*args, **kwargs)
  File "/usr/local/lib/python3.6/site-packages/click/core.py", line 696, in main
    rv = self.invoke(ctx)
  File "/usr/local/lib/python3.6/site-packages/click/core.py", line 1060, in invoke
    return _process_result(sub_ctx.command.invoke(sub_ctx))
  File "/usr/local/lib/python3.6/site-packages/click/core.py", line 889, in invoke
    return ctx.invoke(self.callback, **ctx.params)
  File "/usr/local/lib/python3.6/site-packages/click/core.py", line 534, in invoke
    return callback(*args, **kwargs)
  File "/usr/local/lib/python3.6/site-packages/click/decorators.py", line 27, in new_func
    return f(get_current_context().obj, *args, **kwargs)
  File "/usr/local/lib/python3.6/site-packages/catt/cli.py", line 116, in cast
    prep="app", controller=controller)
  File "/usr/local/lib/python3.6/site-packages/catt/controllers.py", line 84, in setup_cast
    stream = StreamInfo(video_url, model=cc_info, host=cast.host)
  File "/usr/local/lib/python3.6/site-packages/catt/stream_info.py", line 32, in __init__
    self.local_ip = self._get_local_ip(host)
  File "/usr/local/lib/python3.6/site-packages/catt/stream_info.py", line 154, in _get_local_ip
    sock.connect((cc_host, 0))
OSError: [Errno 49] Can't assign requested address

Unable to start on raspberry pi

I am trying to use this on my raspberry pi, however, I am running into an issue. It would see that it has python 2.7 and python 3 installed, and it is defaulting to v2.7. Is there any way I can run the command "catt" and tell it to point to python 3?

image

Pychromecast is dropping suppport for Python 2

Howdy.
Pychromecast will no longer support python 2, as of next release (because python-zeroconf will drop python 2 support).
I have a slew of minor PR's coming up after the controllers refactor PR (which is ready, by the way 😃 ) has been merged. After that I humbly suggest that we make python 3.5 the min. requirement for catt, as this is now available for all major OS'es (the new min. requirement for Pychromecast will be 3.4, I'm just more keen on 3.5).

Traceback

hello, i have python3 but:
catt scan

Traceback (most recent call last):
File "/usr/local/bin/catt", line 6, in
from catt.cli import main
File "/usr/local/lib/python2.7/dist-packages/catt/cli.py", line 13, in
from .controllers import Cache, CastState, StateFileError, StateMode, get_chromecast, get_chromecasts, setup_cast
File "/usr/local/lib/python2.7/dist-packages/catt/controllers.py", line 196
def set_data(self, *args) -> None:
^
SyntaxError: invalid syntax

help me please.

certificate issue casting youtube

Hi there! Thanks so much for this project!

I'm able to cast_site successfully but casting returns the following error. For example when I run the README example:

$ catt cast "https://www.youtube.com/watch?v=dQw4w9WgXcQ"
ERROR: Unable to download webpage: <urlopen error [SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed: unable to get local issuer certificate (_ssl.c:1056)> (caused by URLError(SSLCertVerificationError(1, '[SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed: unable to get local issuer certificate (_ssl.c:1056)')))
Error: Remote resource not found.

Some details:

  • Operating System: macOS 10.14.2
  • catt was installed with pip3

I tracked this error down as something that has also occured in youtube-dl [github issue]. I separately installed youtube-dl and got the same certificate error and then added the suggested workaround (adding the flag --no-check-certificate to the youtube-dl command) which then worked to download the video. Adding this in case it helps in some way.

Cannot cast from MacOS to Chromecast Ultra

I am running MacOS Mojave. I installed Python 3.5 using MacPorts. I then created a virtualenv and installed catt with pip. I tried running both catt cast and catt cast_site. Both seem to find the chromecast device and exit successfully. However, the Chromecast just makes a noise, like a ping or so, but otherwise doesn't show anything.

$ catt cast_site https://www.google.com
Casting https://www.google.com on "Living Room Speaker"...
$

Scrubber interface?

Hi there,

I was wondering if anyone is aware of either a CLI or web/gui based scrubber for catt. If not, I could probably write one fairly quickly but I would like to see if you folks could formalize some sort of a protocol that would allow a different application to request catt to issue a seek command to relative or absolute time position in 1s increments.

I realize that catt itself may not be aware of a playback position immediately or being able to switch a position immediately but it seems the information is available in Google Home so I'm guessing either chromecast itself or a receive app should have that information so we should at least theoretically be able to pull it.

Thoughts?

Traceback ERROR

Traceback (most recent call last):
File "/usr/local/bin/catt", line 7, in
from catt.cli import main
File "/usr/local/lib/python2.7/dist-packages/catt/cli.py", line 7, in
from pathlib import Path
ImportError: No module named pathlib

What can I do to fix this?

catt doesn't allow to select subtitles inside the container

The --subtitle option looks for either an URL or a local file. There is no way to specify a track inside the container.
catt --info does show that the subtitle tracks present inside the container.
It would be nice if those could be selected.

Not sure how much work that would be. And in any case, thank you for catt. It's so much better than going through chromium or an app on my phone!

Latest version won't execute via PHP

Hey,

I've been using Cast All The Things in conjunction with a php script via IFTTT and haven't had any issues with it until upgrading to v0.5.3, which for some reason cannot seem to work when being called from an elevated script via php.

The previous version works fine however, so I'm sticking with it for now, but just thought I'd mention it as I'm somewhat stumped as to why it no longer works. (I'm assuming it is some sort of permissions issue or maybe a path related issue or something like that, but as I mentioned, it runs the script as an elevated user and the previous version has no problems)

Let me know if you have any insight :) Thanks for a great script.

Please add a version option

Please add a version flag to the list of cli options for getting easier information about the current release version:

catt --version

Some Vimeo videos do not work anymore

So while fiddling with tests, I discovered that the url that the format selector returns for some vimeo videos, does not play on my cc 2. Turns out that the resolution of the "best" format is too high.
Replacing "best" with "best[width <=? 1920][height <=? 1080]" appears to solve the problem.
The cc ultra might be able to play the higher resolution format, but I do not have access to one of those.

Support chromecast audio groups

get_chromecasts in controllers.py ensures that all devices can be dialed by creating a new pychromecast.Chromecast using the device's host parameter. Unfortunately, for audio groups, the host param is mostly meaningless and chosen arbitrarily from the devices that participate in the group. This is easily visible from the output of catt scan:

> catt scan
Scanning Chromecasts...
192.168.1.75 - Bedroom - Google Inc. Google Home
192.168.1.77 - Bedroom TV - Google Inc. Eureka Dongle
192.168.1.70 - Kitchen - Google Inc. Google Home Mini
192.168.1.76 - Living Room - Google Inc. Chromecast Audio
192.168.1.70 - Kitchen - Google Inc. Google Home Mini

In this output it's the Kitchen device that's present twice, but this varies across runs as different elements of the group are selected.

Since all device lookups go through get_chromecasts, this means that any command directed at an audio group instead operates on a single arbitrary member of the group.

It appears that removing the list comprehension in the final statement of get_chromecasts (that is, just return devices instead of rebuilding each one with an address) fixes this and lets catt play to chromecast audio groups, but since I don't know why that functionality was added in the first place and was too lazy to get a dev env properly set up, I'll submit a feature request instead of a PR.

Minor API changes

Hey @theychx, I tried to use the API again and found a few omissions:

  1. We should probably expose the _cast property, so the consumer can read the IP address, name, etc.
  2. I think we should rename ctrl to control or controller, whichever it is.

What do you think?

Unable to seek file

When playing video files (I tried video/mp4 files), using any of the command seek, ffwd or rewind causes the chromecast device to restart the playback from scratch.
From what I managed to gather, it seems that the media server should implement http progressive download for the chromecast to be able to seek properly

Add better API documentation

I use catt in other programs for easily casting URLs to a device. It might be worth thinking about adding a stable API at some point, for the benefit of people who want an easier layer over PyChromecast. For now, I think we should at least add a moderately detailed docstring to the DefaultCastController so people can at least know what valid values are for the parameters.

What do you think, @theychx? Would the best way be to use setup_cast and then call play_media_url, or use a controller directly, or what?

I think what I'm trying to say is that it would be worthwhile if we drafted a high-level overview document to make the internals of catt more accessible to contributors, to make their lives easier.

Thoughts?

Schema for statefiles?

I always thought that the code I wrote to crudely validate contents of statefiles looked really ugly.
Do you think it would be worth the extra dependency to use something like jsonschema instead?

catt crashes when trying to cast youtube

pizzadude@pizzadude-thinkpad ~ $ catt cast https://www.youtube.com/watch?v=1sTHTdLaSjM
[youtube] 1sTHTdLaSjM: Downloading webpage
[youtube] 1sTHTdLaSjM: Downloading video info webpage
[youtube] 1sTHTdLaSjM: Extracting video information
[youtube] 1sTHTdLaSjM: Downloading MPD manifest
Traceback (most recent call last):
  File "/usr/local/bin/catt", line 9, in <module>
    load_entry_point('catt==0.2.0', 'console_scripts', 'catt')()
  File "/usr/local/lib/python2.7/dist-packages/click/core.py", line 716, in __call__
    return self.main(*args, **kwargs)
  File "/usr/local/lib/python2.7/dist-packages/click/core.py", line 696, in main
    rv = self.invoke(ctx)
  File "/usr/local/lib/python2.7/dist-packages/click/core.py", line 1060, in invoke
    return _process_result(sub_ctx.command.invoke(sub_ctx))
  File "/usr/local/lib/python2.7/dist-packages/click/core.py", line 889, in invoke
    return ctx.invoke(self.callback, **ctx.params)
  File "/usr/local/lib/python2.7/dist-packages/click/core.py", line 534, in invoke
    return callback(*args, **kwargs)
  File "/usr/local/lib/python2.7/dist-packages/catt/cli.py", line 19, in cast
    stream_info = get_stream_info(video_url)
  File "/usr/local/lib/python2.7/dist-packages/catt/controllers.py", line 15, in get_stream_info
    best_format = list(format_selector(info["formats"]))[0]
  File "/usr/local/lib/python2.7/dist-packages/youtube_dl/YoutubeDL.py", line 1057, in selector_function
    for format in f(ctx):
  File "/usr/local/lib/python2.7/dist-packages/youtube_dl/YoutubeDL.py", line 1075, in selector_function
    formats = list(ctx['formats'])
TypeError: list indices must be integers, not unicode

This is on Linux Mint 18 (Ubuntu 16.04)

latest fails to build

Collecting git+https://github.com/skorokithakis/catt
  Cloning https://github.com/skorokithakis/catt to /tmp/pip-l_sty7jq-build
Requirement already up-to-date: youtube-dl>=2016.07.13 in /usr/local/lib/python3.5/dist-packages (from catt==0.4.2)
Requirement already up-to-date: PyChromecast==0.7.7 in /usr/local/lib/python3.5/dist-packages (from catt==0.4.2)
Requirement already up-to-date: Click>=5.0 in /usr/local/lib/python3.5/dist-packages (from catt==0.4.2)
Requirement already up-to-date: six>=1.10.0 in /usr/lib/python3/dist-packages (from PyChromecast==0.7.7->catt==0.4.2)
Requirement already up-to-date: protobuf==3.0.0b2 in /usr/local/lib/python3.5/dist-packages (from PyChromecast==0.7.7->catt==0.4.2)
Requirement already up-to-date: zeroconf>=0.17.4 in /usr/local/lib/python3.5/dist-packages (from PyChromecast==0.7.7->catt==0.4.2)
Requirement already up-to-date: requests>=2.0 in /usr/local/lib/python3.5/dist-packages (from PyChromecast==0.7.7->catt==0.4.2)
Requirement already up-to-date: setuptools in /usr/local/lib/python3.5/dist-packages (from protobuf==3.0.0b2->PyChromecast==0.7.7->catt==0.4.2)
Requirement already up-to-date: netifaces in /usr/local/lib/python3.5/dist-packages (from zeroconf>=0.17.4->PyChromecast==0.7.7->catt==0.4.2)
Requirement already up-to-date: enum-compat in /usr/local/lib/python3.5/dist-packages (from zeroconf>=0.17.4->PyChromecast==0.7.7->catt==0.4.2)
Requirement already up-to-date: packaging>=16.8 in /usr/local/lib/python3.5/dist-packages (from setuptools->protobuf==3.0.0b2->PyChromecast==0.7.7->catt==0.4.2)
Collecting appdirs>=1.4.0 (from setuptools->protobuf==3.0.0b2->PyChromecast==0.7.7->catt==0.4.2)
  Downloading appdirs-1.4.3-py2.py3-none-any.whl
Collecting pyparsing (from packaging>=16.8->setuptools->protobuf==3.0.0b2->PyChromecast==0.7.7->catt==0.4.2)
  Downloading pyparsing-2.2.0-py2.py3-none-any.whl (56kB)
    100% |████████████████████████████████| 61kB 4.9MB/s 
Installing collected packages: catt, appdirs, pyparsing
  Found existing installation: catt 0.4.2
    Uninstalling catt-0.4.2:
      Successfully uninstalled catt-0.4.2
  Running setup.py install for catt ... done
  Found existing installation: appdirs 1.4.2
    Uninstalling appdirs-1.4.2:
      Successfully uninstalled appdirs-1.4.2
  Rolling back uninstall of appdirs
Exception:
Traceback (most recent call last):
  File "/usr/local/lib/python3.5/dist-packages/pkg_resources/__init__.py", line 2813, in _dep_map
    return self.__dep_map
  File "/usr/local/lib/python3.5/dist-packages/pkg_resources/__init__.py", line 2624, in __getattr__
    raise AttributeError(attr)
AttributeError: _DistInfoDistribution__dep_map

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/usr/local/lib/python3.5/dist-packages/pkg_resources/__init__.py", line 2804, in _parsed_pkg_info
    return self._pkg_info
  File "/usr/local/lib/python3.5/dist-packages/pkg_resources/__init__.py", line 2624, in __getattr__
    raise AttributeError(attr)
AttributeError: _pkg_info

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "/usr/local/lib/python3.5/dist-packages/pip-9.0.1-py3.5.egg/pip/basecommand.py", line 215, in main
    status = self.run(options, args)
  File "/usr/local/lib/python3.5/dist-packages/pip-9.0.1-py3.5.egg/pip/commands/install.py", line 342, in run
    prefix=options.prefix_path,
  File "/usr/local/lib/python3.5/dist-packages/pip-9.0.1-py3.5.egg/pip/req/req_set.py", line 784, in install
    **kwargs
  File "/usr/local/lib/python3.5/dist-packages/pip-9.0.1-py3.5.egg/pip/req/req_install.py", line 851, in install
    self.move_wheel_files(self.source_dir, root=root, prefix=prefix)
  File "/usr/local/lib/python3.5/dist-packages/pip-9.0.1-py3.5.egg/pip/req/req_install.py", line 1064, in move_wheel_files
    isolated=self.isolated,
  File "/usr/local/lib/python3.5/dist-packages/pip-9.0.1-py3.5.egg/pip/wheel.py", line 247, in move_wheel_files
    prefix=prefix,
  File "/usr/local/lib/python3.5/dist-packages/pip-9.0.1-py3.5.egg/pip/locations.py", line 140, in distutils_scheme
    d = Distribution(dist_args)
  File "/usr/local/lib/python3.5/dist-packages/setuptools/dist.py", line 320, in __init__
    _Distribution.__init__(self, attrs)
  File "/usr/lib/python3.5/distutils/dist.py", line 281, in __init__
    self.finalize_options()
  File "/usr/local/lib/python3.5/dist-packages/setuptools/dist.py", line 386, in finalize_options
    ep.require(installer=self.fetch_build_egg)
  File "/usr/local/lib/python3.5/dist-packages/pkg_resources/__init__.py", line 2324, in require
    items = working_set.resolve(reqs, env, installer, extras=self.extras)
  File "/usr/local/lib/python3.5/dist-packages/pkg_resources/__init__.py", line 862, in resolve
    new_requirements = dist.requires(req.extras)[::-1]
  File "/usr/local/lib/python3.5/dist-packages/pkg_resources/__init__.py", line 2568, in requires
    dm = self._dep_map
  File "/usr/local/lib/python3.5/dist-packages/pkg_resources/__init__.py", line 2815, in _dep_map
    self.__dep_map = self._compute_dependencies()
  File "/usr/local/lib/python3.5/dist-packages/pkg_resources/__init__.py", line 2824, in _compute_dependencies
    for req in self._parsed_pkg_info.get_all('Requires-Dist') or []:
  File "/usr/local/lib/python3.5/dist-packages/pkg_resources/__init__.py", line 2806, in _parsed_pkg_info
    metadata = self.get_metadata(self.PKG_INFO)
  File "/usr/local/lib/python3.5/dist-packages/pkg_resources/__init__.py", line 1468, in get_metadata
    value = self._get(self._fn(self.egg_info, name))
  File "/usr/local/lib/python3.5/dist-packages/pkg_resources/__init__.py", line 1577, in _get
    with open(path, 'rb') as stream:
FileNotFoundError: [Errno 2] No such file or directory: '/usr/local/lib/python3.5/dist-packages/appdirs-1.4.2.dist-info/METADATA'

UnicodeEncodeError when accent in device name

I have to modify cli.py line 245:

click.echo("{0.host} - {0.device.friendly_name} - {0.device.manufacturer} {0.device.model_name}".format(device))

click.echo(u"{0.host} - {0.device.friendly_name} - {0.device.manufacturer} {0.device.model_name}".decode('utf-8').format(device))

in order to handle device name with accent (a lot of accent in french)

Catt does not support multiple casting devices

Hello. So I just bought a Chromecast Audio to go along with my CC2.As you know, this breaks my current setup where I use catt in several ways. So I am proposing the following:

Catt should support an option to set -d "CCaudio" or -d "192.168.1.200" to make commands specific to this device. Catt should also employ a rudimentary config file (youtube-dl style) so that the user can set a default device (or perhaps other future flags). This could go in ~/.config/catt/config or perhaps just ~/.catt. I am not shure how the current caching scheme fits into this, but it would certainly have to change.

Would you consider merging a PR implementing these ideas?

Casting local files broken in 0.9.1

It looks like casting local files broke with the 0.9.1 release:

Traceback (most recent call last):
  File "~/.local/bin/catt", line 10, in <module>
    sys.exit(main())
  File "~/.local/lib/python3.7/site-packages/catt/cli.py", line 472, in main
    return cli(obj={}, default_map=readconfig())
  File "~/.local/lib/python3.7/site-packages/click/core.py", line 764, in __call__
    return self.main(*args, **kwargs)
  File "~/.local/lib/python3.7/site-packages/click/core.py", line 717, in main
    rv = self.invoke(ctx)
  File "~/.local/lib/python3.7/site-packages/click/core.py", line 1137, in invoke
    return _process_result(sub_ctx.command.invoke(sub_ctx))
  File "~/.local/lib/python3.7/site-packages/click/core.py", line 956, in invoke
    return ctx.invoke(self.callback, **ctx.params)
  File "~/.local/lib/python3.7/site-packages/click/core.py", line 555, in invoke
    return callback(*args, **kwargs)
  File "~/.local/lib/python3.7/site-packages/click/decorators.py", line 27, in new_func
    return f(get_current_context().obj, *args, **kwargs)
  File "~/.local/lib/python3.7/site-packages/catt/cli.py", line 169, in cast
    settings["device"], video_url=video_url, prep="app", controller=controller, ytdl_options=ytdl_option
  File "~/.local/lib/python3.7/site-packages/catt/controllers.py", line 139, in setup_cast
    app = get_app("default")
  File "~/.local/lib/python3.7/site-packages/catt/controllers.py", line 107, in get_app
    raise AppSelectionError("cast_type is needed for app selection")
catt.controllers.AppSelectionError: cast_type is needed for app selection

It seems like local casting calls get_app("default"), which was previously special-cased inside get_app.

Does not work on WSL (Windows 10) - Workaround Included

Unfortunately catt does not work on WSL on Windows 10.

The issue is in python-zeroconf, a library used by pychromecast, which is used by catt.

If you don't want to wait for the fix on python-zeroconf to be merged, pychormecast to be updated to use the fixed python-zeroconf and catt to be updated to use the new version of pychomecast, you can simpley type

pip install git+https://github.com/marcosdiez/pyzeroconf.git@now_it_works_on_wsl --upgrade

I suggest this issue to be closed whenever all these merges occur.

mpsyt support

I was hoping to get catt to work with mpsyt. I opened an issue here mps-youtube/yewtube#607

I think if there was an option to set catt to stay in foreground until the end of the video we can have some basic compatibility with mpsyt.

Feature request: HDMI CEC from catt

Hi!
I have a TV with HDMI CEC functionality. So when the chromecast starts, the TV is started as well throug HDMI CEC. But if I shut off the TV, the HDMI CEC wont work for a couple of minutes. It would be awesome to be able to trigger the HDMI CEC again manually from catt.

Is that possible?

Youtube playlists

When I provide catt with a youtube link to a youtube playlist, the youtube dl is triggered correct (as it seems) but catt is faling. This is the logg for when i try to do this.

So, is this a bugg just form me or is thre functionality just not there yet for playlists?

I am on macOS and all other features in catt is working properly.

Logg

▶ catt cast https://www.youtube.com/watch\?v\=kk0WRHV_vt8\&list\=PL52RKVKBFM328OwddSMRQS9BYOA3oVDgl

Casting remote file https://www.youtube.com/watch?v=kk0WRHV_vt8&list=PL52RKVKBFM328OwddSMRQS9BYOA3oVDgl...
[youtube:playlist] Downloading playlist PL52RKVKBFM328OwddSMRQS9BYOA3oVDgl - add --no-playlist to just download video kk0WRHV_vt8
[youtube:playlist] PL52RKVKBFM328OwddSMRQS9BYOA3oVDgl: Downloading webpage
[download] Downloading playlist: Snarky Puppy - We Like It Here
[youtube:playlist] playlist Snarky Puppy - We Like It Here: Downloading 8 videos
[download] Downloading video 1 of 8
[youtube] kk0WRHV_vt8: Downloading webpage
[youtube] kk0WRHV_vt8: Downloading video info webpage
[youtube] kk0WRHV_vt8: Extracting video information
[youtube] kk0WRHV_vt8: Downloading MPD manifest
[download] Downloading video 2 of 8
[youtube] fuhHU_BZXSk: Downloading webpage
[youtube] fuhHU_BZXSk: Downloading video info webpage
[youtube] fuhHU_BZXSk: Extracting video information
[youtube] fuhHU_BZXSk: Downloading MPD manifest
[download] Downloading video 3 of 8
[youtube] kDXnPfA_5pY: Downloading webpage
[youtube] kDXnPfA_5pY: Downloading video info webpage
[youtube] kDXnPfA_5pY: Extracting video information
[youtube] kDXnPfA_5pY: Downloading MPD manifest
[download] Downloading video 4 of 8
[youtube] eFUOZ5PI3m8: Downloading webpage
[youtube] eFUOZ5PI3m8: Downloading video info webpage
[youtube] eFUOZ5PI3m8: Extracting video information
[youtube] eFUOZ5PI3m8: Downloading MPD manifest
[download] Downloading video 5 of 8
[youtube] 4Qo1NFwMhBA: Downloading webpage
[youtube] 4Qo1NFwMhBA: Downloading video info webpage
[youtube] 4Qo1NFwMhBA: Extracting video information
[youtube] 4Qo1NFwMhBA: Downloading MPD manifest
[download] Downloading video 6 of 8
[youtube] y0bcTSDFScg: Downloading webpage
[youtube] y0bcTSDFScg: Downloading video info webpage
[youtube] y0bcTSDFScg: Extracting video information
[youtube] y0bcTSDFScg: Downloading MPD manifest
[download] Downloading video 7 of 8
[youtube] L_XJ_s5IsQc: Downloading webpage
[youtube] L_XJ_s5IsQc: Downloading video info webpage
[youtube] L_XJ_s5IsQc: Extracting video information
[youtube] L_XJ_s5IsQc: Downloading MPD manifest
[download] Downloading video 8 of 8
[youtube] mg2cMqW_hOY: Downloading webpage
[youtube] mg2cMqW_hOY: Downloading video info webpage
[youtube] mg2cMqW_hOY: Extracting video information
[youtube] mg2cMqW_hOY: Downloading MPD manifest
[download] Finished downloading playlist: Snarky Puppy - We Like It Here
Traceback (most recent call last):
  File "/usr/local/bin/catt", line 11, in <module>
    sys.exit(main())
  File "/Library/Python/2.7/site-packages/catt/cli.py", line 238, in main
    return cli(obj={}, default_map=readconfig())
  File "/Library/Python/2.7/site-packages/click/core.py", line 722, in __call__
    return self.main(*args, **kwargs)
  File "/Library/Python/2.7/site-packages/click/core.py", line 697, in main
    rv = self.invoke(ctx)
  File "/Library/Python/2.7/site-packages/click/core.py", line 1066, in invoke
    return _process_result(sub_ctx.command.invoke(sub_ctx))
  File "/Library/Python/2.7/site-packages/click/core.py", line 895, in invoke
    return ctx.invoke(self.callback, **ctx.params)
  File "/Library/Python/2.7/site-packages/click/core.py", line 535, in invoke
    return callback(*args, **kwargs)
  File "/Library/Python/2.7/site-packages/click/decorators.py", line 27, in new_func
    return f(get_current_context().obj, *args, **kwargs)
  File "/Library/Python/2.7/site-packages/catt/cli.py", line 103, in cast
    stream_info = get_stream_info(video_url)
  File "/Library/Python/2.7/site-packages/catt/controllers.py", line 25, in get_stream_info
    "url": best_format["url"],
KeyError: 'url'

Missing packages

I was having some youtube issues so I did a pip install --upgrade catt...and got these:

ImportError: No module named configparser
ImportError: No module named pathlib

And then:
$ catt --help
Traceback (most recent call last):
File "/home/nook/.local/bin/catt", line 7, in
from catt.cli import main
File "/home/nook/.local/lib/python2.7/site-packages/catt/cli.py", line 13, in
from .controllers import Cache, CastState, StateFileError, StateMode, get_chromecast, get_chromecasts, setup_cast
File "/home/nook/.local/lib/python2.7/site-packages/catt/controllers.py", line 189
def set_data(self, *args) -> None:
^
SyntaxError: invalid syntax

Error when casting local files in 0.9.2

When I try to cast a local file:

catt -d "My Chromecast" cast "$HOME/Media/test.mp4"

I get the following error:

Traceback (most recent call last):
  File "/usr/local/lib/python3.7/site-packages/catt/http_server.py", line 90, in do_GET
    copy_byte_range(mediafile, self.wfile, first, last)
  File "/usr/local/lib/python3.7/site-packages/catt/http_server.py", line 24, in copy_byte_range
    outfile.write(buf)
  File "/usr/local/Cellar/python/3.7.2_2/Frameworks/Python.framework/Versions/3.7/lib/python3.7/socketserver.py", line 799, in write
    self._sock.sendall(b)
BrokenPipeError: [Errno 32] Broken pipe

Any way to input / interact into websites on Chromecast?

I am successfully using CATT to display a private security camera web UI on a Chromecast device.
However I want to require authentication, otherwise it will be available without auth on the web. Also may want to interact with the UI.
There must be many other websites played by CATT users that require input and/or interaction, right?
How do you do it?
Is there any remote / virtual keyboard, or a way to connect a keyboard to allow me to input a username / password into a site running in a Chromecast device?
I have searched like hell and tried chatting with Google support, to no avail.

Error: no devices found

I am probably missing something super obvious, but I gave python permission on Windows to go through the firewall, I run catt scan ...and this is what I get back. My chromecast works fine over Chrome but catt isn't seeing it ...did I mess up?

Typo in readme command write-config

On readme page it says that you need to run this line in order to write to config file:
catt -d <name_of_chromecast> write_config
write-config (with a dash) is how it probably is supposed to be, at least it is so on my Windows 10 installation.

Thank you very much for writing this program! It's awesome 👍

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.