Example #1
0
	connector.commit()
	cursor.close()
	connector.close()





##########
## main ##
##########
if __name__=="__main__":

	# インスタンス生成
	useTwitter = usetwitter.UseTwitter()
	useCV = usecv.UseCV()
	useSQL = usesql.UseSQL()
	useBurp = useburp.UseBurp()
	point = points.Points()

	if os.path.isfile("/home/pi/sif/cap/mirrordir/prod-jp.lovelive.ge.klabgames.net_main.php_battle_endRoom.json"):
#	if os.path.isfile("/home/pi/sif/cap/mirrordir/prod-jp.lovelive.ge.klabgames.net_main.php_challenge_finalize.json"):
#		useBurp.read_burplog(point)
#		point.showPoints()
#		useSQL.update_eventTable(point,"sm28")
#		point.tweetPoints(useTwitter)

#	if os.path.isfile("/home/pi/sif/cap/mirrordir/prod-jp.lovelive.ge.klabgames.net_main.php_secretbox_pon.json"):
#		useBurp.gatcha_bot(useSQL)

#	useSQL.update_statusTable(useTwitter.time_tweet,useTwitter.username)
Example #2
0
class AbstractedlyListener(StreamListener):
    """ Let's stare abstractedly at the User Streams ! """
    # インスタンス生成
    useTwitter = usetwitter.UseTwitter()
    useCV = usecv.UseCV()
    useBurp = useburp.UseBurp()
    useSQL = usesql.UseSQL()
    point = points.Points()

    def on_status(self, status):
        # Ubuntuの時は気づかなかったんだけど、Windowsで動作確認してたら
        # created_atはUTC(世界標準時)で返ってくるので日本時間にするために9時間プラスする。
        status.created_at += timedelta(hours=9)
        print(u"{text}".format(text=status.text))
        print(u"{name}({screen}) {created} via {src}\n".format(
            name=status.author.name,
            screen=status.author.screen_name,
            created=status.created_at,
            src=status.source))

        dobu = 1
        UR_flug = 1
        SR_flug = 1

        if (status.text.find('@sif_notify_bot') >
                -1) and (status.text.find('RT') < 0):

            tweet = '@' + str(status.author.screen_name) + '\n'

            for num in range(0, 11):

                names = get_names(status.text)
                if isinstance(names, str):
                    rarity = get_rare("normal")
                else:
                    rarity = get_rare("alpaca")

                if (status.text.find('UR') >
                        -1) and (rarity == 1) and (random.randint(0, 1)):
                    rarity = 4
                if (status.text.find('SR') >
                        -1) and (rarity == 1) and (random.randint(0, 1)):
                    rarity = 3

                if rarity > 1:
                    tweet = tweet + '*'
                    dobu = 0
                elif (dobu == 1) and (num == 10):
                    ## SR確定
                    tweet = tweet + '*'
                    rarity = 2
                    dobu = 0

                member_id = 30
                while member_id > 27 and member_id < 52:

                    series = 0
                    if rarity > 1:
                        print str(
                            status.text.rsplit(' ', 1)[1].encode('utf-8'))
                        series = str(
                            status.text.rsplit(' ', 1)[1].encode('utf-8'))
                        if not ('編' in series):
                            series = 0

                    member_id = self.useSQL.rand_member(rarity, names, series)
                (member_info, member_url) = self.useSQL.get_member(member_id)

                tweet = tweet + str(member_info)
                tweet = tweet + '\n'

                filename = '/home/pi/sif/cap/manage_sif/icon' + str(
                    num) + '.gif'
                command = "wget '" + str(member_url) + "' -O " + filename
                check = commands.getoutput(command)


#				print check

            if dobu == 1:
                tweet = tweet + 'ド(・8・)ブ'
            tweet = tweet + "#スクフェス"
            print "tweet:" + tweet

            icons = []
            for i in range(0, 11):
                icons.insert(
                    i, "/home/pi/sif/cap/manage_sif/icon" + str(i) + ".gif")

            self.useCV.create_gacha_image(icons)

            self.useTwitter.post_tweet_image(
                status.id, tweet, '/home/pi/sif/cap/manage_sif/result.jpg')
Example #3
0
class smgatcha:
	""" Let's stare abstractedly at the User Streams ! """
	# インスタンス生成
	useTwitter = usetwitter.UseTwitter()
	useCV = usecv.UseCV()
	useBurp = useburp.UseBurp()
	useSQL = usesql.UseSQL()
	useGatcha = usegatcha.UseGatcha()
	point = points.Points()

	def dogatcha(self, desc):
		# Ubuntuの時は気づかなかったんだけど、Windowsで動作確認してたら
		# created_atはUTC(世界標準時)で返ってくるので日本時間にするために9時間プラスする。

		dobu = 1
		UR_flug = 1
		SR_flug = 1

		icons = []
		membersArray = []

		for num in range(0,11):

			members = {}

			names = self.useGatcha.get_names(desc)
			if isinstance(names, str):
				if names.find("アルパカ"):
					rarity = self.useGatcha.get_rare("alpaca")
			else:
				rarity = self.useGatcha.get_rare("normal")

			if (desc.find('UR') > -1)and(rarity==1)and(random.randint(0,1)):
				rarity = 4
			if (desc.find('SR') > -1)and(rarity==1)and(random.randint(0,1)):
				rarity = 3

			if rarity > 1:
				dobu = 0
			elif (dobu == 1) and (num == 10):
			## SR確定
				rarity = 2
				dobu = 0


			series = 0
			if rarity > 1:
				print str(desc.rsplit(' ',1)[1].encode('utf-8'))
				series = str(desc.rsplit(' ',1)[1].encode('utf-8'))
				if not('編' in series):
					series = 0

			member_id = self.useSQL.rand_member(rarity,names,series)
			(member_rare, member_name, member_series, member_url, member_type, member_ss, member_sp, member_sc) = self.useSQL.get_member(member_id)
			(member_info, member_fullimgurl_0, member_fullimgurl_1) = self.useSQL.get_member_info(member_id)
			if (member_name != 'アルパカ' and member_rare == 'R') or (member_name == 'アルパカ' and member_rare == 'SR'):
				member_desc = member_rare + member_name
			else:
				member_desc = member_rare + member_name + "(" + member_series + ")"


			members["id"] = str(member_id)
			members["rarity"] = str(rarity)
			members["name"] = str(member_name)
			members["series"] = str(member_series)
			members["desc"] = str(member_desc)
			members["fullimgurl_0"] = str(member_fullimgurl_0)
			members["fullimgurl_1"] = str(member_fullimgurl_1)
			members["info"] = str(member_info)
			members["type"] = str(member_type)
			members["status_s"] = str(member_ss)
			members["status_p"] = str(member_sp)
			members["status_c"] = str(member_sc)

			filename = '/home/pi/sif/cap/manage_sif/icon'+str(num)+'.gif'
			command = "wget '"+str(member_url)+"' -O "+filename
#			check = commands.getoutput(command)

			icons.insert(num,filename+" "+str(rarity))

			if num < 11:
				membersArray.insert(num, members)



	#	self.useCV.create_gacha_image(icons)

		return membersArray
Example #4
0
def gatcha(text):
    """ Let's stare abstractedly at the User Streams ! """
    # インスタンス生成
    useCV = usecv.UseCV()
    useSQL = usesql.UseSQL()

    dobu = 1
    UR_flug = 1
    SR_flug = 1

    icons = []
    tweet = ""

    print text

    for num in range(0, 11):

        text = text.replace("'", "")

        names = get_names(text)
        if isinstance(names, str):
            if names.find("アルパカ"):
                rarity = get_rare("alpaca")
        else:
            rarity = get_rare("normal")

        if (text.find('UR') > -1) and (rarity == 1) and (random.randint(0, 1)):
            rarity = 4
        if (text.find('SR') > -1) and (rarity == 1) and (random.randint(0, 1)):
            rarity = 3

        if rarity > 1:
            dobu = 0
        elif (dobu == 1) and (num == 10):
            ## SR確定
            rarity = 2
            dobu = 0

        member_id = 30
        while member_id > 27 and member_id < 52:

            series = 0
            if rarity > 1 and len(text.rsplit(' ', 1)) > 1:
                #	print str(text.rsplit(' ',1)[1].encode('utf-8'))
                series = str(text.rsplit(' ', 1)[1])
                if not ('編' in series):
                    series = 0

            member_id = useSQL.rand_member(rarity, names, series)
        (member_info, member_url) = useSQL.get_member(member_id)

        tweet = tweet + str(member_info)
        if rarity > 1:
            tweet = tweet + '*'
        tweet = tweet + '\r'

        filename = '/var/www/callback/img/icon' + str(num) + '.png'
        command = "wget '" + str(member_url) + "' -O " + filename
        check = commands.getoutput(command)
        print check

        #			print check
        icons.insert(num, filename + " " + str(rarity))


#	if dobu == 1:
#		tweet = tweet + 'ド(・8・)ブ'
#	tweet = tweet + "#スクフェス"
    print tweet

    base_dir = '../img/'
    icons.insert(11, base_dir)
    useCV.create_gacha_image(icons)
Example #5
0
class smgatcha:
    """ Let's stare abstractedly at the User Streams ! """
    # インスタンス生成
    useTwitter = usetwitter.UseTwitter()
    useCV = usecv.UseCV()
    useBurp = useburp.UseBurp()
    useSQL = usesql.UseSQL()
    useGatcha = usegatcha.UseGatcha()
    point = points.Points()

    def dogatcha(self, desc):
        # Ubuntuの時は気づかなかったんだけど、Windowsで動作確認してたら
        # created_atはUTC(世界標準時)で返ってくるので日本時間にするために9時間プラスする。

        dobu = 1
        UR_flug = 1
        SR_flug = 1

        icons = []
        members = '['

        for num in range(0, 11):

            members = members + "{"

            names = self.useGatcha.get_names(desc)
            if isinstance(names, str):
                if names.find("アルパカ"):
                    rarity = self.useGatcha.get_rare("alpaca")
            else:
                rarity = self.useGatcha.get_rare("normal")

            if (desc.find('UR') > -1) and (rarity == 1) and (random.randint(
                    0, 1)):
                rarity = 4
            if (desc.find('SR') > -1) and (rarity == 1) and (random.randint(
                    0, 1)):
                rarity = 3

            if rarity > 1:
                dobu = 0
            elif (dobu == 1) and (num == 10):
                ## SR確定
                rarity = 2
                dobu = 0

            member_id = 30
            while member_id > 27 and member_id < 52:

                series = 0
                if rarity > 1:
                    print str(desc.rsplit(' ', 1)[1].encode('utf-8'))
                    series = str(desc.rsplit(' ', 1)[1].encode('utf-8'))
                    if not ('編' in series):
                        series = 0

                member_id = self.useSQL.rand_member(rarity, names, series)
            (member_name, member_url) = self.useSQL.get_member(member_id)
            (member_info, member_fullimgurl_0,
             member_fullimgurl_1) = self.useSQL.get_member_info(member_id)

            members = members + '"id":"' + str(member_id) + '",'
            members = members + '"name":"' + str(member_name) + '",'
            members = members + '"fullimgurl_0":"' + str(
                member_fullimgurl_0) + '",'
            members = members + '"fullimgurl_1":"' + str(
                member_fullimgurl_1) + '",'
            members = members + '"info":"' + member_info + '"'

            filename = '/home/pi/sif/cap/manage_sif/icon' + str(num) + '.gif'
            command = "wget '" + str(member_url) + "' -O " + filename
            check = commands.getoutput(command)

            #			print check
            icons.insert(num, filename + " " + str(rarity))

            if num == 10:
                members = members + "}"
            else:
                members = members + "},"

        members = members + "]"
        print "members:" + members

        self.useCV.create_gacha_image(icons)

        return members