def local(items, link, poster, fanart):
    try:
        dbcon = database.connect(control.metaFile())
        dbcur = dbcon.cursor()
        args = [i['imdb'] for i in items]
        dbcur.execute('SELECT * FROM mv WHERE imdb IN (%s)'  % ', '.join(list(map(lambda arg:  "'%s'" % arg, args))))
        data = dbcur.fetchall()
    except:
        return items

    for i in range(0, len(items)):
        try:
            item = items[i]

            match = [x for x in data if x[1] == item['imdb']][0]

            try:
                if poster in item and not item[poster] == '0': raise Exception()
                if match[2] == '0': raise Exception()
                items[i].update({poster: link % ('300', '/%s.jpg' % match[2])})
            except:
                pass
            try:
                if fanart in item and not item[fanart] == '0': raise Exception()
                if match[3] == '0': raise Exception()
                items[i].update({fanart: link % ('1280', '/%s.jpg' % match[3])})
            except:
                pass
        except:
            pass

    return items
Esempio n. 2
0
def local(items, link, poster, fanart):
    try:
        dbcon = database.connect(control.metaFile())
        dbcur = dbcon.cursor()
        args = [i['imdb'] for i in items]
        dbcur.execute('SELECT * FROM mv WHERE imdb IN (%s)'  % ', '.join(list(map(lambda arg:  "'%s'" % arg, args))))
        data = dbcur.fetchall()
    except:
        return items

    for i in range(0, len(items)):
        try:
            item = items[i]

            match = [x for x in data if x[1] == item['imdb']][0]

            try:
                if poster in item and not item[poster] == '0': raise Exception()
                if match[2] == '0': raise Exception()
                items[i].update({poster: link % ('300', '/%s.jpg' % match[2])})
            except:
                pass
            try:
                if fanart in item and not item[fanart] == '0': raise Exception()
                if match[3] == '0': raise Exception()
                items[i].update({fanart: link % ('1280', '/%s.jpg' % match[3])})
            except:
                pass
        except:
            pass

    return items