Skip to content

Commit

Permalink
Abema: add missing logging
Browse files Browse the repository at this point in the history
  • Loading branch information
NoAiOne committed Dec 21, 2019
1 parent d30a779 commit dfd8403
Showing 1 changed file with 3 additions and 6 deletions.
9 changes: 3 additions & 6 deletions yuu/ext/abematv.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ def is_channel(url):
return True
return False

yuu_abema_logger = logging.getLogger('yuu.abematv')
yuu_log = logging.getLogger('yuu.abematv')

class AbemaTVDownloader:
def __init__(self, files, key, iv, url, session):
Expand Down Expand Up @@ -50,12 +50,10 @@ def __init__(self, files, key, iv, url, session):

self._aes = None


def setup_decryptor(self):
self.iv = unhexlify(self.iv)
self._aes = AES.new(self.key, AES.MODE_CBC, IV=self.iv)


def download_chunk(self):
self.setup_decryptor() # Initialize a new decryptor
try:
Expand All @@ -70,12 +68,11 @@ def download_chunk(self):
vid = self._aes.decrypt(vid.content)
outf.write(vid)
except Exception as err:
print('[ERROR] Problem occured\nreason: {}'.format(err))
yuu_log.error('\nProblem occured\nreason: {}'.format(err))
return None, self.temporary_folder
pbar.update()
self.downloaded_files.append(outputtemp)
except KeyboardInterrupt:
print('[WARN] User pressed CTRL+C, cleaning up...')
yuu_log.warn('User pressed CTRL+C, cleaning up...')
return None, self.temporary_folder
return self.downloaded_files, self.temporary_folder

Expand Down

0 comments on commit dfd8403

Please sign in to comment.