<commit_before>#!/usr/bin/python3
# coding=utf-8
import sys, os, requests, argparse, json
 
def main(command, base_url):
	base_url = base_url or "http://192.168.0.105:3333" # temporary
	cmd = command  # temporary
	cmds = {"p": 889, "n": 922, "b": 921, "f": 830, "jf": 900, "jb": 899}
	rcmd = cmds[cmd]
	rdata = {"wm_command": rcmd}
	try:
		r = requests.post("{0}/command.html".format(base_url), data=rdata, timeout=4)
	except requests.exceptions.ConnectTimeout:
		print("Error: Request timed out, check if the web interface is actually running on the URL you provided.")
	except:
		print("Unknown error.")

if __name__ == "__main__":
	aparser = argparse.ArgumentParser()
	aparser.add_argument("--url", help="base url on which mpc-hc web iface is")
	aparser.add_argument("command")
	args = aparser.parse_args()
	if args.url:
		main(args.command, args.url)
	else:
		main(args.command, "")<commit_msg>shit broke sleep time<commit_after>#!/usr/bin/python3
# coding=utf-8
import sys, os, requests, argparse, json
 
def main(command, base_url):
	cmd = command  # temporary
	print("CMD is", ord(cmd))
	cmds = {"p": 889, "n": 922, "b": 921, "f": 830, "jf": 900, "jb": 899}
	rcmd = cmds[cmd]
	rdata = {"wm_command": rcmd}
	try:
		r = requests.post("{0}/command.html".format(base_url), data=rdata, timeout=4)
	except requests.exceptions.ConnectTimeout:
		print("Error: Request timed out, check if the web interface is actually running on the URL you provided.")
	except:
		print("Unknown error.")

if __name__ == "__main__":
	# todo: config parse (baseurl + command prefs)
	# todo: cleanup
	# todo: optional curses
	aparser = argparse.ArgumentParser()
	aparser.add_argument("--url", help="Base url on which mpc-hc web iface is")
	aparser.add_argument("--ui", help="Available options: none (default)|text|curses")
	aparser.add_argument("command")
	args = aparser.parse_args()
	if args.url:
		if args.ui == "text":
			while True:
				acmd = input("Type a command or 'quit' and press Enter: ")
				if acmd != "quit":
					main(str(acmd), args.url)
				else:
					sys.exit(0)
		
		else:
			main(args.command, args.url)
	else:
		print("You need to specify a URL of the remote web interface using the --url argument.")
{'fraction_non_alphanumeric': 0.15576748410535876, 'fraction_numerical': 0.026793823796548592, 'mean_word_length': 4.386308068459658, 'pattern_counts': {'":': 18, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 1, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '4238475', 'n_tokens_mistral': 870, 'n_tokens_neox': 780, 'n_words': 227}