cmus to status
unknown
python
3 years ago
1.1 kB
8
Indexable
import vk_api import time import os api = vk_api.VkApi(token="paste token here") user_status = api.method("status.get", {"user_id": "your id"})["text"] print(user_status) while True: artist="" title="" run=True try: mstatus = os.popen("/usr/bin/cmus-remote -Q") for line in mstatus: if "cmus is not running" in line: run = False elif "tag artist" in line: artist = line[11:-1] elif "tag title" in line: title = line[10:-1] if run is False: api.method("status.set", {"text": user_status}) break api.method("status.set", {"text": artist + " — " + title}) time.sleep(30) except KeyboardInterrupt: api.method("status.set", {"text": user_status}) except vk_api.Captcha as e: s_id = e.sid print(e.url) code = input() api.method("status.set", {"text": user_status}, s_id, code) else: api.method("status.set", {"text": user_status})
Editor is loading...