def copyOnlyTapesToLocal(self): op1TapePath, op1AlbumPath = config[ "OP_1_Mounted_Dir"] + "/tape", config["OP_1_Mounted_Dir"] + "/album" currentTimeFolder = savePaths["Local_Projects"] + "/" + self.getTime() forcedir(currentTimeFolder + "/tape") try: copy_tree(op1TapePath, currentTimeFolder + "/tape") except: shutil.rmtree(currentTimeFolder)
def loadProjectToOP1(self, localProjectPath): shutil.rmtree(config["OP_1_Mounted_Dir"] + "/tape") forcedir(config["OP_1_Mounted_Dir"] + "/tape") op1TapePath = config["OP_1_Mounted_Dir"] + "/tape" copy_tree(localProjectPath + "/tape", op1TapePath) if isdir(localProjectPath + "/album"): shutil.rmtree(config["OP_1_Mounted_Dir"] + "/album") forcedir(config["OP_1_Mounted_Dir"] + "/album") op1AlbumPath = config["OP_1_Mounted_Dir"] + "/album" copy_tree(localProjectPath + "/album", op1AlbumPath)
def copyToLocal(self): op1TapePath, op1AlbumPath = config[ "OP_1_Mounted_Dir"] + "/tape", config["OP_1_Mounted_Dir"] + "/album" newPath = savePaths["Local_Projects"] + "/" + self.getTime() forcedir(newPath + "/album") forcedir(newPath + "/tape") try: copy_tree(op1AlbumPath, newPath) copy_tree(op1TapePath, newPath) except: shutil.rmtree(newPath)
def copyToLocal(self): op1TapePath, op1AlbumPath = config[ "OP_1_Mounted_Dir"] + "/tape", config["OP_1_Mounted_Dir"] + "/album" currentTimeFolder = savePaths["Local_Projects"] + "/" + self.getTime() forcedir(currentTimeFolder + "/album") forcedir(currentTimeFolder + "/tape") try: copy_tree(op1AlbumPath, currentTimeFolder + "/album") copy_tree(op1TapePath, currentTimeFolder + "/tape") except: # Connection broken, remove created folder shutil.rmtree(currentTimeFolder)
def backupOPZState(self): if os.listdir(config["OP_Z_Mounted_Dir"]): OPZStatePath = config["OP_Z_Mounted_Dir"] # currentTimeFolder = savePaths["OP_Z_Local_Backup_States_Path"] + "/" + self.getTime() currentTimeFolder = savePaths[ "OP_Z_Local_Backup_States_Path"] + "/" + self.getLatestProjectName( savePaths["OP_Z_Local_Backup_States_Path"]) print(OPZStatePath) print(currentTimeFolder) forcedir(currentTimeFolder) try: copy_tree(OPZStatePath, currentTimeFolder) print("Finished CPY") except: shutil.rmtree(currentTimeFolder)
"TargetOp1MountDir": "/media/op1", "TargetOpZMountDir": "/media/opz" } # For System Use savePaths = { "OP_1_System_Path": config["OP_1_Mounted_Dir"], "OP_Z_System_Path": config["OP_Z_Mounted_Dir"], # Local OP1 Backup Paths "Local_Dir": config["OP1BackupPath"], "Local_Projects": config["OP1BackupPath"] + "projects", "Local_Patches": config["OP1BackupPath"] + "patches", "Local_Synth": config["OP1BackupPath"] + "patches/synth", "Local_Drum": config["OP1BackupPath"] + "patches/drum", } # Ensuring important folders are created if not os.path.exists(config["OP1BackupPath"]): forcedir( os.path.dirname(os.path.realpath(__file__)) + "/OP_1_Backup_Library/projects") forcedir( os.path.dirname(os.path.realpath(__file__)) + "/OP_1_Backup_Library/patches/synth") forcedir( os.path.dirname(os.path.realpath(__file__)) + "/OP_1_Backup_Library/patches/drum") forcedir( os.path.dirname(os.path.realpath(__file__)) + "/OP_Z_Backup_Library/Backups")
config["OP1BackupPath"] + "patches/drum", # Local OPZ Backup Paths "OP_Z_System_Path": config["OP_Z_Mounted_Dir"], "OP_Z_Local_Backup_States_Path": os.path.join(config["OPZBackupPath"], "Backup_States") } # =========================== Battery configuration =========================== # RaspiUPS uses MAX17043 chip set # ADS1115 not yet compatible batteryConfig = { "enable": False, "UPS_Method": "RaspiUPS" # RaspiUPS or ADS1115 } # =================== DO NOT Modify =================== # Ensuring important folders are created if not os.path.exists(config["OP1BackupPath"]) or not os.path.exists( config["OPZBackupPath"]): forcedir(os.path.join(config["OP1BackupPath"], "projects")) forcedir(os.path.join(config["OP1BackupPath"], "patches/synth")) forcedir(os.path.join(config["OP1BackupPath"], "patches/drum")) forcedir(os.path.join(config["OPZBackupPath"], "Backup_States")) os.system("sudo chmod 0777 -R " + "/files") if not os.path.exists(os.path.join(workDir, "op1funSetup.txt")): data = {"USER_ID": "", "USER_EMAIL": "", "API_TOKEN": ""} with open(os.path.join(workDir, 'op1funSetup.txt'), 'w') as outfile: json.dump(data, outfile, sort_keys=False, indent=4)