Skip to content

Instantly share code, notes, and snippets.

@Whitetigerswt
Created November 5, 2021 14:42
Show Gist options
  • Save Whitetigerswt/0b9d652e416e2043c3847ecb7c8682f8 to your computer and use it in GitHub Desktop.
Save Whitetigerswt/0b9d652e416e2043c3847ecb7c8682f8 to your computer and use it in GitHub Desktop.
#!/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