removed redundant directory parameter from coub_dl.__init__()

This commit is contained in:
Kjistóf 2017-10-30 19:31:18 +01:00
parent 8139b88afe
commit 116d6f0239
1 changed files with 8 additions and 9 deletions

View File

@ -7,7 +7,7 @@
from subprocess import call, Popen, PIPE, DEVNULL
from os import listdir, remove
from os.path import splitext, exists, join
from os.path import splitext, exists, join, split
from re import match
from enum import Enum
from datetime import timedelta
@ -43,10 +43,9 @@ class coub_dl:
output_files = {File.OUTPUT}
def __init__(self, url, files_dict, directory):
def __init__(self, url, files_dict):
self._url = url
self._files_dict = files_dict
self._directory = directory
self._loopdata = namedtuple('loopdata', ('base', 'fraction', 'time', 'file'))
@ -83,11 +82,11 @@ class coub_dl:
def read_extensions(self):
for file in listdir(self._directory):
for filename in self._files_dict:
fullname = join(self._directory, file)
if match('^{}\..+$'.format(self._files_dict[filename]), fullname):
self._files_dict[filename] = fullname
for stream in {Stream.AUDIO, Stream.VIDEO}:
sdir, sfile = split(self._files_dict[stream])
for file in listdir(sdir):
if match('^{}\..+$'.format(sfile), file):
self._files_dict[stream] = join(sdir, file)
def check_downloads(self):
@ -195,7 +194,7 @@ def run(URL, output, extension):
for key in {key: FILES[key] for key in FILES if key not in coub_dl.output_files}:
FILES[key] = join(tempdir, FILES[key])
coub_dl(URL, FILES, tempdir)()
coub_dl(URL, FILES)()
def determine_output_filename(url, user_supplied, extension, files_dict):