Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- # Stupid Simple Winamp Player (SSWP) v0.2, written by ProjectRevoTPP
- '''
- Future improvements:
- -Display Game name, year released, and system name similar to how TPP userbar displays it (emulate it)
- -fix subprocess hang if winamp does not immediately launch
- '''
- import winamp
- import yaml
- import re
- import sys
- import time
- import os
- w = winamp.Winamp()
- winamppath = r"" #put your path to winamp.exe here
- musicpath = r"" #use forward slashes or it'll break, no slash after the last folder
- def get_song_path(meta, game_id, song_id): #function written by valkyrie, thanks man
- for game in meta:
- if game_id == game["id"]:
- songs = game["songs"]
- for song in songs:
- if song_id == song["id"]:
- return game["path"] + "/" + song["path"]
- return ""
- if (os.path.isfile("metadata.txt")):
- print "metadata.txt found.. continuing"
- with open('metadata.txt', 'r') as metadata:
- mdata = yaml.load(metadata)
- else:
- print "Cannot find metadata. Exiting in three seconds.."
- time.sleep(3)
- raise
- while 1:
- fullid = raw_input ('Enter the full ID of the song you want to play: ') #test
- try:
- gameid, songid = fullid.split('-', 1)
- except:
- print "Error: No dash detected - cannot split full ID. Trying again in three seconds.."
- time.sleep(3)
- continue
- print "gameID: ", gameid
- print "songID: ", songid
- songpath = get_song_path(mdata, gameid, songid)
- gamepath = musicpath + "/" + songpath
- fullpath = '"' + winamppath + '" "' + gamepath + '"'
- if (os.path.isfile(gamepath)):
- print "Playing " + songid + ".."
- w.playSoloFile(fullpath)
- else:
- print "File does not exist. Returning in three seconds.."
- time.sleep(3)
- continue
- '''
- Add this to pywinamp library manually (winamp.py):
- def playSoloFile(self, filePath):
- self.stop()
- self.clearPlaylist()
- subprocess.call(filePath) # I don't really like using a subprocess and may improve this in the future
- '''
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement