removed redundant directory parameter from coub_dl.__init__()
This commit is contained in:
parent
8139b88afe
commit
116d6f0239
17
coub-dl.py
17
coub-dl.py
@ -7,7 +7,7 @@
|
|||||||
|
|
||||||
from subprocess import call, Popen, PIPE, DEVNULL
|
from subprocess import call, Popen, PIPE, DEVNULL
|
||||||
from os import listdir, remove
|
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 re import match
|
||||||
from enum import Enum
|
from enum import Enum
|
||||||
from datetime import timedelta
|
from datetime import timedelta
|
||||||
@ -43,10 +43,9 @@ class coub_dl:
|
|||||||
output_files = {File.OUTPUT}
|
output_files = {File.OUTPUT}
|
||||||
|
|
||||||
|
|
||||||
def __init__(self, url, files_dict, directory):
|
def __init__(self, url, files_dict):
|
||||||
self._url = url
|
self._url = url
|
||||||
self._files_dict = files_dict
|
self._files_dict = files_dict
|
||||||
self._directory = directory
|
|
||||||
self._loopdata = namedtuple('loopdata', ('base', 'fraction', 'time', 'file'))
|
self._loopdata = namedtuple('loopdata', ('base', 'fraction', 'time', 'file'))
|
||||||
|
|
||||||
|
|
||||||
@ -83,11 +82,11 @@ class coub_dl:
|
|||||||
|
|
||||||
|
|
||||||
def read_extensions(self):
|
def read_extensions(self):
|
||||||
for file in listdir(self._directory):
|
for stream in {Stream.AUDIO, Stream.VIDEO}:
|
||||||
for filename in self._files_dict:
|
sdir, sfile = split(self._files_dict[stream])
|
||||||
fullname = join(self._directory, file)
|
for file in listdir(sdir):
|
||||||
if match('^{}\..+$'.format(self._files_dict[filename]), fullname):
|
if match('^{}\..+$'.format(sfile), file):
|
||||||
self._files_dict[filename] = fullname
|
self._files_dict[stream] = join(sdir, file)
|
||||||
|
|
||||||
|
|
||||||
def check_downloads(self):
|
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}:
|
for key in {key: FILES[key] for key in FILES if key not in coub_dl.output_files}:
|
||||||
FILES[key] = join(tempdir, FILES[key])
|
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):
|
def determine_output_filename(url, user_supplied, extension, files_dict):
|
||||||
|
Loading…
Reference in New Issue
Block a user