Created
May 28, 2023 09:53
-
-
Save yanknvim/d4a1938c62a0a89edc5e48e021e15045 to your computer and use it in GitHub Desktop.
今再生してるものをIntentに吐き出す
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
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