Ejemplo n.º 1
0
def getMovieTypes(col):
    common.waitforDB('movie')
    c = MovieDB.cursor()
    items = c.execute('select distinct %s from movies' % col)
    list = common.getTypes(items, col)
    c.close()
    return list
Ejemplo n.º 2
0
def getMovieTypes(col):
    common.waitforDB('movie')
    c = MovieDB.cursor()
    items = c.execute('select distinct %s from movies' % col)
    types = common.getTypes(items, col)
    c.close()
    return types
Ejemplo n.º 3
0
def getShowTypes(col):
    common.waitforDB('tv')
    c = tvDB.cursor()
    items = c.execute('select distinct %s from shows' % col)
    types = common.getTypes(items, col)
    c.close()
    return types
Ejemplo n.º 4
0
def getMovieTypes(col):
    common.waitforDB('movie')
    c = MovieDB.cursor()
    items = c.execute('select distinct %s from movies' % col)
    list = []
    lowlist = []
    for data in items:
        data = data[0]
        if type(data) == type(str()):
            if 'Rated' in data:
                item = data.split('for')[0]
                if item not in list and item <> '' and item <> 0 and item <> 'Inc.' and item <> 'LLC.':
                    list.append(item)
            else:
                if 'genres' in col: data = data.split('/')
                else: data = re.split(r'[,;/]', data)
                for item in data:
                    item = item.strip()
                    if item.lower() not in lowlist and item <> '' and item <> 0 and item <> 'Inc.' and item <> 'LLC.':
                        list.append(item)
                        lowlist.append(item.lower())
        elif data <> 0:
            if data is not None:
                list.append(str(data))
    c.close()
    return list
Ejemplo n.º 5
0
def lookupMoviedb(value,
                  rvalue='distinct *',
                  name='asin',
                  single=True,
                  exact=False,
                  table='movies'):
    common.waitforDB('movie')
    c = MovieDB.cursor()
    if not c.execute(
            'SELECT count(*) FROM sqlite_master WHERE type="table" AND name=(?)',
        (table, )).fetchone()[0]:
        return ''
    sqlstring = 'select %s from %s where %s ' % (rvalue, table, name)
    retlen = len(rvalue.split(','))
    if not exact:
        value = '%' + value + '%'
        sqlstring += 'like (?)'
    else:
        sqlstring += '= (?)'
    if c.execute(sqlstring, (value, )).fetchall():
        result = c.execute(sqlstring, (value, )).fetchall()
        if single:
            if len(result[0]) > 1:
                return result[0]
            return result[0][0]
        else:
            return result
    if (retlen < 2) and (single):
        return None
    return (None, ) * retlen
Ejemplo n.º 6
0
Archivo: tv.py Proyecto: WhileE/xbmc
def getShowTypes(col):
    common.waitforDB('tv')
    c = tvDB.cursor()
    items = c.execute('select distinct %s from shows' % col)
    l = common.getTypes(items, col)
    c.close()
    return l
Ejemplo n.º 7
0
def loadMoviedb(filter=False,value=False,sortcol=False):
    common.waitforDB('movie')
    c = MovieDB.cursor()
    if filter:
        value = '%' + value + '%'
        return c.execute('select distinct * from movies where %s like (?)' % filter, (value,))
    elif sortcol:
        return c.execute('select distinct * from movies where %s is not null order by %s asc' % (sortcol,sortcol))
    else:
        return c.execute('select distinct * from movies')
Ejemplo n.º 8
0
def loadTVShowdb(filter=False, value=False, sortcol=False):
    common.waitforDB('tv')
    c = tvDB.cursor()
    if filter:
        value = '%' + value + '%'
        return c.execute('select distinct * from shows where %s like (?)' % filter, (value,))
    elif sortcol:
        return c.execute('select distinct * from shows where %s is not null order by %s asc' % (sortcol, sortcol))
    else:
        return c.execute('select distinct * from shows')
Ejemplo n.º 9
0
Archivo: tv.py Proyecto: WhileE/xbmc
def loadTVShowdb(filterobj=None, value=None, sortcol=None):
    common.waitforDB('tv')
    c = tvDB.cursor()
    if filterobj:
        value = '%' + value + '%'
        return c.execute('select distinct * from shows where %s like (?)' % filterobj, (value,))
    elif sortcol:
        return c.execute('select distinct * from shows where %s is not null order by %s asc' % (sortcol, sortcol))
    else:
        return c.execute('select distinct * from shows')
Ejemplo n.º 10
0
Archivo: tv.py Proyecto: WhileE/xbmc
def loadTVSeasonsdb(seriesasin=None, sortcol=None, seasonasin=None):
    common.waitforDB('tv')
    c = tvDB.cursor()
    if seriesasin:
        return c.execute('select distinct * from seasons where seriesasin = (?)', (seriesasin,))
    if seasonasin:
        seasonasin = '%' + seasonasin + '%'
        return c.execute('select distinct * from seasons where asin like (?)', (seasonasin,))
    elif sortcol:
        return c.execute('select distinct * from seasons where %s is not null order by %s asc' % (sortcol, sortcol))
    else:
        return c.execute('select distinct * from seasons')
Ejemplo n.º 11
0
def loadTVSeasonsdb(seriesasin=False, sortcol=False, seasonasin=False):
    common.waitforDB('tv')
    c = tvDB.cursor()
    if seriesasin:
        return c.execute('select distinct * from seasons where seriesasin = (?)', (seriesasin,))
    if seasonasin:
        seasonasin = '%' + seasonasin + '%'
        return c.execute('select distinct * from seasons where asin like (?)', (seasonasin,))
    elif sortcol:
        return c.execute('select distinct * from seasons where %s is not null order by %s asc' % (sortcol, sortcol))
    else:
        return c.execute('select distinct * from seasons')
Ejemplo n.º 12
0
def loadMoviedb(movie_filter=False, value=False, sortcol=False):
    common.waitforDB('movie')
    c = MovieDB.cursor()
    if movie_filter:
        value = '%' + value + '%'
        return c.execute(
            'select distinct * from movies where %s like (?)' % movie_filter,
            (value, ))
    elif sortcol:
        return c.execute(
            'select distinct * from movies where %s is not null order by %s asc'
            % (sortcol, sortcol))
    else:
        return c.execute('select distinct * from movies')
Ejemplo n.º 13
0
Archivo: tv.py Proyecto: sbeatz/xbmc
def getShowTypes(col):
    common.waitforDB('tv')
    c = tvDB.cursor()
    items = c.execute('select distinct %s from shows' % col)
    list = []
    lowlist = []
    for data in items:
        if data and data[0] <> None:
            data = data[0]
            if type(data) == type(str()):
                if 'genres' in col: data = data.split('/')
                else: data = re.split(r'[,;/]', data)
                for item in data:
                    item = item.strip()
                    if item.lower() not in lowlist and item <> '' and item <> 0 and item <> 'Inc.' and item <> 'LLC.':
                        list.append(item)
                        lowlist.append(item.lower())
            else:
                list.append(str(data))
    c.close()
    return list
Ejemplo n.º 14
0
def lookupMoviedb(value, rvalue='distinct *', name='asin', single=True, exact=False):
    common.waitforDB('movie')
    c = MovieDB.cursor()
    sqlstring = 'select %s from movies where %s ' % (rvalue, name)
    retlen = len(rvalue.split(','))
    if not exact:
        value = '%' + value + '%'
        sqlstring += 'like (?)'
    else:
        sqlstring += '= (?)'
    if c.execute(sqlstring, (value,)).fetchall():
        result = c.execute(sqlstring, (value,)).fetchall()
        if single:
            if len(result[0]) > 1:
                return result[0]
            return result[0][0]
        else:
            return result
    if (retlen < 2) and (single):
        return None
    return (None,) * retlen
Ejemplo n.º 15
0
def lookupTVdb(value, rvalue='distinct *', tbl='episodes', name='asin', single=True, exact=False):
    common.waitforDB('tv')
    c = tvDB.cursor()
    if not c.execute('SELECT count(*) FROM sqlite_master WHERE type="table" AND name=(?)', (tbl,)).fetchone()[0]: return ''
    sqlstring = 'select %s from %s where %s ' % (rvalue, tbl, name)
    retlen = len(rvalue.split(','))
    if not exact:
        value = '%' + value + '%'
        sqlstring += 'like (?)'
    else:
        sqlstring += '= (?)'
    if c.execute(sqlstring, (value,)).fetchall():
        result = c.execute(sqlstring, (value,)).fetchall()
        if single:
            if len(result[0]) > 1:
                return result[0]
            return result[0][0]
        else:
            return result
    if (retlen < 2) and (single):
        return None
    return (None,) * retlen
Ejemplo n.º 16
0
Archivo: tv.py Proyecto: WhileE/xbmc
def loadTVEpisodesdb(seriestitle):
    common.waitforDB('tv')
    c = tvDB.cursor()
    return c.execute('select distinct * from episodes where seasonasin = (?) order by episode', (seriestitle,))
Ejemplo n.º 17
0
def loadTVEpisodesdb(seriestitle):
    common.waitforDB('tv')
    c = tvDB.cursor()
    return c.execute('select distinct * from episodes where seasonasin = (?) order by episode', (seriestitle,))