本文整理汇总了Python中pyasm.common.Common.get_dir_info方法的典型用法代码示例。如果您正苦于以下问题:Python Common.get_dir_info方法的具体用法?Python Common.get_dir_info怎么用?Python Common.get_dir_info使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类pyasm.common.Common
的用法示例。
在下文中一共展示了Common.get_dir_info方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: create
# 需要导入模块: from pyasm.common import Common [as 别名]
# 或者: from pyasm.common.Common import get_dir_info [as 别名]
def create(
file_path,
search_type,
search_id,
file_type=None,
requires_file=True,
st_size=None,
repo_type=None,
search_code=None,
):
exists = os.path.exists(file_path)
isdir = os.path.isdir(file_path)
if requires_file and not os.path.exists(file_path):
raise FileException("File '%s' does not exist" % file_path)
file_name = os.path.basename(file_path)
file = File(File.SEARCH_TYPE)
file.set_value("file_name", file_name)
file.set_value("search_type", search_type)
if search_code:
file.set_value("search_code", search_code)
# MongoDb
if search_id and isinstance(search_id, int):
file.set_value("search_id", search_id)
if file_type:
file.set_value("type", file_type)
if isdir:
file.set_value("base_type", File.BASE_TYPE_DIR)
else:
file.set_value("base_type", File.BASE_TYPE_FILE)
project = Project.get()
file.set_value("project_code", project.get_code())
if exists:
if isdir:
dir_info = Common.get_dir_info(file_path)
size = dir_info.get("size")
file.set_value("st_size", size)
else:
from stat import ST_SIZE
size = os.stat(file_path)[ST_SIZE]
file.set_value("st_size", size)
elif st_size != None:
file.set_value("st_size", st_size)
if repo_type:
file.set_value("repo_type", repo_type)
file.commit()
return file
示例2: get_info
# 需要导入模块: from pyasm.common import Common [as 别名]
# 或者: from pyasm.common.Common import get_dir_info [as 别名]
def get_info(my, dirname, basename):
location = my.kwargs.get("location")
# get some info about the file
path = "%s/%s" % (dirname, basename)
snapshot = my.snapshots.get(path)
file_range = None
if FileGroup.is_sequence(path) and snapshot:
file_range = snapshot.get_file_range()
#start_frame = file_range.get_frame_start()
#end_frame = file_range.get_frame_end()
if location == 'server':
my.info = Common.get_dir_info(path, file_range=file_range)
else:
my.info = {}
return my.info
示例3: on_complete
# 需要导入模块: from pyasm.common import Common [as 别名]
# 或者: from pyasm.common.Common import get_dir_info [as 别名]
def on_complete(my, path, data):
if my.message_key:
my.server.log_message(my.message_key, data, status="complete")
if __name__ == '__main__':
import time
from_path = "/home/tactic/svg"
start = time.time()
dir_info = Common.get_dir_info(from_path)
print "dir_info: ", dir_info
total_size = dir_info.get("size")
from pyasm.security import Batch
Batch()
class Progress(object):
def __init__(my):
my.total_sent = 0
def on_update(my, path, data):
from tactic_client_lib import TacticServerStub
server = TacticServerStub.get()