def transcoding_done(self, track): if hasattr(cherrypy.request, 'queue_current_id') and cherrypy.request.queue_current_id is not None: queue_current_id = cherrypy.request.queue_current_id queue_dao.update_queue(queue_current_id, played=True) cherrypy.request.queues_done = True ws_user = ws.get_ws_user() cache.set('queue.current_track_%d' % ws_user.id, None) cache.set('queue.current_progress_%d' % ws_user.id, None)
def transcoding_progress(self, progress, transcoder, track): ws_user = ws.get_ws_user() if ws_user is not None: cache.set('queue.current_progress_%d' % ws_user.id, progress) if 'User-Agent' in cherrypy.request.headers: user_agent = cherrypy.request.headers['User-Agent'] else: user_agent = None format = transcoder.__class__.outputs() ws.emit('queue.progress', progress, self.serialize_track(track), user_agent, format) cherrypy.request.queue_progress = progress
def transcoding_start(self, transcoder, track): if hasattr(cherrypy.request, 'queue_current_id') and cherrypy.request.queue_current_id is not None: queue_current_id = cherrypy.request.queue_current_id queue_dao.update_queue(queue_current_id, current_seconds=None, playing=True) track = self.serialize_track(track) if 'User-Agent' in cherrypy.request.headers: user_agent = cherrypy.request.headers['User-Agent'] else: user_agent = None format = transcoder.__class__.outputs() ws_user = ws.get_ws_user() if ws_user is not None: cache.set('queue.current_track_%d' % ws_user.id, track) ws.emit('queue.start', track, user_agent, format)
def _reset_current(self): ws_user = ws.get_ws_user() cache.set('queue.current_track_%d' % ws_user.id, None) cache.set('queue.current_progress_%d' % ws_user.id, None) ws.emit('queue.reset')