Last active
December 17, 2024 11:45
-
-
Save zopieux/ccb8d29437765083e4c80da52f2145b2 to your computer and use it in GitHub Desktop.
FIP radio live metadata
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Displays the currently playing media at FIP radio | |
# http://www.fipradio.fr/player | |
# You may want to update the number at the end of the URL | |
# if you use a specific "style" channel instead of the | |
# generic (main) channel, which is 7. | |
import requests | |
import time | |
import subprocess | |
URL = 'https://api.radiofrance.fr/livemeta/pull/7' | |
def retrieve(): | |
data = requests.get(URL).json() | |
level = data['levels'][0] | |
uid = level['items'][level['position']] | |
step = data['steps'][uid] | |
return step | |
def main(): | |
last_data = None | |
while True: | |
try: | |
data = retrieve() | |
except Exception: | |
time.sleep(2) | |
continue | |
if data != last_data: | |
msg = "{title} — {authors} ({anneeEditionMusique})".format(**data) | |
subprocess.check_call(['notify-send', '-i', 'applications-multimedia', 'FIP radio', | |
msg]) | |
last_data = data | |
time.sleep(10) | |
if __name__ == '__main__': | |
import traceback | |
try: | |
main() | |
except: | |
with open('/tmp/fip-crash.log', 'w') as f: | |
traceback.print_exc(file=f) |
@villeneuve Merci de m'en avoir informé ! J'ai mis à jour le script.
Inspiré par ce script, voici un raccourci iOS qui fait la même chose:
https://www.icloud.com/shortcuts/8e8961c616ab439897d998a1e858c079
A slightly modified version that prints the track listing to the terminal one line at a time (with timestamps):
https://gist.github.com/wturrell/f887b3d413339597b35549293f1bad63
@wturell: Excellent!
There's an experimental stream serving metadatas for FIP at this place:
http://radio-metadata.fr:8000/fip
There's an experimental stream serving metadatas for FIP at this place: http://radio-metadata.fr:8000/fip
Awesome, could not find any better for my moodeaudio installation !
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Bonjour,
Depuis juillet 2019 l'url des metadata de Fip a changée c'est maintenant:
https://api.radiofrance.fr/livemeta/pull/7
Merci pour ce code :-)