def getSchedulerDetail(): try: remoteDict = Json_evaluation.getJsonByKey(filename=__syncFile__, key="susServer", path=__path__) Sync.getSchedulerStatus(remoteDict, path=__path__, logPath=__logPath__) return jsonify( Json_evaluation.readJSON(path=__path__, filename=__schedulerTimeStampFile__)) except Exception as e: return str(e), 500
def run_button(self, event): isit = None r = Parser().read("repo_path") os.chdir(r) Globals.TERM.set_background_saturation(0.3) Globals.TERM.fork_command('clear') Globals.TERM.fork_command('bash') if Globals.checkClobber.get_active() == True: isit = True if not os.path.exists("%s/.repo" % r): RepoHelper().run_no_repo_found() Globals.TERM.set_background_saturation(1.0) Globals.TERM.fork_command('clear') return Globals.TERM.feed_child('make clobber\n') if Globals.checkSync.get_active() == True: isit = True Sync().run() if Globals.checkCompile.get_active() == True: isit = True Compile().run() if isit == None: self.ResetTerm()
def syncronize(self): vRef = self.beepRef.fileName v1 = self.faceVideo.fileName if not ((vRef == '') | (v1 == '')): sync = Sync(vRef, v1) syncedFaceVid = sync.get_synced_video() if syncedFaceVid != '': self.faceVideo.setMediaPlayer(syncedFaceVid) self.video360.setMediaPlayer(self.video360.fileName) QMessageBox.about(self, 'video Annotator', 'Sync process is done!') else: QMessageBox.about(self, 'video Annotator', 'Sync process failed. Please try again.') else: QMessageBox.about(self, 'video Annotator', 'Please upload the videos first!')
def __build_screen(self, sc, canvas, show_hour=False): directory = None try: isCopy = self.__config_get(sc, "CopyOf") directory = self.sync_directory + isCopy + "/" except: directory = self.sync_directory + sc + "/" self.__prepare_dir(directory) try: fileList = self.__config_get(sc, 'FileList').splitlines() for f in fileList: if f not in self.files_list: self.files_list.append(f) self.sync_services.append( Sync(f, directory, self.sync_delay)) except: pass try: align = self.__config_get(sc, "Alignement") except: align = self.screen_align try: ratio = self.__config_get(sc, "Ratio") except: ratio = self.screen_ratio try: delay = self.configuration.get(sc, "Delay") except: delay = self.screen_delay try: rotat = self.__config_get(sc, "Rotation") except: rotat = self.screen_rotation screen = Screen(canvas, delay, directory, align, ratio, rotat, show_hour) return screen
#!/usr/bin/env python # -*- coding: utf-8 -*- from Sync import Sync sync = Sync() sync.sync_follow_delete_yuming()
#!/usr/bin/env python # -*- coding: utf-8 -*- from Sync import Sync sync = Sync() sync.sync_follow_yuming()
#!/usr/bin/python3 # -*- coding: utf-8 -*- from PasswordManager import CtSesam from PasswordSettingsManager import PasswordSettingsManager from Sync import Sync import getpass import zlib if __name__ == "__main__": syncer = Sync("https://ersatzworld.net/ctpwdgen-server/", 'inter', 'op') remote_blob = syncer.pull() master_password = getpass.getpass(prompt='Masterpasswort: ') settings_manager = PasswordSettingsManager() write_to_file = False remote_update_needed = False try: settings_manager.load_settings_from_file(master_password) remote_update_needed = settings_manager.update_from_export_data( master_password, remote_blob) write_to_file = True except zlib.error: print( "Falsches Masterpasswort. Es wurden keine Einstellungen geladen.") domain = input('Domain: ') while len(domain) < 1: print( 'Bitte gib eine Domain an, für die das Passwort generiert werden soll.' ) domain = input('Domain: ') setting_found = False
def create_sync(self): """ creates a sync object. """ self.sync = Sync(self.server_address, self.username, self.password, self.certificate_file.name)
class SyncManager: """ Synchronization manager. This initializes and stores settings and handles the Sync object. """ def __init__(self): self.server_address = "" self.username = "" self.password = "" self.certificate = "" self.certificate_file = None self.sync = None def __del__(self): if self.certificate_file: self.certificate_file.close() def get_binary_sync_settings(self): """ returns packed sync settings :return: binary settings :rtype: bytes """ if self.sync: return Packer.compress(json.dumps({ "server-address": self.server_address, "username": self.username, "password": self.password, "certificate": self.certificate }).encode('utf-8')) else: return b'' def load_binary_sync_settings(self, data): """ loads sync settings :param bytes data: packed json data of sync settings """ settings_dict = json.loads(str(Packer.decompress(data), encoding='utf-8')) if "server-address" in settings_dict and \ "username" in settings_dict and \ "password" in settings_dict and \ "certificate" in settings_dict: self.server_address = settings_dict["server-address"] self.username = settings_dict["username"] self.password = settings_dict["password"] self.certificate = settings_dict["certificate"] if self.certificate_file: self.certificate_file.close() self.certificate_file = NamedTemporaryFile() self.certificate_file.write(self.certificate.encode('utf-8')) self.certificate_file.seek(0) self.create_sync() else: print("Sync settings konnten nicht geladen werden.") def ask_for_sync_settings(self): """ Ask the user for sync settings: Asks for server-URL, username and password. """ print("Bitte geben Sie die Einstellungen für Ihren Synchronisations-Server an...") self.server_address = input("URL: ") self.username = input("Benutzername: ") self.password = input("Passwort: ") line = input("Zertifikat im .pem-Format (beenden mit einer Leerzeile): ") while len(line) > 0: self.certificate += line + "\n" line = input("") self.certificate += line if self.certificate_file: self.certificate_file.close() self.certificate_file = NamedTemporaryFile() self.certificate_file.write(self.certificate.encode('utf-8')) self.certificate_file.seek(0) self.create_sync() print("Teste die Verbindung...") if len(self.sync.pull()) > 0: print("Verbindung erfolgreich getestet.") else: print("Es konnte keine Verbindung aufgebaut werden.") def create_sync(self): """ creates a sync object. """ self.sync = Sync(self.server_address, self.username, self.password, self.certificate_file.name) def pull(self): """ pulls data from the sync server. Returns an empty string if no connection is possible. :return: pulled base64 data :rtype: str """ if self.sync: return self.sync.pull() else: return False, '' def push(self, data): """ pushes data to the sync server. If the push fails an error message is displayed. :param str data: base64 data """ if self.sync: if not self.sync.push(data): print("Synchronisation fehlgeschlagen.") else: print("Sie haben keine gültigen Einstellungen für den sync server.")
def test_pull_empty_request(self): sync = Sync("https://ersatzworld.net/ctpwdgen-server/", 'inter', 'op', 'file.pem') status, blob = sync.pull() self.assertTrue(status) self.assertEqual('', blob)
def test_pull(self): sync = Sync("https://ersatzworld.net/ctpwdgen-server/", 'inter', 'op', 'file.pem') status, blob = sync.pull() self.assertTrue(status) self.assertEqual(str(b64encode(b'Test'), encoding='utf-8'), blob)
# -*- coding: utf-8 -*- from Sync import Sync import threading SYNC_THREAD = Sync(True) KEYS = [ "karni", "bar", "ely", "shaffir", "ronny", "baranetz", "aviv", "doyev", "tamar", "sadot", "inbar", "rousso", "ori", "sharabi" ] VALUES = [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13] def set_thread(key, value): Sync.set_value(SYNC_THREAD, key, value) def delete_thread(key): Sync.delete_value(SYNC_THREAD, key) def get_thread(key): print Sync.get_value(SYNC_THREAD, key) def create_set_threads(num, key, value): set_threads = [] for i in range(num): set_threads.append( threading.Thread(target=set_thread(key[i], value[i]))) return set_threads
def set_thread(key, value): Sync.set_value(SYNC_THREAD, key, value)
#!/usr/bin/python3 # -*- coding: utf-8 -*- from PasswordManager import CtSesam from PasswordSettingsManager import PasswordSettingsManager from Sync import Sync import getpass import zlib if __name__ == "__main__": syncer = Sync("https://ersatzworld.net/ctpwdgen-server/", 'inter', 'op') remote_blob = syncer.pull() master_password = getpass.getpass(prompt='Masterpasswort: ') settings_manager = PasswordSettingsManager() write_to_file = False remote_update_needed = False try: settings_manager.load_settings_from_file(master_password) remote_update_needed = settings_manager.update_from_export_data(master_password, remote_blob) write_to_file = True except zlib.error: print("Falsches Masterpasswort. Es wurden keine Einstellungen geladen.") domain = input('Domain: ') while len(domain) < 1: print('Bitte gib eine Domain an, für die das Passwort generiert werden soll.') domain = input('Domain: ') setting_found = False if domain in [dom[:len(domain)] for dom in settings_manager.get_domain_list()]: if domain in settings_manager.get_domain_list(): setting_found = True print("Die Einstellungen für " + domain + " wurden geladen.")
#!/usr/bin/env python # -*- coding: utf-8 -*- from Sync import Sync sync = Sync() sync.sync_null_date_yuming() sync.sync_near_expiration_date_yuming()
id_timer = timer_id() #15min '900seconds carousel_timer = repeating_timer(15) #15sec lcd_timer = repeating_timer(3) #3sec user_ident_timer = onetime_timer(60) #60sec k_timer = onetime_timer(2) # osd_timer = loop_timer(5, 1) # pip_timer = repeating_timer(20) # tx_hang_timer = onetime_timer(30) # tx hang timer 5min 300 # General class inits videoswitch = videoswitch() #HDMI video switch enc = encoder("192.168.88.249", "m0dts", "xxxxx") #hdmi encoder comms485 = Serial_485() #serial for comms display = display(display_type) #display io = IO() #i2c io extender board sync = Sync() #analog sync osd = OSD() #OSD MAX7456 dtmf = DTMF() time.sleep(1) setup() # Timers carousel_timer.interval = 15 #15sec k_timer.interval = 2 lcd_timer.interval = 8 user_ident_timer.interval = 10 pip_timer.interval = config["VideoSwitchSettings"]["pip_toggle_time"] #class init enc.disable_osd_image(0)
def get_thread(key): print Sync.get_value(SYNC_THREAD, key)
def delete_thread(key): Sync.delete_value(SYNC_THREAD, key)
def test_push(self): sync = Sync("https://ersatzworld.net/ctpwdgen-server/", 'inter', 'op', 'file.pem') self.assertTrue(sync.push(str(b64encode(b'Test'), encoding='utf-8')))