Simple script to call album art from your online feed ODR-padenc

48 views
Skip to first unread message

Frank Hennessy

unread,
Apr 27, 2024, 5:57:15 AM4/27/24
to mmbtools
Hi all messing with the idea as I haven't seen it incorporated into the tools and if there is anything like this or more so a better method then please highlight it :)

anyway let's dive in.


the goal was to incorporate live album art and pipe it straight to the service MOT folder.

This is very rudimentary not purely refined and I would appreciate any feedback or even adjustments that it would need.

I think this is a nice addition if refined to add to the tools if it is implemented in the next branch.

the above was tested using the following tools

SACAD to pull art down from a stream using track titling and searches discodogs apple databases and so on for the required track art.
by amending the outlined pathways and executing the Python script 

The script allows the read of the service icy-text converts it to an artist - title into the track and title line of SACAD and executes every 60 seconds. 

#!/usr/bin/env python3

def process_line(line):
    parts = line.split("-")
    if len(parts) != 2:
        return None, None  # returns none if doesn't match criteria
    artist = parts[0].strip()
    song = parts[1].strip()
    return artist, song

def main():
    input_file = '/home/dabmux/pad2/ICY.txt'  # Replace with input file path
    output_file = '/home/dabmux/pad/MOT/SERVICE.jpeg'  # Output file path

    with open(input_file, 'r') as file:
        for line in file:
            artist, song = process_line(line)
            if artist and song:
                command = f"sacad '{artist}' '{song}' 320 {output_file}"
                print("Executing command:", command)
                import os; os.system(command)

if __name__ == "__main__":
    main()




Jan de Vries

unread,
May 9, 2024, 2:46:38 PM5/9/24
to mmbtools
Works fine !
An addon would be that if no picture was found, to have some default picture displayed, also the wait/repeat funtion in this script.

Jan.


Op zaterdag 27 april 2024 om 11:57:15 UTC+2 schreef frankop...@gmail.com:
Reply all
Reply to author
Forward
0 new messages