Created
November 5, 2021 14:42
-
-
Save Whitetigerswt/0b9d652e416e2043c3847ecb7c8682f8 to your computer and use it in GitHub Desktop.
This file contains 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
#!/usr/bin/env python3 | |
from gi.repository import Playerctl, GLib | |
import re | |
live_music = re.compile(".*\slive\s.*", re.IGNORECASE) | |
last_played = "" | |
player = Playerctl.Player() | |
def on_metadata(player, e): | |
global last_played | |
if live_music.match(player.get_title()) and player.get_title() != last_played: | |
player.next() | |
last_played = player.get_title() | |
player.connect('metadata', on_metadata) | |
GLib.MainLoop().run() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment