def checkin_files(my): basedir = my.get_upload_dir(my.ticket) file_types = [] for filename in my.filenames: file_path = "%s/%s" % (basedir, filename) my.file_paths.append(file_path) # for now, use the extension as the type basename, ext = os.path.splitext(filename) file_types.append(ext) # should create an icon here if ext == ".png": creator = IconCreator(file_path) creator.create_icons() icon_path = creator.get_icon_path() my.file_paths.append(icon_path) file_types.append("icon") # remove the web file try: os.unlink(creator.get_web_path()) except OSError, e: print e
def checkin_files(my): basedir = my.get_upload_dir(my.ticket) file_types = [] for filename in my.filenames: file_path = "%s/%s" % (basedir, filename) my.file_paths.append(file_path) # for now, use the extension as the type basename, ext = os.path.splitext(filename) file_types.append(ext) # should create an icon here if ext == ".png": creator = IconCreator(file_path) creator.create_icons() icon_path = creator.get_icon_path() my.file_paths.append(icon_path) file_types.append("icon") # remove the web file try: os.unlink(creator.get_web_path()) except OSError, e: print e
def _check_in_swf(my, snapshot, sobject, render, pat, final_pat, render_dir, filenames): final_path = icon_path = '' for name in filenames: if pat.match(name): final_name = pat.sub(final_pat, name) shutil.move(render_dir + "/" + name, render_dir \ + "/" + final_name) src_path = "%s/%s" % (render_dir, final_name) if final_name.endswith('.png'): icon_creator = IconCreator(src_path) icon_creator.create_icons() icon_path = icon_creator.get_icon_path() elif final_name.endswith('.swf'): final_path = src_path types = ["main"] paths = [final_path] if icon_path: paths.append(icon_path) types.append('icon') checkin = FileCheckin(render, paths, types, context="render", column="images") checkin.execute()
def _check_in_png(my, snapshot, sobject, render, pat, final_pat, render_dir, filenames): icon_path = final_path = '' icon_creator = None file_range = my.render_context.get_frame_range() for name in filenames: if pat.match(name): final_name = pat.sub(final_pat, name) shutil.move(render_dir + "/" + name, render_dir + "/" + final_name) final_path = "%s/%s" % (render_dir, final_name) icon_creator = IconCreator(final_path) icon_creator.create_icons() if icon_creator: icon_path = icon_creator.get_icon_path() gen_icon_path = re.sub("(.*_icon\.)(\d{4})(\.png)", r"\1####\3", icon_path) gen_final_path = re.sub("(.*\.)(\d{4})(\.png)", r"\1####\3", final_path) types = ["main", "icon"] paths = [gen_final_path, gen_icon_path] # check that all the files exist try: for path in paths: FileGroup.check_paths(path, file_range) except FileException, e: print( "The frame range of layer [%s] probably\ does not match the shot's frame range [%s]. %s" \ %(sobject.get_value('name'), file_range.get_key(), e)) # FIXME: this is a little redundant, but it works count = 0 file_paths = FileGroup.expand_paths(paths[0], file_range) for file_path in file_paths: if not os.path.exists(file_path): break count += 1 file_range.frame_end = count
def _check_in_swf(my, snapshot, sobject, render, pat, final_pat, render_dir, filenames): final_path = icon_path = '' for name in filenames: if pat.match(name): final_name = pat.sub(final_pat, name) shutil.move(render_dir + "/" + name, render_dir \ + "/" + final_name) src_path = "%s/%s" % (render_dir, final_name) if final_name.endswith('.png'): icon_creator = IconCreator(src_path) icon_creator.create_icons() icon_path = icon_creator.get_icon_path() elif final_name.endswith('.swf'): final_path = src_path types = ["main"] paths = [final_path] if icon_path: paths.append(icon_path) types.append('icon') checkin = FileCheckin(render, paths, types, context="render", column="images") checkin.execute()
def _check_in_png(my, snapshot, sobject, render, pat, final_pat, render_dir, filenames): icon_path = final_path = '' icon_creator = None file_range = my.render_context.get_frame_range() for name in filenames: if pat.match(name): final_name = pat.sub(final_pat, name) shutil.move(render_dir + "/" + name, render_dir + "/" + final_name) final_path = "%s/%s" % (render_dir, final_name) icon_creator = IconCreator(final_path) icon_creator.create_icons() if icon_creator: icon_path = icon_creator.get_icon_path() gen_icon_path = re.sub("(.*_icon\.)(\d{4})(\.png)", r"\1####\3", icon_path) gen_final_path = re.sub("(.*\.)(\d{4})(\.png)", r"\1####\3", final_path) types = ["main", "icon"] paths = [gen_final_path, gen_icon_path] # check that all the files exist try: for path in paths: FileGroup.check_paths(path, file_range) except FileException, e: print( "The frame range of layer [%s] probably\ does not match the shot's frame range [%s]. %s" \ %(sobject.get_value('name'), file_range.get_key(), e)) # FIXME: this is a little redundant, but it works count = 0 file_paths = FileGroup.expand_paths(paths[0], file_range) for file_path in file_paths: if not os.path.exists(file_path): break count += 1 file_range.frame_end = count