def download_file(url, destination): import requests response = requests.get(url) if response.status_code == 200: with open(destination, 'wb') as f: f.write(response.content) return True return False def check_for_playlist_updates(playlist_url, current_playlist): import requests response = requests.get(playlist_url) if response.status_code == 200: new_playlist = response.json() if new_playlist != current_playlist: return new_playlist return None def schedule_playlist_update(playlist_url, current_playlist, update_interval=300): from threading import Timer def check_updates(): new_playlist = check_for_playlist_updates(playlist_url, current_playlist) if new_playlist: current_playlist.clear() current_playlist.extend(new_playlist) Timer(update_interval, check_updates).start() check_updates()