Skip to content

Commit

Permalink
Bugfix #1320 of arne123/RPi-Jukebox-RFID/tree/gpio-control_to_class (#…
Browse files Browse the repository at this point in the history
…1323)

* Bugfix of arne123/RPi-Jukebox-RFID/tree/gpio-control_to_class

This update form @arne123 fixes #1320 .
There was still a Bug in the Import of the class function. and here is my commit.

* Bugfix #1328  i2c_lcd.py

Removed string function to remove newline. Type error because trake_time contains binary.

Therefore using subprocess.check_output setting to remove newline with  universal_newlines

This fixes issue  #1328
  • Loading branch information
derchan authored Mar 7, 2021
1 parent 0c5842d commit 9651a60
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,15 @@

import logging
from evdev import categorize, ecodes, KeyEvent
import components.gpio_control.function_calls
from io_buttons_usb_encoder import button_map, current_device
from components.gpio_control.function_calls import phoniebox_function_calls


logger = logging.getLogger(__name__)

try:
button_map = button_map()
function_calls = phoniebox_function_calls()
for event in current_device().read_loop():
if event.type == ecodes.EV_KEY:
keyevent = categorize(event)
Expand All @@ -23,7 +25,7 @@
try:
function_name = button_map[button_string]
try:
getattr(components.gpio_control.function_calls, function_name)()
getattr(function_calls, function_name)()
except:
logger.warning(
"Function " + function_name + " not found in function_calls.py (mapped from button: " + button_string + ")")
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
try:
functions = list(
filter(lambda function_name: function_name.startswith("functionCall"),
dir(components.gpio_control.function_calls)))
dir(components.gpio_control.function_calls.phoniebox_function_calls)))
button_map = {}

print("")
Expand Down
9 changes: 4 additions & 5 deletions components/displays/HD44780-i2c/i2c_lcd.py
Original file line number Diff line number Diff line change
Expand Up @@ -333,7 +333,7 @@ def sec_to_min_and_sec(seconds):
album = album.replace("\n", "").replace("ä", "\341").replace("ö", "\357").replace("ü", "\365").replace("ß", "\342").replace("Ä", "\341").replace("Ö", "\357").replace("Ü", "\365") # weitere codes siehe https://www.mikrocontroller.net/topic/293125 #
except KeyError: #
album = "" #
## read in artist info
## read in artist info
try: #
artist = current_song_infos['artist'] #
artist = artist.replace("\n", "").replace("ä", "\341").replace("ö", "\357").replace("ü", "\365").replace("ß", "\342").replace("Ä", "\341").replace("Ö", "\357").replace("Ü", "\365") # weitere codes siehe https://www.mikrocontroller.net/topic/293125 #
Expand All @@ -342,7 +342,7 @@ def sec_to_min_and_sec(seconds):
artist = current_song_infos['name'] #
artist = artist.replace("\n", "").replace("ä", "\341").replace("ö", "\357").replace("ü", "\365").replace("ß", "\342").replace("Ä", "\341").replace("Ö", "\357").replace("Ü", "\365") # weitere codes siehe https://www.mikrocontroller.net/topic/293125 #
except KeyError: #
artist = "" #
artist = "" #
if (client.mpd_version) >= "0.20":
try: #
elapsed = status['elapsed'].split(".")[0] #
Expand All @@ -351,8 +351,7 @@ def sec_to_min_and_sec(seconds):
except KeyError: #
track_time = "" #
else: #
track_time = subprocess.check_output('mpc | head -n2 | tail -n1 | sed "s/ \+/ /g" | cut -d" " -f3', shell=True)
track_time = track_time.replace("\n", "") #
track_time = subprocess.check_output('mpc | head -n2 | tail -n1 | sed "s/ \+/ /g" | cut -d" " -f3', universal_newlines=True, shell=True)
###########################################################################################

############# RESET GLOBAL COUNTER, IF TITLE CHANGED ############################
Expand Down Expand Up @@ -410,7 +409,7 @@ def sec_to_min_and_sec(seconds):
if i_counter >= 65000: #
i_counter = 1000 # <-- not 0, cause the display could be off #
######################################################################################

####################### REMIND STUFF FOR NEXT CYCLE #################################
last_state = state #
last_title = title #
Expand Down

0 comments on commit 9651a60

Please sign in to comment.