enqueue files to playlist in winamp with python -
i trying python enqueue music files winamp. have tried following:
some functions work, add playlist doesn't
again command line switches work, load file doesn't
does know way done? not looking complete controller winamp, way push files playlist in running instance.
i using winamp 5.63 , windows 7 x64 , python 2.7
i'm using python 3 on windows 8 64-bit , using pywinamp.py can add files playlist , play file. here code:
# run winamp.exe try: open(os.devnull, 'wb') devnull: devnull = open(os.devnull) winamp_path = 'c:\\program files\\winamp\\winamp.exe' p = subprocess.popen([winamp_path], stdout=devnull, stderr=devnull) except oserror e: # handle exception pass w = winamp() # class pywinamp.py # wait app start ''' reason couldn't access __mainwindowhwnd attribute of winamp class added line in __init__ method of winamp class: self.wid = self.__mainwindowhwnd. way know if winamp open''' while not w.wid: w = winamp() time.sleep(2) # enqueue file in winamp w.enqueuefile(filepath.encode('utf-8')) # ctypes needs bytes type # length of winamp playlist , set position on last track w.setplaylistposition(w.getlistlength()) # play song w.play()
Comments
Post a Comment