from Universal import ioservice def generateConfigs(): generateProcessorConfigs() generateServerConfig() generateVideoConfig() def generateProcessorConfigs(): ioservice.addConfiguration("Video Configuration", "FFProbe Path") ioservice.addConfiguration("Video Configuration", "Encoder Path") ioservice.addConfiguration("Video Configuration", "Sleep Timer (Seconds)", "100") ioservice.addConfiguration("Video Configuration", "Blacklist Words", "1080p, 720p, 480p, 360p, x265, x264") def generateServerConfig(): ioservice.addConfiguration("Server 1", "Type", "NONE") ioservice.addConfiguration("Server 1", "Host", "127.0.0.1") ioservice.addConfiguration("Server 1", "Port", "22") ioservice.addConfiguration("Server 1", "Username", "NONE") ioservice.addConfiguration("Server 1", "Password", "NONE") ioservice.addConfiguration("Server 1", "Key File", "NONE") ioservice.addConfiguration("Server 1", "Key Type (RSA/DSA)", "RSA") ioservice.addConfiguration("Server 1", "Media Root", "/Server/Drive/Media/") def generateVideoConfig(): ioservice.addConfiguration("Video Library 1", "Name", "TV Shows") ioservice.addConfiguration("Video Library 1", "Input", "./Input/TV-Shows/") ioservice.addConfiguration("Video Library 1", "Output", "./Output/TV-Shows/") ioservice.addConfiguration("Video Library 1", "Database Service", "TMDB") ioservice.addConfiguration("Video Library 1", "Media Type", "SHOWS") ioservice.addConfiguration("Video Library 1", "Compress Video", "False") ioservice.addConfiguration("Video Library 1", "Output Format", "mkv") ioservice.addConfiguration("Video Library 1", "Directory Format", "/${NAME}/Season ${SEASON}/${NAME} S${SEASON}E${EPISODE}.${FORMAT}") ioservice.addConfiguration("Video Library 1", "Command", "${COMPRESSOR} -i ${INPUT} -o ${OUTPUT}") ioservice.addConfiguration("Video Library 1", "Subtitle Command", "--srt-file ${SRT_FILE} --srt-lang ${SRT_LANGUAGE}") ioservice.addConfiguration("Video Library 1", "Delete Input", "False") ioservice.addConfiguration("Video Library 1", "Server", "None") ioservice.addConfiguration("Video Library 1", "Server Path", "/TV Shows/${NAME}/Season ${SEASON}/${NAME} S${SEASON}E${EPISODE}.${FORMAT}") ioservice.addConfiguration("Video Library 1", "Server Overwrite", "False") class VideoSettings: def __init__(self): self.settings = {} self.library = {} self.server = {} def updateEverything(self, num): self.updateSettings() self.updateLibrary(num) def updateSettings(self): tmp_ffprobe = ioservice.getConfigurationStr("Video Configuration", "FFProbe Path") tmp_encoder = ioservice.getConfigurationStr("Video Configuration", "Encoder Path") tmp_timer = ioservice.getConfigurationStr("Video Configuration", "Sleep Timer (Seconds)") tmp_blacklist = ioservice.getConfigurationStr("Video Configuration", "Blacklist Words") self.settings = {"FFProbe": tmp_ffprobe, "Encoder": tmp_encoder, "Timer": tmp_timer, "Blacklist": tmp_blacklist} def updateLibrary(self, num): tmp_section = ("Video Library " + str(num)) tmp_name = ioservice.getConfigurationStr(tmp_section, "Directory Name") tmp_input = ioservice.getConfigurationStr(tmp_section, "Input") tmp_output = ioservice.getConfigurationStr(tmp_section, "Output") tmp_database = ioservice.getConfigurationStr(tmp_section, "Database Service") tmp_type = ioservice.getConfigurationStr(tmp_section, "Media Type") tmp_compress = ioservice.getConfigurationBool(tmp_section, "Compress Video") tmp_out_format = ioservice.getConfigurationStr(tmp_section, "Output Format") tmp_dir_format = ioservice.getConfigurationStr(tmp_section, "Directory Format") tmp_command = ioservice.getConfigurationStr(tmp_section, "Command") tmp_srt_command = ioservice.getConfigurationStr(tmp_section, "Subtitle Command") tmp_del_input = ioservice.getConfigurationBool(tmp_section, "Delete Input") tmp_server = ioservice.getConfigurationStr(tmp_section, "Server") tmp_server_path = ioservice.getConfigurationStr(tmp_section, "Server Path") tmp_server_overwrite = ioservice.getConfigurationBool(tmp_section, "Server Overwrite") self.library = {"Name": tmp_name, "Input": tmp_input, "Output": tmp_output, "Database": tmp_database, "Type": tmp_type, "Compress": tmp_compress, "Format": tmp_out_format, "Directory": tmp_dir_format, "Command": tmp_command, "SRT Command": tmp_srt_command, "Delete Input": tmp_del_input, "Server": tmp_server, "Server Path": tmp_server_path, "Server Overwrite": tmp_server_overwrite} def updateServer(self, num): tmp_section = ("Server " + str(num)) tmp_type = ioservice.getConfigurationStr(tmp_section, "Type") tmp_host = ioservice.getConfigurationStr(tmp_section, "Host") tmp_port = ioservice.getConfigurationStr(tmp_section, "Port") tmp_username = ioservice.getConfigurationStr(tmp_section, "Username") tmp_password = ioservice.getConfigurationStr(tmp_section, "Password") tmp_keyfile = ioservice.getConfigurationStr(tmp_section, "Key File") tmp_keytype = ioservice.getConfigurationStr(tmp_section, "Key Type (RSA/DSA)") tmp_root = ioservice.getConfigurationStr(tmp_section, "Media Root") self.server = {"Type": tmp_type, "Host": tmp_host, "Port": tmp_port, "Username": tmp_username, "Password": tmp_password, "Key File": tmp_keyfile, "Key Type": tmp_keytype, "Root": tmp_root}