Changeset 41

Show
Ignore:
Timestamp:
11/26/07 08:22:37 (1 year ago)
Author:
jmoiron
Message:
  • fix juk support w/o pydcop
  • fix dcop support sniffing
Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • xchat/mp3.py

    r40 r41  
    1919#   - allow for customizeable announce string (like dcclogger) 
    2020#   - more mp3 players (any requests?) 
     21# 
     22# 11/26/07 - Fixed a bug w/ using juk/amarok w/o pydcop 
     23# 
    2124 
    2225 
     
    393396    importing, the comparissons are made and the appropriate functions are used.""" 
    394397    def __init__(self): 
    395         global JUK_FIRST_RUN, DCOP_MESSAGE, __DCOP__ 
    396         if JUK_FIRST_RUN and not __DCOP__
     398        global JUK_FIRST_RUN, DCOP_MESSAGE, pydcop 
     399        if JUK_FIRST_RUN and not pydcop
    397400            print_info(DCOP_MESSAGE) 
    398401        JUK_FIRST_RUN = False 
    399402        MediaPlayer.__init__(self, 'juk') 
    400403        self._ifcache = {} 
    401         self._use_dcop = __DCOP__ 
    402404        # these functions are to be selected from _%s_dcop and #s_nodcop 
    403405        self._functions = ['eject', 'open'] 
     
    405407        # are juk PLayer dcop values 
    406408        self._func_map = {'play':'play', 'stop':'stop', 'pause':'playPause', 'next':'forward', 'prev':'back'} 
    407         if self._use_dcop: 
     409        if pydcop: 
    408410            # if we have pydcop, create 'juk' and set some functions 
    409411            self.juk = pydcop.anyAppCalled("juk") 
     
    415417            # with no dcop, set equivalent functions to above using 'command' interface 
    416418            self.get_property = (lambda x: command('dcop juk Player trackProperty %s' % (x)).strip()) 
    417             self.get_juk = (lambda func: getattr(self.Juk.Player, func)()) 
     419            self.get_juk = (lambda func: command('dcop juk Player %s' % func)) 
    418420            for func in self._functions: 
    419421                setattr(self, func, getattr(self, '_%s_nodcop' % func)) 
     
    453455    importing, the comparissons are made and the appropriate functions are used.""" 
    454456    def __init__(self): 
    455         global AMAROK_FIRST_RUN, AMAROK_DCOP_MESSAGE, __DCOP__ 
    456         if AMAROK_FIRST_RUN and not __DCOP__
     457        global AMAROK_FIRST_RUN, AMAROK_DCOP_MESSAGE, pydcop 
     458        if AMAROK_FIRST_RUN and not pydcop
    457459            print_info(AMAROK_DCOP_MESSAGE) 
    458460        AMAROK_FIRST_RUN = False 
    459461        MediaPlayer.__init__(self, 'amarok') 
    460462        self._ifcache = {} 
    461         self._use_dcop = __DCOP__ 
    462463        """If the pydcop is available, then we create a 'self.get_property' function 
    463464        that uses pydcop; if it isn't available, we create a function that works the same 
     
    465466        'self.play', 'self.stop', etc. to the object's namespace.""" 
    466467        self._functions = ['play', 'stop', 'pause'] 
    467         if self._use_dcop: 
     468        if pydcop: 
    468469            self.amarok = pydcop.anyAppCalled("amarok") 
    469470            self.get_property = (lambda x: getattr(self.amarok.player, x)())