Don't open links while having a 0.0 balance

This commit is contained in:
jackrobison 2016-01-22 16:46:35 -05:00
parent b48800049b
commit 808fbed4f3

View file

@ -16,42 +16,44 @@ def main(args):
daemon = xmlrpclib.ServerProxy('http://localhost:7080/') daemon = xmlrpclib.ServerProxy('http://localhost:7080/')
try: try:
b = daemon.get_balance() balance = daemon.get_balance()
is_running = True is_running = True
if len(args) > 1:
print 'Too many args', args
elif is_running:
if args[0][7:] == 'lbry':
daemon.render_gui()
elif args[0][7:] == 'settings':
r = daemon.get_settings()
html = "<body>" + json.dumps(r) + "</body>"
r = daemon.render_html(html)
else:
if float(balance) > 0.0:
r = daemon.get(args[0][7:])
print r
path = r['path']
if path[0] != '/':
path = '/' + path
print path
filename = path.split('/')[len(path.split('/')) - 1]
extension = path.split('.')[len(path.split('.')) - 1]
if extension in ['mp4', 'flv', 'mov']:
html = render_video(path)
daemon.render_html(html)
else:
webbrowser.open('file://' + str(path))
except: except:
webbrowser.open('http://lbry.io/get') webbrowser.open('http://lbry.io/get')
is_running = False is_running = False
if len(args) > 1:
print 'Too many args', args
elif is_running:
if args[0][7:] == 'lbry':
daemon.render_gui()
elif args[0][7:] == 'settings':
r = daemon.get_settings()
html = "<body>" + json.dumps(r) + "</body>"
r = daemon.render_html(html)
else:
r = daemon.get(args[0][7:])
print r
path = r['path']
if path[0] != '/':
path = '/' + path
print path
filename = path.split('/')[len(path.split('/')) - 1]
extension = path.split('.')[len(path.split('.')) - 1]
if extension in ['mp4', 'flv', 'mov']:
html = render_video(path)
daemon.render_html(html)
else:
webbrowser.open('file://' + str(path))
if __name__ == "__main__": if __name__ == "__main__":
main(sys.argv[1:]) main(sys.argv[1:])