From 6ef38f17a7664b76481547d5a9e90aa5462b8e54 Mon Sep 17 00:00:00 2001 From: codey Date: Mon, 10 Mar 2025 10:00:23 -0400 Subject: [PATCH] update sfm stream url, add album to webhook np message --- .gitignore | 7 +++- utils/radio_util.py | 82 ++++++++++++++++++++++++--------------------- 2 files changed, 49 insertions(+), 40 deletions(-) diff --git a/.gitignore b/.gitignore index 5093bea..df2918d 100644 --- a/.gitignore +++ b/.gitignore @@ -10,4 +10,9 @@ db_migrate.py notifier.py youtube* playlist_creator.py -artist_genre_tag.py \ No newline at end of file +artist_genre_tag.py +uv.lock +py.typed +pyproject.toml +mypy.ini +.python-version \ No newline at end of file diff --git a/utils/radio_util.py b/utils/radio_util.py index c5cb86e..09006d6 100644 --- a/utils/radio_util.py +++ b/utils/radio_util.py @@ -146,41 +146,41 @@ class RadioUtil: LIMITED GENRES """ - db_query: str = """SELECT distinct(LOWER(TRIM(artist)) || " - " || LOWER(TRIM(song))), (TRIM(artist) || " - " || TRIM(song)) AS artistdashsong, id, artist, song, album, genre, file_path, duration FROM tracks\ - WHERE (genre LIKE "%metalcore%"\ - OR genre LIKE "%rock%"\ - OR genre LIKE "%pop punk%"\ - OR genre LIKE "%math rock%"\ - OR genre LIKE "%punk rock%"\ - OR genre LIKE "%metal%"\ - OR genre LIKE "%punk%"\ - OR genre LIKE "%electronic%"\ - OR genre LIKE "%nu metal%"\ - OR genre LIKE "%EDM%"\ - OR genre LIKE "%post-hardcore%"\ - OR genre LIKE "%pop rock%"\ - OR genre LIKE "%experimental%"\ - OR genre LIKE "%post-punk%"\ - OR genre LIKE "%death metal%"\ - OR genre LIKE "%electronicore%"\ - OR genre LIKE "%hard rock%"\ - OR genre LIKE "%psychedelic rock%"\ - OR genre LIKE "%grunge%"\ - OR genre LIKE "%house%"\ - OR genre LIKE "%dubstep%"\ - OR genre LIKE "%hardcore%"\ - OR genre LIKE "%hair metal%"\ - OR genre LIKE "%horror punk%"\ - OR genre LIKE "%folk punk%"\ - OR genre LIKE "%breakcore%"\ - OR genre LIKE "%post-rock%"\ - OR genre LIKE "%deathcore%"\ - OR genre LIKE "%hardcore punk%"\ - OR genre LIKE "%synthwave%"\ - OR genre LIKE "%trap%"\ - OR genre LIKE "%indie pop%"\ - OR genre LIKE "%dnb%")\ - GROUP BY artistdashsong ORDER BY RANDOM()""" + # db_query: str = """SELECT distinct(LOWER(TRIM(artist)) || " - " || LOWER(TRIM(song))), (TRIM(artist) || " - " || TRIM(song)) AS artistdashsong, id, artist, song, album, genre, file_path, duration FROM tracks\ + # WHERE (genre LIKE "%metalcore%"\ + # OR genre LIKE "%rock%"\ + # OR genre LIKE "%pop punk%"\ + # OR genre LIKE "%math rock%"\ + # OR genre LIKE "%punk rock%"\ + # OR genre LIKE "%metal%"\ + # OR genre LIKE "%punk%"\ + # OR genre LIKE "%electronic%"\ + # OR genre LIKE "%nu metal%"\ + # OR genre LIKE "%EDM%"\ + # OR genre LIKE "%post-hardcore%"\ + # OR genre LIKE "%pop rock%"\ + # OR genre LIKE "%experimental%"\ + # OR genre LIKE "%post-punk%"\ + # OR genre LIKE "%death metal%"\ + # OR genre LIKE "%electronicore%"\ + # OR genre LIKE "%hard rock%"\ + # OR genre LIKE "%psychedelic rock%"\ + # OR genre LIKE "%grunge%"\ + # OR genre LIKE "%house%"\ + # OR genre LIKE "%dubstep%"\ + # OR genre LIKE "%hardcore%"\ + # OR genre LIKE "%hair metal%"\ + # OR genre LIKE "%horror punk%"\ + # OR genre LIKE "%folk punk%"\ + # OR genre LIKE "%breakcore%"\ + # OR genre LIKE "%post-rock%"\ + # OR genre LIKE "%deathcore%"\ + # OR genre LIKE "%hardcore punk%"\ + # OR genre LIKE "%synthwave%"\ + # OR genre LIKE "%trap%"\ + # OR genre LIKE "%indie pop%"\ + # OR genre LIKE "%dnb%")\ + # GROUP BY artistdashsong ORDER BY RANDOM()""" """ LIMITED TO ONE/SMALL SUBSET OF GENRES @@ -193,8 +193,8 @@ class RadioUtil: LIMITED TO ONE/SOME ARTISTS... """ - # db_query = 'SELECT distinct(artist || " - " || song) AS artistdashsong, id, artist, song, album, genre, file_path, duration FROM tracks\ - # WHERE artist LIKE "%sullivan king%" GROUP BY artistdashsong ORDER BY artist ASC, album ASC, id DESC' + db_query = 'SELECT distinct(artist || " - " || song) AS artistdashsong, id, artist, song, album, genre, file_path, duration FROM tracks\ + WHERE artist LIKE "%chunk! n%" GROUP BY artistdashsong ORDER BY artist ASC, album ASC, id DESC' async with sqlite3.connect(self.active_playlist_path, timeout=2) as db_conn: @@ -359,9 +359,13 @@ class RadioUtil: }, { "name": "Higher Res", - "value": "[stream/icecast](https://relay.sfm.codey.lol/aces.ogg) | [web player](https://codey.lol/radio)", + "value": "[stream/icecast](https://stream.codey.lol/sfm.ogg) | [web player](https://codey.lol/radio)", "inline": True, - } + }, + { + "name": "Album", + "value": track['album'] if track['album'] else "Unknown", + }, ] }] }