Skip to content

Commit

Permalink
1.7.1 - 20190131
Browse files Browse the repository at this point in the history
- 31.01.2019 - Version 1.7.1 - 20190131
  - Bugfix:
    - The information on the radio stream was not displayed correctly: fixed (Issue: <a href="https://github.com/splitti/oled_phoniebox/issues/2#issuecomment-456209931">https://github.com/splitti/oled_phoniebox/issues/2#issuecomment-456209931</a>)
    - Fixing some small errors
  - Features:
    - Mute Image
    - Radio Image (new Font added)
  • Loading branch information
splitti committed Jan 31, 2019
1 parent d20147f commit 840679c
Show file tree
Hide file tree
Showing 4 changed files with 46 additions and 17 deletions.
12 changes: 10 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
Date: 18.01.2019
Version: 1.6.2 - 20190118
Date: 31.01.2019
Version: 1.7.1 - 20190131

# oled_phoniebox
oled_phoniebox
Expand Down Expand Up @@ -73,8 +73,16 @@ Images (cardhand and musiccard) based on:

Font:
- https://www.dafont.com/bitstream-vera-mono.font
- https://www.dafont.com/wifi.font

## Changelog
- 31.01.2019 - Version 1.7.1 - 20190131
- Bugfix:
- The information on the radio stream was not displayed correctly: fixed (Issue: <a href="https://github.com/splitti/oled_phoniebox/issues/2#issuecomment-456209931">https://github.com/splitti/oled_phoniebox/issues/2#issuecomment-456209931</a>)
- Fixing some small errors
- Features:
- Mute Image
- Radio Image (new Font added)
- 18.01.2019 - Version 1.6.2 - 20190118
- Bugfix: One Line Install-Script
- 16.01.2019 - Version 1.6.1 - 20190116
Expand Down
Binary file added fonts/WIFI.ttf
Binary file not shown.
47 changes: 34 additions & 13 deletions oled_phoniebox.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,10 +17,14 @@
font = ImageFont.truetype(font_path, 12)
font_small = ImageFont.truetype(font_path, 10)
font_hightower = ImageFont.truetype(font_path, 54)
font_path_wifi = os.path.abspath(os.path.join(os.path.dirname(__file__),
'fonts', 'WIFI.ttf'))
font_wifi = ImageFont.truetype(font_path_wifi, 64)


confFile = "/home/pi/oled_phoniebox/oled_phoniebox.conf"
tempFile = "/tmp/o4p_overview.temp"
version = "1.6.2 - 20190118"
version = "1.7.1 - 20190131"

def ShowImage(imgname):
img_path = os.path.abspath(os.path.join(os.path.dirname(__file__),'images', imgname+'.png'))
Expand All @@ -45,6 +49,7 @@ def main(num_iterations=sys.maxsize):
device.contrast(oldContrast)
ShowImage("music")
tmpcard = 3
linePos = 1
line1 = 4
line2 = 19
line3 = 34
Expand Down Expand Up @@ -117,9 +122,12 @@ def main(num_iterations=sys.maxsize):
with canvas(device) as draw:
draw.rectangle((30,22,45,42), outline="white", fill="white")
draw.polygon([(45, 22),(60, 10), (60,54), (45, 42)], outline="white", fill="white")
draw.rectangle((75,28,105,36), outline="white", fill="white")
if oldVol < volume:
draw.rectangle((86,17,94,47), outline="white", fill="white")
if volume != 0:
draw.rectangle((75,28,105,36), outline="white", fill="white")
if oldVol < volume:
draw.rectangle((86,17,94,47), outline="white", fill="white")
else:
draw.text((75, 2),"X",font=font_hightower, fill="white")
sleep(displayTime)
oldVol = volume
if (playing == "[playing]") or (playing == "[paused]"):
Expand Down Expand Up @@ -160,11 +168,16 @@ def main(num_iterations=sys.maxsize):
if initVars['GENERAL']['mode'] == "lite" :
if playing != "[paused]":
TimeLine = elapsed.split("/")
if TimeLine[1] != "0:00":
elapsed = TimeLine[1]
if not file.startswith("http"):
if TimeLine[1] != "0:00":
elapsed = TimeLine[1]
if not file.startswith("http"):
TimeLineP = int(mpcstatus.split("\n")[1].replace(" "," ").replace(" "," ").split(" ")[3].replace("(","").replace("%)",""))
TimeLineP = device.width * TimeLineP / 100
else:
TimeLineP = device.width
track = "X"
xpos_w = device.width/2-38
track = track.split("/")[0]
if len(track) == 1:
xpos = device.width/2-15
Expand All @@ -175,7 +188,10 @@ def main(num_iterations=sys.maxsize):
if len(track) == 4:
xpos = device.width/2-60
with canvas(device) as draw:
draw.text((xpos, 4),track,font=font_hightower, fill="white")
if not file.startswith("http"):
draw.text((xpos, 4),track,font=font_hightower, fill="white")
else:
draw.text((xpos_w, 4),track,font=font_wifi, fill="white")
draw.rectangle((0,0,TimeLineP,1), outline="white", fill="white")
draw.rectangle((109, line4+8,111,line4+10), outline=WifiConn[0], fill=WifiConn[0])
draw.rectangle((114, line4+6,116,line4+10), outline=WifiConn[1], fill=WifiConn[1])
Expand Down Expand Up @@ -225,7 +241,9 @@ def main(num_iterations=sys.maxsize):
cnt = 0-spaceJump
if playing != "[paused]":
TimeLine = elapsed.split("/")
if TimeLine[1] != "0:00":
if TimeLine[0] == "(0%)":
elapsed = "-:--"
elif TimeLine[1] != "0:00":
elapsed = TimeLine[1]
else:
elapsed = "-:--"
Expand All @@ -252,20 +270,23 @@ def main(num_iterations=sys.maxsize):
if len(track) == 5:
track = track
with canvas(device) as draw:
if not file.startswith("http"):
draw.line((39, line4-2, 39, device.height), fill="white")
draw.text((0, line4),elapsed,font=font_small, fill="white")
draw.text((42, line4),track,font=font_small, fill="white")
draw.line((0, line4-2, device.width, line4-2), fill="white")
else:
draw.line((75, line4-2, device.width, line4-2), fill="white")
draw.rectangle((0,0,TimeLineP,1), outline="white", fill="white")
draw.rectangle((109, line4+8,111,line4+10), outline=WifiConn[0], fill=WifiConn[0])
draw.rectangle((114, line4+6,116,line4+10), outline=WifiConn[1], fill=WifiConn[1])
draw.rectangle((119, line4+4,121,line4+10), outline=WifiConn[2], fill=WifiConn[2])
draw.rectangle((124, line4+2,126,line4+10), outline=WifiConn[3], fill=WifiConn[3])
draw.line((0, line4-2, device.width, line4-2), fill="white")
draw.line((39, line4-2, 39, device.height), fill="white")
draw.line((75, line4-2, 75, device.height), fill="white")
draw.line((105, line4-2, 105, device.height), fill="white")
draw.text((0-subLine1, line1),txtLine1,font=font, fill="white")
draw.text((0-subLine2, line2),txtLine2,font=font, fill="white")
draw.text((0-subLine3, line3),txtLine3,font=font, fill="white")
draw.text((0, line4),elapsed,font=font_small, fill="white")
draw.text((42, line4),track,font=font_small, fill="white")
draw.text((78, line4),vol,font=font_small, fill="white")
draw.text((108, line4),"---",font=font_small, fill=WifiConn[4])
oldMPC = currMPC
Expand All @@ -280,7 +301,7 @@ def main(num_iterations=sys.maxsize):
tmpcard = 0
except:
sleep(0.5)
# ShowImage("music")
ShowImage("music")

#if __name__ == "__main__":
initVars = Init(confFile)
Expand Down
4 changes: 2 additions & 2 deletions scripts/install/o4p_installer.sh
Original file line number Diff line number Diff line change
Expand Up @@ -326,7 +326,7 @@ echo -e "${green}Done${nocolor}"
echo -e ""
echo -e -n " --> Installing Service: "
sudo chown -R pi:pi ${installPath} > /dev/null
sudo chmod +x ${installPath}/oled_phoniebox.py > /dev/null
#sudo chmod +x ${installPath}/oled_phoniebox.py > /dev/null
sudo cp ${installPath}/templates/service.template /etc/systemd/oled_phoniebox.service > /dev/null
sudo chown root:root /etc/systemd/oled_phoniebox.service > /dev/null 2>&1
sudo chmod 644 /etc/systemd/oled_phoniebox.service > /dev/null 2>&1
Expand Down Expand Up @@ -380,7 +380,7 @@ do
"Option 2: Replace service for contrast-control")
echo -e " "
echo -e -n " --> Delete old Service: "
sudo chmod +x ${installPath}/scripts/gpio-buttons/gpio-buttons.py > /dev/null
#sudo chmod +x ${installPath}/scripts/gpio-buttons/gpio-buttons.py > /dev/null
sudo service phoniebox-gpio-buttons stop > /dev/null 2>&1
sudo systemctl disable phoniebox-gpio-buttons > /dev/null 2>&1
sudo rm /etc/systemd/system/phoniebox-gpio-buttons.service > /dev/null 2>&1
Expand Down

0 comments on commit 840679c

Please sign in to comment.