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
MediaCurator is released on PyPi [link](https://pypi.org/project/MediaCurator/)
MediaCurator is released on [PyPi](https://pypi.org/project/MediaCurator/)
## 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/"]

View File

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

View File

@ -185,17 +185,14 @@ class Video():
self.filename_tmp = ""
exit()
else:
os.chmod(f"{self.path}{self.filename_tmp}", 0o777)
try:
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_tmp = ""
return True
@staticmethod
def detect_fferror(filepath):
'''Returns a string with the detected errors'''

View File

@ -11,9 +11,17 @@
import sys
from mediacurator.library.video import Video
from mediacurator.library.medialibrary import MediaLibrary
from mediacurator.library.tools import detect_ffmpeg, user_confirm
# Normal import
try:
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
colorama.init()