def gengroups(players):
    global groupsfinal
    global onlineplayers
    fontstyle = ""
    for player in players:
        # print player
        playername, UUID, lastlogin, status, twitter, twitch, youtube, reddit, maildrop = player
        if playername in onlineplayers:
            fontstyle = "background-color: #FFAA00; color: white;"
        else:
            timediff = datetime.datetime.now() - lastlogin
            hourspast = int(timediff.total_seconds() // 3600)
            if hourspast > 59:
                hourspast = 59
            fontstyle = "color: " + gradient[ hourspast ] + ";"



        social = ""

        if youtube:
            social += '<a href="http://youtube.com/' + youtube + '"><img src="youtube.png"></a>'
        if twitter:
            social += '<a href="http://twitter.com/' + twitter.strip("@") + '"><img src="twitter.png"></a>'
        if reddit:
            social += '<a href="http://reddit.com/u/' + reddit + '"><img src="reddit.png"></a>'
        if twitch:
            social += '<a href="http://twitch.tv/' + twitch + '"><img src="twitch.png"></a>'


        # print bool(maildrop)
        playerstatus = maildropstatus = statusstatus = ''
        # print maildropstatus
        if bool(maildrop) or status:
            if bool(maildrop):
                maildropstatus = showandtellraw.tohtml( '<green^Maildrop> for you' )

            if status:
                statusstatus = status
                if bool(maildrop):
                    statusstatus += "</br>"

            playerstatus =  ' <div class="status" style="padding: 5px;color: white;background:rgba(0,0,0,0.75); font-size: 75%;">' + unicode(statusstatus) + unicode(maildropstatus) + '</div>'

        groupsfinal.append( { "content" : '<div style="padding: 5px; width: 220px; min-height: 60px"> ' + '<div style="width: 100%;' + fontstyle+ '">'+'<img style="height:32px; width:32px; vertical-align:middle" src="https://minotar.net/avatar/' + playername + '/32">  '+ playername +'  </div>' + playerstatus + social + "</div>", "id" : UUID, "sort" : 1})
            "><gold^ hours, average ><dark_purple^" +
            "%.1F" % (totalminutes / 60.0 / totalplayer) +
            "><gold^ hours per player>")
    print(line)
    outfile.write(line)

filenames = [config + '/topmotd.txt', otherdata + '/quickie.txt']
with open(otherdata + '/motd.txt', 'w') as outfile:
    for fname in filenames:
        with open(fname) as infile:
            outfile.write(infile.read())

with open(webdata + '/motd.html', 'w') as outfile:
    outfile.write("""
    <style type="text/css" media="screen">
a:link { color:white; }
a:visited { color:white; }
</style>
<link rel="stylesheet" href="../font.css">
    <div class="status" style="padding: 5px;color: white;background:rgba(0,0,0,0.75); font-size: 50%;font-family: minecraftfont;">
                  """)
    for line in open(otherdata + "/motd.txt", "r").readlines():
        outfile.write(showandtellraw.tohtml(line) + "</br>")

    outfile.write('</div>')


with open(webdata + "/status.md", "w") as outfile:
    outfile.write(stats)

Exemple #3
0
            "><gold^\\\\>" + "<dark_purple^" + str(numwhitelist) + " >" +
            "<gold^players seen, ><dark_purple^" + "%.1F" %
            (totalminutes / 60.0) + "><gold^ h, average ><dark_purple^" +
            "%.1F" % (totalminutes / 60.0 / totalplayer) +
            "><gold^ h\/player>")
    print(line)
    outfile.write(line)

filenames = [config + '/topmotd.txt', otherdata + '/quickie.txt']
with open(otherdata + '/motd.txt', 'w') as outfile:
    for fname in filenames:
        with open(fname) as infile:
            outfile.write(infile.read())

with open(webdata + '/motd.html', 'w') as outfile:
    outfile.write("""
    <style type="text/css" media="screen">
a:link { color:white; }
a:visited { color:white; }
</style>
<link rel="stylesheet" href="../font.css">
    <div class="status" style="padding: 5px;color: white;background:rgba(0,0,0,0.75); font-size: 50%;font-family: minecraftfont;">
                  """)
    for line in open(otherdata + "/motd.txt", "r").readlines():
        outfile.write(showandtellraw.tohtml(line) + "</br>")

    outfile.write('</div>')

with open(webdata + "/status.md", "w") as outfile:
    outfile.write(stats)