Ejemplo n.º 1
0
def _games():
    """
    Porting games from old DB
    """
    old_to_new = _old_to_new()

    c_old.execute("""SELECT id, casino_id, image_path AS screenshot, link AS info__url_play_side, 
    width AS flash_width, heigth AS flash_height, show_slot AS flash_enabled, name AS info__name,
    show_mode AS flash_inframe, order_slot AS order_hand FROM slots ORDER BY id ASC""") #show_new_window, reflink, 
    for item in c_old.fetchall():
        if not old_to_new.has_key(item["casino_id"]):
            continue

        c_new.execute("""INSERT INTO casino_game(gametype, name, screenshot, flash_width, flash_height, 
            flash_enabled, order_hand, flash_inframe, maincasino_id, order_google, param_sale, param_gambling, 
            param_demo, param_mobile, param_integrity, param_shift, param_dealer, param_multiplayer, 
            param_tele, param_jackpot, enabled, old_id) VALUES(0, %s, %s, %s, %s, %s, %s, %s, %s, 0, -1, 
            -1, 0, -1, -1, -1, -1, -1, -1, -1, false, %s) RETURNING id""", (item["info__name"], 
            item["screenshot"], item["flash_width"], item["flash_height"], item["flash_enabled"], item["order_hand"],
            ('true' if item["flash_inframe"] == "1" else 'false'), old_to_new[item["casino_id"]], item["id"]))
        new_id = c_new.fetchone()[0]

        c_new.execute("""INSERT INTO casino_gameinfo(urlkey, game_id, lang_id, name, url_play_side, 
            tags_picture, tags_theme, tags_name, selltext, url_buy_our, url_play_our, 
            url_flash, url_buy_side) VALUES(null, %s, 1, %s, %s, '', '', '', '', null, null, null, null)""", 
            (new_id, item["info__name"], item["info__url_play_side"]))
    conn_new.commit()
Ejemplo n.º 2
0
def __casino():
    """
    Porting casino
    """
    c_old.execute("""SELECT id, casino_name AS name, casino_domain AS domain, path AS purl_main,
    description, article AS text, logo AS image FROM managers_sites ORDER BY id ASC""")

    for item in c_old.fetchall():
        casino_name = item["name"] if item["name"] else item["domain"]
        c_new.execute("""INSERT INTO casino_casino(name, domain, param_mobile, param_download, param_browser, 
        param_audited, param_integrity, param_license, param_jackpot, param_tournaments, 
        param_nodepositbonus, old_id, param_shift, param_dealer, param_multiplayer, 
        similar_sale, urlkey, status, link_similar_sale, order_google, order_hand, enabled, relation) 
        VALUES(%s, %s, -1, -1, -1, -1, -1, -1, -1, -1, -1, %s, -1, -1, -1, false, '', 1, '', 0, 0, false, 1) 
        RETURNING id""", (casino_name, item["domain"], item["id"]))
        new_id = c_new.fetchone()[0]

        item_image = item["image"] if item["image"] else ""
        c_new.execute("""INSERT INTO casino_casinoinfo(casino_id, lang_id, name, image, description, 
        purl_main, purl_download, purl_bonus) VALUES(%s, 1, %s, %s, %s, %s, '', '')""", 
        (new_id, item["name"], item_image, item["description"], item["purl_main"]))
        # c_new.execute("""INSERT INTO casino_casinoinfo(casino_id, lang_id, name, image, description, 
        # text, purl_main, purl_download, purl_bonus) VALUES(%s, 1, %s, %s, %s, %s, %s, '', '')""", 
        # (new_id, item["name"], item_image, item["description"], item["text"], item["purl_main"]))
    conn_new.commit()
Ejemplo n.º 3
0
def _country():
    """
    Move countries
    """
    c_old.execute("""SELECT id, name FROM countries ORDER BY id ASC""")
    for item in c_old.fetchall():
        c_new.execute("""INSERT INTO old_site_country(id, name, code, flag) 
            VALUES(%s, %s, '', '')""", item)
    conn_new.commit()
Ejemplo n.º 4
0
def _developers():
    """
    Move developers
    """
    c_old.execute("SELECT id, name, image_path FROM developers_games ORDER BY id ASC")
    for item in c_old.fetchall():
        c_new.execute("INSERT INTO casino_developer(name, logo, old_id) VALUES(%s, %s, %s)", 
            (item["name"], item["image_path"], item["id"]))
    conn_new.commit()
Ejemplo n.º 5
0
def _casino_logo():
    """
    Copy casino logo images
    """
    c.execute("""SELECT id, logo FROM old_site_casino c WHERE logo<>'' ORDER BY id ASC""")
    for item in c.fetchall():
        filename = copy_file("http://casino-rating.org/images/logos/%s.jpg" % item["logo"], "casino", "jpg")
        c.execute("""UPDATE old_site_casino SET logo=%s WHERE id=%s""", (filename, item["id"]))
    conn_new.commit()
Ejemplo n.º 6
0
def _parameters_groups():
    """
    Move parameters groups
    """
    c_old.execute("""SELECT id, name, description, meta, orderp FROM parameters_groups ORDER BY id ASC""")
    for item in c_old.fetchall():
        c_new.execute("""INSERT INTO old_site_parametergroup(id, name, description, meta, "order") 
            VALUES(%s, %s, %s, %s, %s)""", item)
    conn_new.commit()
Ejemplo n.º 7
0
def _casino_articles():
    """
    Copy casino articles (small texts)
    """
    c_old.execute("""SELECT a.id, a.last_update, attach_id, title, a.article, owner_id, article_type
    FROM articles a INNER JOIN managers_sites m ON m.id=attach_id ORDER BY id ASC""")
    for item in c_old.fetchall():
        c_new.execute("""INSERT INTO old_site_casinoarticle(id, "date", casino_id, title, "text",
        owner_id, type) VALUES(%s, %s, %s, %s, %s, %s, %s)""", item)
    conn_new.commit()
Ejemplo n.º 8
0
def _slots_logo():
    """
    Copy slots logo images
    """
    c.execute("""SELECT id, screenshot FROM casino_game WHERE screenshot<>'' ORDER BY id ASC""")
    for item in c.fetchall():
        filename = copy_file("http://casino-rating.org/%s" % item["screenshot"], "slots", 
            get_file_extension(item["screenshot"]))
        c.execute("""UPDATE casino_game SET screenshot=%s WHERE id=%s""", (filename, item["id"]))
    conn_new.commit()
Ejemplo n.º 9
0
def _casino_screenshots():
    """
    Copy casino screenshots
    """
    c.execute("""SELECT id, casino_id, image FROM old_site_casinoscreenshot WHERE image<>'' ORDER BY id ASC""")
    for item in c.fetchall():
        filename = copy_file("http://casino-rating.org/images/logos/%s" % item["image"], "casino", 
            get_file_extension(item["image"]))
        c.execute("""UPDATE old_site_casinoscreenshot SET image=%s WHERE id=%s""", (filename, item["id"]))
    conn_new.commit()
Ejemplo n.º 10
0
def _casino_logo():
    """
    Copy casino logo images
    """
    c.execute(
        """SELECT c.id, old_id, image FROM casino_casino c 
    INNER JOIN casino_casinoinfo ci ON ci.casino_id=c.id WHERE image<>'' ORDER BY c.id ASC"""
    )
    for item in c.fetchall():
        filename = copy_file("http://casino-rating.org/images/logos/%s.jpg" % item["image"], "casino", "jpg")
        c.execute("""UPDATE casino_casinoinfo SET image=%s WHERE casino_id=%s AND lang_id=1""", (filename, item["id"]))
    conn_new.commit()
Ejemplo n.º 11
0
def _casino_screenshots():
    """
    Copy casino screenshots
    """
    c_old.execute("""SELECT s.id, casino_id, group_id, image_path, s.comment FROM screenshots s
    INNER JOIN managers_sites m ON m.id=s.casino_id
    ORDER BY id ASC""")
    # print len(c_old.fetchall())
    for item in c_old.fetchall():
        c_new.execute("""INSERT INTO old_site_casinoscreenshot(id, casino_id, type, image, name) 
        VALUES(%s, %s, %s, %s, %s)""", item)
    conn_new.commit()
Ejemplo n.º 12
0
def _casino_screenshots():
    """
    Copy casino screenshots
    """
    old_to_new = _old_to_new()

    c_old.execute("""SELECT casino_id, image_path, comment FROM screenshots WHERE group_id=3 ORDER BY id ASC""")
    for item in c_old.fetchall():
        if not old_to_new.has_key(item["casino_id"]):
            continue
        c_new.execute("""INSERT INTO casino_casinoimage(lang_id, casino_id, name, image) 
        VALUES(1, %s, %s, %s)""", (old_to_new[item["casino_id"]], item["comment"], item["image_path"]))
    conn_new.commit()
Ejemplo n.º 13
0
def _casino_parameters():
    """
    Move casin parameters
    """
    c_old.execute("""SELECT pr.id, manager_id, casino_id, parameter_id, value, comments, comments_autor 
    FROM managers_rating pr INNER JOIN managers_sites s ON s.id=pr.casino_id 
    INNER JOIN parameters p ON p.id=pr.parameter_id ORDER BY id ASC""")
    # print len(c_old.fetchall())
    for item in c_old.fetchall():
        # if not item["manager_id"]: item["manager_id"] = None
        c_new.execute("""INSERT INTO old_site_parametertocasino(id, manager_id, casino_id, 
        parameter_id, value, comment, author) VALUES(%s, %s, %s, %s, %s, %s, %s)""", item)
    conn_new.commit()
Ejemplo n.º 14
0
def _parameters():
    """
    Move parameters
    """
    c_old.execute("""SELECT id, name, description, view_description, "min", "max", percent,
    parameter_type, basic, param_group, type_casinos, type_roulettes, type_pokers, 
    managers_editable, visible_main, visible_info, visible_compare, orderp, faq, faq_managers 
    FROM parameters ORDER BY id ASC""")
    for item in c_old.fetchall():
        item[7] = {"label" : 1, "image" : 2, "digit" : 3, "text" : 4}[item[7]]
        c_new.execute("""INSERT INTO old_site_parameter(id, name, description, view_description,
        "min", "max", percent, type, basic, group_id, type_casinos, type_roulettes, type_pokers, 
        managers_editable, visible_main, visible_info, visible_compare, "order", faq, faq_managers) 
        VALUES(%s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s)""", item)
    conn_new.commit()
Ejemplo n.º 15
0
def _games_developers():
    """
    Copy games screenshots
    """
    old_games = _old_to_new('casino_game')
    old_developers = _old_to_new('casino_developer')

    c_old.execute("""SELECT slot_id, developer_id FROM slots_developers""")
    for item in c_old.fetchall():
        if not old_games.has_key(item["slot_id"]):
            # print item["slot_id"]
            continue
        c_new.execute("""INSERT INTO casino_game_developers(game_id, developer_id) VALUES(%s, %s)""", 
        (old_games[item["slot_id"]], old_developers[item["developer_id"]],))
    conn_new.commit()
Ejemplo n.º 16
0
def _paymentsystems():
    """
    Create list of payment system from parameters list
    """
    c_old.execute("""SELECT id, name, param_group FROM parameters 
    WHERE param_group IN (20, 22) ORDER BY name ASC""")#GROUP BY name 
    # c_new.execute("""TRUNCATE common_paymentsystem""")
    data_list = {}
    for item in c_old.fetchall():
        if item["name"] not in data_list:
            data_list[item["name"]] = {"cnt" : 0, "types" : {}}
        data_list[item["name"]]["types"][item["param_group"]] = item["id"]
        data_list[item["name"]]["cnt"] += 1

    input_values = []
    for name in data_list.keys():
        if data_list[name]["cnt"] > 2:
            continue
        params = '{%s, %s}' % (data_list[name]["types"].get(20, 'null'), data_list[name]["types"].get(22, 'null'))
        c_new.execute("""INSERT INTO common_paymentsystem(name, icon, "text", param_ids) 
        VALUES('%s', '', '', '%s')""" % (name, params,))
    conn_new.commit()
Ejemplo n.º 17
0
def _casino():
    """
    Move casino
    """
    rating = {}
    c_old.execute("""SELECT site_id AS id, "sum" FROM view_simple_rating ORDER BY id ASC""")
    for item in c_old.fetchall():
        rating[item["id"]] = "%.2f" % item["sum"]
    
    c_old.execute("""SELECT id, logo, country, casino_name, casino_domain, email, "path", roulettes,
    pokerrooms, ready, accept, sell, otstoy, otstoy_desc, max_show_slots, description, article, 
    comment FROM managers_sites ORDER BY id ASC""")
    for item in c_old.fetchall():
        if 0 == item["country"]:item["country"] = None
        if item["otstoy_desc"] is None:item["otstoy_desc"] = ""
        if item["comment"] is None:item["comment"] = ""
        if item["logo"] is None:item["logo"] = ""

        c_new.execute("""INSERT INTO old_site_casino(id, logo, country_id, name, domain, email,
        "path", roulettes, pokerrooms, ready, accept, sell, otstoy, otstoy_desc, max_show_slots, 
        description, article, comment, "rating", "ru_name", "enabled") VALUES
        (%s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, %s, '', true)
        """, item + [rating.get(item["id"], "0")])
    conn_new.commit()
Ejemplo n.º 18
0
def _casino_params():
    """
    Parting casino parameters and paymentsystems relates
    """
    param_list = [297, 147, 111, 74, 210, 77, 116, 127]
    param_keys = {297 : "param_mobile", 147 : "param_browser", 111 : "param_audited", 
    74 : "param_integrity", 210 : "param_license", 77 : "param_jackpot", 116 : "param_tournaments", 
    127 : "param_nodepositbonus", 192 : "param_download"}
    
    #Get list of payment params ids
    payment_list = {}
    c_new.execute("SELECT id, param_ids  FROM common_paymentsystem ORDER BY id ASC")
    for item in c_new.fetchall():
        if item[1][0] is None:
            #input
            param_list.append(item[1][1])
            payment_list[item[1][1]] = {"id" : item[0], "type" : 2}
        elif item[1][1] is None:
            #output
            param_list.append(item[1][0])
            payment_list[item[1][0]] = {"id" : item[0], "type" : 1}
        else:
            param_list += item[1]
            payment_list[item[1][0]] = {"id" : item[0], "type" : 1}
            payment_list[item[1][1]] = {"id" : item[0], "type" : 2}

    # c_old.execute("""SELECT site_id AS old_id, site_name AS name, site_description AS info__description, 
    # logo AS info__image, "path" AS info__purl_main, parameter_id AS p_id, parameter_value AS p_val
    # FROM view_rating ORDER BY id ASC""")
    c_old.execute("""SELECT casino_id AS old_id, parameter_id AS p_id, value AS p_val 
    FROM managers_rating ORDER BY id ASC""")
    casino_list = {}

    old_to_new = _old_to_new()

    for item in c_old.fetchall():
        if not old_to_new.has_key(item["old_id"]):
            continue

        oid = item["old_id"]
        pid = item["p_id"]
        if casino_list.has_key(oid):
            if pid not in param_list:
                continue
        else:
            '''
            c_old.execute("""SELECT casino_domain AS domain, article AS info__text 
            FROM managers_sites WHERE id=%s""" % oid)
            casino = c_old.fetchone()
            casino_list[oid] = {"info" : {"text" : casino["info__text"], 
            "image" : item["info__image"], "purl_main" : item["info__purl_main"], 
            "description" : item["info__description"]}, "main" : {"name" : item["name"], 
            "domain" : casino["domain"]}, "payments" : {}}
            '''
            casino_list[oid] = {"params" : {}, "payments" : {}}
        
        if param_keys.has_key(pid):
            #Set casino param value
            casino_list[oid]["params"][param_keys[pid]] = item["p_val"]

        if payment_list.has_key(pid) and int(item["p_val"]) == 1:
            #Set relates between casino and paymentsystem
            payid = payment_list[pid]["id"]
            value = 3 if casino_list[oid]["payments"].has_key(payid) else payment_list[pid]["type"]
            casino_list[oid]["payments"][payid] = value

    for old_id in casino_list.keys():
        item = casino_list[old_id]
        c = item["params"]
        # i = item["info"]
        #update casino record
        new_id = old_to_new[old_id]
        c_new.execute("""UPDATE casino_casino SET param_mobile=%s, param_browser=%s, 
        param_audited=%s, param_integrity=%s, param_license=%s, param_jackpot=%s, param_tournaments=%s, 
        param_nodepositbonus=%s WHERE id=%s""", (c.get("param_mobile", -1), c.get("param_browser", -1), 
        c.get("param_audited", -1), c.get("param_integrity", -1), c.get("param_license", -1), 
        c.get("param_jackpot", -1), c.get("param_tournaments", -1), c.get("param_nodepositbonus", -1), new_id))
        # new_id = c_new.fetchone()[0]

        '''
        #insert casino info record
        c_new.execute("""INSERT INTO casino_casinoinfo(casino_id, lang_id, name, image, description, 
        text, purl_main, purl_download, purl_bonus) VALUES(%s, 1, %s, %s, %s, %s, %s, '', '')""", 
        (new_id, c["name"], i["image"], i["description"], i["text"], i["purl_main"]))
        conn_new.commit()
        '''

        for payment_id in item["payments"]:
            #Add payment relates
            c_new.execute("""INSERT INTO casino_casinotopaymentsystem(casino_id, paymentsystem_id, type) 
            VALUES(%s, %s, %s)""", (new_id, payment_id, item["payments"][payment_id]))
        conn_new.commit()