Skip to content

Commit

Permalink
threads erneut in main eingebaut
Browse files Browse the repository at this point in the history
  • Loading branch information
selfisch committed Oct 27, 2017
1 parent 3e628b6 commit 0775fb0
Showing 1 changed file with 15 additions and 6 deletions.
21 changes: 15 additions & 6 deletions main.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,15 +11,23 @@
import log
logger = log.setup_custom_logger('main')

from func_mopidy import mopidy
from func_cardreader import cardreader
from func_usbbtn import usbbtn
from func_mopidy import mopidy
from func_mousebtn import mouse

mpd_connect_thread = threading.Thread(name='mpd_connect_thread', target=mopidy.mpdConnect)
read_card_thread = threading.Thread(name='read_card', target=cardreader.read_card)
mouse_press_thread = threading.Thread(name='mouse_press', target=mouse.mouse_press)
button_press_thread = threading.Thread(name='button_press', target=usbbtn.button_press)

# lade die Class mopidy in die Variable mopidy
mopidy = mopidy()
#mopidy = mopidy()
# lade die Class usbbtn in die Variable usbbtn
usbbtn = usbbtn()
#usbbtn = usbbtn()
check_usbbtn = usbbtn.check_usbbtn()
check_reader = cardreader.check_reader()
check_mouse = mouse.check_mouse()

# in das Verzeichnis des Skript wechseln
abspath = os.path.abspath(__file__)
Expand All @@ -34,12 +42,13 @@

try:
logger.info('Starte die Anwendung')
button_press_thread = threading.Thread(name='button_press', target=usbbtn.button_press)

if check_usbbtn != 'n':
button_press_thread.start()

# usbbtn.source('tuner')
if check_reader != 'n':
read_card_thread.start()
if check_mouse != 'n':
mouse_press_thread.start()

except (SystemExit):
logger.info("Anwendung beendet")
Expand Down

0 comments on commit 0775fb0

Please sign in to comment.