-
Notifications
You must be signed in to change notification settings - Fork 0
/
controller.py
85 lines (59 loc) · 1.95 KB
/
controller.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
# encoding: utf-8
import sys, logging
from errorinfo import *
from xquery import TagQuery
from listening import ListeningProbe
from creator import Creator
from config import *
logging.basicConfig(filename=LOG_PATH, level=logging.INFO)
class XController(object):
def __init__(self, typecode):
self.started = False
self.probe = ListeningProbe(typecode)
if not self.probe.noplaying:
self.xiaquery = TagQuery(self.probe.lid, dbfile=DB_FILE)
self.crt = Creator(TEMP_DIR, self.probe.lpath)
else:
raise ControllerError('no current listening')
def start(self):
self.started = True
self.pr1 = self.xiaquery.expandInfo()
self.pr2 = self.crt.ensureEnv( self.xiaquery.gettags() )
self.pr3 = self.crt.move()
def ahk_display(self):
print u'Xiami_controller'
if self.started:
print self.pr1
print self.pr2
print self.pr3
else:
print u'Not Yet Started!'
class DIRController(object):
def __init__(self):
self.started = False
self.probe = ListeningProbe('dir')
def start(self):
self.started = True
for n in range(len(self.probe.playing.lpath)):
lpath = self.probe.playing.lpath[n]
lid = self.probe.playing.lid[n]
q = TagQuery(lid, dbfile=DB_FILE)
c = Creator(TEMP_DIR, lpath)
q.expandInfo()
tags = q.gettags()
c.ensureEnv(tags)
print n
c.move()
c.clear()
print u'<\t -All Done!- \t>'
class FlashGotController(object):
def __init__(self):
pass
class Runner(object):
def __init__(self):
pass
def start(self):
pass
if __name__ == '__main__':
d = DIRController()
d.start()