Пример #1
0
from cmoc import ResetList, QuickList, Prepare

#example script gets every single mii in the DB, then adds it to spot_list

ql = QuickList()
pr = Prepare()

miilist = []
artisanlist = []
miidata = 'gAoAPwAAAAAAAAAAAAAAAAAAAAAAAF4AhonbB8JJnRIgBDxAuX0ookiKBEAAMZkEAIoAiiUEAAAAAAAAAAAAAAAAAAAAAAAAAAAaLw=='
likes = 0
skill = 0
country = 49
initial = 'AA'

artisandata = 'gAsAUABlAGUAdwBlAGUAAAAAAAAAAAAAhorkD1RU1sYgADxAub0IPAiQCEAUabiQAIoAiiUEAAAAAAAAAAAAAAAAAAAAAAAAAAC68Q=='
master = 0

ResetList(b'NL')
for i in range(499):
    miilist.append((i, initial, likes, skill, country, miidata) +
                   (artisandata, i, master))

list_type = 'NL'

data = ql.build(list_type, miilist)

with open('150/new_list01.ces', 'wb') as file:
    file.write(pr.prepare(data))

with open('150/new_list01.dec', 'wb') as file:
Пример #2
0
from cmoc import QuickList, Prepare
from datetime import timezone, datetime
import MySQLdb
from json import load

with open("/var/rc24/File-Maker/Channels/Check_Mii_Out_Channel/config.json",
          "r") as f:
    config = load(f)

# get the top 99 artisans and adds them to popcrafts_list

ql = QuickList()
pr = Prepare()

db = MySQLdb.connect("localhost",
                     config["dbuser"],
                     config["dbpass"],
                     "cmoc",
                     charset="utf8mb4")
cursor = db.cursor()

# 100000993 is the RC24 gold pants artisan
cursor.execute(
    "SELECT craftsno FROM artisan WHERE craftsno !=100000993 ORDER BY votes DESC LIMIT 100"
)
count = cursor.fetchall()

artisanlist = []

for i in range(len(
        count)):  # add the artisan data to each mii based on their craftsno
Пример #3
0
from cmoc import QuickList, Prepare
import MySQLdb
from json import load
from time import sleep

with open("/var/rc24/File-Maker/Channels/Check_Mii_Out_Channel/config.json",
          "r") as f:
    config = load(f)

#gets the most popular miis ordered by their volatile likes which resets to 0 when spot_list resets
ql = QuickList()
pr = Prepare()

db = MySQLdb.connect('localhost', config['dbuser'], config['dbpass'], 'cmoc')
cursor = db.cursor()

cursor.execute('SELECT COUNT(*) FROM mii WHERE likes > 0')
count = int(cursor.fetchone()[0])
print('Popular Count:', count)

#popular is always sorted by volatile likes first, but we combine miis ordered by permlikes to fill in the rest to equal 100 total miis
if count >= 100:
    extraCount = 0
    count = 100

else:
    extraCount = 100 - count

cursor.execute(
    'SELECT mii.entryno, mii.initial, mii.permlikes, mii.skill, mii.country, mii.miidata, artisan.miidata, artisan.craftsno, artisan.master FROM mii, artisan WHERE mii.craftsno=artisan.craftsno ORDER BY mii.likes DESC LIMIT %s',
    [count])
Пример #4
0
from cmoc import QuickList, Prepare
import MySQLdb
from json import load
from time import sleep

with open("/var/rc24/File-Maker/Tools/CMOC/config.json", "r") as f:
    config = load(f)
#get the top 50 most popular miis sorted by their permanent likes and add them to pop_list

ql = QuickList()
pr = Prepare()

db = MySQLdb.connect('localhost', config['dbuser'], config['dbpass'], 'cmoc')
cursor = db.cursor()

cursor.execute(
    'SELECT craftsno,entryno FROM mii ORDER BY permlikes DESC LIMIT 50')
numbers = cursor.fetchall()

miilist = []

for i in range(len(
        numbers)):  #add the artisan data to each mii based on their craftsno
    cursor.execute(
        'SELECT entryno,initial,permlikes,skill,country,miidata FROM mii WHERE craftsno = %s AND entryno = %s',
        (numbers[i][0], numbers[i][1]))
    mii = cursor.fetchone()
    cursor.execute(
        'SELECT miidata,craftsno,master FROM artisan WHERE craftsno = %s',
        [numbers[i][0]])
    artisan = cursor.fetchone()
Пример #5
0
    "SELECT mii.entryno, mii.initial, mii.permlikes, mii.skill, mii.country, mii.miidata, artisan.miidata, artisan.craftsno, artisan.master FROM mii, artisan WHERE mii.craftsno=artisan.craftsno ORDER BY mii.likes DESC LIMIT %s",
    [count],
)
popularMiis = cursor.fetchall()

cursor.execute(
    "SELECT mii.entryno, mii.initial, mii.permlikes, mii.skill, mii.country, mii.miidata, artisan.miidata, artisan.craftsno, artisan.master FROM mii, artisan WHERE mii.permlikes < 25 AND mii.craftsno=artisan.craftsno ORDER BY mii.permlikes DESC LIMIT %s",
    [extraCount],
)
extraMiis = cursor.fetchall()

cursor.execute("UPDATE mii SET likes = 0"
               )  # reset everyone's likes, but not their permlikes

db.commit()
db.close()

for country in [0, 150]:
    # gets the most popular miis ordered by their volatile likes which resets to 0 when spot_list resets
    ql = QuickList()
    pr = Prepare()

    data = ql.build("SL", (popularMiis + extraMiis), country)

    with open("{}/{}/spot_list.ces".format(config["miicontest_path"], country),
              "wb") as file:
        file.write(pr.prepare(data))

with open("decfiles/spot_list.dec", "wb") as file:
    file.write(data)
Пример #6
0
from cmoc import QuickList, Prepare, ResetList
import MySQLdb
from json import load
from time import sleep

with open("/var/rc24/File-Maker/Channels/Check_Mii_Out_Channel/config.json", "r") as f:
    config = load(f)
# get the top 50 most popular miis sorted by their permanent likes and add them to pop_list


db = MySQLdb.connect("localhost", config["dbuser"], config["dbpass"], "cmoc")
cursor = db.cursor()

cursor.execute(
    "SELECT mii.entryno, mii.initial, mii.permlikes, mii.skill, mii.country, mii.miidata, artisan.miidata, artisan.craftsno, artisan.master FROM mii, artisan WHERE mii.craftsno=artisan.craftsno ORDER BY permlikes DESC LIMIT 50"
)
miilist = cursor.fetchall()

for country in [0, 150]:
    ql = QuickList()
    pr = Prepare()

    data = ql.build("PL", miilist, country)

    with open( 
        "{}/{}/pop_list.ces".format(config["miicontest_path"], country), "wb"
    ) as file:
        file.write(pr.prepare(data))