Skip to content

Commit

Permalink
fix: Give correct error messages with Dashcast (#133)
Browse files Browse the repository at this point in the history
* Improve castcontroller selection in setup_cast

..the default castcontroller was being returned when Dashcast was active.

* Update youtube_dl requirement

..in order to make CI pass

* Fix tests

..by replacing dailymotion test with twitch test.
  • Loading branch information
theychx authored and skorokithakis committed Oct 12, 2018
1 parent f8a49d4 commit 138f580
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 7 deletions.
6 changes: 3 additions & 3 deletions catt/controllers.py
Expand Up @@ -129,9 +129,9 @@ def setup_cast(device_name, video_url=None, prep=None, controller=None, ytdl_opt

if app["app_name"] == "youtube":
controller = YoutubeCastController(cast, app["app_name"], app["app_id"], prep=prep)
# We also check for controller, in the unlikely event that youtube-dl
# gets an extractor named "dashcast".
elif app["app_name"] == "dashcast" and controller:
# We make these checks in order to avoid problems,
# in the unlikely event that youtube-dl gets an extractor named "dashcast".
elif controller == "dashcast" or (app["app_name"] == "dashcast" and not stream):
controller = DashCastController(cast, app["app_name"], app["app_id"], prep=prep)
else:
controller = DefaultCastController(cast, app["app_name"], app["app_id"], prep=prep)
Expand Down
2 changes: 1 addition & 1 deletion setup.py
Expand Up @@ -13,7 +13,7 @@
with open("README.rst") as readme_file:
readme = readme_file.read()

requirements = ["youtube-dl>=2017.3.15", "PyChromecast>=2.3.0", "Click>=5.0", "ifaddr>=0.1.4", "requests>=2.18.4"]
requirements = ["youtube-dl>=2018.10.5", "PyChromecast>=2.3.0", "Click>=5.0", "ifaddr>=0.1.4", "requests>=2.18.4"]

test_requirements = [] # type: ignore

Expand Down
6 changes: 3 additions & 3 deletions tests/test_catt.py
Expand Up @@ -23,11 +23,11 @@ def test_stream_info_youtube_playlist(self):
self.assertEqual(stream.extractor, "youtube")

def test_stream_info_other_video(self):
stream = StreamInfo("http://www.dailymotion.com/video/x6fotne")
stream = StreamInfo("https://clips.twitch.tv/CloudyEnticingChickpeaCeilingCat")
self.assertIn("https://", stream.video_url)
self.assertEqual(stream.video_id, "x6fotne")
self.assertEqual(stream.video_id, "304482431")
self.assertTrue(stream.is_remote_file)
self.assertEqual(stream.extractor, "dailymotion")
self.assertEqual(stream.extractor, "twitch")

def test_cache(self):
cache = Cache()
Expand Down

0 comments on commit 138f580

Please sign in to comment.