Skip to content

Instantly share code, notes, and snippets.

@yanknvim
Created May 28, 2023 09:53
Show Gist options
  • Save yanknvim/d4a1938c62a0a89edc5e48e021e15045 to your computer and use it in GitHub Desktop.
Save yanknvim/d4a1938c62a0a89edc5e48e021e15045 to your computer and use it in GitHub Desktop.
今再生してるものをIntentに吐き出す
import subprocess
import webbrowser
artist = subprocess.run('playerctl -i firefox metadata -f "{{ artist }}"', shell=True, text=True, capture_output=True).stdout
title = subprocess.run('playerctl -i firefox metadata -f "{{ title }}"', shell=True, text=True, capture_output=True).stdout
url = subprocess.run('playerctl -i firefox metadata xesam:url', shell=True, text=True, capture_output=True).stdout
artist_and_title = "{0} - {1}".format(artist, title)
intent_url = "https://twitter.com/intent/tweet?hashtags=NowPlaying&text={0}&url={1}".format(artist_and_title, url)
webbrowser.open(intent_url)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment