|
@@ -612,6 +612,8 @@ class LCD(Worker, threading.Thread):
|
|
|
|
|
|
BOTTOM_HEIGHT = 12
|
|
BOTTOM_HEIGHT = 12
|
|
INDICATE_HEIGHT = 10
|
|
INDICATE_HEIGHT = 10
|
|
|
|
+ TOP_HEIGHT = 138
|
|
|
|
+
|
|
|
|
|
|
term = False
|
|
term = False
|
|
|
|
|
|
@@ -664,12 +666,12 @@ class LCD(Worker, threading.Thread):
|
|
if item.getWidth() != self.WIDTH:
|
|
if item.getWidth() != self.WIDTH:
|
|
scale = float(float(self.WIDTH)/float(item.getWidth()))
|
|
scale = float(float(self.WIDTH)/float(item.getWidth()))
|
|
image = item.getImage().resize((int(item_width * scale), int(item_height*scale)), Image.BILINEAR)
|
|
image = item.getImage().resize((int(item_width * scale), int(item_height*scale)), Image.BILINEAR)
|
|
- if image.size[1] > self.HEIGHT:
|
|
|
|
- image = image.crop( box=(0,0,self.WIDTH, self.HEIGHT) )
|
|
|
|
|
|
|
|
# Display TOP
|
|
# Display TOP
|
|
if item.getPos() == LCDItem.TOP:
|
|
if item.getPos() == LCDItem.TOP:
|
|
- self.disp.display(image, x0=left, y0=upper, x1=self.WIDTH-1, y1=image.size[1]-1 )
|
|
|
|
|
|
+ topimg = Image.new('RGB', (LCD.WIDTH, LCD.TOP_HEIGHT), 0)
|
|
|
|
+ topimg.paste(image)
|
|
|
|
+ self.disp.display(topimg, x0=left, y0=upper, x1=self.WIDTH-1, y1=topimg.size[1]-1 )
|
|
|
|
|
|
# Display Bottom
|
|
# Display Bottom
|
|
elif item.getPos() == LCDItem.BOTTOM:
|
|
elif item.getPos() == LCDItem.BOTTOM:
|
|
@@ -859,28 +861,13 @@ class AlbumArt(Worker, threading.Thread):
|
|
|
|
|
|
# Display AlbumArt
|
|
# Display AlbumArt
|
|
if imgfile is not None:
|
|
if imgfile is not None:
|
|
- # LCD clear
|
|
|
|
- param = LCDItem(None, clear=True)
|
|
|
|
- msg = Message(self,Message.DISPLAY, param)
|
|
|
|
- self.sendMessage(msg)
|
|
|
|
- #
|
|
|
|
image = Image.open(imgfile)
|
|
image = Image.open(imgfile)
|
|
param = LCDItem(image, pos=LCDItem.TOP)
|
|
param = LCDItem(image, pos=LCDItem.TOP)
|
|
msg = Message(self, Message.DISPLAY, param)
|
|
msg = Message(self, Message.DISPLAY, param)
|
|
self.sendMessage(msg)
|
|
self.sendMessage(msg)
|
|
# インジケータ再描画
|
|
# インジケータ再描画
|
|
- self.sendMessage(Message(self, Message.INDICATOR, None))
|
|
|
|
|
|
+# self.sendMessage(Message(self, Message.INDICATOR, None))
|
|
|
|
|
|
- # Display Title
|
|
|
|
- if 'title' in current:
|
|
|
|
- title = current['title']
|
|
|
|
- jpfont = ImageFont.truetype(DEFAULT_FONT, LCD.BOTTOM_HEIGHT, encoding="unic");
|
|
|
|
- image = Image.new('RGB', (LCD.WIDTH, LCD.BOTTOM_HEIGHT), 0)
|
|
|
|
- draw = ImageDraw.Draw(image)
|
|
|
|
- draw.text((0,0) , title, font=jpfont, fill='#FFFFFF')
|
|
|
|
- param = LCDItem(image, pos=LCDItem.BOTTOM)
|
|
|
|
- msg = Message(self, Message.DISPLAY, param)
|
|
|
|
- self.sendMessage(msg)
|
|
|
|
return
|
|
return
|
|
|
|
|
|
def receiveMessage(self,message):
|
|
def receiveMessage(self,message):
|
|
@@ -900,6 +887,42 @@ class AlbumArt(Worker, threading.Thread):
|
|
except queue.Empty:
|
|
except queue.Empty:
|
|
sleep(0.05)
|
|
sleep(0.05)
|
|
return
|
|
return
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+class SongTitle(Worker, threading.Thread):
|
|
|
|
+
|
|
|
|
+ term = False
|
|
|
|
+
|
|
|
|
+ def __init__(self, pm):
|
|
|
|
+ threading.Thread.__init__(self)
|
|
|
|
+ Worker.__init__(self, pm)
|
|
|
|
+ self.messageq = queue.Queue()
|
|
|
|
+
|
|
|
|
+ def receiveMessage(self, message):
|
|
|
|
+ if message.getMessage() == Message.MPD:
|
|
|
|
+ self.messageq.put(message.getParam())
|
|
|
|
+ elif message.getMessage() == Message.TERM:
|
|
|
|
+ self.term = True
|
|
|
|
+ return True
|
|
|
|
+
|
|
|
|
+ def draw(self, title):
|
|
|
|
+ jpfont = ImageFont.truetype(DEFAULT_FONT, LCD.BOTTOM_HEIGHT, encoding="unic");
|
|
|
|
+ image = Image.new('RGB', (LCD.WIDTH, LCD.BOTTOM_HEIGHT), 0)
|
|
|
|
+ draw = ImageDraw.Draw(image)
|
|
|
|
+ draw.text((0,0) , title, font=jpfont, fill='#FFFFFF')
|
|
|
|
+ param = LCDItem(image, pos=LCDItem.BOTTOM)
|
|
|
|
+ msg = Message(self, Message.DISPLAY, param)
|
|
|
|
+ self.sendMessage(msg)
|
|
|
|
+
|
|
|
|
+ def run(self):
|
|
|
|
+ while self.term == False:
|
|
|
|
+ try:
|
|
|
|
+ param = self.messageq.get_nowait()
|
|
|
|
+ if 'title' in param['current']:
|
|
|
|
+ self.draw(param['current']['title'])
|
|
|
|
+ except queue.Empty:
|
|
|
|
+ sleep(0.05)
|
|
|
|
+ return
|
|
|
|
|
|
|
|
|
|
# Indicator worker
|
|
# Indicator worker
|
|
@@ -1131,7 +1154,6 @@ class MPC(Worker, threading.Thread):
|
|
|
|
|
|
|
|
|
|
|
|
|
|
-
|
|
|
|
# lirc remote control worker
|
|
# lirc remote control worker
|
|
class Remote(Worker, threading.Thread):
|
|
class Remote(Worker, threading.Thread):
|
|
|
|
|
|
@@ -1237,6 +1259,12 @@ class PlayerMain(Master, threading.Thread):
|
|
self.mpc.start()
|
|
self.mpc.start()
|
|
self.workers.append(self.mpc)
|
|
self.workers.append(self.mpc)
|
|
|
|
|
|
|
|
+ # SongTitle
|
|
|
|
+ st = SongTitle(self)
|
|
|
|
+ st.setDaemon(True)
|
|
|
|
+ st.start()
|
|
|
|
+ self.workers.append(st)
|
|
|
|
+
|
|
# Indicator
|
|
# Indicator
|
|
id = Indicator(self)
|
|
id = Indicator(self)
|
|
id.setDaemon(True)
|
|
id.setDaemon(True)
|