Update url handler

This commit is contained in:
Jack 2015-12-09 23:59:19 -05:00
parent afac596a7b
commit 9667b81c8d

View file

@ -1,11 +1,10 @@
import os
import webbrowser import webbrowser
import xmlrpclib, sys import xmlrpclib, sys
def main(args): def main(args):
if len(args) == 0: if len(args) == 0:
args.append('lbry://economicsman') args.append('lbry://wonderfullife')
daemon = xmlrpclib.ServerProxy('http://localhost:7080/') daemon = xmlrpclib.ServerProxy('http://localhost:7080/')
@ -13,11 +12,9 @@ def main(args):
print 'Too many args', args print 'Too many args', args
else: else:
resolved = daemon.resolve_name(str(args[0])[7:])
daemon.download_name(str(args[0])[7:]) daemon.download_name(str(args[0])[7:])
path = [h for h in daemon.get_downloads() if h['stream_hash'] == resolved['stream_hash']][0]['path'] path = daemon.path_from_name(args[0][7:])[0]['path']
webbrowser.open('file://' + path) webbrowser.open('file://' + path)
if __name__ == "__main__": if __name__ == "__main__":
main(sys.argv[1:]) main(sys.argv[1:])