def set_current_profile(clip_path): profile = mltprofiles.get_default_profile() producer = mlt.Producer(profile, str(clip_path)) global _current_profile profile_index = mltprofiles.get_closest_matching_profile_index(utils.get_file_producer_info(producer)) _current_profile = mltprofiles.get_profile_for_index(profile_index) return profile_index
def set_current_profile(clip_path): profile = mltprofiles.get_default_profile() producer = mlt.Producer(profile, str(clip_path)) global _current_profile profile_index = mltprofiles.get_closest_matching_profile_index( utils.get_file_producer_info(producer)) _current_profile = mltprofiles.get_profile_for_index(profile_index) return profile_index
def _display_file_info(media_file): # get info clip = current_sequence().create_file_producer_clip(media_file.path) info = utils.get_file_producer_info(clip) width = info["width"] height = info["height"] if media_file.type == appconsts.IMAGE: graphic_img = Image.open(media_file.path) width, height = graphic_img.size size = str(width) + " x " + str(height) length = utils.get_tc_string(info["length"]) try: img = guiutils.get_gtk_image_from_file(media_file.icon_path, 300) except: print "_display_file_info() failed to get thumbnail" vcodec = info["vcodec"] acodec = info["acodec"] if vcodec == None: vcodec = _("N/A") if acodec == None: acodec = _("N/A") channels = str(info["channels"]) frequency = str(info["frequency"]) + "Hz" if media_file.type == appconsts.VIDEO: match_profile_index = mltprofiles.get_closest_matching_profile_index( info) match_profile_name = mltprofiles.get_profile_name_for_index( match_profile_index) else: match_profile_name = _("N/A") if media_file.type == appconsts.VIDEO: if media_file.matches_project_profile(): matches_project_profile = _("Yes") else: matches_project_profile = _("No") else: matches_project_profile = _("N/A") try: num = info["fps_num"] den = info["fps_den"] fps = float(num / den) except: fps = _("N/A") dialogs.file_properties_dialog( (media_file, img, size, length, vcodec, acodec, channels, frequency, fps, match_profile_name, matches_project_profile))
def _display_file_info(media_file): # get info clip = current_sequence().create_file_producer_clip(media_file.path) info = utils.get_file_producer_info(clip) width = info["width"] height = info["height"] if media_file.type == appconsts.IMAGE: graphic_img = Image.open(media_file.path) width, height = graphic_img.size size = str(width) + " x " + str(height) length = utils.get_tc_string(info["length"]) try: img = guiutils.get_gtk_image_from_file(media_file.icon_path, 300) except: print "_display_file_info() failed to get thumbnail" vcodec = info["vcodec"] acodec = info["acodec"] if vcodec == None: vcodec = _("N/A") if acodec == None: acodec = _("N/A") channels = str(info["channels"]) frequency = str(info["frequency"]) + "Hz" if media_file.type == appconsts.VIDEO: match_profile_index = mltprofiles.get_closest_matching_profile_index(info) match_profile_name = mltprofiles.get_profile_name_for_index(match_profile_index) else: match_profile_name = _("N/A") if media_file.type == appconsts.VIDEO: if media_file.matches_project_profile(): matches_project_profile = _("Yes") else: matches_project_profile = _("No") else: matches_project_profile = _("N/A") try: num = info["fps_num"] den = info["fps_den"] fps = float(num/den) except: fps = _("N/A") dialogs.file_properties_dialog((media_file, img, size, length, vcodec, acodec, channels, frequency, fps, match_profile_name, matches_project_profile))
def _not_matching_media_info_callback(dialog, response_id, media_file): dialog.destroy() if response_id == Gtk.ResponseType.ACCEPT: # Save in hidden and open match_profile_index = mltprofiles.get_closest_matching_profile_index(media_file.info) profile = mltprofiles.get_profile_for_index(match_profile_index) path = utils.get_hidden_user_dir_path() + "/" + PROJECT().name persistance.save_project(PROJECT(), path, profile.description()) #<----- HERE actually_load_project(path)
def _not_matching_media_info_callback(dialog, response_id, media_file): dialog.destroy() if response_id == Gtk.ResponseType.ACCEPT: # Save in hidden and open match_profile_index = mltprofiles.get_closest_matching_profile_index( media_file.info) profile = mltprofiles.get_profile_for_index(match_profile_index) path = utils.get_hidden_user_dir_path() + "/" + PROJECT().name persistance.save_project(PROJECT(), path, profile.description()) #<----- HERE actually_load_project(path)
def matches_project_profile(self): if (not hasattr(self, "info")): # to make really sure that old projects don't crash, return True # but probably is not needed as attr is added at load if self.info == None: return True is_match = True # this is true for audio and graphics and image sequences and is only # set false for video that does not match profile if self.type == appconsts.VIDEO: best_media_profile_index = mltprofiles.get_closest_matching_profile_index(self.info) project_profile_index = mltprofiles.get_index_for_name(PROJECT().profile.description()) if best_media_profile_index != project_profile_index: is_match = False return is_match
def get_clip_profile_index(clip_path): profile = mltprofiles.get_default_profile() producer = mlt.Producer(profile, str(clip_path)) profile_index = mltprofiles.get_closest_matching_profile_index(utils.get_file_producer_info(producer)) return profile_index