diff --git a/handle_imported_video.py b/handle_imported_video.py index 8bc006d..1427b21 100644 --- a/handle_imported_video.py +++ b/handle_imported_video.py @@ -8,7 +8,14 @@ import shutil import json import getopt - +if sys.platform == "linux" or sys.platform == "linux2": + # linux + ops = "linux" +elif sys.platform == "darwin": + # OS X + ops = "osx" +elif platform == "win32": + ops = "win" try: opts, args = getopt.getopt(sys.argv[1:], "r:fp:d:s:", ["command=", "help", "output=", "backup"]) except getopt.GetoptError as err: @@ -21,7 +28,10 @@ output = None _DEV = "gopro9_1" _SEQUENCES = [] _FLIP = False -_SOURCE_DIR = "/share/Photo/imported/" +if ops == "win": + _SOURCE_DIR = "p:\\imported\\" +else: + _SOURCE_DIR = "/share/Photo/imported/" for o, a in opts: if o == "-h": _ACTION = True @@ -45,13 +55,17 @@ for o, a in opts: #_SOURCE_DIR = "/media/nas/nas-photo/imported/" -_FULL_PATH = _SOURCE_DIR + "/" + _DEV + "/" + _DAY_DIR +if ops == "win": + _FULL_PATH = _SOURCE_DIR + "\\" + _DEV + "\\" + _DAY_DIR + "\\" +else: + _FULL_PATH = _SOURCE_DIR + "/" + _DEV + "/" + _DAY_DIR + "/" + print(_FULL_PATH) video_seq = {} if os.path.exists(_FULL_PATH): - if os.path.exists(_FULL_PATH + "/100GOPRO"): - _FULL_PATH = _FULL_PATH + "/100GOPRO" + if os.path.exists(_FULL_PATH + "100GOPRO"): + _FULL_PATH = _FULL_PATH + "100GOPRO" for filename in os.listdir(_FULL_PATH): if filename.endswith(".MP4"): prefix = filename[0:2] @@ -64,7 +78,7 @@ if os.path.exists(_FULL_PATH): print(seq) print(part) print(json.dumps(video_seq,indent=2)) - _PROCESSED = _FULL_PATH + "/processed" + _PROCESSED = _FULL_PATH + "processed" if not os.path.exists(_PROCESSED): os.mkdir(_PROCESSED) print(f"SEQUENCES : {_SEQUENCES}")