mirror of
https://github.com/migatu/conjurer.git
synced 2026-07-14 21:38:38 +00:00
Hit list queue for radio
This commit is contained in:
@@ -35,10 +35,11 @@ if platform in ("linux", "linux2"):
|
|||||||
LOGSTORE = "/home/pi/RetroPie/logs/"
|
LOGSTORE = "/home/pi/RetroPie/logs/"
|
||||||
ENCODING = "utf-8"
|
ENCODING = "utf-8"
|
||||||
MUSIC_FOLDER = "/home/pi/RetroPie/mp3/"
|
MUSIC_FOLDER = "/home/pi/RetroPie/mp3/"
|
||||||
|
PRIORITY_FOLDER = "/home/pi/RetroPie/mp3/Magiczne i chuj/"
|
||||||
|
|
||||||
|
|
||||||
music_file_list = []
|
music_file_list = []
|
||||||
|
priority_list = []
|
||||||
|
|
||||||
def create_playlist():
|
def create_playlist():
|
||||||
"""
|
"""
|
||||||
@@ -63,6 +64,18 @@ def create_playlist():
|
|||||||
except json.JSONDecodeError:
|
except json.JSONDecodeError:
|
||||||
pass
|
pass
|
||||||
|
|
||||||
|
with open("/home/pi/Conjurer/prio_playlist.json", "r+", encoding="utf-8") as r_file:
|
||||||
|
with open(
|
||||||
|
"/home/pi/Conjurer/hit.playlist", "w", encoding="utf-8"
|
||||||
|
) as w_file:
|
||||||
|
try:
|
||||||
|
playlist = json.load(r_file)
|
||||||
|
for item in playlist:
|
||||||
|
w_file.write(item)
|
||||||
|
w_file.write("\n")
|
||||||
|
except json.JSONDecodeError:
|
||||||
|
pass
|
||||||
|
|
||||||
|
|
||||||
def rescan():
|
def rescan():
|
||||||
"""
|
"""
|
||||||
@@ -70,17 +83,30 @@ def rescan():
|
|||||||
and adds them to a list of music files.
|
and adds them to a list of music files.
|
||||||
"""
|
"""
|
||||||
logging.info("Rescan triggered")
|
logging.info("Rescan triggered")
|
||||||
|
|
||||||
for mp3_item in Path.glob(Path(MUSIC_FOLDER), "**/*.mp3"):
|
for mp3_item in Path.glob(Path(MUSIC_FOLDER), "**/*.mp3"):
|
||||||
temp_music_file = mp3_item.as_posix()
|
temp_music_file = mp3_item.as_posix()
|
||||||
if platform == "win32":
|
if platform == "win32":
|
||||||
temp_music_file = temp_music_file.replace("/", "\\")
|
temp_music_file = temp_music_file.replace("/", "\\")
|
||||||
music_file_list.append(temp_music_file)
|
music_file_list.append(temp_music_file)
|
||||||
|
|
||||||
|
for mp3_item in Path.glob(Path(PRIORITY_FOLDER), "**/*.mp3"):
|
||||||
|
temp_music_file = mp3_item.as_posix()
|
||||||
|
if platform == "win32":
|
||||||
|
temp_music_file = temp_music_file.replace("/", "\\")
|
||||||
|
priority_list.append(temp_music_file)
|
||||||
|
|
||||||
with open("/home/pi/Conjurer/playlist.json", "r+", encoding="utf-8") as s_file:
|
with open("/home/pi/Conjurer/playlist.json", "r+", encoding="utf-8") as s_file:
|
||||||
database = music_file_list
|
database = music_file_list
|
||||||
# self.app.logger.info("DUMPING DATA")
|
# self.app.logger.info("DUMPING DATA")
|
||||||
s_file.truncate(0)
|
s_file.truncate(0)
|
||||||
s_file.seek(0)
|
s_file.seek(0)
|
||||||
json.dump(database, s_file)
|
json.dump(database, s_file)
|
||||||
|
with open("/home/pi/Conjurer/prio_playlist.json", "r+", encoding="utf-8") as s_file:
|
||||||
|
# self.app.logger.info("DUMPING DATA")
|
||||||
|
s_file.truncate(0)
|
||||||
|
s_file.seek(0)
|
||||||
|
json.dump(priority_list, s_file)
|
||||||
create_playlist()
|
create_playlist()
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -3,8 +3,9 @@ enable_replaygain_metadata()
|
|||||||
|
|
||||||
s1 = replaygain(playlist(reload_mode="watch", "/home/pi/Conjurer/all_playlist.playlist"))
|
s1 = replaygain(playlist(reload_mode="watch", "/home/pi/Conjurer/all_playlist.playlist"))
|
||||||
s2 = replaygain(playlist(reload_mode="watch", "/home/pi/Conjurer/priority_queue.playlist"))
|
s2 = replaygain(playlist(reload_mode="watch", "/home/pi/Conjurer/priority_queue.playlist"))
|
||||||
|
s2 = replaygain(playlist(reload_mode="watch", "/home/pi/Conjurer/hit.playlist"))
|
||||||
|
|
||||||
s = random(id="randomizer", weights=[7, 10], [s2, s1])
|
s = random(id="randomizer", weights=[1, 3, 2], [s1, s2, s3])
|
||||||
|
|
||||||
interactive.harbor(port = 9999)
|
interactive.harbor(port = 9999)
|
||||||
f = interactive.float("f", description="Frequency", min=0., max=1000.,unit="Hz", 200.)
|
f = interactive.float("f", description="Frequency", min=0., max=1000.,unit="Hz", 200.)
|
||||||
|
|||||||
@@ -8,9 +8,14 @@ cp /home/pi/conjurer/conjurer_musician/requirements_musician.txt /home/pi/Conjur
|
|||||||
cp /home/pi/conjurer/conjurer_musician/conjurer_musician.py /home/pi/Conjurer/
|
cp /home/pi/conjurer/conjurer_musician/conjurer_musician.py /home/pi/Conjurer/
|
||||||
cp /home/pi/conjurer/conjurer_musician/radio_conjurer.liq /home/pi/Conjurer/
|
cp /home/pi/conjurer/conjurer_musician/radio_conjurer.liq /home/pi/Conjurer/
|
||||||
touch /home/pi/Conjurer/discord_mus_service.log
|
touch /home/pi/Conjurer/discord_mus_service.log
|
||||||
touch /home/pi/Conjurer/all_playlist.txt
|
|
||||||
touch /home/pi/Conjurer/playlist.json
|
touch /home/pi/Conjurer/playlist.json
|
||||||
|
touch /home/pi/Conjurer/prio_playlist.json
|
||||||
|
|
||||||
|
touch /home/pi/Conjurer/all_playlist.playlist
|
||||||
touch /home/pi/Conjurer/priority_queue.playlist
|
touch /home/pi/Conjurer/priority_queue.playlist
|
||||||
|
touch /home/pi/Conjurer/hit.playlist
|
||||||
|
|
||||||
touch /home/pi/Conjurer/radio_log.log
|
touch /home/pi/Conjurer/radio_log.log
|
||||||
./env/bin/python3 -m pip install --upgrade pip
|
./env/bin/python3 -m pip install --upgrade pip
|
||||||
./env/bin/python3 -m pip install -r requirements_musician.txt
|
./env/bin/python3 -m pip install -r requirements_musician.txt
|
||||||
|
|||||||
Reference in New Issue
Block a user