Beispiel #1
0
    def updateUserContent(self,
                          user_id,
                          content_id,
                          completion_status=None,
                          owned=None,
                          user_rating=None):
        condition = "user_id = '{}' AND content_id = '{}'".format(
            user_id, content_id)
        settings = ""

        if completion_status == "on":
            settings += "completion_status = true,"
        else:
            settings += "completion_status = false,"

        if owned == "on":
            settings += "owned = true,"
        else:
            settings += "owned = false,"

        if user_rating is not None and user_rating != "":
            settings += "user_rating = '{}',".format(user_rating)

        if len(settings) > 0 and settings[-1] == ',':
            settings = settings[:-1]

        myDB.updateRows("user_content", settings, condition)
Beispiel #2
0
    def updateSeries(self,
                     series_id,
                     release_year=None,
                     language=None,
                     no_seasons=None,
                     imdb_id=None):
        condition = "series_id = '{}'".format(series_id)
        settings = ""

        if release_year is not None and release_year != "":
            settings += "release_year = '{}',".format(release_year)
        else:
            settings += "release_year = NULL,"

        if language is not None and language != "":
            language = language.replace("'", "''")
            settings += "language = '{}',".format(language)
        else:
            settings += "language = NULL,"

        if no_seasons is not None and no_seasons != "":
            settings += "no_seasons = '{}',".format(no_seasons)
        else:
            settings += "no_seasons = NULL,"

        if imdb_id is not None and imdb_id != "":
            imdb_id = imdb_id.replace("'", "''")
            settings += "imdb_id = '{}'".format(imdb_id)
        else:
            settings += "imdb_id = NULL"

        myDB.updateRows("series", settings, condition)
Beispiel #3
0
    def updateBook(self,
                   book_id,
                   author=None,
                   release_year=None,
                   language=None,
                   no_pages=None,
                   isbn=None):
        condition = "book_id = '{}'".format(book_id)
        settings = ""

        if author is not None and author != "":
            author = author.replace("'", "''")
            settings += "author = '{}',".format(author)
        else:
            settings += "author = NULL,"

        if release_year is not None and release_year != "":
            settings += "release_year = '{}',".format(release_year)
        else:
            settings += "release_year = NULL,"

        if language is not None and language != "":
            language = language.replace("'", "''")
            settings += "language = '{}',".format(language)
        else:
            settings += "language = NULL,"

        if no_pages is not None and no_pages != "":
            settings += "no_pages = '{}',".format(no_pages)
        else:
            settings += "no_pages = NULL,"

        if isbn is not None and isbn != "":
            isbn = isbn.replace("'", "''")
            settings += "isbn = '{}'".format(isbn)
        else:
            settings += "isbn = NULL"

        myDB.updateRows("book", settings, condition)
Beispiel #4
0
    def updateMovie(self,
                    movie_id,
                    director=None,
                    release_year=None,
                    language=None,
                    length=None,
                    imdb_id=None):
        condition = "movie_id = '{}'".format(movie_id)
        settings = ""

        if director is not None and director != "":
            director = director.replace("'", "''")
            settings += "director = '{}',".format(director)
        else:
            settings += "author = NULL,"

        if release_year is not None and release_year != "":
            settings += "release_year = '{}',".format(release_year)
        else:
            settings += "release_year = NULL,"

        if language is not None and language != "":
            language = language.replace("'", "''")
            settings += "language = '{}',".format(language)
        else:
            settings += "language = NULL,"

        if length is not None and length != "":
            settings += "length = '{}',".format(length)
        else:
            settings += "length = NULL,"

        if imdb_id is not None and imdb_id != "":
            imdb_id = imdb_id.replace("'", "''")
            settings += "imdb_id = '{}'".format(imdb_id)
        else:
            settings += "imdb_id = NULL"

        myDB.updateRows("movie", settings, condition)
Beispiel #5
0
    def updateContent(self, content_id, title):
        condition = "content_id = '{}'".format(content_id)
        title = title.replace("'", "''")
        settings = "title = '{}'".format(title)

        myDB.updateRows("content", settings, condition)