Changeset 1884
- Timestamp:
- 16/11/08 18:44:29 (8 weeks ago)
- svm:headrev:
cc3e1ea1-1e01-0410-8d68-8b121e83a9d5:11166- Location:
- freevo
- Files:
-
- 10 modified
-
freevo_config.py (modified) (3 diffs)
-
src/encodingcore.py (modified) (3 diffs)
-
src/helpers/encodingserver.py (modified) (9 diffs)
-
src/helpers/recordserver.py (modified) (3 diffs)
-
src/plugins/idlebar/encoding.py (modified) (6 diffs)
-
src/plugins/idlebar/transcode.py (modified) (12 diffs)
-
src/video/encodingclient.py (modified) (6 diffs)
-
src/video/plugins/dvdbackup.py (modified) (11 diffs)
-
src/video/plugins/reencode.py (modified) (10 diffs)
-
src/www/htdocs/encoding_web.rpy (modified) (21 diffs)
Legend:
- Unmodified
- Added
- Removed
-
freevo/freevo_config.py
r1834 r1884 381 381 (5.26, 382 382 """ Added VIDEO_AUTOJOIN_REGEX to allow joining video files based on a regular expression 383 Renamed USE_NETWORK to SYS_USE_NETWORK 383 Renamed USE_NETWORK to SYS_USE_NETWORK 384 384 Renamed USE_SDL_KEYBOARD to SYS_USE_KEYBOARD 385 385 Added SYS_USE_JOYSTICK to allow a joystick device to be used 386 386 Added DEBUG_BENCHMARKING can be used to time and trace function calls 387 387 Added DEBUG_BENCHMARKCALL can be used to print the arguments and results of function calls 388 Removed MPLAYER_AUDIO_CACHE_KB, MPLAYER_AUDIO_CACHE_MIN_PERCENT and MPLAYER_AUDIO_NETWORK_OPTS, it broke detach 388 Removed MPLAYER_AUDIO_CACHE_KB, MPLAYER_AUDIO_CACHE_MIN_PERCENT and MPLAYER_AUDIO_NETWORK_OPTS, it broke detach 389 389 """), 390 390 ] … … 2094 2094 WWW_PAGES = [ 2095 2095 # Label Title Page 2096 (_('Home'), _('Home'), 'index.rpy'), 2097 (_('TV Guide'), _('View TV Listings'), 'guide.rpy'), 2098 (_('Scheduled Recordings'), _('View Scheduled Recordings'), 'record.rpy'), 2099 (_('Favorites'), _('View Favorites'), 'favorites.rpy'), 2100 (_('Media Library'), _('View Media Library'), 'library.rpy'), 2101 (_('Manual Recording'), _('Schedule a Manual Recording'), 'manualrecord.rpy'), 2102 (_('Search'), _('Advanced Search Page'), 'search.rpy'), 2096 (_('Home'), _('Home'), 'index.rpy'), 2097 (_('TV Guide'), _('View TV Listings'), 'guide.rpy'), 2098 (_('Scheduled Recordings'), _('View Scheduled Recordings'), 'record.rpy'), 2099 (_('Favorites'), _('View Favorites'), 'favorites.rpy'), 2100 (_('Media Library'), _('View Media Library'), 'library.rpy'), 2101 (_('Manual Recording'), _('Schedule a Manual Recording'), 'manualrecord.rpy'), 2102 (_('Search'), _('Advanced Search Page'), 'search.rpy'), 2103 2103 (_('Help'), _('View Online Help and Documentation'), 'help/') 2104 2104 ] … … 2148 2148 ENCODINGSERVER_GID = 0 2149 2149 2150 2150 2151 ENCODINGSERVER_IP = 'localhost' 2151 ENCODINGSERVER_PORT = 6666 2152 ENCODINGSERVER_PORT = 18002 2153 ENCODINGSERVER_SECRET = 'secret2' 2152 2154 2153 2155 # ====================================================================== -
freevo/src/encodingcore.py
r1875 r1884 279 279 start=0 280 280 if timeslice[0]: 281 self.timeslice_mencoder += [ '-ss', str(timeslice[0])]281 self.timeslice_mencoder += ['-ss', str(timeslice[0])] 282 282 start = timeslice[0] 283 283 if timeslice[1]: … … 309 309 _debug_('setVideoCodec(self, vcodec=%s, tgtsize=%s, multipass=%s, vbitrate=%s)' % \ 310 310 (vcodec, tgtsize, multipass, vbitrate)) 311 #safety checks first312 311 if vcodec not in self.encodingopts.getVideoCodecList(): 313 return 'Unknown video codec '312 return 'Unknown video codec %r' % vcodec 314 313 315 314 self.vcodec = vcodec … … 325 324 def setAudioCodec(self, acodec, abrate=128): 326 325 """Set audio codec & bitrate""" 327 #safety first328 326 if acodec not in self.encodingopts.getAudioCodecList(): 329 return 'Unknown audio codec '327 return 'Unknown audio codec %r' % acodec 330 328 331 329 self.acodec = acodec -
freevo/src/helpers/encodingserver.py
r1791 r1884 28 28 29 29 import sys, string, random, time, os, re, pwd, stat, tempfile 30 31 import kaa 32 import kaa.rpc 30 33 import config 31 34 from util import vfs … … 47 50 print e 48 51 49 from twisted.web import xmlrpc, server50 from twisted.internet import reactor51 from util.marmalade import jellyToXML, unjellyFromXML52 52 import time, random, sys, os 53 53 import logging … … 56 56 from encodingcore import EncodingJob, EncodingQueue, EncodingOptions 57 57 58 #some data59 58 __author__ = 'den_RDC (rdc@kokosnoot.com)' 60 59 __revision__ = '$Rev$' … … 64 63 DEBUG = hasattr(config, 'DEBUG_'+appconf) and eval('config.DEBUG_'+appconf) or config.DEBUG 65 64 66 jam = jellyToXML 67 unjam = unjellyFromXML 68 69 70 class EncodingServer(xmlrpc.XMLRPC): 65 66 class EncodingServer: 71 67 def __init__(self, debug=False, allowNone=False): 72 68 """ Initialise the EncodingServer class """ 73 69 _debug_('EncodingServer.__init__(debug=%r, allowNone=%r)' % (debug, allowNone), 2) 74 try:75 xmlrpc.XMLRPC.__init__(self, allowNone)76 except TypeError:77 xmlrpc.XMLRPC.__init__(self)78 70 self.debug = debug 79 71 self.jobs = {} … … 83 75 84 76 85 def xmlrpc_echotest(self, blah): 86 """ Using Twisted check the connection """ 87 _debug_('xmlrpc_echotest(blah=%r)' % (blah), 2) 88 return (True, 'EncodingServer::echotest: %s' % blah) 89 90 91 def xmlrpc_initEncodeJob(self, source, output, friendlyname='', chapter=None, rmsource=False): 92 """ Using Twisted initialise an encoding job """ 93 _debug_('xmlrpc_initEncodeJob(source=%r, output=%r, friendlyname=%r, chapter=%r, rmsource=%s)' % \ 94 (source, output, friendlyname, chapter, rmsource), 1) 77 @kaa.rpc.expose('ping') 78 def _pingtest(self): 79 _debug_('pingtest()', 2) 80 return True 81 82 @kaa.rpc.expose('getContainerCAP') 83 def _getContainerCAP(self): 84 """ get the container capabilities """ 85 return (True, EncodingOptions.getContainerList(self.encodingopts)) 86 87 88 @kaa.rpc.expose('getVideoCodecCAP') 89 def _getVideoCodecCAP(self): 90 """ get the video capabilities """ 91 return (True, EncodingOptions.getVideoCodecList(self.encodingopts)) 92 93 94 @kaa.rpc.expose('getAudioCodecCAP') 95 def _getAudioCodecCAP(self): 96 """ get the audio capabilities """ 97 return (True, EncodingOptions.getAudioCodecList(self.encodingopts)) 98 99 100 @kaa.rpc.expose('getVideoFiltersCAP') 101 def _getVideoFiltersCAP(self): 102 """ get the video filter capabilities """ 103 return (True, EncodingOptions.getVideoFiltersList(self.encodingopts)) 104 105 106 @kaa.rpc.expose('initEncodingJob') 107 def _initEncodingJob(self, source, output, friendlyname='', chapter=None, rmsource=False): 108 """ 109 Initialise an encoding job 110 @param source: source file to encode 111 @param output: output file to encode 112 @param friendlyname: encoding job title 113 @param chapter: chapter number to encode 114 @param rmsource: remove the source after successful encoding 115 @returns: tuple of success status and job identifier 116 """ 95 117 #safety checks 96 118 if not (source or output): 97 return (False, ' EncodingServer::initEncodeJob: no source or output given')119 return (False, '%s.initEncodeJob: no source or output given' % (self.__class__,)) 98 120 99 121 # generate a 'random' idnr based on the time in p2.3, int() can return long … … 109 131 if self.jobs[idnr].finishedanalyze and self.jobs[idnr].failed: 110 132 _debug_('Analysis failed') 111 return (False, 10)133 return (False, 10) 112 134 113 135 _debug_('Initialized job %s (idnr: %s)' % (friendlyname, idnr), DINFO) 114 115 136 return (True, idnr) 116 137 117 138 118 def xmlrpc_getContainerCAP(self): 119 """ Using Twisted get the container capabilities """ 120 _debug_('xmlrpc_getContainerCAP()' , 2) 121 return EncodingOptions.getContainerList( self.encodingopts) 122 123 124 def xmlrpc_setContainer(self, idnr, container): 125 """ Using Twisted set the container """ 126 _debug_('xmlrpc_setContainer(idnr=%r, container=%r)' % (idnr, container), 2) 139 @kaa.rpc.expose('setContainer') 140 def _setContainer(self, idnr, container): 141 """ set the container """ 127 142 status = self.jobs[idnr].setContainer(container) 128 129 143 if not status: 130 144 return (True, 'EncodingServer::setContainer: OK') 131 else: 132 return (False, 'EncodingServer::setContainer: %s' % status) 133 134 135 def xmlrpc_setTimeslice(self,idnr,timeslice): 136 _debug_('xmlrpc_setTimeslice(self, %s, %s)' % (idnr, timeslice), 3) 145 return (False, 'EncodingServer::setContainer: %s' % status) 146 147 148 @kaa.rpc.expose('setVideoCodec') 149 def _setVideoCodec(self, idnr, vcodec, tgtsize, multipass=False, vbitrate=0, altprofile=None): 150 """ set the video codec """ 151 _debug_('_setVideoCodec(idnr=%r, vcodec=%r, tgtsize=%r, multipass=%r, vbitrate==%r)' % \ 152 (idnr, vcodec, tgtsize, multipass, vbitrate), 1) 153 if not (vcodec or (tgtsize and vbitrate)): 154 return (False, 'EncodingServer::setVideoCodec: no codec or target size given') 155 156 status = self.jobs[idnr].setVideoCodec(vcodec, tgtsize, multipass, vbitrate, altprofile) 157 if not status: 158 return (True, 'EncodingServer::setVideoCodec: OK') 159 return (False, 'EncodingServer::setVideoCodec: %s' % status) 160 161 162 @kaa.rpc.expose('setAudioCodec') 163 def _setAudioCodec(self, idnr, acodec, abrate): 164 """ set the audio codec """ 165 _debug_('_setAudioCodec(idnr=%r, acodec=%r, abrate=%r)' % (idnr, acodec, abrate), 2) 166 if not (acodec or abrate): 167 return (False, 'EncodingServer::setAudioCodec: no codec or bitrate given') 168 169 status = self.jobs[idnr].setAudioCodec(acodec, abrate) 170 if not status: 171 return (True, 'EncodingServer::setAudioCodec: OK') 172 return (False, 'EncodingServer::setAudioCodec: %s' % status) 173 174 175 @kaa.rpc.expose('setVideoFilters') 176 def _setVideoFilters(self, idnr, filters): 177 """ set the video filter list """ 178 if not filters: 179 return (False, 'EncodingServer::setVideoFilters: no filter given') 180 181 status = self.jobs[idnr].setVideoFilters(filters) 182 if not status: 183 return (True, 'EncodingServer::setVideoFilters: OK') 184 return (False, 'EncodingServer::setVideoFilters: %s' % status) 185 186 187 @kaa.rpc.expose('setTimeslice') 188 def _setTimeslice(self,idnr,timeslice): 189 _debug_('_setTimeslice(self, %s, %s)' % (idnr, timeslice), 3) 137 190 status = self.jobs[idnr].setTimeslice(timeslice) 138 191 if not status: 139 192 return (True, 'EncodingServer::setTimeslice: OK') 140 else: 141 return (False, 'EncodingServer::setTimeslice: %s' % status) 142 143 144 def xmlrpc_getVideoCodecCAP(self): 145 """ Using Twisted get the video capabilities """ 146 _debug_('xmlrpc_getVideoCodecCAP()', 2) 147 return EncodingOptions.getVideoCodecList(self.encodingopts) 148 149 150 def xmlrpc_setVideoCodec(self, idnr, vcodec, tgtsize, multipass=False, vbitrate=0, altprofile=None): 151 """ Using Twisted set the video codec """ 152 _debug_('xmlrpc_setVideoCodec(idnr=%r, vcodec=%r, tgtsize=%r, multipass=%r, vbitrate==%r)' % \ 153 (idnr, vcodec, tgtsize, multipass, vbitrate), 1) 154 #safety checks 155 if not (vcodec or (tgtsize and vbitrate)): 156 return (False, 'EncodingServer::setVideoCodec: no codec or target size given') 157 158 status = self.jobs[idnr].setVideoCodec(vcodec, tgtsize, multipass, vbitrate, altprofile) 159 160 if not status: 161 return (True, 'EncodingServer::setVideoCodec: OK') 162 else: 163 return (False, 'EncodingServer::setVideoCodec: %s' % status) 164 165 166 def xmlrpc_getAudioCodecCAP(self): 167 """ Using Twisted get the audio capabilities """ 168 _debug_('xmlrpc_getAudioCodecCAP()', 2) 169 return EncodingOptions.getAudioCodecList(self.encodingopts) 170 171 172 def xmlrpc_setAudioCodec(self, idnr, acodec, abrate): 173 """ Using Twisted set the audio codec """ 174 _debug_('xmlrpc_setAudioCodec(idnr=%r, acodec=%r, abrate=%r)' % (idnr, acodec, abrate), 2) 175 #safety checks 176 if not (acodec or abrate): 177 return (False, 'EncodingServer::setAudioCodec: no codec or bitrate given') 178 179 status = self.jobs[idnr].setAudioCodec(acodec, abrate) 180 181 if not status: 182 return (True, 'EncodingServer::setAudioCodec: OK') 183 else: 184 return (False, 'EncodingServer::setAudioCodec: %s' % status) 185 186 187 def xmlrpc_setVideoRes(self, idnr, videores ): 188 """ Using Twisted set the video resolution """ 189 _debug_('xmlrpc_setAudioCodec(idnr=%r, videores=%r)' % (idnr, videores ), 2) 190 #safety checks 193 return (False, 'EncodingServer::setTimeslice: %s' % status) 194 195 196 @kaa.rpc.expose('setVideoRes') 197 def _setVideoRes(self, idnr, videores ): 198 """ set the video resolution """ 199 _debug_('_setAudioCodec(idnr=%r, videores=%r)' % (idnr, videores ), 2) 191 200 if not (videores): 192 return (False, 'EncodingServer::setVideoRes: no video resolution given')201 return (False, 'EncodingServer::setVideoRes: no video resolution given') 193 202 194 203 status = self.jobs[idnr].setVideoRes( videores) 195 196 204 if not status: 197 205 return (True, 'EncodingServer::setVideoRes: OK') 198 else:199 return (False, 'EncodingServer::setVideoRes: %s' % status) 200 201 202 def xmlrpc_setNumThreads(self, idnr, numthreads ):203 """ Using Twistedset the number of threads """204 _debug_(' xmlrpc_setAudioCodec(idnr=%r, numthreads=%r)' % (idnr, numthreads ), 2)206 return (False, 'EncodingServer::setVideoRes: %s' % status) 207 208 209 @kaa.rpc.expose('setNumThreads') 210 def _setNumThreads(self, idnr, numthreads ): 211 """ set the number of threads """ 212 _debug_('_setAudioCodec(idnr=%r, numthreads=%r)' % (idnr, numthreads ), 2) 205 213 #safety checks 206 214 if not (numthreads): 207 return (False, 'EncodingServer::setNumThreads: no number given')215 return (False, 'EncodingServer::setNumThreads: no number given') 208 216 209 217 status = self.jobs[idnr].setNumThreads( numthreads) 210 211 218 if not status: 212 219 return (True, 'EncodingServer::setNumThreads: OK') 213 else: 214 return (False, 'EncodingServer::setNumThreads: %s' % status) 215 216 217 def xmlrpc_getVideoFiltersCAP(self): 218 """ Using Twisted get the video filter capabilities """ 219 _debug_('xmlrpc_getVideoFiltersCAP()', 2) 220 return EncodingOptions.getVideoFiltersList(self.encodingopts) 221 222 223 def xmlrpc_setVideoFilters(self, idnr, filters): 224 """ Using Twisted set the video filter list """ 225 _debug_('xmlrpc_setVideoFilters(idnr, filters)', 2) 226 #safety checks 227 if not filters: 228 return (False, 'EncodingServer::setAudioCodec: no codec or bitrate given') 229 230 status = self.jobs[idnr].setVideoFilters(unjam(filters)) 231 232 if not status: 233 return (True, 'EncodingServer::setVideoFilters: OK') 234 else: 235 return (False, 'EncodingServer::setVideoFilters: %s' % status) 236 237 238 def xmlrpc_queueIt(self, idnr, now=False): 239 """ Using Twisted queue a job to run """ 240 _debug_('xmlrpc_queueIt(idnr=%r, now=%r)' % (idnr, now), 2) 220 return (False, 'EncodingServer::setNumThreads: %s' % status) 221 222 223 @kaa.rpc.expose('listJobs') 224 def _listJobs(self): 225 """ List the current jobs """ 226 _debug_('_listJobs()', 2) 227 jlist = self.queue.listJobs() 228 return (True, jlist) 229 230 231 @kaa.rpc.expose('queueIt') 232 def _queueIt(self, idnr, now=False): 233 """ queue a job to run """ 234 _debug_('_queueIt(idnr=%r, now=%r)' % (idnr, now), 2) 241 235 self.queue.addEncodingJob(self.jobs[idnr]) 242 236 del self.jobs[idnr] … … 247 241 248 242 249 def xmlrpc_getProgress(self): 250 """ Using Twisted get the progress status of the current job """ 251 _debug_('xmlrpc_getProgress()', 2) 243 @kaa.rpc.expose('startQueue') 244 def _startQueue(self): 245 """ start the job queue """ 246 _debug_('_startQueue()', 2) 247 self.queue.startQueue() 248 return (True, 'EncodingServer::startqueue: OK') 249 250 251 @kaa.rpc.expose('getProgress') 252 def _getProgress(self): 253 """ get the progress status of the current job """ 254 _debug_('_getProgress()', 2) 252 255 prog = self.queue.getProgress() 253 256 if type(prog) is str: 254 257 return (False, 'EncodingServer::getProgress: %s' % prog) 255 return (True, jam(prog)) 256 257 258 def xmlrpc_startQueue(self): 259 """ Using Twisted start the job queue """ 260 _debug_('xmlrpc_startQueue()', 2) 261 self.queue.startQueue() 262 return (True, 'EncodingServer::startqueue: OK') 263 264 265 def xmlrpc_listJobs(self): 266 """ List the current jobs """ 267 _debug_('xmlrpc_listJobs()', 2) 268 jlist = self.queue.listJobs() 269 return (True, jam(jlist)) 258 return (True, prog) 270 259 271 260 … … 274 263 _debug_('main()', 2) 275 264 global DEBUG 276 tmppath = tempfile.mkdtemp(prefix = 'encodeserver ')265 tmppath = tempfile.mkdtemp(prefix = 'encodeserver-') 277 266 os.chdir(tmppath) 278 267 … … 283 272 encodingcore.DEBUG = debug 284 273 _debug_('main: DEBUG=%s' % DEBUG, DINFO) 285 es = EncodingServer(debug=debug, allowNone=True) 286 reactor.listenTCP(config.ENCODINGSERVER_PORT, server.Site(es)) 287 reactor.run() 274 socket = ('', config.ENCODINGSERVER_PORT) 275 secret = config.ENCODINGSERVER_SECRET 276 _debug_('socket=%r, secret=%r' % (socket, secret)) 277 278 encodingserver = EncodingServer(debug=debug, allowNone=True) 279 try: 280 rpc = kaa.rpc.Server(socket, secret) 281 except Exception: 282 raise 283 284 rpc.connect(encodingserver) 285 286 _debug_('kaa.main starting') 287 kaa.main.run() 288 _debug_('kaa.main finished') 288 289 289 290 -
freevo/src/helpers/recordserver.py
r1847 r1884 69 69 from video.commdetectclient import connectionTest as commdetectConnectionTest 70 70 71 from video.encodingclient import initEncodeJob 72 from video.encodingclient import queueIt as queueEncodeJob 73 from video.encodingclient import listJobs as listEncodeJobs 74 from video.encodingclient import connectionTest as encodeConnectionTest 75 from video.encodingclient import setContainer, setVideoCodec, setAudioCodec, setVideoRes, setNumThreads, setVideoFilters 71 from video.encodingclient import EncodingClientActions 76 72 77 73 import tv.record_types … … 143 139 self.schedule = ScheduledRecordings() 144 140 self.updateFavoritesSchedule() 141 self.es = EncodingClientActions() 145 142 146 143 … … 1360 1357 _debug_('commdetect server not running', DINFO) 1361 1358 if config.TV_REENCODE: 1362 (result, response) = encodeConnectionTest('connection test')1359 (result, response) = self.es.ping('connection test') 1363 1360 if result: 1364 1361 source = prog.filename 1365 1362 output = prog.filename 1366 1363 multipass = config.REENCODE_NUMPASSES > 1 1367 1368 (status, resp) = initEncodeJob(source, output, prog.title, None, config.TV_REENCODE_REMOVE_SOURCE) 1364 1365 (status, resp) = self.es.initEncodeJob(source, output, prog.title, None, 1366 config.TV_REENCODE_REMOVE_SOURCE) 1369 1367 _debug_('initEncodeJob:status:%s resp:%s' % (status, resp)) 1370 1368 1371 1369 idnr = resp 1372 1370 1373 (status, resp) = se tContainer(idnr, config.REENCODE_CONTAINER)1371 (status, resp) = self.es.setContainer(idnr, config.REENCODE_CONTAINER) 1374 1372 _debug_('setContainer:status:%s resp:%s' % (status, resp)) 1375 1373 1376 (status, resp) = se tVideoCodec(idnr, config.REENCODE_VIDEOCODEC, 0, multipass,1374 (status, resp) = self.es.setVideoCodec(idnr, config.REENCODE_VIDEOCODEC, 0, multipass, 1377 1375 config.REENCODE_VIDEOBITRATE, config.REENCODE_ALTPROFILE) 1378 1376 _debug_('setVideoCodec:status:%s resp:%s' % (status, resp)) 1379 1377 1380 (status, resp) = setAudioCodec(idnr, config.REENCODE_AUDIOCODEC, config.REENCODE_AUDIOBITRATE) 1378 (status, resp) = self.es.setAudioCodec(idnr, config.REENCODE_AUDIOCODEC, 1379 config.REENCODE_AUDIOBITRATE) 1381 1380 _debug_('setAudioCodec:status:%s resp:%s' % (status, resp)) 1382 1381 1383 (status, resp) = se tNumThreads(idnr, config.REENCODE_NUMTHREADS)1382 (status, resp) = self.es.setNumThreads(idnr, config.REENCODE_NUMTHREADS) 1384 1383 _debug_('setNumThreads:status:%s resp:%s' % (status, resp)) 1385 1384 1386 (status, resp) = se tVideoRes(idnr, config.REENCODE_RESOLUTION)1385 (status, resp) = self.es.setVideoRes(idnr, config.REENCODE_RESOLUTION) 1387 1386 _debug_('setVideoRes:status:%s resp:%s' % (status, resp)) 1388 1387 1389 (status, resp) = listEncodeJobs()1390 _debug_('list EncodeJobs:status:%s resp:%s' % (status, resp))1391 1392 (status, resp) = queueEncodeJob(idnr, True)1393 _debug_('queue EncodeJob:status:%s resp:%s' % (status, resp))1388 (status, resp) = self.es.listJobs() 1389 _debug_('listJobs:status:%s resp:%s' % (status, resp)) 1390 1391 (status, resp) = self.es.queueIt(idnr, True) 1392 _debug_('queueIt:status:%s resp:%s' % (status, resp)) 1394 1393 else: 1395 1394 _debug_('encoding server not running', DINFO) -
freevo/src/plugins/idlebar/encoding.py
r1848 r1884 1 1 # -*- coding: iso-8859-1 -*- 2 2 # ----------------------------------------------------------------------- 3 # encoding.py -IdleBarplugin for showing encoding status3 # IdleBarplugin for showing encoding status 4 4 # ----------------------------------------------------------------------- 5 5 # $Id$ … … 30 30 31 31 # python modules 32 import os, sys, pygame , xmlrpclib32 import os, sys, pygame 33 33 import time 34 34 … … 68 68 self.lastpoll = 0 69 69 self.plugin_name = 'video.encodingstatus' 70 server_string = 'http://%s:%s/' % \ 71 (config.ENCODINGSERVER_IP, config.ENCODINGSERVER_PORT) 72 self.server = xmlrpclib.Server(server_string, allow_none=1) 70 self.server = EncodingClientActions() 73 71 74 72 self.skin = skin.get_singleton() … … 103 101 104 102 105 def getprogress(self):106 _debug_('getprogress(self)', 2)107 """Get the progress & pass information of the job currently encoding.108 109 This call returns False if no job is currently encoding (fx the queue is not active).110 When the queue is active, this call returns a tuple of 4 values:111 (friendlyname, status, perc, timerem)112 113 friendlyname is the friendlyname you assigned to the encoding job114 status is the current status of the encoding job, represented by an integer115 0 - Not set (this job hasn't started encoding). Never used in this context116 1 - Audio pass in progress117 2 - First (analyzing) video pass (only used in multipass encoding)118 3 - Final video pass119 4 - Postmerge (not used atm). Final merging or similar processing in progress120 perc is the percentage completed of the current pass121 timerem is the estimated time remaining of the current pass, formatted as a122 human-readable string.123 """124 125 try:126 (status, response) = self.server.getProgress()127 except:128 return (False, 'EncodingClient: connection error')129 130 return returnFromJelly(status, response)131 132 133 def listjobs(self):134 _debug_('listjobs(self)', 2)135 """Get a list with all jobs in the encoding queue and their current state136 137 Returns a list of tuples containing all the current queued jobs. When the queue is138 empty, an empty list is returned.139 Each job in the list is a tuple containing 3 values140 (idnr, friendlyname, status)141 These values have the same meaning as the corresponding values returned by the142 getProgress call"""143 144 try:145 (status, response) = self.server.listJobs()146 except:147 return (False, 'EncodingClient: connection error')148 149 return returnFromJelly(status, response)150 151
