From 4842ccdc22d48fc23a057dbf667d336aab2007ac Mon Sep 17 00:00:00 2001 From: mtuszowski Date: Sat, 3 Aug 2024 15:32:47 +0200 Subject: [PATCH] Music trackin upgrade --- bot.py | 2 +- communication_subroutine.py | 7 +++++-- conjurer_musician/conjurer_musician.py | 2 +- 3 files changed, 7 insertions(+), 4 deletions(-) diff --git a/bot.py b/bot.py index 0e3e1bf..fb18b11 100644 --- a/bot.py +++ b/bot.py @@ -2543,7 +2543,7 @@ async def co_na_plejliscie_wariacie(ctx): async with ctx.typing(): logger.info("plejlista") logger.info(PREPPED_TRACKS) - await ctx.send(f"Didżej Hammer i jego sztuczna inteligencja (||he he||) prezentują: \n- obecnie grany jest {(PREPPED_TRACKS['now_playing']).rstrip()} \n- na liście priorytetowej {(PREPPED_TRACKS['priority']).rstrip()} \n- na liście hitów obecnie czeka kawałek {(PREPPED_TRACKS['hit']).rstrip()} \n- na liście wszystkich kawałków {(PREPPED_TRACKS['all']).rstrip()} \n- najświeższym zamówieniem od słuchaczy jest {(PREPPED_TRACKS['requests']).rstrip()} \nZ kolei jingiel to: {(PREPPED_TRACKS['jingles']).rstrip()}") + await ctx.send(f"Didżej Hammer i jego sztuczna inteligencja (||he he||) prezentują: \n- obecnie grany jest {(PREPPED_TRACKS['now_playing']).rstrip()} \n- następny będzie{(PREPPED_TRACKS['next']).rstrip()} \n- na liście priorytetowej {(PREPPED_TRACKS['priority']).rstrip()} \n- na liście hitów obecnie czeka kawałek {(PREPPED_TRACKS['hit']).rstrip()} \n- na liście wszystkich kawałków {(PREPPED_TRACKS['all']).rstrip()} \n- najświeższym zamówieniem od słuchaczy jest {(PREPPED_TRACKS['requests']).rstrip()} \nZ kolei jingiel to: {(PREPPED_TRACKS['jingles']).rstrip()}") # *================================== Run if __name__ == "__main__": diff --git a/communication_subroutine.py b/communication_subroutine.py index 77122f3..d4a6774 100644 --- a/communication_subroutine.py +++ b/communication_subroutine.py @@ -19,7 +19,8 @@ PREPPED_TRACKS = { "all": "", "priority":"", "jingles":"", - "now_playing":"" + "now_playing":"", + "next": "" } logger = logging.getLogger("discord") @@ -47,7 +48,9 @@ def log_radio_tracks(): logger.info(request) record = json.loads(request.data) logger.info(record) - PREPPED_TRACKS[record[0]] = record[1] + if "next" in record[0]: + PREPPED_TRACKS["now_playing"] = PREPPED_TRACKS["next"] + PREPPED_TRACKS[record[0]] = record[1] logger.info("DATA RECEIVED") return jsonify("SUCCESS") diff --git a/conjurer_musician/conjurer_musician.py b/conjurer_musician/conjurer_musician.py index f626452..8b39283 100644 --- a/conjurer_musician/conjurer_musician.py +++ b/conjurer_musician/conjurer_musician.py @@ -123,7 +123,7 @@ def scan_tracks(): time.sleep(0.1) file1 = open(PERSISTENCE_PATH, 'r') lines = file1.readlines() - result = ["now_playing", lines[2]] + result = ["next", lines[2]] file1.close() returned = requests.post( f"{MAIN_BOT_ADDRESS}{MUSIC_TRACKER}",