Skip to content
This repository has been archived by the owner on Feb 18, 2023. It is now read-only.

Commit

Permalink
Merge pull request #6 from PiloeGAO/basicPublishSystem
Browse files Browse the repository at this point in the history
Basic publish system
  • Loading branch information
PiloeGAO authored May 23, 2021
2 parents 8ae23fb + 04c0f28 commit 8dc1f27
Show file tree
Hide file tree
Showing 45 changed files with 1,571 additions and 117 deletions.
5 changes: 4 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -137,4 +137,7 @@ dmypy.json
.pyre/

# VSCode files
.vscode/
.vscode/

# FFMEPG install folder
Hestia/core/ffmpeg/*
2 changes: 1 addition & 1 deletion Hestia/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
:file: __init__.py
:brief: Initialize file.
:author: PiloeGAO (Leo DEPOIX)
:version: 0.0.3
:version: 0.0.4
"""

from os import sys, path
Expand Down
70 changes: 70 additions & 0 deletions Hestia/core/IOUtils.py
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
17 changes: 14 additions & 3 deletions Hestia/core/category.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
:file: category.py
:brief: Category base class.
:author: PiloeGAO (Leo DEPOIX)
:version: 0.0.3
:version: 0.0.4
"""

class Category():
Expand All @@ -13,13 +13,15 @@ class Category():
id (str, optional): Category's ID. Defaults to "".
name (str, optional): Catgeory's name. Defaults to "".
description (str, optional): Category's description. Defaults to "".
type (str, optional): Category's type (must be "Asset" or "Shot"). Defaults to "".
type (str, optional): Category's type (must be "Assets" or "Shots"). Defaults to "".
"""
def __init__(self, id="", name="", description="", type=""):
def __init__(self, id="", name="", description="", type="", **kwargs):
self.__id = id
self.__name = name
self.__description = description
self.__type = type

self.__rawDatas = kwargs["rawDatas"] if "rawDatas" in kwargs else ""

self.__entities = []

Expand Down Expand Up @@ -77,6 +79,15 @@ def type(self):
"""
return self.__type

@property
def rawDatas(self):
"""Get the raw datas of the class.
Returns:
dict: Raw datas
"""
return self.__rawDatas

@property
def entities(self):
"""Get the entities stored in the category.
Expand Down
31 changes: 25 additions & 6 deletions Hestia/core/entity.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
:file: entity.py
:brief: Entity base class.
:author: PiloeGAO (Leo DEPOIX)
:version: 0.0.3
:version: 0.0.4
"""

class Entity():
Expand All @@ -16,30 +16,31 @@ class Entity():
name (str, optional): Entity's name. Defaults to "".
description (str, optional): Entity's description. Defaults to "".
icon (str, optional): Entity's icon. Defaults to "".
tasks (list: class: "Task"): Entity's tasks. Defaults to [].
versions (list: class: "Version"): Entity's version. Defaults to [].
"""
def __init__(self, manager, entityType = "Assets", id = "", name = "", description = "", icon = "", versions=[], **kwargs):
def __init__(self, manager, entityType = "Assets", id = "", name = "", description = "", icon = "", tasks=[], versions=[], **kwargs):
self.__manager = manager
# Common datas.
self.__type = entityType
self.__id = id
self.__name = name
self.__description = description

self.__rawDatas = kwargs["rawDatas"] if "rawDatas" in kwargs else ""

self.__iconDownloaded = False
self.__icon = icon
self.__tasks = tasks
self.__versions = versions

# Shot specific datas.
self.__frameNumber = 0
if("frameNumber" in kwargs):
self.__frameNumber = int(kwargs["frameNumber"])
self.__frameNumber = int(kwargs["frameNumber"]) if "frameNumber" in kwargs else 0
self.__assignedAssets = kwargs["assignedAssets"] if "assignedAssets" in kwargs else []

@property
def type(self):
"""Get the type of entity.
Returns:
str: Entity type.
"""
Expand Down Expand Up @@ -89,6 +90,15 @@ def description(self, description):
description (str): The description of the entity
"""
self.__description = description

@property
def rawDatas(self):
"""Get the raw datas of the class.
Returns:
dict: Raw datas
"""
return self.__rawDatas

@property
def icon(self):
Expand All @@ -114,6 +124,15 @@ def icon(self, icon):
self.__icon = icon
self.__iconDownloaded = True

@property
def tasks(self):
"""Get tasks of the entity.
Returns:
list: class:`Task`: Task of the entity.
"""
return self.__tasks

@property
def versions(self):
"""Get versions of the entity.
Expand Down
79 changes: 78 additions & 1 deletion Hestia/core/links/dccs/defaultIntegration.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
:file: defaultIntegration.py
:brief: Default integration class.
:author: PiloeGAO (Leo DEPOIX)
:version: 0.0.3
:version: 0.0.4
"""

class DefaultIntegration(object):
Expand All @@ -12,13 +12,35 @@ class DefaultIntegration(object):
def __init__(self, manager=None):
self.__manager = manager

self._name = "standalone"

self._active = False

self._defaultFormat = ""
self._availableFormats = []

self._supportInstances = False
self._instances = False
self._supportScreenshots = False

@property
def name(self):
"""Get the name of the integration.
Returns:
str: Integration name
"""
return self._name

@property
def defaultFormat(self):
"""Get the default format.
Returns:
str: Default format/extension.
"""
return self._defaultFormat

@property
def availableFormats(self):
"""Get the available formats.
Expand Down Expand Up @@ -56,6 +78,15 @@ def instances(self, newStatus):
print("Instances new status" + str(newStatus))
self._instances = newStatus

@property
def supportScreenshots(self):
"""Get the screenshots support.
Returns:
bool: Is screenshot support is available.
"""
return self._supportScreenshots

def initializeFileFormats(self):
"""Initialize the file formats list.
Expand Down Expand Up @@ -150,5 +181,51 @@ def assignShaderToSelectedAsset(self, version):
def extractAssets(self):
"""Extracts assets for shot building file.
"""
return NotImplementedError

def takePlayblast(self, startFrame, endFrame, path):
"""Take a playblast of the scene.
Args:
startFrame (int): Start frame.
endFrame (int): End frame.
path (sty): Ouput path.
Returns:
bool: Function status.
"""
return NotImplementedError

def openFile(self, path):
"""Open the file in the DCC.
Args:
path (str): File path.
Returns:
bool: Function status.
"""
return NotImplementedError

def saveFile(self, path):
"""Save current file to the given path.
Args:
path (str): File path.
Returns:
bool: Functions status.
"""
return NotImplementedError

def exportSelection(self, path, extension):
"""Export selection to the path with the correct format.
Args:
path (str): Output path.
extension (str): Extensionof the file.
Returns:
bool: Function status.
"""
return NotImplementedError
Loading

0 comments on commit 8dc1f27

Please sign in to comment.