removed f_string support for legacy versions of Python

This commit is contained in:
k4yt3x 2019-07-27 13:39:40 -04:00
parent 5151be4122
commit 89dfd21f97
10 changed files with 71 additions and 63 deletions

View File

@ -1,12 +1,10 @@
#!/usr/bin/env python3
# -*- coding: future_fstrings -*-
# -*- coding: utf-8 -*-
"""
Name: Video2X Exceptions
Dev: K4YT3X
Date Created: December 13, 2018
Last Modified: March 19, 2019
Last Modified: July 27, 2019
"""

View File

@ -1,25 +1,27 @@
#!/usr/bin/env python3
# -*- coding: future_fstrings -*-
# -*- coding: utf-8 -*-
"""
Name: FFMPEG Class
Name: Video2X FFmpeg Controller
Author: K4YT3X
Date Created: Feb 24, 2018
Last Modified: July 26, 2019
Last Modified: July 27, 2019
Description: This class handles all FFmpeg related operations.
"""
from avalon_framework import Avalon
# built-in imports
import json
import subprocess
import os
# third-party imports
from avalon_framework import Avalon
class Ffmpeg:
"""This class communicates with FFmpeg
This class deals with FFmpeg. It handles extracitng
This class deals with FFmpeg. It handles extracting
frames, stripping audio, converting images into videos
and inserting audio tracks to videos.
"""
@ -28,7 +30,6 @@ class Ffmpeg:
self.ffmpeg_settings = ffmpeg_settings
self.ffmpeg_path = self.ffmpeg_settings['ffmpeg_path']
self.ffmpeg_binary = os.path.join(self.ffmpeg_path, 'ffmpeg.exe')
self.ffmpeg_probe_binary = os.path.join(self.ffmpeg_path, 'ffprobe.exe')
self.image_format = image_format
@ -37,8 +38,8 @@ class Ffmpeg:
def get_pixel_formats(self):
""" Get a dictionary of supported pixel formats
List all supported pixel formats and their corresponding
bit depth.
List all supported pixel formats and their
corresponding bit depth.
Returns:
dictionary -- JSON dict of all pixel formats to bit depth
@ -71,7 +72,7 @@ class Ffmpeg:
""" Gets input video information
This method reads input video information
using ffprobe in dictionary.
using ffprobe in dictionary
Arguments:
input_video {string} -- input video file path
@ -101,8 +102,7 @@ class Ffmpeg:
def extract_frames(self, input_video, extracted_frames):
"""Extract every frame from original videos
This method extracts every frame from videoin
using FFmpeg
This method extracts every frame from input video using FFmpeg
Arguments:
input_video {string} -- input video path
@ -130,8 +130,7 @@ class Ffmpeg:
def convert_video(self, framerate, resolution, upscaled_frames):
"""Converts images into videos
This method converts a set of images into a
video.
This method converts a set of images into a video
Arguments:
framerate {float} -- target video framerate

View File

@ -1,18 +1,17 @@
#!/usr/bin/env python3
# -*- coding: future_fstrings -*-
# -*- coding: utf-8 -*-
"""
Name: Video2X Image Cleaner
Author: BrianPetkovsek
Author: K4YT3X
Date Created: March 24, 2019
Last Modified: April 28, 2019
Last Modified: July 27, 2019
Description: This class is to remove the extracted frames
that have already been upscaled.
"""
# built-in imports
import os
import threading
import time

View File

@ -4,4 +4,3 @@ GPUtil
psutil
requests
tqdm
future-fstrings>=1.1.0

View File

@ -1,12 +1,10 @@
#!/usr/bin/env python3
# -*- coding: future_fstrings -*-
# -*- coding: utf-8 -*-
"""
Name: Video2X Upscaler
Author: K4YT3X
Date Created: December 10, 2018
Last Modified: July 9, 2019
Last Modified: July 27, 2019
Dev: SAT3LL
@ -16,15 +14,16 @@ Licensed under the GNU General Public License Version 3 (GNU GPL v3),
(C) 2018-2019 K4YT3X
"""
from avalon_framework import Avalon
# local imports
from exceptions import *
from ffmpeg import Ffmpeg
from fractions import Fraction
from image_cleaner import ImageCleaner
from tqdm import tqdm
from waifu2x_caffe import Waifu2xCaffe
from waifu2x_converter import Waifu2xConverter
from waifu2x_ncnn_vulkan import Waifu2xNcnnVulkan
# built-in imports
from fractions import Fraction
import copy
import os
import re
@ -33,6 +32,10 @@ import tempfile
import threading
import time
# third-party imports
from avalon_framework import Avalon
from tqdm import tqdm
class Upscaler:
""" An instance of this class is a upscaler that will

View File

@ -1,8 +1,6 @@
#!/usr/bin/env python3
# -*- coding: future_fstrings -*-
"""
# -*- coding: utf-8 -*-
r"""
__ __ _ _ ___ __ __
\ \ / / (_) | | |__ \ \ \ / /
@ -15,7 +13,7 @@ __ __ _ _ ___ __ __
Name: Video2X Controller
Author: K4YT3X
Date Created: Feb 24, 2018
Last Modified: July 9, 2019
Last Modified: July 27, 2019
Dev: BrianPetkovsek
Dev: SAT3LL
@ -43,13 +41,14 @@ enlarging engine. It extracts frames from a video, enlarge it by a
number of times without losing any details or quality, keeping lines
smooth and edges sharp.
"""
from avalon_framework import Avalon
# local imports
from upscaler import Upscaler
# built-in imports
import argparse
import GPUtil
import json
import os
import psutil
import re
import shutil
import sys
@ -57,6 +56,11 @@ import tempfile
import time
import traceback
# third-party imports
from avalon_framework import Avalon
import GPUtil
import psutil
VERSION = '2.8.1'
# each thread might take up to 2.5 GB during initialization.

View File

@ -1,13 +1,11 @@
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
"""
Name: Video2X Setup Script
Author: K4YT3X
Author: BrianPetkovsek
Date Created: November 28, 2018
Last Modified: June 26, 2019
Last Modified: July 27, 2019
Dev: SAT3LL
@ -26,6 +24,8 @@ Installation Details:
- waifu2x_ncnn_vulkan: %LOCALAPPDATA%\\video2x\\waifu2x-ncnn-vulkan
"""
# built-in imports
import argparse
import json
import os
@ -105,10 +105,10 @@ class Video2xSetup:
for file in self.trash:
try:
if os.path.isfile(file):
print('Deleting: {}'.format(file))
print(f'Deleting: {file}')
os.remove(file)
else:
print('Deleting: {}'.format(file))
print(f'Deleting: {file}')
shutil.rmtree(file)
except FileNotFoundError:
pass
@ -221,9 +221,9 @@ def download(url, save_path, chunk_size=4096):
import requests
output_file = os.path.join(save_path, url.split('/')[-1])
print('Downloading: {}'.format(url))
print('Chunk size: {}'.format(chunk_size))
print('Saving to: {}'.format(output_file))
print(f'Downloading: {url}')
print(f'Chunk size: {chunk_size}')
print(f'Saving to: {output_file}')
stream = requests.get(url, stream=True)
total_size = int(stream.headers['content-length'])
@ -252,7 +252,7 @@ if __name__ == '__main__':
try:
args = process_arguments()
print('Video2X Setup Script')
print('Version: {}'.format(VERSION))
print(f'Version: {VERSION}')
# do not install pip modules if script
# is packaged in exe format

View File

@ -1,20 +1,22 @@
#!/usr/bin/env python3
# -*- coding: future_fstrings -*-
# -*- coding: utf-8 -*-
"""
Name: Waifu2x Caffe Driver
Author: K4YT3X
Date Created: Feb 24, 2018
Last Modified: July 9, 2019
Last Modified: July 27, 2019
Description: This class is a high-level wrapper
for waifu2x-caffe.
"""
from avalon_framework import Avalon
# built-in imports
import subprocess
import threading
# third-party imports
from avalon_framework import Avalon
class Waifu2xCaffe:
"""This class communicates with waifu2x cui engine

View File

@ -1,21 +1,23 @@
#!/usr/bin/env python3
# -*- coding: future_fstrings -*-
# -*- coding: utf-8 -*-
"""
Name: Waifu2x Converter CPP Driver
Author: K4YT3X
Date Created: February 8, 2019
Last Modified: June 15, 2019
Last Modified: July 27, 2019
Description: This class is a high-level wrapper
for waifu2x-converter-cpp.
"""
from avalon_framework import Avalon
# built-in imports
import os
import subprocess
import threading
# third-party imports
from avalon_framework import Avalon
class Waifu2xConverter:
"""This class communicates with waifu2x cui engine

View File

@ -1,23 +1,25 @@
#!/usr/bin/env python3
# -*- coding: future_fstrings -*-
# -*- coding: utf-8 -*-
"""
Name: Waifu2x NCNN Vulkan Driver
Author: SAT3LL
Date Created: June 26, 2019
Last Modified: June 26, 2019
Last Modified: July 27, 2019
Dev: K4YT3X
Description: This class is a high-level wrapper
for waifu2x_ncnn_vulkan.
"""
from avalon_framework import Avalon
# built-in imports
import os
import subprocess
import threading
# third-party imports
from avalon_framework import Avalon
class Waifu2xNcnnVulkan:
"""This class communicates with waifu2x ncnn vulkan engine