コード例 #1
0
ファイル: stop_watcher.py プロジェクト: ccev/stopwatcher
def check_edits(fil, wp, w_type, w_id, w_lat, w_lon, w_name, w_img):
    if wp is None:
        return
    if (w_lat != wp[0]) or (w_lon != wp[1]):
        if "location" in fil["edit_types"]:
            _waypoint = waypoint(queries, config, w_type, w_id, wp[2], wp[3],
                                 wp[0], wp[1])
            _waypoint.send_location_edit(fil, w_lat, w_lon)
    if w_name is None or w_img is None or wp[2] is None or wp[3] is None:
        return
    if w_name.replace(" ", "").strip() != wp[2].replace(" ", "").strip():
        if "title" in fil["edit_types"]:
            _waypoint = waypoint(queries, config, w_type, w_id, wp[2], wp[3],
                                 wp[0], wp[1])
            _waypoint.send_name_edit(fil, w_name)
            if not w_type == "gym":
                if "update_gym_title" in fil:
                    if fil["update_gym_title"]:
                        if _waypoint.is_gym():
                            _waypoint.set_type("gym")
                            _waypoint.update(False)
    if w_img != wp[3]:
        if "photo" in fil["edit_types"]:
            _waypoint = waypoint(queries, config, w_type, w_id, wp[2], wp[3],
                                 wp[0], wp[1])
            _waypoint.send_img_edit(fil, w_img)
コード例 #2
0
ファイル: tools.py プロジェクト: mimikq/stopwatcher
def compare_loop(queries, config, stops, wp_type, compare_list):
    for s_id, s_lat, s_lon, s_name, s_img in stops:
        p = queries.get_full_portal_by_id(s_id)
        #0=lat, 1=lon, 2=name, 3=img
        if p is not None:
            if (s_lat != p[0]) or (s_lon != p[1]):
                """stop = waypoint(queries, config, wp_type.lower(), s_id)
                stop.update(False)"""
                compare_list[0].append([wp_type, s_name, s_lat, s_lon, p[0], p[1]])
            if s_name != p[2]:
                stop = waypoint(queries, config, wp_type.lower(), s_id)
                stop.update(False)
                compare_list[1].append([wp_type, s_name, p[2]])

            if s_img != p[3]:
                compare_list[2].append([wp_type, s_name, p[3]])
    return compare_list
コード例 #3
0
                deleted_max_portals = fil["deleted"]["max"]["scraper"]
            if "scanner" in fil["deleted"]["max"]:
                deleted_max_stops = fil["deleted"]["max"]["scanner"]
        if "timespan" in fil["deleted"]:
            if "scraper" in fil["deleted"]["timespan"]:
                deleted_timespan_portals = fil["deleted"]["timespan"][
                    "scraper"]
            if "scanner" in fil["deleted"]["timespan"]:
                deleted_timespan_stops = fil["deleted"]["timespan"]["scanner"]

    if "update" in fil:
        if "stop" in fil["update"]:
            print("Looking for Stops to update")
            stops = queries.get_empty_stops(fil["area"])
            for s_id in stops:
                stop = waypoint(queries, config, "stop", s_id[0])
                stop.update()
        if "gym" in fil["update"]:
            print("Looking for Gyms to update")
            gyms = queries.get_empty_gyms(fil["area"])
            for g_id in gyms:
                gym = waypoint(queries, config, "gym", g_id[0])
                gym.update()
    if "delete_converted_stops" in fil:
        if fil["delete_converted_stops"]:
            print("Looking for converted Stops to delete")
            stops = queries.get_converted_stops(fil["area"])
            for s_id, s_name in stops:
                stop = waypoint(queries, config, "stop", s_id, s_name)
                stop.delete()
    if "send" in fil: