This commit is contained in:
2025-06-17 19:56:00 +02:00
parent 32abeff2c1
commit ebf3245e11

View File

@@ -23,7 +23,7 @@ elif sys.platform == "darwin":
elif sys.platform == "win32": elif sys.platform == "win32":
ops = "win" ops = "win"
try: try:
opts, args = getopt.getopt(sys.argv[1:], "q:x:ta:r:fp:d:s:", ["command=", "help", "output=", "backup"]) opts, args = getopt.getopt(sys.argv[1:], "q:x:ta:r:fp:d:s:z:", ["command=", "help", "output=", "backup"])
except getopt.GetoptError as err: except getopt.GetoptError as err:
# print help information and exit: # print help information and exit:
print(str(err)) # will print something like "option -a not recognized" print(str(err)) # will print something like "option -a not recognized"
@@ -59,6 +59,9 @@ for o, a in opts:
_TEST = True _TEST = True
elif o in ("-x", "--file"): elif o in ("-x", "--file"):
_FILE = a _FILE = a
elif o in ("-z", "--file"):
_SRC_FILE = a
elif o in ("-s", "--sequence"): elif o in ("-s", "--sequence"):
a = a.split(",") a = a.split(",")
for s in a: for s in a:
@@ -77,6 +80,14 @@ for o, a in opts:
#print(_FULL_PATH) #print(_FULL_PATH)
def modify_creation_date(path,src_file):
create_date = filedate.File(src_file).get()
filedate.File(path).set(
created = create_date["created"],
modified = create_date["modified"],
accessed = create_date["accessed"]
)
def flip_videos(_DEV,_SOURCE_DIR,_DAY_DIRS): def flip_videos(_DEV,_SOURCE_DIR,_DAY_DIRS):
for _DAY_DIR in _DAY_DIRS: for _DAY_DIR in _DAY_DIRS:
@@ -148,13 +159,8 @@ def flip_videos(_DEV,_SOURCE_DIR,_DAY_DIRS):
print(e) print(e)
print(f"Failed to move {export_name}") print(f"Failed to move {export_name}")
if _ACTION == "flip": def encode_videos(_DEV,_SOURCE_DIR,_DAY_DIRS):
flip_videos(_DEV, _SOURCE_DIR,_DAY_DIRS)
if _ACTION == "join":
for _DAY_DIR in _DAY_DIRS: for _DAY_DIR in _DAY_DIRS:
if ops == "win": if ops == "win":
_FULL_PATH = _SOURCE_DIR + "\\" + _DEV + "\\" + _DAY_DIR + "\\" _FULL_PATH = _SOURCE_DIR + "\\" + _DEV + "\\" + _DAY_DIR + "\\"
@@ -233,34 +239,14 @@ if _ACTION == "join":
# print(os.getcwd()) # print(os.getcwd())
#status, output = subprocess.getstatusoutput(myCmd) #status, output = subprocess.getstatusoutput(myCmd)
if ops == "win":
if _FLIP: myCmd = [
if ops == "win": "ffmpeg", "-f", "concat", "-i", "video.txt","-vcodec", "copy", "-acodec", "copy", "-y", export_name
myCmd = [ ]
"ffmpeg", "-f", "concat", "-i", "video.txt", "-c", "copy", "-metadata:s:v:0", "rotate=180","-y", export_name
]
else:
# myCmd = [
# "/usr/bin/ffmpeg", "-f", "concat", "-i", "video.txt", "-c", "copy", "-metadata:s:v:0", "rotate=180", "-y", export_name
# ]
myCmd = [
"/usr/bin/ffmpeg", "-f", "concat", "-i", "video.txt", "-c", "copy", "-metadata:s:v:0", "rotate=0", "-y", export_name
]
else: else:
if ops == "win": myCmd = [
myCmd = [ "/usr/bin/ffmpeg", "-f", "concat", "-i", "video.txt","-c", "copy", "-y", export_name
"ffmpeg", "-f", "concat", "-i", "video.txt","-vcodec", "copy", "-acodec", "copy", "-y", export_name ]
]
else:
myCmd = [
"/usr/bin/ffmpeg", "-f", "concat", "-i", "video.txt","-c", "copy", "-y", export_name
]
print(myCmd) print(myCmd)
d_print(" ".join(myCmd)) d_print(" ".join(myCmd))
d_print(_FULL_PATH) d_print(_FULL_PATH)
@@ -345,6 +331,16 @@ if _ACTION == "join":
os.remove("video.txt") os.remove("video.txt")
except: except:
pass pass
if _ACTION == "modify_date":
modify_creation_date(_FILE,_SRC_FILE)
if _ACTION == "flip":
flip_videos(_DEV, _SOURCE_DIR,_DAY_DIRS)
if _ACTION == "join":
encode_videos(_DEV, _SOURCE_DIR,_DAY_DIRS)
if _ACTION == "encode": if _ACTION == "encode":
print("Encode Job") print("Encode Job")