Created
November 12, 2016 08:10
-
-
Save Amperture/f9c0907b9a804edf0d75050535cd8174 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/python2 | |
""" | |
If you're a Linux user, and use mpd for your music player, this will push your | |
current song artist and title to a text file for importing into OBS. | |
""" | |
import time | |
import mpd | |
client = mpd.MPDClient() | |
#client.use_unicode=True | |
client.connect("localhost", 6600) | |
''' | |
for entry in client.lsinfo("/"): | |
print("%s" % entry) | |
for key, value in client.status().items(): | |
print ("%s: %s" % (key, value)) | |
''' | |
while True: | |
time.sleep(2) | |
songTitle = client.currentsong()["title"] | |
songArtist = client.currentsong()["artist"] | |
text_file = open("Output.txt", "w") | |
text_file.write("%s - %s \r\n" | |
% (songArtist, songTitle) ) | |
text_file.close() | |
client.close() | |
client.disconnect() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment