diff --git a/VideoScript.py b/VideoScript.py index d530347..bdf28cb 100644 --- a/VideoScript.py +++ b/VideoScript.py @@ -965,12 +965,14 @@ def merge(self, allVideo:bool=True, allAudio:bool=False, allSubtitle:bool=False) if index == 0: commandInputs += f'-i "{path}" ' commandMap += f'-map {index} ' + # remove time codec for mp4 commandMap += f'-map -{index}:d ' commandMetadata += f'-metadata:s:v:{index} title="{name}" ' commandMetadata += f'-metadata:s:a:{index} title="{name}" ' commandMetadata += f'-metadata:s:s:{index} title="{name}" ' else: commandInputs += f'-i "{path}" ' + # remove time codec for mp4 commandMap += f'-map -{index}:d ' if allVideo: commandMap += f'-map {index}:v? ' diff --git a/VideoScriptWebUI.py b/VideoScriptWebUI.py index d14ccbb..958de1e 100644 --- a/VideoScriptWebUI.py +++ b/VideoScriptWebUI.py @@ -46,7 +46,13 @@ "select":"info", "unselect":"dark", } -videoSortBy = ["width", "height", "w x h", "fps", "length", "bit rate"] +videoSortBy = [ + "name", + "width", "height", "w x h", + "r_frame_rate", + "duration", + "bitRate" +] app = Dash( @@ -857,49 +863,27 @@ def reverseVideoList(_, children): ) def sortVideoList(sortBy, allColor): - global vs, allVideoList, videoItemColor + global vs, allVideoList, videoItemColor, videoSortBy - # add color to allVideoList - for index in range(len(allVideoList)): - allVideoList[index]["color"] = allColor[index] + # check dropdown validity + if sortBy not in videoSortBy: + print("Unknow sort selection") + raise PreventUpdate - - if sortBy == "width": - allVideoList = sorted( - allVideoList, - key= lambda video: video['width'], - ) - elif sortBy == "height": - allVideoList = sorted( - allVideoList, - key= lambda video: video['height'], - ) - elif sortBy == "w x h": + # special sort + if sortBy == "w x h": for index in range(len(allVideoList)): allVideoList[index]["w x h"] = allVideoList[index]["width"] * allVideoList[index]["height"] - allVideoList = sorted( - allVideoList, - key= lambda video: video['w x h'], - ) - elif sortBy == "fps": - allVideoList = sorted( - allVideoList, - key= lambda video: video['r_frame_rate'], - ) - elif sortBy == "length": - allVideoList = sorted( - allVideoList, - key= lambda video: video['duration'], - ) - elif sortBy == "bit rate": - allVideoList = sorted( - allVideoList, - key= lambda video: video['bitRate'], - ) + allVideoList.sort(key= lambda video: video['w x h'],) + # normal sort else: - print("Unknow sort selection") - raise PreventUpdate + allVideoList.sort(key= lambda video: video[sortBy],) + + # add color to allVideoList + for index in range(len(allVideoList)): + allVideoList[index]["color"] = allColor[index] + # re generate list of video items videoItems = [] vs.vList = []