Changed the log level of aria2 (#481)

* Changed the log level of aria2

made aria2 more quiet so it only prints out the download progress and any error, so no useless bloat on your terminal

Co-authored-by: Blatzar <46196380+Blatzar@users.noreply.github.com>
master
Arjix 2020-10-10 18:00:59 +03:00 committed by GitHub
parent bb7613dc93
commit d950dd6567
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 15 additions and 3 deletions

View File

@ -20,6 +20,7 @@ DEFAULT_CONFIG = {
'provider': 'twist.moe',
'external_downloader': '',
'aria2c_for_torrents': False,
'aria2c_log_level': 'error',
'selescrape_browser': None,
'selescrape_browser_executable_path': None,
'selescrape_driver_binary_path': None,

View File

@ -264,10 +264,20 @@ def format_command(cmd, episode, file_format, speed_limit, path):
if not Config._CONFIG['dl']['aria2c_for_torrents'] and episode.url.startswith('magnet:?xt=urn:btih:'):
return ['open', episode.url]
# For aria2c.
log_levels = ['debug', 'info', 'notice', 'warn', 'error']
log_level = Config['dl']['aria2c_log_level'].lower()
if log_level not in log_levels:
logger.warn('Invalid logging level "{}", defaulting to "error".'.format(log_level))
logger.debug('Possible levels: {}.'.format(log_levels))
log_level = 'error'
cmd_dict = {
'{aria2}': 'aria2c {stream_url} -x 12 -s 12 -j 12 -k 10M -o '
'{file_format}.mp4 --continue=true --dir={download_dir}'
' --stream-piece-selector=inorder --min-split-size=5M --referer={referer} --check-certificate=false --user-agent={useragent} --max-overall-download-limit={speed_limit}',
'{file_format}.mp4 --continue=true --dir={download_dir} '
'--stream-piece-selector=inorder --min-split-size=5M --referer={referer} '
'--check-certificate=false --user-agent={useragent} --max-overall-download-limit={speed_limit} '
'--console-log-level={log_level}',
'{idm}': 'idman.exe /n /d {stream_url} /p {download_dir} /f {file_format}.mp4'
}
@ -284,7 +294,8 @@ def format_command(cmd, episode, file_format, speed_limit, path):
'download_dir': os.path.abspath(path),
'referer': episode.source().referer,
'useragent': useragent,
'speed_limit': speed_limit
'speed_limit': speed_limit,
'log_level': log_level
}
if cmd == "{idm}":