1
2
3
4
5
6
7
8
9
10
11 import os
12 import string
13 import gobject
14 from GenericPlayer import GenericAPI
15 import commands
16 import urllib
17
19 __name__ = 'Audacious API'
20 __version__ = '0.0'
21 __author__ = 'Whise (Helder Fraga)'
22 __desc__ = 'Audacious API to a Music Player'
23
24 playerAPI = None
25
26 __timeout = None
27 __interval = 2
28
29 callbackFn = None
30 __curplaying = None
31
32
36
37
38
39
41 proc = os.popen("""ps axo "%p,%a" | grep "audacious" | grep -v grep|cut -d',' -f1""").read()
42 procs = proc.split('\n')
43 if len(procs) > 1:
44 return True
45 else:
46 return False
49
50
52 try:
53 a = commands.getoutput('audtool --current-song').split(' - ')[2]
54 return a
55 except:
56 return ''
57
59 try:
60 a = commands.getoutput('audtool --current-song').split(' - ')[1]
61 return a
62 except:
63 return ''
64
66 try:
67 a = commands.getoutput('audtool --current-song').split(' - ')[0]
68 return a
69 except:
70 return ''
71
72
74 try:
75 t = urllib.unquote(commands.getoutput('audtool --current-song-filename'))
76 t = t.replace('file://','')
77 t = t.split('/')
78 basePath = ''
79 for l in t:
80 if l.find('.') == -1:
81 basePath = basePath + l +'/'
82
83 names = ['Album', 'Cover', 'Folde']
84 for x in os.listdir(basePath):
85 if os.path.splitext(x)[1] in [".jpg", ".png"] and (x.capitalize()[:5] in names):
86 coverFile = basePath + x
87 return coverFile
88 except: return ''
89 return ''
90
91
92
95
96
98 os.system('audtool --playback-playpause &')
99
101 os.system('audtool --playlist-advance &')
102
104 os.system('audtool --playlist-reverse &')
105
112
113
123