Avalon SFTP Client, for uploading Avalon workfile or representation to remote site via SFTP
avalon-core
pysftp
$ python -m avalon_sftpc --demo
AVALON_SFTPC_SITES
: Optional, dir path which contains SFTP sites' config files (.cfg
). If not set, will look into ./avalon_sftpc/sites
NOTE: Uploading with 10 processes, not tweakable
- Write SFTP server connection config file
See here
- Generating job package file
# Inside Maya (or other DCC App that has Avalon implementation)
from avalon_sftpc import util
exporter = util.JobExporter(remote_root="",
remote_user="user",
site="site-name")
def collect_rogue_files():
"""Pseudo code, collect files that hasn't been published"""
jobs = list()
for file in unpublished_files():
remote_path = mapping(file)
jobs.append((file, remote_path))
if jobs:
exporter.add_job(files=jobs,
type="Rogue Files",
description="Rogues of %s" % session["AVALON_ASSET"])
def save_file():
cmds.file(save=True, force=True)
# This is optional
additional_jobs = [
collect_rogue_files,
save_file,
]
exporter.from_workfile(additional_jobs)
out = exporter.export()
print(out)
# /../scenes/workfile_v0002.ma.sftp.job
- Launch Avalon Uploader
$ python -m avalon_sftpc
Input package file path, and good to upload :)