From da06c568c50dfde8c33572f570b722b95befd82d Mon Sep 17 00:00:00 2001 From: Manuel Cortez Date: Sun, 17 Sep 2017 23:28:31 -0500 Subject: [PATCH] Fixed issue with url shorteners. Should help to fix #159 --- doc/changelog.md | 2 +- src/sound.py | 4 +--- src/url_shortener/shorteners/url_shortener.py | 6 +----- 3 files changed, 3 insertions(+), 9 deletions(-) diff --git a/doc/changelog.md b/doc/changelog.md index 8badae7d..4e5d974c 100644 --- a/doc/changelog.md +++ b/doc/changelog.md @@ -5,7 +5,7 @@ * When authorising an account, you will see a dialogue with a cancel button, in case you want to abort the process. Also, NVDA will not be blocked when the process starts. ([#101](https://github.com/manuelcortez/TWBlue/issues/101)) * In the translator module, the list of available languages is fetched automatically from the provider. That means all of these languages will work and there will not be inconsistencies. Also we've removed the first combo box, because the language is detected automatically by Yandex'S API. ([#153](https://github.com/manuelcortez/TWBlue/issues/153)) * Trending topics, searches and conversation buffers will use mute settings set for the session in wich they were opened. ([#157](https://github.com/manuelcortez/TWBlue/issues/157)) -* And more. ([#156,](https://github.com/manuelcortez/TWBlue/issues/156) [#163,](https://github.com/manuelcortez/TWBlue/issues/163)) +* And more. ([#156,](https://github.com/manuelcortez/TWBlue/issues/156) [#163,](https://github.com/manuelcortez/TWBlue/issues/163) [#159,](https://github.com/manuelcortez/TWBlue/issues/159)) ## changes in version 0.91 and 0.92 diff --git a/src/sound.py b/src/sound.py index 91c21199..f170eee3 100644 --- a/src/sound.py +++ b/src/sound.py @@ -95,7 +95,7 @@ class soundSystem(object): sound_object.play() class URLStream(object): - def __init__(self,url=None): + def __init__(self, url=None): self.url = url self.prepared = False log.debug("URL Player initialized") @@ -115,7 +115,6 @@ class URLStream(object): log.debug("Transformed URL: %s. Prepared" % (self.url,)) self.prepared = True - def seek(self,step): pos=self.stream.get_position() pos=self.stream.bytes_to_seconds(pos) @@ -145,7 +144,6 @@ class URLStream(object): self.stream.volume = float(volume) self.stream.play() log.debug("played") -# call_threaded(self.delete_when_done) def stop_audio(self,delete=False): if hasattr(self, "stream"): diff --git a/src/url_shortener/shorteners/url_shortener.py b/src/url_shortener/shorteners/url_shortener.py index 432396ad..8bb0d678 100644 --- a/src/url_shortener/shorteners/url_shortener.py +++ b/src/url_shortener/shorteners/url_shortener.py @@ -20,8 +20,4 @@ class URLShortener (object): raise NotImplementedError def unshorten(self, url): - try: - r=requests.get(url) - return r.url - except: - return url #we cannot expand + return url \ No newline at end of file