コード例 #1
0
def alliance_oneday(mongohandle, alliance_id):
    """find by corp and system - one day"""
    allkills = mongohandle.allkills
    timeframe = 24 * 60 * 60
    gmtminus = time.mktime(time.gmtime()) - timeframe
    cursor = allkills.find({"alliance_id": alliance_id,
                            "unix_kill_time": {
                                "$gte": gmtminus}},
                           {"ship": 1,
                            "items": 1,
                            "_id": 0}).hint('alliancetime')
    (ships, items, ammos) = parsecursor.ships_and_items(cursor)
    return (ships, items, ammos)
コード例 #2
0
def corporation_system_oneday(mongohandle, corporation_id, system):
    """find by corp and system - one day"""
    allkills = mongohandle.allkills
    system = int(system)
    timeframe = 24 * 60 * 60
    gmtminus = time.mktime(time.gmtime()) - timeframe
    cursor = allkills.find({"corporation_id": corporation_id,
                            "solar_system_id": system,
                            "unix_kill_time": {
                                "$gte": gmtminus}},
                           {"ship": 1,
                            "items": 1,
                            "_id": 0}).hint('corpsystemtime')
    (ships, items, ammos) = parsecursor.ships_and_items(cursor)
    return (ships, items, ammos)
コード例 #3
0
def corporation_date(mongohandle, corporation_id, date):
    """find by corp system and specified date"""
    allkills = mongohandle.allkills
    timeframe = 24 * 60 * 60
    datestring = date + ' 11:05:00'
    starttime = calendar.timegm(time.strptime(datestring, '%Y-%m-%d %H:%M:%S'))
    stoptime = starttime + timeframe
    cursor = allkills.find({"corporation_id": corporation_id,
                            "unix_kill_time": {
                                "$gte": starttime,
                                "$lt": stoptime}},
                           {"ship": 1,
                            "items": 1,
                            "_id": 0}).hint('corptime')
    (ships, items, ammos) = parsecursor.ships_and_items(cursor)
    return (ships, items, ammos)
コード例 #4
0
def corporation_days(mongohandle, corporation_id, days):
    """find by corp and specified days"""
    allkills = mongohandle.allkills
    if float(days) > 7 or float(days) < 0:
        shiptotals = [{"error":"parameter 'days' range error"}]
        itemtotals = [{"error":"parameter 'days' range error"}]
        ammototals = [{"error":"parameter 'days' range error"}]
        return (shiptotals, itemtotals, ammototals)
    else:
        timeframe = float(days) * 24 * 60 * 60
        gmtminus = time.mktime(time.gmtime()) - timeframe
        cursor = allkills.find({"corporation_id": corporation_id,
                                "unix_kill_time": {
                                    "$gte": gmtminus}},
                               {"ship": 1,
                                "items": 1,
                                "_id": 0}).hint('corptime')
    (ships, items, ammos) = parsecursor.ships_and_items(cursor)
    return (ships, items, ammos)
コード例 #5
0
def alliance_system_days(mongohandle, alliance_id, system, days):
    """find by corp system and specified days"""
    allkills = mongohandle.allkills
    system = int(system)
    if float(days) > 7 or float(days) < 0:
        shiptotals = [{"error":"parameter 'days' range error"}]
        itemtotals = [{"error":"parameter 'days' range error"}]
        ammototals = [{"error":"parameter 'days' range error"}]
        return (shiptotals, itemtotals, ammototals)
    else:
        timeframe = float(days) * 24 * 60 * 60
        gmtminus = time.mktime(time.gmtime()) - timeframe
        cursor = allkills.find({"alliance_id": alliance_id,
                                "solar_system_id": system,
                                "unix_kill_time": {
                                    "$gte": gmtminus}},
                               {"ship": 1,
                                "items": 1,
                                "_id": 0}).hint('alliancesystemtime')
    (ships, items, ammos) = parsecursor.ships_and_items(cursor)
    return (ships, items, ammos)