Changeset 41
- Timestamp:
- 11/26/07 08:22:37 (1 year ago)
- Files:
-
- xchat/mp3.py (modified) (6 diffs)
Legend:
- Unmodified
- Added
- Removed
- Modified
- Copied
- Moved
xchat/mp3.py
r40 r41 19 19 # - allow for customizeable announce string (like dcclogger) 20 20 # - more mp3 players (any requests?) 21 # 22 # 11/26/07 - Fixed a bug w/ using juk/amarok w/o pydcop 23 # 21 24 22 25 … … 393 396 importing, the comparissons are made and the appropriate functions are used.""" 394 397 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: 397 400 print_info(DCOP_MESSAGE) 398 401 JUK_FIRST_RUN = False 399 402 MediaPlayer.__init__(self, 'juk') 400 403 self._ifcache = {} 401 self._use_dcop = __DCOP__402 404 # these functions are to be selected from _%s_dcop and #s_nodcop 403 405 self._functions = ['eject', 'open'] … … 405 407 # are juk PLayer dcop values 406 408 self._func_map = {'play':'play', 'stop':'stop', 'pause':'playPause', 'next':'forward', 'prev':'back'} 407 if self._use_dcop:409 if pydcop: 408 410 # if we have pydcop, create 'juk' and set some functions 409 411 self.juk = pydcop.anyAppCalled("juk") … … 415 417 # with no dcop, set equivalent functions to above using 'command' interface 416 418 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)) 418 420 for func in self._functions: 419 421 setattr(self, func, getattr(self, '_%s_nodcop' % func)) … … 453 455 importing, the comparissons are made and the appropriate functions are used.""" 454 456 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: 457 459 print_info(AMAROK_DCOP_MESSAGE) 458 460 AMAROK_FIRST_RUN = False 459 461 MediaPlayer.__init__(self, 'amarok') 460 462 self._ifcache = {} 461 self._use_dcop = __DCOP__462 463 """If the pydcop is available, then we create a 'self.get_property' function 463 464 that uses pydcop; if it isn't available, we create a function that works the same … … 465 466 'self.play', 'self.stop', etc. to the object's namespace.""" 466 467 self._functions = ['play', 'stop', 'pause'] 467 if self._use_dcop:468 if pydcop: 468 469 self.amarok = pydcop.anyAppCalled("amarok") 469 470 self.get_property = (lambda x: getattr(self.amarok.player, x)())
