예제 #1
0
def main():
    # Init folder for issue
    if not os.path.exists(settings.issue_folder):
        os.makedirs(settings.issue_folder)

    # Get user configuration for issue creation
    try:
        settings.author_name = exec_command("git config user.name").pop()
    except:
        print ("Username unavailable. You are now : {0}".format(settings.author_name))

    try:
        settings.author_email = exec_command("git config user.email").pop()
    except:
        print ("Email unavailable. You are now : {0}".format(settings.author_email))

    print ("Git-Tracker is now listening on http://localhost:5000/ ")
    serve(ip="localhost", port=5000)
예제 #2
0
def aurevoir():
    params = {"username": PSEUDO, "text": "Au revoir {0}".format("https://www.youtube.com/watch?v=uIMBjES4B4g")}
    data = callrest(domain=MATTERMOST_DOMAIN, type="POST", path=MATTERMOST_PATH, params={"payload": json.dumps(params)})

@route("/",["POST"])
def form(**kwargs):
    kwargs['preview'] = False

    # Ajout de la gestion des slash commands (pour l'instant transformation en commande normal)
    if "command" in kwargs:
        kwargs['text'][0] = "{0} {1}".format(kwargs['command'][0].replace("/", ""), kwargs['text'][0])
        kwargs['slash_command'] = True
    else:
        kwargs['slash_command'] = False

    # Test si le bot est non actif sur le channel en cours.
    if kwargs['channel_name'][0] in DISABLE_CHANNEL:
        return build_response(kwargs, "Impossible...")

    return chat(kwargs)

def signal_handler(signal, frame):
    aurevoir()
    sys.exit(0)

if __name__ == '__main__':
    print("Serving BOT on {0} port {1} ...".format(IP, PORT))
    #welcome()
    #signal.signal(signal.SIGINT, signal_handler)
    serve(ip=IP, port=PORT)
예제 #3
0
파일: nabz.py 프로젝트: QGB/PVote
		return "{'stream':true}"
	except:
		return "{'stream':false}"

@route("/stop",["GET"])
def stop():
	if current_playing:
		current_playing.pop().kill()
	return "{'stop':true}"

import os
@route("/say",["GET"])
def say(text="Bonjour"):
	try:
		url = ["http://dict.youdao.com/dictvoice?audio={0}".format(urllib.quote(text[0]))]
		# return url
		# os.system('start '+url[0])
		return '''<script>
new Audio(%s).play()
		</script>'''% url
	except Exception as e:
		return "{'say':false}"


parser = argparse.ArgumentParser(description='Simple Nabz.')
parser.add_argument('--player', action='store',help='Path to VLC command line (/usr/bin/cvlc --play-and-exit  --novideo)', default="/usr/bin/cvlc --play-and-exit  --novideo")
args = parser.parse_args()
args.player = shlex.split(args.player)

serve(ip="0.0.0.0", port=8000)
예제 #4
0
@route("/stop", ["GET"])
def stop():
    if current_playing:
        current_playing.pop().kill()
    return "{'stop':true}"


@route("/say", ["GET"])
def say(text="Bonjour"):
    try:
        url = [
            "http://translate.google.com/translate_tts?tl=fr&q={0}".format(
                urllib.quote(text[0]))
        ]
        current_playing.append(subprocess.Popen(args.player + url,
                                                shell=False))
        return "{'say':true}"
    except Exception as e:
        return "{'say':false}"


parser = argparse.ArgumentParser(description='Simple Nabz.')
parser.add_argument(
    '--player',
    action='store',
    help='Path to VLC command line (/usr/bin/cvlc --play-and-exit)')
args = parser.parse_args()
args.player = shlex.split(args.player)

serve(ip="0.0.0.0", port=5000)
예제 #5
0
파일: PVote.py 프로젝트: QGB/PVote
	icode=235
	if '{0}'.endswith('bg.jpg'):sc='max-age='+str(60*10)#增加读取文件判断有问题,复杂度提升
	
	return {{
	"content":dsf['s{1}'],
	"code":icode,
	"Cache-Control":sc
	}}
'''
def search(path):
	for filename in os.listdir(path):
		fp = os.path.join(path, filename)
		if os.path.isfile(fp):
			for i in types:
				if filename.endswith('.'+i):
					if filename.endswith('jpg') and filename[:1] in '1,2,3,4,5,6,7,8,9,0'.split(','):
						if filename not in gysimg:gysimg.append(filename)
				
					filename=T.sub(fp,basedir,'')[1:].replace('\\','/')
					funcname='fr_'+T.varname(filename)
					exec(sfr.format(filename,funcname))
					print filename,funcname
					break
		elif os.path.isdir(fp):
			search(fp)
search(basedir)

ip="0.0.0.0";port=80
U.pln(ip,port)
serve(ip,port)
예제 #6
0
파일: nabz.py 프로젝트: jeffn741/rPiDemo
	try:
		# current_playing.append(subprocess.Popen("{0} {1} vlc://quit".format(args.player, file), shell=True))
		current_playing.append(subprocess.Popen(args.player+file, shell=False))			
		return "{'stream':true}"
	except:
		return "{'stream':false}"

@route("/stop",["GET"])
def stop():
	if current_playing:
		current_playing.pop().kill()
	return "{'stop':true}"

@route("/say",["GET"])
def say(text="Bonjour"):
	try:
		url = ["http://translate.google.com/translate_tts?tl=fr&q={0}".format(urllib.quote(text[0]))]
		current_playing.append(subprocess.Popen(args.player+url, shell=False))
		return "{'say':true}"
	except Exception as e:
		return "{'say':false}"


parser = argparse.ArgumentParser(description='Simple Nabz.')
parser.add_argument('--player', action='store',help='Path to VLC command line (/usr/bin/cvlc --play-and-exit)')
args = parser.parse_args()
args.player = shlex.split(args.player)

serve(ip="0.0.0.0", port=5000)
예제 #7
0
def stop():
    if current_playing:
        current_playing.pop().kill()
    return "{'stop':true}"


@route("/say", ["GET"])
def say(text="Bonjour"):
    try:
        url = [
            "http://translate.google.com/translate_tts?tl=fr&q={0}".format(
                urllib.quote(text[0]))
        ]
        current_playing.append(subprocess.Popen(args.player + url,
                                                shell=False))
        return "{'say':true}"
    except Exception as e:
        return "{'say':false}"


parser = argparse.ArgumentParser(description='Simple Nabz.')
parser.add_argument(
    '--player',
    action='store',
    help='Path to VLC command line (/usr/bin/cvlc --play-and-exit  --novideo)',
    default="/usr/bin/cvlc --play-and-exit  --novideo")
args = parser.parse_args()
args.player = shlex.split(args.player)

serve(ip="0.0.0.0", port=8000)