Exemplo n.º 1
0
def listSeriesByCategory(id):
    id = str(id)
    with dbConnect() as cursor:
        cursor.execute(
            "SELECT Name, Description FROM Series where Category LIKE ?",
            ("%" + id + ",%", ))
        return cursor.fetchall()
Exemplo n.º 2
0
def getCategoryIdByName(name):
    id_list = []
    for n in name:
        with dbConnect() as cursor:
            cursor.execute(
                'SELECT CategoryId FROM Category where Description = ?', (n, ))
            id_list.append(cursor.fetchone()[0])
    return id_list
Exemplo n.º 3
0
def addNewUser(data):
    with dbConnect() as cursor:
        cursor.execute(
            'Insert INTO User(Username,Password, Role) Values(?,?,?)', (
                data["Username"],
                data["Password"],
                data["Role"],
            ))
        return cursor.fetchall()
Exemplo n.º 4
0
def addNewSeries(data):
    with dbConnect() as cursor:
        cursor.execute(
            'INSERT INTO Series(Name,Description,Category) '
            'Values(?,?,?)', (
                data["Name"],
                data["Description"],
                data["Category"],
            ))
        print("Insert Successful")
        return cursor.fetchone()
Exemplo n.º 5
0
def addNewEpisode(data):
    with dbConnect() as cursor:
        cursor.execute(
            'INSERT INTO Episodes(Name,Description,Series,EpisodeNumber,SeasonNumber,FileLocation,DateAdded) '
            'Values(?,?,?,?,?,?,?)', (
                data["Name"],
                data["Description"],
                data["Series"],
                data["EpisodeNumber"],
                data["SeasonNumber"],
                data["FileLocation"],
                data["DateAdded"],
            ))
        return cursor.fetchall()
Exemplo n.º 6
0
def listAllCategories():
    with dbConnect() as cursor:
        cursor.execute('SELECT CategoryId,Description FROM Category')
        return cursor.fetchall()
Exemplo n.º 7
0
def addNewCategory(data):
    with dbConnect() as cursor:
        cursor.execute("INSERT INTO Category(Description) Values(?)",
                       (data["Description"], ))
Exemplo n.º 8
0
def getCategoryNameById(id):
    with dbConnect() as cursor:
        cursor.execute('SELECT Description FROM Category where CategoryId = ?',
                       (id, ))
        return cursor.fetchone()
Exemplo n.º 9
0
def getRoleIdFromName(name):
    with dbConnect() as cursor:
        cursor.execute('SELECT RoleId FROM Roles where Description = ?',
                       (name, ))
        return cursor.fetchall()
Exemplo n.º 10
0
def listAllRoles():
    with dbConnect() as cursor:
        cursor.execute('SELECT Description FROM Roles')
        return cursor.fetchall()
Exemplo n.º 11
0
def getSeriesIdByName(name):
    with dbConnect() as cursor:
        cursor.execute('SELECT SeriesId FROM Series where Name = ?', (name, ))
        return cursor.fetchone()
Exemplo n.º 12
0
def listAllSeries():
    with dbConnect() as cursor:
        cursor.execute('SELECT SeriesId, Name,Description FROM Series')
        return cursor.fetchall()
Exemplo n.º 13
0
def listAllUsers():
    with dbConnect() as cursor:
        cursor.execute('SELECT Username, Psssword FROM User')
        return cursor.fetchall()
Exemplo n.º 14
0
def listAllEpisodes():
    with dbConnect() as cursor:
        cursor.execute(
            'SELECT Name, Description,EpisodeNumber, SeasonNumber, FileLocation FROM Episodes'
        )
        return cursor.fetchall()
Exemplo n.º 15
0
def getEpisodeByEpisodeId(id):
    with dbConnect() as cursor:
        cursor.execute(
            "SELECT Name, Description,EpisodeNumber, SeasonNumber, FileLocation from Episodes WHERE EpisodeId = ?",
            (id, ))
        return cursor
Exemplo n.º 16
0
def listAllEpisodesBySeries(series):
    with dbConnect() as cursor:
        cursor.execute(
            "SELECT e.EpisodeId, e.Name, e.EpisodeNumber, e.SeasonNumber FROM Episodes e inner join Series s on s.SeriesId = e.Series where s.Name = ?",
            (series, ))
        return cursor.fetchall()
Exemplo n.º 17
0
def listRecentEpisodes():
    with dbConnect() as cursor:
        cursor.execute(
            'SELECT Name, Description,EpisodeNumber, SeasonNumber, FileLocation FROM Episodes ORDER BY DateAdded desc LIMIT 5'
        )
        return cursor.fetchall()
Exemplo n.º 18
0
def VerifyUser(un, ps):
    with dbConnect() as cursor:
        cursor.execute(
            'SELECT Username, Password, Role FROM User WHERE Username = ? and Password = ?',
            (un, ps))
        return cursor.fetchall()