Changeset 1884

Show
Ignore:
Timestamp:
16/11/08 18:44:29 (8 weeks ago)
Author:
duncan
svm:headrev:

cc3e1ea1-1e01-0410-8d68-8b121e83a9d5:11166
Message:

Replaced the Twisted RPC calls with the kaa rpc

Location:
freevo
Files:
10 modified

Legend:

Unmodified
Added
Removed
  • freevo/freevo_config.py

    r1834 r1884  
    381381    (5.26, 
    382382     """ 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 
    384384     Renamed USE_SDL_KEYBOARD to SYS_USE_KEYBOARD 
    385385     Added SYS_USE_JOYSTICK to allow a joystick device to be used 
    386386     Added DEBUG_BENCHMARKING can be used to time and trace function calls 
    387387     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 
    389389     """), 
    390390] 
     
    20942094WWW_PAGES = [ 
    20952095    #   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'), 
    21032103    (_('Help'),                 _('View Online Help and Documentation'), 'help/') 
    21042104] 
     
    21482148ENCODINGSERVER_GID = 0 
    21492149 
     2150 
    21502151ENCODINGSERVER_IP   = 'localhost' 
    2151 ENCODINGSERVER_PORT = 6666 
     2152ENCODINGSERVER_PORT = 18002 
     2153ENCODINGSERVER_SECRET = 'secret2' 
    21522154 
    21532155# ====================================================================== 
  • freevo/src/encodingcore.py

    r1875 r1884  
    279279        start=0 
    280280        if timeslice[0]: 
    281             self.timeslice_mencoder += [ '-ss', str(timeslice[0])] 
     281            self.timeslice_mencoder += ['-ss', str(timeslice[0])] 
    282282            start = timeslice[0] 
    283283        if timeslice[1]: 
     
    309309        _debug_('setVideoCodec(self, vcodec=%s, tgtsize=%s, multipass=%s, vbitrate=%s)' % \ 
    310310            (vcodec, tgtsize, multipass, vbitrate)) 
    311         #safety checks first 
    312311        if vcodec not in self.encodingopts.getVideoCodecList(): 
    313             return 'Unknown video codec' 
     312            return 'Unknown video codec %r' % vcodec 
    314313 
    315314        self.vcodec = vcodec 
     
    325324    def setAudioCodec(self, acodec, abrate=128): 
    326325        """Set audio codec & bitrate""" 
    327         #safety first 
    328326        if acodec not in self.encodingopts.getAudioCodecList(): 
    329             return 'Unknown audio codec' 
     327            return 'Unknown audio codec %r' % acodec 
    330328 
    331329        self.acodec = acodec 
  • freevo/src/helpers/encodingserver.py

    r1791 r1884  
    2828 
    2929import sys, string, random, time, os, re, pwd, stat, tempfile 
     30 
     31import kaa 
     32import kaa.rpc 
    3033import config 
    3134from util import vfs 
     
    4750        print e 
    4851 
    49 from twisted.web import xmlrpc, server 
    50 from twisted.internet import reactor 
    51 from util.marmalade import jellyToXML, unjellyFromXML 
    5252import time, random, sys, os 
    5353import logging 
     
    5656from encodingcore import EncodingJob, EncodingQueue, EncodingOptions 
    5757 
    58 #some data 
    5958__author__ = 'den_RDC (rdc@kokosnoot.com)' 
    6059__revision__ = '$Rev$' 
     
    6463DEBUG = hasattr(config, 'DEBUG_'+appconf) and eval('config.DEBUG_'+appconf) or config.DEBUG 
    6564 
    66 jam = jellyToXML 
    67 unjam = unjellyFromXML 
    68  
    69  
    70 class EncodingServer(xmlrpc.XMLRPC): 
     65 
     66class EncodingServer: 
    7167    def __init__(self, debug=False, allowNone=False): 
    7268        """ Initialise the EncodingServer class """ 
    7369        _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) 
    7870        self.debug = debug 
    7971        self.jobs = {} 
     
    8375 
    8476 
    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        """ 
    95117        #safety checks 
    96118        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__,)) 
    98120 
    99121        # generate a 'random' idnr based on the time in p2.3, int() can return long 
     
    109131        if self.jobs[idnr].finishedanalyze and self.jobs[idnr].failed: 
    110132            _debug_('Analysis failed') 
    111             return (False,10) 
     133            return (False, 10) 
    112134 
    113135        _debug_('Initialized job %s (idnr: %s)' % (friendlyname, idnr), DINFO) 
    114  
    115136        return (True, idnr) 
    116137 
    117138 
    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 """ 
    127142        status = self.jobs[idnr].setContainer(container) 
    128  
    129143        if not status: 
    130144            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) 
    137190        status = self.jobs[idnr].setTimeslice(timeslice) 
    138191        if not status: 
    139192            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) 
    191200        if not (videores): 
    192             return (False, 'EncodingServer::setVideoRes:  no video resolution given') 
     201            return (False, 'EncodingServer::setVideoRes: no video resolution given') 
    193202 
    194203        status = self.jobs[idnr].setVideoRes( videores) 
    195  
    196204        if not status: 
    197205            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 Twisted set 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) 
    205213        #safety checks 
    206214        if not (numthreads): 
    207             return (False, 'EncodingServer::setNumThreads:  no number given') 
     215            return (False, 'EncodingServer::setNumThreads: no number given') 
    208216 
    209217        status = self.jobs[idnr].setNumThreads( numthreads) 
    210  
    211218        if not status: 
    212219            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) 
    241235        self.queue.addEncodingJob(self.jobs[idnr]) 
    242236        del self.jobs[idnr] 
     
    247241 
    248242 
    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) 
    252255        prog = self.queue.getProgress() 
    253256        if type(prog) is str: 
    254257            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) 
    270259 
    271260 
     
    274263    _debug_('main()', 2) 
    275264    global DEBUG 
    276     tmppath = tempfile.mkdtemp(prefix = 'encodeserver') 
     265    tmppath = tempfile.mkdtemp(prefix = 'encodeserver-') 
    277266    os.chdir(tmppath) 
    278267 
     
    283272        encodingcore.DEBUG = debug 
    284273    _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') 
    288289 
    289290 
  • freevo/src/helpers/recordserver.py

    r1847 r1884  
    6969from video.commdetectclient import connectionTest as commdetectConnectionTest 
    7070 
    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 
     71from video.encodingclient import EncodingClientActions 
    7672 
    7773import tv.record_types 
     
    143139        self.schedule = ScheduledRecordings() 
    144140        self.updateFavoritesSchedule() 
     141        self.es = EncodingClientActions() 
    145142 
    146143 
     
    13601357                        _debug_('commdetect server not running', DINFO) 
    13611358                if config.TV_REENCODE: 
    1362                     (result, response) = encodeConnectionTest('connection test') 
     1359                    (result, response) = self.es.ping('connection test') 
    13631360                    if result: 
    13641361                        source = prog.filename 
    13651362                        output = prog.filename 
    13661363                        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) 
    13691367                        _debug_('initEncodeJob:status:%s resp:%s' % (status, resp)) 
    13701368 
    13711369                        idnr = resp 
    13721370 
    1373                         (status, resp) = setContainer(idnr, config.REENCODE_CONTAINER) 
     1371                        (status, resp) = self.es.setContainer(idnr, config.REENCODE_CONTAINER) 
    13741372                        _debug_('setContainer:status:%s resp:%s' % (status, resp)) 
    13751373 
    1376                         (status, resp) = setVideoCodec(idnr, config.REENCODE_VIDEOCODEC, 0, multipass, 
     1374                        (status, resp) = self.es.setVideoCodec(idnr, config.REENCODE_VIDEOCODEC, 0, multipass, 
    13771375                            config.REENCODE_VIDEOBITRATE, config.REENCODE_ALTPROFILE) 
    13781376                        _debug_('setVideoCodec:status:%s resp:%s' % (status, resp)) 
    13791377 
    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) 
    13811380                        _debug_('setAudioCodec:status:%s resp:%s' % (status, resp)) 
    13821381 
    1383                         (status, resp) = setNumThreads(idnr, config.REENCODE_NUMTHREADS) 
     1382                        (status, resp) = self.es.setNumThreads(idnr, config.REENCODE_NUMTHREADS) 
    13841383                        _debug_('setNumThreads:status:%s resp:%s' % (status, resp)) 
    13851384 
    1386                         (status, resp) = setVideoRes(idnr, config.REENCODE_RESOLUTION) 
     1385                        (status, resp) = self.es.setVideoRes(idnr, config.REENCODE_RESOLUTION) 
    13871386                        _debug_('setVideoRes:status:%s resp:%s' % (status, resp)) 
    13881387 
    1389                         (status, resp) = listEncodeJobs() 
    1390                         _debug_('listEncodeJobs:status:%s resp:%s' % (status, resp)) 
    1391  
    1392                         (status, resp) = queueEncodeJob(idnr, True) 
    1393                         _debug_('queueEncodeJob: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)) 
    13941393                    else: 
    13951394                        _debug_('encoding server not running', DINFO) 
  • freevo/src/plugins/idlebar/encoding.py

    r1848 r1884  
    11# -*- coding: iso-8859-1 -*- 
    22# ----------------------------------------------------------------------- 
    3 # encoding.py - IdleBarplugin for showing encoding status 
     3# IdleBarplugin for showing encoding status 
    44# ----------------------------------------------------------------------- 
    55# $Id$ 
     
    3030 
    3131# python modules 
    32 import os, sys, pygame, xmlrpclib 
     32import os, sys, pygame 
    3333import time 
    3434 
     
    6868        self.lastpoll  = 0 
    6969        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() 
    7371 
    7472        self.skin      = skin.get_singleton() 
     
    103101 
    104102 
    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 job 
    114         status is the current status of the encoding job, represented by an integer 
    115             0 - Not set (this job hasn't started encoding). Never used in this context 
    116             1 - Audio pass in progress 
    117             2 - First (analyzing) video pass (only used in multipass encoding) 
    118             3 - Final video pass 
    119             4 - Postmerge (not used atm). Final merging or similar processing in progress 
    120         perc is the percentage completed of the current pass 
    121         timerem is the estimated time remaining of the current pass, formatted as a 
    122             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 state 
    136  
    137         Returns a list of tuples containing all the current queued jobs. When the queue is 
    138         empty, an empty list is returned. 
    139         Each job in the list is a tuple containing 3 values 
    140             (idnr, friendlyname, status) 
    141         These values have the same meaning as the corresponding values returned by the 
    142             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