def list(days, project_name): # pylint: enable=W0622,E0102 """ List tasks in a given project. :param project_name: Name of the project. :type project_name: str """ # Check options if days < 0: echo('"--days {days}" cannot be less than zero (0).'.format(days=days), err=True) EXIT(1) try: dbo = Db() tasks = dbo.get_project_tasks(project_name, days, close=True) except ProtokollException as ex: echo(str(ex), err=True) EXIT(1) # Format the output nicely template = "{task_id:8}|{project_name:15}|{name:50}|{start_time:20}|{stop_time:20}|" \ "{total_mins:10}|{is_running:8}" echo( template.format(task_id='Task Id', project_name='Project Name', name='Task Name', start_time='Start Time', stop_time='Stop Time', total_mins='Total Mins', is_running='Is Running')) for tsk in tasks: echo(template.format(**tsk))
def fetch_models(self): """Use specific model to predict new dataset""" if self.model_pool is None: print("Please train a model first.", file=STDE) EXIT(1) else: return [copy.deepcopy(m.steps[-1][-1]) for m in self.model_pool]
def carregar_licenca(): License = license_verify.Lic() result = License.verifica(1) if result == 0: print('Falha ao validar a licença', 'Adquira uma permissão para utilizar o aplicativo') sleep(50) EXIT()
def stop(): """ Stop a currently running task. """ try: dbo = Db() dbo.stop_running_task(close=True) except ProtokollException as ex: echo(str(ex), err=True) EXIT(1)
def start(project_name, task_name): """ Start a new task in a given project. :param project_name: Name of the project to start the task in. :param task_name: Name/Description of the task you are starting. Character limit of 50. """ try: dbo = Db() dbo.create_task(project_name, task_name[:50], close=True) except ProtokollException as ex: echo(str(ex), err=True) EXIT(1)
def create(project_name): """ Create a new project. If the project already exists, succeed anyways. :param project_name: Name of the project. """ try: dbo = Db() name = dbo.create_project(project_name, close=True) echo("Created project '{name}'".format(name=name)) except ProtokollException as ex: echo(str(ex), err=True) EXIT(1)
def remove(project_name): """ Remove a project. WARNING: This will permanently remove all tasks associated with the project. There is no confirmation so make sure this is what you want! :param project_name: Name of the project to remove. """ try: dbo = Db() dbo.remove_project(project_name, close=True) except ProtokollException as ex: echo(str(ex), err=True) EXIT(1)
def janela_de_ativacao(id_software, codigo_de_maquina, final_cod): lg = ativacao(codigo_de_maquina, size=(500, 500), scale=0.5) lg.window.force_focus() while 1: event, values = lg.window.read(timeout=100) #print(event) if event == None: return if event == 'ATIVAR': print(values['ATIVAR']) if values['ATIVAR'] == final_cod: sg.popup("Ativado. Reinicie o software.") adiciona_licenca(final_cod) EXIT() lg.window.Close()
def list(): # pylint: enable=W0622 """ List projects. """ try: dbo = Db() projects = dbo.get_projects(close=True) except ProtokollException as ex: echo(str(ex), err=True) EXIT(1) # Format the output nicely template = "{project_id: >10}|{name:15}" echo(template.format(project_id='ID', name='Name')) for proj in projects: echo(template.format(**proj))
def main(): """The main function.""" parser = argparse.ArgumentParser( description="%(prog)s - generate package.json from package.json.j2", epilog='''Copyright (c) 2019-2022, Maciej Barć <*****@*****.**> Licensed under the GNU GPL v3 License''') parser.add_argument( "version", type=str, help="version string to use, following 'semver', ie.: 9.9.9") args = parser.parse_args() v = args.version if validate(v): render_package_json(v) else: print("[ERROR]: Given version sting {} is incorrect.".format(v)) print(" Please follow the semver specification.") EXIT(1)
def select_config_window(license_result, mp): mp.stop() l.clear() mp.window['LISTA'].update(l) mp.window.Hide() lg = config_select(license_result, size=(500, 500), scale=0.5) lg.window.force_focus() while 1: event, values = lg.window.read(timeout=100) if event == None: EXIT() if (len(values['CONFIG']) > 0): if os.path.exists(os.path.join(ROOT_DIR, values['CONFIG'][0])): select_config_file(values['CONFIG'][0]) break lg.window.Close() calendar_event(mp) mp.window.set_title('SmartPlayer - {}'.format(NAME)) mp.window.UnHide()
def main(): mp = MediaPlayer(size=(1920, 720), scale=0.5) select_config_window(license_result, mp) T = Thread(target=atualiza, args=(mp, ), daemon=True) T.start() while True: if not T.is_alive(): T = Thread(target=atualiza, args=(mp, ), daemon=True) T.start() print("Reiniciando...") event, mp.values = mp.window.read(timeout=500) if event == None or event == 'Exit': EXIT() if event == "Open config": select_config_window(license_result, mp) if event == 'MouseWheel:Up': mp.set_position(mp.values['TIME'] - (0.0003 / (mp.player.get_length() / 3600000))) if event == 'MouseWheel:Down': mp.set_position(mp.values['TIME'] + (0.0003 / (mp.player.get_length() / 3600000))) if event == 'About...': sg.Popup("Feito por:", "Eng. Cristian Ritter", "*****@*****.**", title="Sobre o aplicativo") if event == 'PLAY': mp.play() if event == 'FORWARD': mp.jump_next_fail() if event == 'FORWARD_1': limite = 0.0003 / (mp.player.get_length() / 3600000) mp.set_position(mp.values['TIME'] + limite) if event == 'FORWARD_10': limite = 0.0028 / (mp.player.get_length() / 3600000) mp.set_position(mp.values['TIME'] + limite) if event == 'REWIND': mp.jump_previous_fail() if event == 'REWIND_1': limite = 0.0003 / (mp.player.get_length() / 3600000) mp.set_position(mp.values['TIME'] - limite) if event == 'REWIND_10': limite = 0.0028 / (mp.player.get_length() / 3600000) mp.set_position(mp.values['TIME'] - limite) if event == 'TIME': if round(mp.values['TIME'], 3) == round(mp.time_old, 3): continue limite = 0.002 / (mp.player.get_length() / 3600000) if mp.values['TIME'] > (1 - limite): mp.set_position(mp.values['TIME'] - limite) else: mp.set_position(mp.values['TIME']) if event == 'LOG': if (len(mp.values['CALENDAR'])) == 0: mp.values['CALENDAR'] = datetime.now().strftime('%Y%m%d') lognm = "log_" + mp.values['CALENDAR'][0:6] + ".txt" logfile = os.path.join(log_folder, lognm) if os.path.exists(logfile): webbrowser.open(logfile) if event == 'CALENDAR': calendar_event(mp) if event == 'MARK_IN': mp.window['EXPORT'].update(disabled=True) if (mp.segundos_total) <= 0: continue mp.window['IN_TEXT'].update(mp.get_time_elapsed()) if event == 'MARK_OUT': mp.window['EXPORT'].update(disabled=True) if (mp.segundos_total) <= 0: continue mp.window['OUT_TEXT'].update(mp.get_time_elapsed()) if event == 'EXPORT': if (len(mp.values['LISTA'])) == 0 or (len( mp.values['EXPORT'])) == 0: continue current_filepath = mp.get_current_audio_filepath(mp.values) filename = str(current_filepath[:-4]).split('\\') begin_seconds = int(mp.values['IN_TEXT'][0:2]) * 60 + int( mp.values['IN_TEXT'][3:5]) end_seconds = int(mp.values['OUT_TEXT'][0:2]) * 60 + int( mp.values['OUT_TEXT'][3:5]) dest = os.path.join( mp.values['EXPORT'], filename[len(filename) - 1] + '_' + str(begin_seconds) + '_' + str(end_seconds) + '.mp3') check_output("{} {} {} trim {} {}".format( SOX, current_filepath, dest, begin_seconds, (end_seconds - begin_seconds))) sg.popup("Que legal! O arquivo já está disponível na pasta: ", dest) pass if event == 'LISTA': mp.stop() if not 'LISTA' in mp.values: continue filename = mp.get_current_audio_filepath(mp.values) if not os.path.exists(filename): sg.popup( "Arquivo não disponível. Por favor atualize a lista.") continue mp.load_single_track(filename) mp.list_player.next() mp.redraw_fail_positions(mp.values)
os.path.abspath(__file__)) # This is your Project Root print("Carregando DLLS...") try: #os.add_dll_directory(os.getcwd()) try: VLC_DIR = os.path.join(ROOT_DIR, 'VLC\\') SOX_DIR = os.path.join(ROOT_DIR, 'sox-14-4-1\\') SOX = os.path.join(SOX_DIR, 'sox') os.add_dll_directory(r'{}'.format(VLC_DIR)) os.add_dll_directory(r'{}'.format(SOX_DIR)) #os.add_dll_directory(r'C:\Program Files (x86)\VideoLAN\VLC') except Exception as Err: sg.popup('DLL ERROR - ' + str(Err)) EXIT() print("Importando VLC...") import vlc ASSETS_PATH = os.path.join(ROOT_DIR, 'Assets/') BUTTON_DICT = { img[:-4].upper(): ASSETS_PATH + img for img in os.listdir(ASSETS_PATH) } DEFAULT_IMG = ASSETS_PATH + 'background3.png' ICON = ASSETS_PATH + 'player.ico' print("Carregando configurações...") def select_config_file(filename):
from sys import exit exit(0) exit(0 + 0 + 0) # cml 1 cc background="25, 200, 200" # cml+ foreground=#ffffff # Leading exit(0 + # Side 1 0) # Side 2 # Side 3 from sys import os, exit as EXIT EXIT(0) EXIT(0 + 0 + 0) # Leading EXIT(0 + # Side 1 0) # Side 2 # Side 3 # # With # with open("my.txt") as f: pass
on_modified_callback=on_torrent_finished) new_movie_observer = Observer() new_movie_observer.schedule( new_movie_event_handler, DUMP_PATH) # monitoring dump path for torrent files new_movie_observer.start() # and when a new torrent fie is added program logging.info("Started observing->" + DUMP_PATH) # knows that there is a new movie. new_titlescreen_event_handler = MovieHandler( on_modified_callback=add_thumbnail) new_movie_observer = Observer() new_movie_observer.schedule(new_titlescreen_event_handler, TO_WATCH_FOLDER) new_movie_observer.start() logging.info("Started observing->" + TO_WATCH_FOLDER) try: show_script_started() while True: time.sleep(10) except KeyboardInterrupt: new_watched_observer.stop() logging.info("Stopped observing->" + VLC_HIST_FOLDER) logging.info("Stopped observing->" + DUMP_PATH) logging.info("Stopped observing->" + TO_WATCH_FOLDER) EXIT() new_watched_observer.stop() logging.info("Stopped observing->" + VLC_HIST_FOLDER) logging.info("Stopped observing->" + DUMP_PATH) logging.info("Stopped observing->" + TO_WATCH_FOLDER)