Skip to content

Commit

Permalink
Fix pylint E1101 for youtube modules
Browse files Browse the repository at this point in the history
Despite the fixed pylint errors, this backend will not work for now...but at least will allow to pass the pylint errors. The problems of this modules are beyond the actual source code because google released a new api which is not implemented here and the old one has been shutdown.

References: #11
  • Loading branch information
opacam committed Sep 13, 2018
1 parent f3229d6 commit 014e09a
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 3 deletions.
3 changes: 2 additions & 1 deletion coherence/backends/youtube_storage.py
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@ def __init__(self, uri, id,
self.cache_maxsize = int(cache_maxsize)
self.buffer_size = int(buffer_size)
self.downloader = None
self.connection = None

self.video_url = None # the url we get from the youtube page
self.stream_url = None # the real video stream, cached somewhere
Expand All @@ -62,7 +63,7 @@ def __init__(self, uri, id,
def requestFinished(self, result):
""" self.connection is set in utils.ReverseProxyResource.render """
self.info("ProxyStream requestFinished: %s", result)
if hasattr(self, 'connection'):
if self.connection is not None:
self.connection.transport.loseConnection()

def render(self, request):
Expand Down
12 changes: 10 additions & 2 deletions coherence/extern/youtubedl/youtubedl.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
import sys
import time
import urllib
import urllib.error

from coherence.upnp.core.utils import getPage

Expand Down Expand Up @@ -336,6 +337,11 @@ def report_finish(self):
"""Report download finished."""
self.to_stdout('')

def _do_download(self, *args):
raise NotImplementedError('Error: the _do_download method was removed'
'at some point of the project, operation'
'cancelled')

def process_info(self, info_dict):
"""Process a single dictionary returned by an InfoExtractor."""
# Do nothing else if in simulate mode
Expand Down Expand Up @@ -373,6 +379,8 @@ def process_info(self, info_dict):
return

try:
# Fixme: This should be reimplemented, probably that the best shoot
# will be to use an external python package to deal with that
success = self._do_download(filename, info_dict['url'])
except (urllib.error.URLError,
http.client.HTTPException,
Expand Down Expand Up @@ -422,7 +430,7 @@ def download(self, url_list):
def get_real_urls(self, url_list):
"""Download a given list of URLs."""
if len(url_list) > 1 and self.fixed_template():
raise SameFileError(self._params['outtmpl'])
raise SameFileError(self.params['outtmpl'])

for url in url_list:
suitable_found = False
Expand All @@ -438,7 +446,7 @@ def got_all_results(all_results):
ret_code = self.trouble()

if len(results) > 1 and self.fixed_template():
raise SameFileError(self._params['outtmpl'])
raise SameFileError(self.params['outtmpl'])

real_urls = []
for result in results:
Expand Down

0 comments on commit 014e09a

Please sign in to comment.