Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #!/usr/bin/env python2
- import json
- import socket
- import os.path
- def get_mpv_info():
- client = socket.socket(socket.AF_UNIX, socket.SOCK_STREAM)
- client.connect("/tmp/mpvsocket")
- for i in ['media-title', 'playback-time', 'length']:
- req = '{"command": ["get_property", "%s"]}\n' %i
- client.send(req)
- res[i] = json.loads(client.recv(1024))['data']
- client.close()
- return res
- d = get_mpv_info()
- print(d['filename'])
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement