示例#1
0
文件: db.py 项目: Jarcol/sicksubs
def get_sid(conn, tvdbid):
    with conn:
        c = conn.cursor()
        c.execute(u'''SELECT sid FROM sids WHERE tvdbid = ?''', (tvdbid,))
        result = c.fetchone()
        if not result:
            # not in db, we have to get it from bierdopje
            sid = bierdopje.get_show_id(tvdbid)
            if sid:
                c.execute(u'''INSERT INTO sids VALUES (?, ?)''', (tvdbid, sid))
            result = sid
        else:
            result = result[0]
        return result
示例#2
0
def update_tvdbids(sids, tvdbid):
    if tvdbid not in sids:
        sid = bierdopje.get_show_id(tvdbid)
        sids[tvdbid] = sid
    return sids