def build(self): self.obj = TimeSelect() thread = threading.Thread(target=self.testThread) thread.setDaemon(True) thread.start() return self.obj
def main(self): self.thread = threading.Thread(target=self.server) self.thread.setDaemon(True) self.thread.start() self.handleActive = True while True: self.handleEvents()
def start(self, path, tSeek): logging.error("thomas - ß?????????????????????????????: yes yes yes") self.path = path self._isPlaying = True mpvParam = mpvParams(tSeek, path, includes.config) self.process = Popen(mpvParam) self.playThread = threading.Thread(target = self._playWorkThread) self.playThread.setDaemon(True) self.playThread.start()
def __init__(self): #self.vlcInst = vlc.Instance() self.vlcInst = vlc.Instance(['-f']) self.vlcPlayer = self.vlcInst.media_player_new() self.evManager = self.vlcPlayer.event_manager() self.evManager.event_attach(vlc.EventType.MediaPlayerEndReached, self._mediaPlayerEnd) self.cmdQueue = queue.Queue() self.workThread = threading.Thread(target = self._worker) self.workThread.setDaemon(True) self.workThread.start()
def build(self): self.handler = DialogHandler() id = self.handler.getNextId() tmpDialog = msgAutoRestart(self.handler, "This is content text", "I am the header", 90, id) self.handler.add(tmpDialog) self.thread = threading.Thread(target=self._taskThread) self.thread.setDaemon(True) self.thread.start() return self.handler
def build(self): self.handler = DialogHandler() self.handler.addInfo(text="This is the content for one", headerText="First header", height=90) self.handler.addInfo(text="This is the content for two", headerText="Second header", height=45) self.handler.addInfo(text="This is the content for three", headerText="Third header", height=45) self.thread = threading.Thread(target=self._taskThread) self.thread.setDaemon(True) self.thread.start() # handler.enable(None) # handler.enable(None) # handler.enable(None) return self.handler
def build(self): self.fList = FileList(id="0", rootdir="/mnt/Ishamedia/", enaColor=includes.styles['enaColor0'], bar_width=10, supportedTypes="mp3,mp4,txt", type="video") from subprocess import threading workThread = threading.Thread(target=self.testFunc) workThread.setDaemon(True) workThread.start() from kivy.uix.stacklayout import StackLayout lay = StackLayout() lay.add_widget(self.fList) return lay return self.fList
def build(self): def dummyPlay(self): logging.error("PlaylistViewer: Dummy play has been called...") self.menu = PlaylistMenu( line_color_playlist=includes.colors['imcBlue'], line_color_media=includes.colors['imcLigthGray'], highlight_color=includes.colors['oldblue'], line_height=6, bar_width=35, font_size=includes.styles['fontSize'], rootdir=includes.config['playlist']['rootdir'], supported_types=includes.config['playlist']['types'], player_start_handler=dummyPlay, ) from subprocess import threading workThread = threading.Thread(target=self.testFunc) workThread.setDaemon(True) workThread.start() return self.menu
def build(self): buttonDesc = [ { 'callback': self.close, 'imgPath' : "close" }, { 'callback': self.smallPlay, 'imgPath' : "small_play" } ] self.widget = DialogButtons( buttonDesc=buttonDesc, size_hint_y=None, height=37.5 ) self.thread = threading.Thread(target=self._taskThread) self.thread.setDaemon(True) self.thread.start() return self.widget
def guiWorker(): from main import Main Main().run() if __name__ == "__main__": if len(sys.argv) == 2 and sys.argv[1] == "main_gui": main_gui.run() sys.exit(0) if len(sys.argv) == 2 and sys.argv[1] == "menu_osd": menu_osd.run() sys.exit(0) wm = IshaWm() wmThread = threading.Thread(target=wm.main) wmThread.setDaemon(True) wmThread.start() while not wm.handleActive: time.sleep(0.1) guiPath = os.path.join(os.path.dirname(os.path.abspath(sys.argv[0])), "main_gui") guiPro = Popen([guiPath, "main_gui"], stdin=sys.stdin, stdout=sys.stdout, stderr=sys.stdout) while not wm.mainGuiMapped: time.sleep(0.1) #Wait so that everything opens in order
app.logger.info('Database file is missing, initializing it now') initialize_database() # loading cache file is found if os.path.exists(CACHE_FILE_PATH): app.logger.info('Detected existing cache file, loading it now') with open(CACHE_FILE_PATH, 'rb') as file_handler: DOMAIN_CACHE = pickle.load(file_handler) app.logger.info( 'Successfully loaded {} records from cache file'.format( len(DOMAIN_CACHE.keys()))) # creating and starting worker a seperate thread app.logger.info('Creating worker thread') worker = Worker() worker_thread = threading.Thread(target=worker.run) worker_thread.start() # starting flask web application app.logger.info('Starting web server') app.permanent_session_lifetime = timedelta(minutes=30) app.secret_key = SECRET_KEY app.run(debug=APP_DEBUG_MODE, host=APP_HOST, port=APP_PORT, threaded=True) except: self.__logger print('-' * 60) traceback.print_exc(file=sys.stdout) print('-' * 60)
def __init__(self, **kwargs): self.selId = kwargs.pop('id', None) self.screenmanager = kwargs.pop('screenmanager', None) super(MenuPlaylist, self).__init__(**kwargs) self.cols = 2 self.rows = 2 columnWidth0 = Window.width * 0.3 columnWidth1 = Window.width - columnWidth0 headerHeight = includes.styles['playlistHeadHeight'] headerText0 = "[b]Playlists[/b]" headerText1 = "[b]Media Files[/b]" # headerColor0 = hexColor('#5a5560')# # headerColor1 = hexColor('#2d4159')#(0.5,0.5,0,1) #enaColor0 = includes.colors['blue'] #enaColor1 = includes.colors['orange'] self.header0 = SelectLabelBg( background_color=includes.styles['headerColor0'], text_size=(columnWidth0 - 20, headerHeight), text=headerText0, halign="center", valign="middle", size_hint_y=None, size_hint_x=None, height=headerHeight, width=columnWidth0, id="-1", markup=True) self.add_widget(self.header0) self.header1 = SelectLabelBg( background_color=includes.styles['headerColor1'], text_size=(columnWidth0 - 20, headerHeight), text=headerText1, halign="center", valign="middle", size_hint_y=None, size_hint_x=None, height=headerHeight, width=columnWidth1, id="-1", markup=True) self.add_widget(self.header1) self.fileList = FileList( id=str(int(self.selId) + 1), rootdir=includes.config['playlist']['rootdir'], enaColor=includes.styles['enaColor0'], bar_width=10, size_hint_x=None, width=columnWidth0, supportedTypes=includes.config['playlist']['types'], screenmanager=self.screenmanager, fillerColor=includes.styles['headerColor0'], showDirs=False, selectFirst=False, showIcon=False, ) self.files = PlaylistJsonList( id=str(int(self.selId) + 5000), enaColor=includes.styles['enaColor1'], bar_width=10, size_hint_x=None, width=columnWidth1, fillerColor=includes.styles['headerColor1'], showIcon=False, ) self.add_widget(self.fileList) self.add_widget(self.files) self.mode = self._fileList self.workThread = threading.Thread(target=self._processPlaylist) self.workThread.setDaemon(True) self.workThread.start() self.ctrlQueue = queue.Queue() self.prevTimestamp = time.time() self.bind(size=self.size_change) self.bind(size=self.pos_change)
def start(self, path, tSeek): logging.info("Player: start playing file... path = {}".format(path)) self.path = path if not os.path.isfile(path): logging.error("Player: file not found [{}]".format(path)) return videoFormats = tuple(includes.config['video']['types'].split(',')) audioFormats = tuple(includes.config['audio']['types'].split(',')) logging.debug("Player: videoFormats = {} / audioFormats = {}".format( videoFormats, audioFormats)) mode = "nothing" if path.lower().endswith(videoFormats): mode = "video" mediaInfo = MediaInfo.parse(path) videoWidth, videoHeight = 0, 0 for track in mediaInfo.tracks: if track.track_type == 'Video': videoWidth, videoHeight = track.width, track.height osdHeight = 50 playerHeight = Window.height - (2 * osdHeight ) #videoHeight - osdHeight playerWidth = int(playerHeight * (videoWidth / videoHeight)) posx = int((Window.width - playerWidth) / 2) posy = int((Window.height - playerHeight) / 2) logging.error( "Player: playerWidth: {} / playerHeight: {} / videoWidth: {} / videoHeight: {} / posx: {} / posy: {}" .format(playerWidth, playerHeight, videoWidth, videoHeight, posx, posy)) self.isPlaying = True self.runtime = tSeek self.process = Popen([ "mpv", "--geometry={}+{}+{}".format(playerWidth, posx, posy), "--start=+{}".format(tSeek), "--no-border", "--no-input-default-bindings", path, "--really-quiet", "--no-osc", "--no-input-terminal", "--input-ipc-server={}".format( os.path.join(includes.config['tmpdir'], "socket")) ]) elif path.lower().endswith(audioFormats): self.isPlaying = True mode = "audio" logging.debug("Player: start playing audio") self.isPlaying = True self.process = Popen([ "mpv", "--start=+{}".format(tSeek), "--no-border", "--no-input-default-bindings", path, "--really-quiet", "--no-osc", "--no-input-terminal", "--input-ipc-server={}".format( os.path.join(includes.config['tmpdir'], "socket")) ]) else: logging.debug("Player: no video nor audio file... {}".format(path)) # Start player thread self.playThread = threading.Thread(target=self._playWorkThread, args=(mode, )) self.playThread.setDaemon(True) self.playThread.start()