home *** CD-ROM | disk | FTP | other *** search
- # Source Generated with Decompyle++
- # File: in.pyo (Python 2.5)
-
- import threading
- from nowplaying import ComSongChecker, register
-
- class iTunesSongChecker(ComSongChecker):
- PROCESS_NAME = u'iTunes.exe'
- COM_NAME = 'iTunes.Application'
- app_name = 'iTunes'
- name_id = 'itunes_win'
-
- def _currentSong(self):
- import comtypes
-
- try:
- song = self.client.CurrentTrack
- except comtypes.COMError:
- e = None
- ecode = e.args[0]
- if ecode == -2147418111:
- return getattr(self, '_lastsong', None)
- elif ecode == -2147417848:
- self._release()
- return None
- elif ecode == -2147221008:
- comtypes.CoInitializeEx()
- return getattr(self, '_lastsong', None)
- else:
- raise e
- except:
- ecode == -2147418111
-
- if song is None:
- thissong = None
- elif bool(self.client.PlayerState):
- pass
-
- thissong = dict(status = 'stopped', title = song.Name, filename = song.Name, length = song.Duration, artist = song.Artist, playlist_position = song.Index, rating = song.Rating, size = song.Size)
- self._lastsong = thissong
- return self._lastsong
-
-
- register(iTunesSongChecker)
- if __name__ == '__main__':
- from time import clock
- before = clock()
- checker = iTunesSongChecker()
- print 'here1'
- checker.get_instance()
- print 'here2'
- info = checker._currentSong()
- duration = clock() - before
- from pprint import pprint
- pprint(info)
- print
- print 'duration', duration
-
-