From 0239fa865ca5e6bb2371c28fcb5c985ada77abf5 Mon Sep 17 00:00:00 2001 From: Andreas Demmelbauer Date: Sat, 21 Dec 2019 03:01:41 +0100 Subject: [PATCH] add oe1 journal --- discobert.py | 12 ++++++++++-- lircrc | 2 +- 2 files changed, 11 insertions(+), 3 deletions(-) diff --git a/discobert.py b/discobert.py index 95c39de..d61387b 100644 --- a/discobert.py +++ b/discobert.py @@ -156,6 +156,13 @@ def startMusic(playlist, single=False, shuffle=True, repeat=True): client.setvol(80)# set volume client.play() # play +def getNewestPodcastUrl(xml): + podcast = xml + podcast_string = requests.get(podcast).text + tree = ET.fromstring(podcast_string) + return tree.find('.//enclosure').get('url') + + def playMusic(): try: client.play() @@ -513,8 +520,9 @@ while True: if(code == "mode_record"): say("I'm sorry, I'm afraid I can't do that!") - if(code == "mode_help"): - tour() + if(code == "mode_news"): + oejournalUrl = getNewestPodcastUrl('https://files.orf.at/podcast/oe1/oe1_journale.xml') + startMusic(oejournalUrl) diff --git a/lircrc b/lircrc index a0d9e3c..a7b987a 100644 --- a/lircrc +++ b/lircrc @@ -57,7 +57,7 @@ end begin button = KEY_CD prog = disco - config = mode_help + config = mode_news end