Added dev imports

This commit is contained in:
Fabrice Quenneville 2020-12-26 12:31:27 -05:00
parent 5a42a153e9
commit be222039d6
4 changed files with 21 additions and 18 deletions

View File

@ -11,7 +11,7 @@ The documentation is available on the following [link](https://fabquenneville.gi
## Releases ## Releases
MediaCurator is released on PyPi [link](https://pypi.org/project/MediaCurator/) MediaCurator is released on [PyPi](https://pypi.org/project/MediaCurator/)
## Usage ## Usage
mediacurator [list,convert] [-del] [-in:any,avi,mkv,wmv,mpg,mp4,m4v,flv,vid] [-filters:fferror,old,lowres,hd,720p,1080p,uhd,mpeg,mpeg4,x264,wmv3,wmv] [-out:mkv/mp4,x265/av1] [-print:list,formated,verbose] [-dirs/-files:"/mnt/media/",,"/mnt/media2/"] mediacurator [list,convert] [-del] [-in:any,avi,mkv,wmv,mpg,mp4,m4v,flv,vid] [-filters:fferror,old,lowres,hd,720p,1080p,uhd,mpeg,mpeg4,x264,wmv3,wmv] [-out:mkv/mp4,x265/av1] [-print:list,formated,verbose] [-dirs/-files:"/mnt/media/",,"/mnt/media2/"]

View File

@ -24,15 +24,13 @@ def detect_ffmpeg():
def user_confirm(question, color=False): def user_confirm(question, color=False):
'''Returns the user answer to a yes or no question''' '''Returns the user answer to a yes or no question'''
if color == "yellow": if color == "yellow":
print(colorama.Fore.YELLOW, end = '') print(f"{colorama.Fore.YELLOW}{question} {colorama.Fore.RESET}", end = '')
answer = input(f"{question} ") answer = input()
print(colorama.Fore.RESET)
elif color == "red": elif color == "red":
print(colorama.Fore.RED, end = '') print(f"{colorama.Fore.RED}{question} {colorama.Fore.RESET}", end = '')
answer = input(f"{question} ") answer = input()
print(colorama.Fore.RESET)
else: else:
answer = input(question) answer = input(f"{question} ")
if answer.lower() in ["y","yes"]: if answer.lower() in ["y","yes"]:
return True return True
elif answer.lower() in ["n","no"]: elif answer.lower() in ["n","no"]:

View File

@ -185,17 +185,14 @@ class Video():
self.filename_tmp = "" self.filename_tmp = ""
exit() exit()
else: else:
try:
os.chmod(f"{self.path}{self.filename_tmp}", 0o777) os.chmod(f"{self.path}{self.filename_tmp}", 0o777)
except PermissionError:
print(f"{colorama.Fore.RED}PermissionError on: '{self.path}{self.filename_tmp}'{colorama.Fore.RESET}")
self.filename_new = self.filename_tmp self.filename_new = self.filename_tmp
self.filename_tmp = "" self.filename_tmp = ""
return True return True
@staticmethod @staticmethod
def detect_fferror(filepath): def detect_fferror(filepath):
'''Returns a string with the detected errors''' '''Returns a string with the detected errors'''

View File

@ -11,9 +11,17 @@
import sys import sys
from mediacurator.library.video import Video # Normal import
from mediacurator.library.medialibrary import MediaLibrary try:
from mediacurator.library.tools import detect_ffmpeg, user_confirm from mediacurator.library.video import Video
from mediacurator.library.medialibrary import MediaLibrary
from mediacurator.library.tools import detect_ffmpeg, user_confirm
# Allow local import for development purposes
except ModuleNotFoundError:
from library.video import Video
from library.medialibrary import MediaLibrary
from library.tools import detect_ffmpeg, user_confirm
import colorama import colorama
colorama.init() colorama.init()