1.0.0: updated hwaccel value and path validation

This commit is contained in:
K4YT3X 2018-11-26 14:16:50 -05:00
parent 4f269ad938
commit 9f0ee65375

View File

@ -4,7 +4,7 @@
Name: Video2x Config Generator Name: Video2x Config Generator
Author: K4YT3X Author: K4YT3X
Date Created: October 23, 2018 Date Created: October 23, 2018
Last Modified: October 23, 2018 Last Modified: November 26, 2018
Licensed under the GNU General Public License Version 3 (GNU GPL v3), Licensed under the GNU General Public License Version 3 (GNU GPL v3),
available at: https://www.gnu.org/licenses/gpl-3.0.txt available at: https://www.gnu.org/licenses/gpl-3.0.txt
@ -13,13 +13,32 @@ Licensed under the GNU General Public License Version 3 (GNU GPL v3),
""" """
from avalon_framework import Avalon from avalon_framework import Avalon
import json import json
import os
VERSION = '1.0.0'
def get_path(text):
""" Get path and validate
"""
while True:
path = Avalon.gets(text)
if os.path.isdir(path):
return path
Avalon.error('{} id not a directory / folder'.format(path))
def enroll_settings(): def enroll_settings():
settings = {} settings = {}
settings['waifu2x_path'] = Avalon.gets('waifu2x-caffe-cui.exe path: ')
settings['ffmpeg_path'] = Avalon.gets('ffmpeg binaries directory: ') settings['waifu2x_path'] = get_path('waifu2x-caffe-cui.exe path: ')
settings['ffmpeg_path'] = get_path('ffmpeg binaries directory: ')
settings['ffmpeg_arguments'] = Avalon.gets('Extra arguments passed to ffmpeg: ') settings['ffmpeg_arguments'] = Avalon.gets('Extra arguments passed to ffmpeg: ')
settings['ffmpeg_hwaccel'] = Avalon.gets('ffmpeg hardware acceleration method (cuda): ')
if settings['ffmpeg_hwaccel'] == '':
settings['ffmpeg_hwaccel'] = 'cuda'
return settings return settings
@ -29,4 +48,8 @@ def write_config(settings):
config.close() config.close()
write_config(enroll_settings()) try:
print('Video2X Config Generator {}'.format(VERSION))
write_config(enroll_settings())
except KeyboardInterrupt:
Avalon.warning('Exiting...')