Ejemplo n.º 1
0
def to_make_order(req, to_order_path, validateimage_path, order_day, time_list, PHONE, order_item, userId):
	for time in time_list:
		to_order_time = order_day
		if time.startswith('18'):
			to_order_time = to_order_time + " " + time
		elif time.startswith('19'):
			to_order_time = to_order_time + " " + time
		elif time.startswith('20'):
			to_order_time = to_order_time + " " + time
		if len(to_order_time) > len(order_day):
			print "[*] " + to_order_time + " is available"

			# to order here
			if insert_order(req, to_order_path, validateimage_path, to_order_time, PHONE, order_item, userId):
				return True
	return False
Ejemplo n.º 2
0
def constantvzw(create_event):
    soup = BeautifulSoup(urlopen("http://www.constantvzw.org/site/").read())

    for event in soup.find("div", id="flow")("div", recursive=False)[:-1]:
        title = event('a')[1].text
        url = "http://www.constantvzw.org/site/" + event('a')[1]["href"]

        if len(event.span.text.split(" @ ")) == 2:
            time, location = event.span.text.split(" @ ")
        else:
            time = event.span.text.split("@")[0].strip()
            location = None

        if time.startswith("From "):
            data = time.split(" ")[1:]
            if len(data) == 4:
                start = parse("%s %s" % (data[0], data[3]))
                end = parse("%s %s" % (data[2], data[3]))
            elif len(data) == 7:
                start = parse("%s %s %s" % tuple(data[:3]))
                end = parse("%s %s %s" % tuple(data[4:]))
            else:
                start = parse("%s %s" % (data[0], data[1]))
                end = parse("%s %s" % (data[3], data[4]))
        else:
            start = parse(time).replace(tzinfo=None)
            end = None

        create_event(
            title=title,
            url=url,
            start=start,
            end=end,
            location=location.strip() if location else None
        )
Ejemplo n.º 3
0
def ipdetails(ip, cgiloc):

	import socket
	try: addr = socket.gethostbyaddr(ip)[0]
	except: addr = 'unknown host'
	if addr != 'unknown host': # add successful lookups to the DNS cache
		try:
			db = dbm.open(database, "c")
			db[ip] = addr
			db.close()
		except: pass # fail silently - lots of things could have gone wrong...
	print """<p class = "section">Visit details for <b>%s</b><br /><b>hostname:</b> %s<br />""" % (ip, addr)
	counter = 1; pagecounter = 1
	for line in loglines:
		address = line.split(' ')[0]
		if address == ip:
			time = line.split(' ')[3].replace('[','')
			if time.startswith(apachetoday): time = time.replace(apachetoday +':','today, ')
			resource = line.split(' ')[6]
			if counter == 1:
				referrer = line.split('"')[-4]
				user_agent = line.split('"')[-2]
				if len(user_agent) > 50: user_agent = user_agent[0:50].strip() + "..."
				if len(referrer) > 1: 
					print """<b>referrer:</b> <a href = "%(referrer)s">%(referrer)s</a><br />""" % vars()
				print """<b>browser:</b> %(user_agent)s<br /><br />""" % vars()
			if ispage(resource):
				quotedresource = urllib.quote(resource)
				print """%(pagecounter)s: <b>%(time)s</b>: %(resource)s [<a href = "%(cgiloc)s?url=%(quotedresource)s">details</a>]
				<br />""" % vars()
				pagecounter += 1
			counter += 1
	print "</p>"	
Ejemplo n.º 4
0
def constantvzw(create_event):
    soup = BeautifulSoup(urlopen("http://www.constantvzw.org/site/").read())

    for event in soup.find("div", id="flow")("div", recursive=False)[:-1]:
        title = event('a')[1].text
        url = "http://www.constantvzw.org/site/" + event('a')[1]["href"]

        if len(event.span.text.split(" @ ")) == 2:
            time, location = event.span.text.split(" @ ")
        else:
            time = event.span.text.split("@")[0].strip()
            location = None

        if time.startswith("From "):
            data = time.split(" ")[1:]
            if len(data) == 4:
                start = parse("%s %s" % (data[0], data[3]))
                end = parse("%s %s" % (data[2], data[3]))
            elif len(data) == 7:
                start = parse("%s %s %s" % tuple(data[:3]))
                end = parse("%s %s %s" % tuple(data[4:]))
            else:
                start = parse("%s %s" % (data[0], data[1]))
                end = parse("%s %s" % (data[3], data[4]))
        else:
            start = parse(time).replace(tzinfo=None)
            end = None

        create_event(
            title=title,
            url=url,
            start=start,
            end=end,
            location=location.strip() if location else None
        )
def convert_time(str_time):
    date_time = str_time.split('T')
    mil_time = date_time[1].split('-')[0]
    time = datetime.datetime.strptime(mil_time,
                                      '%H:%M:%S').strftime('%I:%M %p')
    if time.startswith('0'):
        time = time[1:]
    return date_time[0], time
Ejemplo n.º 6
0
    def update_clock(self) -> None:
        """Get the real time and save it as a string.
        Ex. 8:15 AM
        """
        time = datetime.now()
        time = time.strftime("%I:%M %p")

        # Remove the starting zero from the hour if it exists.
        if time.startswith("0"):
            time = time[1:]
        self.clock = time
Ejemplo n.º 7
0
def urldetails(url, cgiloc):

	print """<p class = "section" id = "urldetails">Requests for <b>%s</b><br /><br />""" % url
	counter = 1
	for line in loglines:
		resource = line.split(' ')[6]
		if resource == url and not ignorelines(line):
			time = line.split(' ')[3].replace('[','')
			if time.startswith(apachetoday): time = time.replace(apachetoday +':','today, ')
			ip = line.split(' ')[0]
			addr = getDNS(ip)
			print """%(counter)s: %(time)s: <a href = "%(cgiloc)s?ip=%(ip)s">%(addr)s</a>
			<br />""" % vars()
			counter = counter + 1
	print "</p>"
Ejemplo n.º 8
0
def init():
    print 'initialization starts.'
    global month_period
    global categories
    init_url = r'http://iutmain.itracker.cn/Class_DetailCate.aspx?IMI=1&DateType=W&QueryDate=2015-10&doCache=0'
    response = opener_iut.open(init_url)
    print "status code: ", response.getcode()
    response_content = response.read()
    for time in p_month.findall(response_content):
        if time.startswith(('2014', '2015')):
            print 'adding %s to month_period' % time
            month_period.append(time)
    for category in p_category.findall(response_content):
        print 'adding %s to categories' % category
        categories.append(category)
Ejemplo n.º 9
0
def init():
    print 'initialization starts.'
    global month_period
    global categories
    init_url = r'http://iutmain.itracker.cn/Class_DetailCate.aspx?IMI=1&DateType=W&QueryDate=2015-10&doCache=0'
    response = opener_iut.open(init_url)
    print "status code: ", response.getcode()
    response_content = response.read()
    for time in p_month.findall(response_content):
        if time.startswith(('2014','2015')):
            print 'adding %s to month_period' % time
            month_period.append(time)
    for category in p_category.findall(response_content):
        print 'adding %s to categories' % category
        categories.append(category)
Ejemplo n.º 10
0
def urldetails(url, cgiloc):

    print """<p class = "section" id = "urldetails">Requests for <b>%s</b><br /><br />""" % url
    counter = 1
    for line in loglines:
        resource = line.split(' ')[6]
        if resource == url and not ignorelines(line):
            time = line.split(' ')[3].replace('[', '')
            if time.startswith(apachetoday):
                time = time.replace(apachetoday + ':', 'today, ')
            ip = line.split(' ')[0]
            addr = getDNS(ip)
            print """%(counter)s: %(time)s: <a href = "%(cgiloc)s?ip=%(ip)s">%(addr)s</a>
			<br />""" % vars()
            counter = counter + 1
    print "</p>"
Ejemplo n.º 11
0
 def render(self, task: "Task") -> Text:
     """Show time remaining."""
     elapsed = task.finished_time if task.finished else task.elapsed
     if elapsed is None:
         return Text("-:--:--", style="progress.elapsed")
     from datetime import timedelta
     delta = timedelta(seconds=(elapsed))
     time = str(delta)[:-4]
     if time.startswith('0:00:'):
         time = time[5:]
     time = time + 's'
     passes = task.fields.get('passes')
     if passes is not None:
         time += f'[{passes}]'
     else:
         time += '   '
     return Text(time, style="progress.elapsed")
Ejemplo n.º 12
0
    async def seek(self, ctx, *, time: str):
        player = self.bot.lavalink.players.get(ctx.guild.id)

        seconds = time_rx.search(time)
        if not seconds:
            return await ctx.send("Please specify a time in seconds to skip.",
                                  delete_after=30)

        seconds = int(seconds.group()) * 1000
        if time.startswith("-"):
            seconds *= -1

        track_time = player.position + seconds
        await player.seek(track_time)

        await ctx.send(
            f"Moved song to `{lavalink.utils.format_time(track_time)}`")
Ejemplo n.º 13
0
def constantvzw(create_event):
    """
    <p><strong>Constant is a non-profit association, an interdisciplinary arts-lab based and active in Brussels since 1997.</strong></p>

    <p>Constant works in-between media and art and is interested in the culture and ethics of the World Wide Web. The artistic practice of Constant is inspired by the way that technological infrastructures, data-exchange and software determine our daily life. Free software, copyright alternatives and (cyber)feminism are important threads running through the activities of Constant.</p>

    <p>Constant organizes workshops, print-parties, walks and ‘Verbindingen/Jonctions’-meetings on a regular basis for a public that’s into experiments, discussions and all kinds of exchanges.</p>
    """
    soup = BeautifulSoup(requests.get("http://www.constantvzw.org/site/").content)

    for event in soup.find("div", id="flow")("div", recursive=False)[:-1]:
        title = event('a')[1].text
        url = "http://www.constantvzw.org/site/" + event('a')[1]["href"]

        if len(event.span.text.split(" @ ")) == 2:
            time, location = event.span.text.split(" @ ")
        else:
            time = event.span.text.split("@")[0].strip()
            location = None

        if time.startswith("From "):
            data = time.split(" ")[1:]
            if len(data) == 4:
                start = parse("%s %s" % (data[0], data[3]))
                end = parse("%s %s" % (data[2], data[3]))
            elif len(data) == 7:
                start = parse("%s %s %s" % tuple(data[:3]))
                end = parse("%s %s %s" % tuple(data[4:]))
            else:
                start = parse("%s %s" % (data[0], data[1]))
                end = parse("%s %s" % (data[3], data[4]))
        else:
            start = parse(time).replace(tzinfo=None)
            end = None

        db_event = create_event(
            title=title,
            url=url,
            start=start,
            end=end,
            location=location.strip() if location else None
        )

        db_event.tags.add("artist", "libre")
Ejemplo n.º 14
0
def ipdetails(ip, cgiloc):

    import socket
    try:
        addr = socket.gethostbyaddr(ip)[0]
    except:
        addr = 'unknown host'
    if addr != 'unknown host':  # add successful lookups to the DNS cache
        try:
            db = dbm.open(database, "c")
            db[ip] = addr
            db.close()
        except:
            pass  # fail silently - lots of things could have gone wrong...
    print """<p class = "section">Visit details for <b>%s</b><br /><b>hostname:</b> %s<br />""" % (
        ip, addr)
    counter = 1
    pagecounter = 1
    for line in loglines:
        address = line.split(' ')[0]
        if address == ip:
            time = line.split(' ')[3].replace('[', '')
            if time.startswith(apachetoday):
                time = time.replace(apachetoday + ':', 'today, ')
            resource = line.split(' ')[6]
            if counter == 1:
                referrer = line.split('"')[-4]
                user_agent = line.split('"')[-2]
                if len(user_agent) > 50:
                    user_agent = user_agent[0:50].strip() + "..."
                if len(referrer) > 1:
                    print """<b>referrer:</b> <a href = "%(referrer)s">%(referrer)s</a><br />""" % vars(
                    )
                print """<b>browser:</b> %(user_agent)s<br /><br />""" % vars()
            if ispage(resource):
                quotedresource = urllib.quote(resource)
                print """%(pagecounter)s: <b>%(time)s</b>: %(resource)s [<a href = "%(cgiloc)s?url=%(quotedresource)s">details</a>]
				<br />""" % vars()
                pagecounter += 1
            counter += 1
    print "</p>"
Ejemplo n.º 15
0
    async def _seek(self, ctx, *, time: str):
        """ Seeks to a given position in a track. """
        player = self.bot.lavalink.players.get(ctx.guild.id)
        
        if not player.is_playing:
            return await ctx.send(ctx.localizer.format_str("{not_playing}"))

        if ctx.author not in player.listeners:
            return await ctx.send(ctx.localizer.format_str("{have_to_listen}"))

        seconds = time_rx.search(time)
        if not seconds:
            return await ctx.send(ctx.localizer.format_str("{seek.missing_amount}"))

        seconds = int(seconds.group()) * 1000
        if time.startswith('-'):
            seconds *= -1

        track_time = player.position + seconds
        await player.seek(track_time)
        msg = ctx.localizer.format_str("{seek.track_moved}", _position=timeformatter.format(track_time))
        await ctx.send(msg)
Ejemplo n.º 16
0
async def on_message(message):
    #Gives the steam-connect for the Ark Server
    if message.content.upper() == "?ARK":
        await client.send_message(message.channel,
                                  "steam://connect/100.16.94.176:27015")
    # Tests to see if the bot is responding
    if message.content.upper() == "?TESTBOT":
        pinned_message = message
        await client.send_message(message.channel, "Responding.")
    # Gets the time until HQ
    if message.content.upper() == "?HQ":
        time = str(datetime.datetime.now())[11:16]
        if time.startswith("0"):
            time1 = int(time[1])
            time2 = int(time[3:5])
            if time1 < 15:
                print("test1")
                time1 = str(15 - time1)
                time2 = str(60 - time2)
            elif (time1 > 15) & (time1 < 21):
                print("test2")
                time1 = str(21 - time1)
                time2 = str(60 - time2)
            elif time1 > 21:
                print("test5")
                time1 = str(15 + (24 - time1))
                time2 = str(60 - time2)
        else:
            time1 = int(time[0:1])
            time2 = int(time[3:5])
            if time1 < 15:
                print("test3")
                time1 = str(15 - time1)
                time2 = str(60 - time2)
            elif time1 > 15:
                print("test4")
                time1 = str(21 - time1)
                time2 = str(60 - time2)
        await client.send_message(
            message.channel, "Current Time: \t" + time + "\n" +
            "Time to HQ: \t" + time1 + ":" + time2)
    # Changes colin's nickname
    x = message.server.members
    for member in x:
        if member.name == "PardonTheSuit":
            if message.content.startswith("<@!338503364751130627>"):
                await client.change_nickname(member, message.content[23:])
            #elif message.author == member:
            #    await client.delete_message(message)
            #    await client.send_message(message.channel, "Just me and my :two_hearts:daddy:two_hearts:, hanging out I got pretty hungry:eggplant: so I started to pout :disappointed: He asked if I was down :arrow_down:for something yummy :heart_eyes::eggplant: and I asked what and he said he'd give me his :sweat_drops:cummies!:sweat_drops: Yeah! Yeah!:two_hearts::sweat_drops: I drink them!:sweat_drops: I slurp them!:sweat_drops: I swallow them whole:sweat_drops: :heart_eyes: It makes :cupid:daddy:cupid: :blush:happy:blush: so it's my only goal... :two_hearts::sweat_drops::tired_face:Harder daddy! Harder daddy! :tired_face::sweat_drops::two_hearts: 1 cummy:sweat_drops:, 2 cummy:sweat_drops::sweat_drops:, 3 cummy:sweat_drops::sweat_drops::sweat_drops:, 4:sweat_drops::sweat_drops::sweat_drops::sweat_drops: I'm :cupid:daddy's:cupid: :crown:princess :crown:but I'm also a w***e! :heart_decoration: He makes me feel squishy:heartpulse:!He makes me feel good:purple_heart:! :cupid::cupid::cupid:He makes me feel everything a little should!~ :cupid::cupid::cupid: :crown::sweat_drops::cupid:Wa-What!:cupid::sweat_drops::crown:")
    # Responds to the user with Pong!
    if message.content.upper().startswith("?PING"):
        userID = message.author.id
        await client.send_message(message.channel, "<@%s> Pong!" % (userID))
    # Gets the status on Skyrim Together
    if message.content.upper().startswith("?RIM"):
        while True:
            try:
                url = "http://www.reddit.com/r/SkyrimTogether/comments/7hhux1/live_todo_list"
                values = {"s": "basics", "submit": "search"}
                data = urllib.parse.urlencode(values)
                data = data.encode("utf-8")
                req = urllib.request.Request(url, data)
                resp = urllib.request.urlopen(req)
                respData = resp.read()
                paragraphs = re.findall(r'<p>(.*?)</p>', str(respData))
                for eachP in paragraphs:
                    if "Last update" in eachP:
                        await client.send_message(message.channel,
                                                  eachP[8:len(eachP) - 9])
                break
            except:
                # await client.send_message(message.channel, "There was an error, please retry the command.")
                print("retry")
                pass
    # Has the bot message a specific user message
    if message.content.upper().startswith("?SAY"):
        await client.delete_message(message)
        #if message.author.id == "175441095210041344":
        if len(message.content) > 5:
            args = message.content.split(" ")
            await client.send_message(message.channel,
                                      "%s" % (" ".join(args[1:])))
        else:
            await client.send_message(message.channel,
                                      "Please enter something to say.")
        #else:
        #await client.send_message(message.channel, "You lack permission to perform the specified command.")
    # Has the bot lists all of the possible user commands
    if message.content.upper() == "?HELP":
        command_list = [
            "Ark - Gives steam-connect for the ark server",
            "HQ - Gives time until the next HQ game",
            "Testbot - Tests to see if the bot is working", "Ping - Pong!",
            "Say - Tells the bot to say something",
            "Rim - Gets the date of the last Skyrim Together reddit update"
        ]
        await client.send_message(
            message.channel, "All commands are preceded by a \'?\'.\n--------")
        for com in command_list:
            await client.send_message(message.channel, "-\t" + com)
    sn.write(0,1,'名称')
    sn.write(0,2,'费用')
    
    number=1
    # add records of that sort
    for piece in lst:
        length=len(piece)
        end=length-6
        clear=piece[5:end]
        
        p1=clear.find(',')
        p2=clear.find('¥')
        time=clear[:p1]
        name=clear[p1+1:p2]
        fee=clear[p2:]
        
        #筛选有效和时间正确的记录
        if time.startswith('<'): continue #部分空行记录
        if time.startswith('#'): continue #允许以#排除部分记录
        if formtime(time) < begin_time: continue
        if formtime(time) > end_time:continue

        sn.write(number,0,time)
        sn.write(number,1,name)
        sn.write(number,2,fee)
        number=number+1

#save xlsx
workbook.close()
    
Ejemplo n.º 18
0
list_time = []
list_tx = []
list_ty = []
list_tz = []
list_qx = []
list_qy = []
list_qz = []
list_qw = []
with open(filename) as f:
    for l in f:
        if len(l.split()) != 8:
            continue

        time, tx, ty, tz, qx, qy, qz, qw = l.split()
        if time.startswith('#'):
            continue
        else:
            list_time.append(time)
            list_tx.append(tx)
            list_ty.append(ty)
            list_tz.append(tz)
            list_qx.append(qx)
            list_qy.append(qy)
            list_qz.append(qz)
            list_qw.append(qw)

#x_points = xrange(0,9)
#y_points = xrange(0,9)
#p = ax.plot(x_points, y_points, 'b')
Ejemplo n.º 19
0
def from_time(time):
    if isinstance(time, str):
        if not time.startswith('"'):
            time = '"{}"'.format(time)
        return time
    return time.strftime('"%H:%M:%S"')