This repository has been archived by the owner on Feb 18, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #6 from PiloeGAO/basicPublishSystem
Basic publish system
- Loading branch information
Showing
45 changed files
with
1,571 additions
and
117 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -137,4 +137,7 @@ dmypy.json | |
.pyre/ | ||
|
||
# VSCode files | ||
.vscode/ | ||
.vscode/ | ||
|
||
# FFMEPG install folder | ||
Hestia/core/ffmpeg/* |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,70 @@ | ||
""" | ||
:package: Hestia | ||
:file: IOUtils.py | ||
:brief: IO functions. | ||
:author: PiloeGAO (Leo DEPOIX) | ||
:version: 0.0.4 | ||
""" | ||
import sys, os, shutil, subprocess | ||
|
||
def makeFolder(path): | ||
"""Build a folder. | ||
Args: | ||
path (str): Folder path. | ||
Returns: | ||
bool: Creation status. | ||
""" | ||
if(not os.path.isdir(path)): | ||
try: | ||
os.makedirs(path) | ||
except OSError as error: | ||
print("Directory %s can't be created (%s)" % (path, error)) | ||
return False | ||
else: | ||
return True | ||
else: | ||
return False | ||
|
||
def copyFile(filePath, targetPath, **kwargs): | ||
"""Copy a file from a directory to another. | ||
Args: | ||
filePath (str): Input path. | ||
targetPath (str): Ouput path. | ||
Returns: | ||
bool: Copy status. | ||
""" | ||
oldFilename = os.path.split(filePath)[1] | ||
if( not os.path.isfile(targetPath + os.sep + oldFilename)): | ||
shutil.copy(filePath, targetPath) | ||
|
||
if(kwargs["newName"] != None): | ||
src = targetPath + os.sep + oldFilename | ||
dst = targetPath + os.sep + kwargs["newName"] + os.path.splitext(oldFilename)[1] | ||
os.rename(src, dst) | ||
|
||
return True | ||
return False | ||
|
||
def videoConverter(filePath, targetPath): | ||
"""Convert video to MP4. | ||
Args: | ||
filePath (str): Input path. | ||
targetPath (str): Ouput path. | ||
Returns: | ||
bool: Convert status. | ||
""" | ||
ffmpeg_installDir = os.path.dirname(os.path.abspath(__file__)) + os.sep + "ffmpeg" + os.sep + "bin" | ||
|
||
# TODO: Support MacOS and Linux. | ||
if(os.path.isdir(ffmpeg_installDir) and sys.platform.startswith("win32")): | ||
ffmepg_exe = ffmpeg_installDir + os.sep + "ffmpeg.exe" | ||
subprocess.call("%s -i %s -vcodec libx264 -acodec aac %s" % (ffmepg_exe, filePath, targetPath)) | ||
return True | ||
|
||
return False |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.