Fix SQL indentation

This commit is contained in:
jellyfin-bot 2019-10-03 23:34:23 +02:00 committed by Odd Stråbø
parent 00765c0a12
commit 49cfb6cb51
4 changed files with 824 additions and 650 deletions

View file

@ -1,83 +1,99 @@
get_item = """ SELECT kodi_id, kodi_fileid, kodi_pathid, parent_id, media_type, get_item = """
jellyfin_type, media_folder, jellyfin_parent_id SELECT kodi_id, kodi_fileid, kodi_pathid, parent_id, media_type,
FROM jellyfin jellyfin_type, media_folder, jellyfin_parent_id
WHERE jellyfin_id = ? FROM jellyfin
""" WHERE jellyfin_id = ?
"""
get_item_obj = ["{Id}"] get_item_obj = ["{Id}"]
get_item_series_obj = ["{SeriesId}"] get_item_series_obj = ["{SeriesId}"]
get_item_song_obj = ["{SongAlbumId}"] get_item_song_obj = ["{SongAlbumId}"]
get_item_id_by_parent = """ SELECT jellyfin_id, kodi_id get_item_id_by_parent = """
FROM jellyfin SELECT jellyfin_id, kodi_id
WHERE parent_id = ? FROM jellyfin
AND media_type = ? WHERE parent_id = ?
""" AND media_type = ?
"""
get_item_id_by_parent_boxset_obj = ["{SetId}", "movie"] get_item_id_by_parent_boxset_obj = ["{SetId}", "movie"]
get_item_by_parent = """ SELECT jellyfin_id, kodi_id, kodi_fileid get_item_by_parent = """
FROM jellyfin SELECT jellyfin_id, kodi_id, kodi_fileid
WHERE parent_id = ? FROM jellyfin
AND media_type = ? WHERE parent_id = ?
""" AND media_type = ?
get_item_by_media_folder = """ SELECT jellyfin_id, jellyfin_type """
FROM jellyfin get_item_by_media_folder = """
WHERE media_folder = ? SELECT jellyfin_id, jellyfin_type
""" FROM jellyfin
WHERE media_folder = ?
"""
get_item_by_parent_movie_obj = ["{KodiId}", "movie"] get_item_by_parent_movie_obj = ["{KodiId}", "movie"]
get_item_by_parent_tvshow_obj = ["{ParentId}", "tvshow"] get_item_by_parent_tvshow_obj = ["{ParentId}", "tvshow"]
get_item_by_parent_season_obj = ["{ParentId}", "season"] get_item_by_parent_season_obj = ["{ParentId}", "season"]
get_item_by_parent_episode_obj = ["{ParentId}", "episode"] get_item_by_parent_episode_obj = ["{ParentId}", "episode"]
get_item_by_parent_album_obj = ["{ParentId}", "album"] get_item_by_parent_album_obj = ["{ParentId}", "album"]
get_item_by_parent_song_obj = ["{ParentId}", "song"] get_item_by_parent_song_obj = ["{ParentId}", "song"]
get_item_by_wild = """ SELECT kodi_id, media_type get_item_by_wild = """
FROM jellyfin SELECT kodi_id, media_type
WHERE jellyfin_id LIKE ? FROM jellyfin
""" WHERE jellyfin_id LIKE ?
"""
get_item_by_wild_obj = ["{Id}"] get_item_by_wild_obj = ["{Id}"]
get_item_by_kodi = """ SELECT jellyfin_id, parent_id, media_folder, jellyfin_type, checksum get_item_by_kodi = """
FROM jellyfin SELECT jellyfin_id, parent_id, media_folder, jellyfin_type, checksum
WHERE kodi_id = ? FROM jellyfin
AND media_type = ? WHERE kodi_id = ?
""" AND media_type = ?
get_checksum = """ SELECT jellyfin_id, checksum """
FROM jellyfin get_checksum = """
WHERE jellyfin_type = ? SELECT jellyfin_id, checksum
""" FROM jellyfin
get_view_name = """ SELECT view_name WHERE jellyfin_type = ?
FROM view """
WHERE view_id = ? get_view_name = """
""" SELECT view_name
get_media_by_id = """ SELECT jellyfin_type FROM view
FROM jellyfin WHERE view_id = ?
WHERE jellyfin_id = ? """
""" get_media_by_id = """
get_media_by_parent_id = """ SELECT jellyfin_id, jellyfin_type, kodi_id, kodi_fileid SELECT jellyfin_type
FROM jellyfin FROM jellyfin
WHERE jellyfin_parent_id = ? WHERE jellyfin_id = ?
""" """
get_view = """ SELECT view_name, media_type get_media_by_parent_id = """
FROM view SELECT jellyfin_id, jellyfin_type, kodi_id, kodi_fileid
WHERE view_id = ? FROM jellyfin
""" WHERE jellyfin_parent_id = ?
get_views = """ SELECT * """
FROM view get_view = """
""" SELECT view_name, media_type
get_views_by_media = """ SELECT * FROM view
FROM view WHERE view_id = ?
WHERE media_type = ? """
""" get_views = """
get_items_by_media = """ SELECT jellyfin_id SELECT *
FROM jellyfin FROM view
WHERE media_type = ? """
""" get_views_by_media = """
get_version = """ SELECT idVersion SELECT *
FROM version FROM view
""" WHERE media_type = ?
"""
get_items_by_media = """
SELECT jellyfin_id
FROM jellyfin
WHERE media_type = ?
"""
get_version = """
SELECT idVersion
FROM version
"""
add_reference = """ INSERT OR REPLACE INTO jellyfin(jellyfin_id, kodi_id, kodi_fileid, kodi_pathid, jellyfin_type, add_reference = """
media_type, parent_id, checksum, media_folder, jellyfin_parent_id) INSERT OR REPLACE INTO jellyfin(jellyfin_id, kodi_id, kodi_fileid, kodi_pathid, jellyfin_type,
VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?) media_type, parent_id, checksum, media_folder, jellyfin_parent_id)
""" VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?)
"""
add_reference_movie_obj = ["{Id}", "{MovieId}", "{FileId}", "{PathId}", "Movie", "movie", None, "{Checksum}", "{LibraryId}", "{JellyfinParentId}"] add_reference_movie_obj = ["{Id}", "{MovieId}", "{FileId}", "{PathId}", "Movie", "movie", None, "{Checksum}", "{LibraryId}", "{JellyfinParentId}"]
add_reference_boxset_obj = ["{Id}", "{SetId}", None, None, "BoxSet", "set", None, "{Checksum}", None, None] add_reference_boxset_obj = ["{Id}", "{SetId}", None, None, "BoxSet", "set", None, "{Checksum}", None, None]
add_reference_tvshow_obj = ["{Id}", "{ShowId}", None, "{PathId}", "Series", "tvshow", None, "{Checksum}", "{LibraryId}", "{JellyfinParentId}"] add_reference_tvshow_obj = ["{Id}", "{ShowId}", None, "{PathId}", "Series", "tvshow", None, "{Checksum}", "{LibraryId}", "{JellyfinParentId}"]
@ -88,55 +104,66 @@ add_reference_mvideo_obj = ["{Id}", "{MvideoId}", "{FileId}", "{PathId}", "Music
add_reference_artist_obj = ["{Id}", "{ArtistId}", None, None, "{ArtistType}", "artist", None, "{Checksum}", "{LibraryId}", "{JellyfinParentId}"] add_reference_artist_obj = ["{Id}", "{ArtistId}", None, None, "{ArtistType}", "artist", None, "{Checksum}", "{LibraryId}", "{JellyfinParentId}"]
add_reference_album_obj = ["{Id}", "{AlbumId}", None, None, "MusicAlbum", "album", None, "{Checksum}", None, "{JellyfinParentId}"] add_reference_album_obj = ["{Id}", "{AlbumId}", None, None, "MusicAlbum", "album", None, "{Checksum}", None, "{JellyfinParentId}"]
add_reference_song_obj = ["{Id}", "{SongId}", None, "{PathId}", "Audio", "song", "{AlbumId}", "{Checksum}", None, "{JellyfinParentId}"] add_reference_song_obj = ["{Id}", "{SongId}", None, "{PathId}", "Audio", "song", "{AlbumId}", "{Checksum}", None, "{JellyfinParentId}"]
add_view = """ INSERT OR REPLACE INTO view(view_id, view_name, media_type) add_view = """
VALUES (?, ?, ?) INSERT OR REPLACE INTO view(view_id, view_name, media_type)
""" VALUES (?, ?, ?)
add_version = """ INSERT OR REPLACE INTO version(idVersion) """
VALUES (?) add_version = """
""" INSERT OR REPLACE INTO version(idVersion)
VALUES (?)
"""
update_reference = """ UPDATE jellyfin update_reference = """
SET checksum = ? UPDATE jellyfin
WHERE jellyfin_id = ? SET checksum = ?
""" WHERE jellyfin_id = ?
"""
update_reference_obj = ["{Checksum}", "{Id}"] update_reference_obj = ["{Checksum}", "{Id}"]
update_parent = """ UPDATE jellyfin update_parent = """
SET parent_id = ? UPDATE jellyfin
WHERE jellyfin_id = ? SET parent_id = ?
""" WHERE jellyfin_id = ?
"""
update_parent_movie_obj = ["{SetId}", "{Id}"] update_parent_movie_obj = ["{SetId}", "{Id}"]
update_parent_episode_obj = ["{SeasonId}", "{Id}"] update_parent_episode_obj = ["{SeasonId}", "{Id}"]
update_parent_album_obj = ["{ArtistId}", "{AlbumId}"] update_parent_album_obj = ["{ArtistId}", "{AlbumId}"]
delete_item = """ DELETE FROM jellyfin delete_item = """
WHERE jellyfin_id = ? DELETE FROM jellyfin
""" WHERE jellyfin_id = ?
"""
delete_item_obj = ["{Id}"] delete_item_obj = ["{Id}"]
delete_item_by_parent = """ DELETE FROM jellyfin delete_item_by_parent = """
WHERE parent_id = ? DELETE FROM jellyfin
AND media_type = ? WHERE parent_id = ?
""" AND media_type = ?
"""
delete_item_by_parent_tvshow_obj = ["{ParentId}", "tvshow"] delete_item_by_parent_tvshow_obj = ["{ParentId}", "tvshow"]
delete_item_by_parent_season_obj = ["{ParentId}", "season"] delete_item_by_parent_season_obj = ["{ParentId}", "season"]
delete_item_by_parent_episode_obj = ["{ParentId}", "episode"] delete_item_by_parent_episode_obj = ["{ParentId}", "episode"]
delete_item_by_parent_song_obj = ["{ParentId}", "song"] delete_item_by_parent_song_obj = ["{ParentId}", "song"]
delete_item_by_parent_artist_obj = ["{ParentId}", "artist"] delete_item_by_parent_artist_obj = ["{ParentId}", "artist"]
delete_item_by_parent_album_obj = ["{KodiId}", "album"] delete_item_by_parent_album_obj = ["{KodiId}", "album"]
delete_item_by_kodi = """ DELETE FROM jellyfin delete_item_by_kodi = """
WHERE kodi_id = ? DELETE FROM jellyfin
AND media_type = ? WHERE kodi_id = ?
""" AND media_type = ?
delete_item_by_wild = """ DELETE FROM jellyfin """
WHERE jellyfin_id LIKE ? delete_item_by_wild = """
""" DELETE FROM jellyfin
delete_view = """ DELETE FROM view WHERE jellyfin_id LIKE ?
WHERE view_id = ? """
""" delete_view = """
DELETE FROM view
WHERE view_id = ?
"""
delete_parent_boxset_obj = [None, "{Movie}"] delete_parent_boxset_obj = [None, "{Movie}"]
delete_media_by_parent_id = """ DELETE FROM jellyfin delete_media_by_parent_id = """
WHERE jellyfin_parent_id = ? DELETE FROM jellyfin
""" WHERE jellyfin_parent_id = ?
delete_version = """ DELETE FROM version """
""" delete_version = """
DELETE FROM version
"""

View file

@ -3,467 +3,564 @@
Some functions require additional information, therefore obj do not always reflect Some functions require additional information, therefore obj do not always reflect
the Kodi database query values. the Kodi database query values.
''' '''
create_path = """ SELECT coalesce(max(idPath), 0) create_path = """
FROM path SELECT coalesce(max(idPath), 0)
""" FROM path
create_file = """ SELECT coalesce(max(idFile), 0) """
FROM files create_file = """
""" SELECT coalesce(max(idFile), 0)
create_person = """ SELECT coalesce(max(actor_id), 0) FROM files
FROM actor """
""" create_person = """
create_genre = """ SELECT coalesce(max(genre_id), 0) SELECT coalesce(max(actor_id), 0)
FROM genre FROM actor
""" """
create_studio = """ SELECT coalesce(max(studio_id), 0) create_genre = """
FROM studio SELECT coalesce(max(genre_id), 0)
""" FROM genre
create_bookmark = """ SELECT coalesce(max(idBookmark), 0) """
FROM bookmark create_studio = """
""" SELECT coalesce(max(studio_id), 0)
create_tag = """ SELECT coalesce(max(tag_id), 0) FROM studio
FROM tag """
""" create_bookmark = """
create_unique_id = """ SELECT coalesce(max(uniqueid_id), 0) SELECT coalesce(max(idBookmark), 0)
FROM uniqueid FROM bookmark
""" """
create_rating = """ SELECT coalesce(max(rating_id), 0) create_tag = """
FROM rating SELECT coalesce(max(tag_id), 0)
""" FROM tag
create_movie = """ SELECT coalesce(max(idMovie), 0) """
FROM movie create_unique_id = """
""" SELECT coalesce(max(uniqueid_id), 0)
create_set = """ SELECT coalesce(max(idSet), 0) FROM uniqueid
FROM sets """
""" create_rating = """
create_country = """ SELECT coalesce(max(country_id), 0) SELECT coalesce(max(rating_id), 0)
FROM country FROM rating
""" """
create_musicvideo = """ SELECT coalesce(max(idMVideo), 0) create_movie = """
FROM musicvideo SELECT coalesce(max(idMovie), 0)
""" FROM movie
create_tvshow = """ SELECT coalesce(max(idShow), 0) """
FROM tvshow create_set = """
""" SELECT coalesce(max(idSet), 0)
create_season = """ SELECT coalesce(max(idSeason), 0) FROM sets
FROM seasons """
""" create_country = """
create_episode = """ SELECT coalesce(max(idEpisode), 0) SELECT coalesce(max(country_id), 0)
FROM episode FROM country
""" """
create_musicvideo = """
SELECT coalesce(max(idMVideo), 0)
FROM musicvideo
"""
create_tvshow = """
SELECT coalesce(max(idShow), 0)
FROM tvshow
"""
create_season = """
SELECT coalesce(max(idSeason), 0)
FROM seasons
"""
create_episode = """
SELECT coalesce(max(idEpisode), 0)
FROM episode
"""
get_path = """ SELECT idPath get_path = """
FROM path SELECT idPath
WHERE strPath = ? FROM path
""" WHERE strPath = ?
"""
get_path_obj = ["{Path}"] get_path_obj = ["{Path}"]
get_file = """ SELECT idFile get_file = """
FROM files SELECT idFile
WHERE idPath = ? FROM files
AND strFilename = ? WHERE idPath = ?
""" AND strFilename = ?
"""
get_file_obj = ["{FileId}"] get_file_obj = ["{FileId}"]
get_filename = """ SELECT strFilename get_filename = """
FROM files SELECT strFilename
WHERE idFile = ? FROM files
""" WHERE idFile = ?
get_person = """ SELECT actor_id """
FROM actor get_person = """
WHERE name = ? SELECT actor_id
COLLATE NOCASE FROM actor
""" WHERE name = ?
get_genre = """ SELECT genre_id COLLATE NOCASE
FROM genre """
WHERE name = ? get_genre = """
COLLATE NOCASE SELECT genre_id
""" FROM genre
get_studio = """ SELECT studio_id WHERE name = ?
FROM studio COLLATE NOCASE
WHERE name = ? """
COLLATE NOCASE get_studio = """
""" SELECT studio_id
get_tag = """ SELECT tag_id FROM studio
FROM tag WHERE name = ?
WHERE name = ? COLLATE NOCASE
COLLATE NOCASE """
""" get_tag = """
SELECT tag_id
FROM tag
WHERE name = ?
COLLATE NOCASE
"""
get_tag_movie_obj = ["Favorite movies", "{MovieId}", "movie"] get_tag_movie_obj = ["Favorite movies", "{MovieId}", "movie"]
get_tag_mvideo_obj = ["Favorite musicvideos", "{MvideoId}", "musicvideo"] get_tag_mvideo_obj = ["Favorite musicvideos", "{MvideoId}", "musicvideo"]
get_tag_episode_obj = ["Favorite tvshows", "{KodiId}", "tvshow"] get_tag_episode_obj = ["Favorite tvshows", "{KodiId}", "tvshow"]
get_art = """ SELECT url get_art = """
FROM art SELECT url
WHERE media_id = ? FROM art
AND media_type = ? WHERE media_id = ?
AND type = ? AND media_type = ?
""" AND type = ?
get_movie = """ SELECT * """
FROM movie get_movie = """
WHERE idMovie = ? SELECT *
""" FROM movie
WHERE idMovie = ?
"""
get_movie_obj = ["{MovieId}"] get_movie_obj = ["{MovieId}"]
get_rating = """ SELECT rating_id get_rating = """
FROM rating SELECT rating_id
WHERE media_type = ? FROM rating
AND media_id = ? WHERE media_type = ?
""" AND media_id = ?
"""
get_rating_movie_obj = ["movie", "{MovieId}"] get_rating_movie_obj = ["movie", "{MovieId}"]
get_rating_episode_obj = ["episode", "{EpisodeId}"] get_rating_episode_obj = ["episode", "{EpisodeId}"]
get_unique_id = """ SELECT uniqueid_id get_unique_id = """
FROM uniqueid SELECT uniqueid_id
WHERE media_type = ? FROM uniqueid
AND media_id = ? WHERE media_type = ?
""" AND media_id = ?
"""
get_unique_id_movie_obj = ["movie", "{MovieId}"] get_unique_id_movie_obj = ["movie", "{MovieId}"]
get_unique_id_tvshow_obj = ["tvshow", "{ShowId}"] get_unique_id_tvshow_obj = ["tvshow", "{ShowId}"]
get_unique_id_episode_obj = ["episode", "{EpisodeId}"] get_unique_id_episode_obj = ["episode", "{EpisodeId}"]
get_country = """ SELECT country_id get_country = """
FROM country SELECT country_id
WHERE name = ? FROM country
COLLATE NOCASE WHERE name = ?
""" COLLATE NOCASE
get_set = """ SELECT idSet """
FROM sets get_set = """
WHERE strSet = ? SELECT idSet
COLLATE NOCASE FROM sets
""" WHERE strSet = ?
get_musicvideo = """ SELECT * COLLATE NOCASE
FROM musicvideo """
WHERE idMVideo = ? get_musicvideo = """
""" SELECT *
FROM musicvideo
WHERE idMVideo = ?
"""
get_musicvideo_obj = ["{MvideoId}"] get_musicvideo_obj = ["{MvideoId}"]
get_tvshow = """ SELECT * get_tvshow = """
FROM tvshow SELECT *
WHERE idShow = ? FROM tvshow
""" WHERE idShow = ?
"""
get_tvshow_obj = ["{ShowId}"] get_tvshow_obj = ["{ShowId}"]
get_episode = """ SELECT * get_episode = """
FROM episode SELECT *
WHERE idEpisode = ? FROM episode
""" WHERE idEpisode = ?
"""
get_episode_obj = ["{EpisodeId}"] get_episode_obj = ["{EpisodeId}"]
get_season = """ SELECT idSeason get_season = """
FROM seasons SELECT idSeason
WHERE idShow = ? FROM seasons
AND season = ? WHERE idShow = ?
""" AND season = ?
"""
get_season_obj = ["{Title}", "{ShowId}", "{Index}"] get_season_obj = ["{Title}", "{ShowId}", "{Index}"]
get_season_special_obj = [None, "{ShowId}", -1] get_season_special_obj = [None, "{ShowId}", -1]
get_season_episode_obj = [None, "{ShowId}", "{Season}"] get_season_episode_obj = [None, "{ShowId}", "{Season}"]
get_backdrops = """ SELECT url get_backdrops = """
FROM art SELECT url
WHERE media_id = ? FROM art
AND media_type = ? WHERE media_id = ?
AND type LIKE ? AND media_type = ?
""" AND type LIKE ?
get_art = """ SELECT url """
FROM art get_art = """
WHERE media_id = ? SELECT url
AND media_type = ? FROM art
AND type = ? WHERE media_id = ?
""" AND media_type = ?
get_art_url = """ SELECT url, type AND type = ?
FROM art """
WHERE media_id = ? get_art_url = """
AND media_type = ? SELECT url, type
""" FROM art
get_show_by_unique_id = """ SELECT idShow WHERE media_id = ?
FROM tvshow_view AND media_type = ?
WHERE uniqueid_value = ? """
""" get_show_by_unique_id = """
SELECT idShow
FROM tvshow_view
WHERE uniqueid_value = ?
"""
get_total_episodes = """ SELECT totalCount get_total_episodes = """
FROM tvshowcounts SELECT totalCount
WHERE idShow = ? FROM tvshowcounts
""" WHERE idShow = ?
"""
get_total_episodes_obj = ["{ParentId}"] get_total_episodes_obj = ["{ParentId}"]
add_path = """ INSERT INTO path(idPath, strPath) add_path = """
VALUES (?, ?) INSERT INTO path(idPath, strPath)
""" VALUES (?, ?)
"""
add_path_obj = ["{Path}"] add_path_obj = ["{Path}"]
add_file = """ INSERT INTO files(idFile, idPath, strFilename) add_file = """
VALUES (?, ?, ?) INSERT INTO files(idFile, idPath, strFilename)
""" VALUES (?, ?, ?)
"""
add_file_obj = ["{PathId}", "{Filename}"] add_file_obj = ["{PathId}", "{Filename}"]
add_person = """ INSERT INTO actor(actor_id, name) add_person = """
VALUES (?, ?) INSERT INTO actor(actor_id, name)
""" VALUES (?, ?)
"""
add_people_movie_obj = ["{People}", "{MovieId}", "movie"] add_people_movie_obj = ["{People}", "{MovieId}", "movie"]
add_people_mvideo_obj = ["{People}", "{MvideoId}", "musicvideo"] add_people_mvideo_obj = ["{People}", "{MvideoId}", "musicvideo"]
add_people_tvshow_obj = ["{People}", "{ShowId}", "tvshow"] add_people_tvshow_obj = ["{People}", "{ShowId}", "tvshow"]
add_people_episode_obj = ["{People}", "{EpisodeId}", "episode"] add_people_episode_obj = ["{People}", "{EpisodeId}", "episode"]
add_actor_link = """ INSERT INTO actor_link(actor_id, media_id, media_type, role, cast_order) add_actor_link = """
VALUES (?, ?, ?, ?, ?) INSERT INTO actor_link(actor_id, media_id, media_type, role, cast_order)
""" VALUES (?, ?, ?, ?, ?)
add_link = """ INSERT INTO {LinkType}(actor_id, media_id, media_type) """
VALUES (?, ?, ?) add_link = """
""" INSERT INTO {LinkType}(actor_id, media_id, media_type)
add_genre = """ INSERT INTO genre(genre_id, name) VALUES (?, ?, ?)
VALUES (?, ?) """
""" add_genre = """
INSERT INTO genre(genre_id, name)
VALUES (?, ?)
"""
add_genres_movie_obj = ["{Genres}", "{MovieId}", "movie"] add_genres_movie_obj = ["{Genres}", "{MovieId}", "movie"]
add_genres_mvideo_obj = ["{Genres}", "{MvideoId}", "musicvideo"] add_genres_mvideo_obj = ["{Genres}", "{MvideoId}", "musicvideo"]
add_genres_tvshow_obj = ["{Genres}", "{ShowId}", "tvshow"] add_genres_tvshow_obj = ["{Genres}", "{ShowId}", "tvshow"]
add_studio = """ INSERT INTO studio(studio_id, name) add_studio = """
VALUES (?, ?) INSERT INTO studio(studio_id, name)
""" VALUES (?, ?)
"""
add_studios_movie_obj = ["{Studios}", "{MovieId}", "movie"] add_studios_movie_obj = ["{Studios}", "{MovieId}", "movie"]
add_studios_mvideo_obj = ["{Studios}", "{MvideoId}", "musicvideo"] add_studios_mvideo_obj = ["{Studios}", "{MvideoId}", "musicvideo"]
add_studios_tvshow_obj = ["{Studios}", "{ShowId}", "tvshow"] add_studios_tvshow_obj = ["{Studios}", "{ShowId}", "tvshow"]
add_bookmark = """ INSERT INTO bookmark(idBookmark, idFile, timeInSeconds, totalTimeInSeconds, player, type) add_bookmark = """
VALUES (?, ?, ?, ?, ?, ?) INSERT INTO bookmark(idBookmark, idFile, timeInSeconds, totalTimeInSeconds, player, type)
""" VALUES (?, ?, ?, ?, ?, ?)
"""
add_bookmark_obj = ["{FileId}", "{PlayCount}", "{DatePlayed}", "{Resume}", "{Runtime}", "DVDPlayer", 1] add_bookmark_obj = ["{FileId}", "{PlayCount}", "{DatePlayed}", "{Resume}", "{Runtime}", "DVDPlayer", 1]
add_streams_obj = ["{FileId}", "{Streams}", "{Runtime}"] add_streams_obj = ["{FileId}", "{Streams}", "{Runtime}"]
add_stream_video = """ INSERT INTO streamdetails(idFile, iStreamType, strVideoCodec, fVideoAspect, iVideoWidth, add_stream_video = """
iVideoHeight, iVideoDuration, strStereoMode) INSERT INTO streamdetails(idFile, iStreamType, strVideoCodec, fVideoAspect, iVideoWidth,
VALUES (?, ?, ?, ?, ?, ?, ?, ?) iVideoHeight, iVideoDuration, strStereoMode)
""" VALUES (?, ?, ?, ?, ?, ?, ?, ?)
"""
add_stream_video_obj = ["{FileId}", 0, "{codec}", "{aspect}", "{width}", "{height}", "{Runtime}", "{3d}"] add_stream_video_obj = ["{FileId}", 0, "{codec}", "{aspect}", "{width}", "{height}", "{Runtime}", "{3d}"]
add_stream_audio = """ INSERT INTO streamdetails(idFile, iStreamType, strAudioCodec, iAudioChannels, strAudioLanguage) add_stream_audio = """
VALUES (?, ?, ?, ?, ?) INSERT INTO streamdetails(idFile, iStreamType, strAudioCodec, iAudioChannels, strAudioLanguage)
""" VALUES (?, ?, ?, ?, ?)
"""
add_stream_audio_obj = ["{FileId}", 1, "{codec}", "{channels}", "{language}"] add_stream_audio_obj = ["{FileId}", 1, "{codec}", "{channels}", "{language}"]
add_stream_sub = """ INSERT INTO streamdetails(idFile, iStreamType, strSubtitleLanguage) add_stream_sub = """
VALUES (?, ?, ?) INSERT INTO streamdetails(idFile, iStreamType, strSubtitleLanguage)
""" VALUES (?, ?, ?)
"""
add_stream_sub_obj = ["{FileId}", 2, "{language}"] add_stream_sub_obj = ["{FileId}", 2, "{language}"]
add_tag = """ INSERT INTO tag(tag_id, name) add_tag = """
VALUES (?, ?) INSERT INTO tag(tag_id, name)
""" VALUES (?, ?)
"""
add_tags_movie_obj = ["{Tags}", "{MovieId}", "movie"] add_tags_movie_obj = ["{Tags}", "{MovieId}", "movie"]
add_tags_mvideo_obj = ["{Tags}", "{MvideoId}", "musicvideo"] add_tags_mvideo_obj = ["{Tags}", "{MvideoId}", "musicvideo"]
add_tags_tvshow_obj = ["{Tags}", "{ShowId}", "tvshow"] add_tags_tvshow_obj = ["{Tags}", "{ShowId}", "tvshow"]
add_art = """ INSERT INTO art(media_id, media_type, type, url) add_art = """
VALUES (?, ?, ?, ?) INSERT INTO art(media_id, media_type, type, url)
""" VALUES (?, ?, ?, ?)
add_movie = """ INSERT INTO movie(idMovie, idFile, c00, c01, c02, c03, c04, c05, c06, c07, """
c09, c10, c11, c12, c14, c15, c16, c18, c19, c21, userrating, premiered) add_movie = """
VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?) INSERT INTO movie(idMovie, idFile, c00, c01, c02, c03, c04, c05, c06, c07,
""" c09, c10, c11, c12, c14, c15, c16, c18, c19, c21, userrating, premiered)
VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)
"""
add_movie_obj = ["{MovieId}", "{FileId}", "{Title}", "{Plot}", "{ShortPlot}", "{Tagline}", add_movie_obj = ["{MovieId}", "{FileId}", "{Title}", "{Plot}", "{ShortPlot}", "{Tagline}",
"{Votes}", "{RatingId}", "{Writers}", "{Year}", "{Unique}", "{SortTitle}", "{Votes}", "{RatingId}", "{Writers}", "{Year}", "{Unique}", "{SortTitle}",
"{Runtime}", "{Mpaa}", "{Genre}", "{Directors}", "{Title}", "{Studio}", "{Runtime}", "{Mpaa}", "{Genre}", "{Directors}", "{Title}", "{Studio}",
"{Trailer}", "{Country}", "{CriticRating}", "{Year}"] "{Trailer}", "{Country}", "{CriticRating}", "{Year}"]
add_rating = """ INSERT INTO rating(rating_id, media_id, media_type, rating_type, rating, votes) add_rating = """
VALUES (?, ?, ?, ?, ?, ?) INSERT INTO rating(rating_id, media_id, media_type, rating_type, rating, votes)
""" VALUES (?, ?, ?, ?, ?, ?)
"""
add_rating_movie_obj = ["{RatingId}", "{MovieId}", "movie", "default", "{Rating}", "{Votes}"] add_rating_movie_obj = ["{RatingId}", "{MovieId}", "movie", "default", "{Rating}", "{Votes}"]
add_rating_tvshow_obj = ["{RatingId}", "{ShowId}", "tvshow", "default", "{Rating}", "{Votes}"] add_rating_tvshow_obj = ["{RatingId}", "{ShowId}", "tvshow", "default", "{Rating}", "{Votes}"]
add_rating_episode_obj = ["{RatingId}", "{EpisodeId}", "episode", "default", "{Rating}", "{Votes}"] add_rating_episode_obj = ["{RatingId}", "{EpisodeId}", "episode", "default", "{Rating}", "{Votes}"]
add_unique_id = """ INSERT INTO uniqueid(uniqueid_id, media_id, media_type, value, type) add_unique_id = """
VALUES (?, ?, ?, ?, ?) INSERT INTO uniqueid(uniqueid_id, media_id, media_type, value, type)
""" VALUES (?, ?, ?, ?, ?)
"""
add_unique_id_movie_obj = ["{Unique}", "{MovieId}", "movie", "{UniqueId}", "{ProviderName}"] add_unique_id_movie_obj = ["{Unique}", "{MovieId}", "movie", "{UniqueId}", "{ProviderName}"]
add_unique_id_tvshow_obj = ["{Unique}", "{ShowId}", "tvshow", "{UniqueId}", "{ProviderName}"] add_unique_id_tvshow_obj = ["{Unique}", "{ShowId}", "tvshow", "{UniqueId}", "{ProviderName}"]
add_unique_id_episode_obj = ["{Unique}", "{EpisodeId}", "episode", "{UniqueId}", "{ProviderName}"] add_unique_id_episode_obj = ["{Unique}", "{EpisodeId}", "episode", "{UniqueId}", "{ProviderName}"]
add_country = """ INSERT INTO country(country_id, name) add_country = """
VALUES (?, ?) INSERT INTO country(country_id, name)
""" VALUES (?, ?)
add_set = """ INSERT INTO sets(idSet, strSet, strOverview) """
VALUES (?, ?, ?) add_set = """
""" INSERT INTO sets(idSet, strSet, strOverview)
VALUES (?, ?, ?)
"""
add_set_obj = ["{Title}", "{Overview}"] add_set_obj = ["{Title}", "{Overview}"]
add_musicvideo = """ INSERT INTO musicvideo(idMVideo, idFile, c00, c04, c05, c06, c07, c08, c09, c10, add_musicvideo = """
c11, c12, premiered) INSERT INTO musicvideo(idMVideo, idFile, c00, c04, c05, c06, c07, c08, c09, c10,
VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?) c11, c12, premiered)
""" VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)
"""
add_musicvideo_obj = ["{MvideoId}", "{FileId}", "{Title}", "{Runtime}", "{Directors}", "{Studio}", "{Year}", add_musicvideo_obj = ["{MvideoId}", "{FileId}", "{Title}", "{Runtime}", "{Directors}", "{Studio}", "{Year}",
"{Plot}", "{Album}", "{Artists}", "{Genre}", "{Index}", "{Premiere}"] "{Plot}", "{Album}", "{Artists}", "{Genre}", "{Index}", "{Premiere}"]
add_tvshow = """ INSERT INTO tvshow(idShow, c00, c01, c02, c04, c05, c08, c09, c10, c12, c13, c14, c15) add_tvshow = """
VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?) INSERT INTO tvshow(idShow, c00, c01, c02, c04, c05, c08, c09, c10, c12, c13, c14, c15)
""" VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)
"""
add_tvshow_obj = ["{ShowId}", "{Title}", "{Plot}", "{Status}", "{RatingId}", "{Premiere}", "{Genre}", "{Title}", add_tvshow_obj = ["{ShowId}", "{Title}", "{Plot}", "{Status}", "{RatingId}", "{Premiere}", "{Genre}", "{Title}",
"disintegrate browse bug", "{Unique}", "{Mpaa}", "{Studio}", "{SortTitle}"] "disintegrate browse bug", "{Unique}", "{Mpaa}", "{Studio}", "{SortTitle}"]
add_season = """ INSERT INTO seasons(idSeason, idShow, season) add_season = """
VALUES (?, ?, ?) INSERT INTO seasons(idSeason, idShow, season)
""" VALUES (?, ?, ?)
add_episode = """ INSERT INTO episode(idEpisode, idFile, c00, c01, c03, c04, c05, c09, c10, c12, c13, c14, """
idShow, c15, c16, idSeason) add_episode = """
VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?) INSERT INTO episode(idEpisode, idFile, c00, c01, c03, c04, c05, c09, c10, c12, c13, c14,
""" idShow, c15, c16, idSeason)
VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)
"""
add_episode_obj = ["{EpisodeId}", "{FileId}", "{Title}", "{Plot}", "{RatingId}", "{Writers}", "{Premiere}", "{Runtime}", add_episode_obj = ["{EpisodeId}", "{FileId}", "{Title}", "{Plot}", "{RatingId}", "{Writers}", "{Premiere}", "{Runtime}",
"{Directors}", "{Season}", "{Index}", "{Title}", "{ShowId}", "{AirsBeforeSeason}", "{Directors}", "{Season}", "{Index}", "{Title}", "{ShowId}", "{AirsBeforeSeason}",
"{AirsBeforeEpisode}", "{SeasonId}"] "{AirsBeforeEpisode}", "{SeasonId}"]
add_art = """ INSERT INTO art(media_id, media_type, type, url) add_art = """
VALUES (?, ?, ?, ?) INSERT INTO art(media_id, media_type, type, url)
""" VALUES (?, ?, ?, ?)
"""
update_path = """ UPDATE path update_path = """
SET strPath = ?, strContent = ?, strScraper = ?, noUpdate = ? UPDATE path
WHERE idPath = ? SET strPath = ?, strContent = ?, strScraper = ?, noUpdate = ?
""" WHERE idPath = ?
"""
update_path_movie_obj = ["{Path}", "movies", "metadata.local", 1, "{PathId}"] update_path_movie_obj = ["{Path}", "movies", "metadata.local", 1, "{PathId}"]
update_path_toptvshow_obj = ["{TopLevel}", "tvshows", "metadata.local", 1, "{TopPathId}"] update_path_toptvshow_obj = ["{TopLevel}", "tvshows", "metadata.local", 1, "{TopPathId}"]
update_path_tvshow_obj = ["{Path}", None, None, 1, "{PathId}"] update_path_tvshow_obj = ["{Path}", None, None, 1, "{PathId}"]
update_path_episode_obj = ["{Path}", None, None, 1, "{PathId}"] update_path_episode_obj = ["{Path}", None, None, 1, "{PathId}"]
update_path_mvideo_obj = ["{Path}", "musicvideos", None, 1, "{PathId}"] update_path_mvideo_obj = ["{Path}", "musicvideos", None, 1, "{PathId}"]
update_file = """ UPDATE files update_file = """
SET idPath = ?, strFilename = ?, dateAdded = ? UPDATE files
WHERE idFile = ? SET idPath = ?, strFilename = ?, dateAdded = ?
""" WHERE idFile = ?
"""
update_file_obj = ["{PathId}", "{Filename}", "{DateAdded}", "{FileId}"] update_file_obj = ["{PathId}", "{Filename}", "{DateAdded}", "{FileId}"]
update_genres = """ INSERT OR REPLACE INTO genre_link(genre_id, media_id, media_type) update_genres = """
VALUES (?, ?, ?) INSERT OR REPLACE INTO genre_link(genre_id, media_id, media_type)
""" VALUES (?, ?, ?)
update_studios = """ INSERT OR REPLACE INTO studio_link(studio_id, media_id, media_type) """
VALUES (?, ?, ?) update_studios = """
""" INSERT OR REPLACE INTO studio_link(studio_id, media_id, media_type)
update_playcount = """ UPDATE files VALUES (?, ?, ?)
SET playCount = ?, lastPlayed = ? """
WHERE idFile = ? update_playcount = """
""" UPDATE files
update_tag = """ INSERT OR REPLACE INTO tag_link(tag_id, media_id, media_type) SET playCount = ?, lastPlayed = ?
VALUES (?, ?, ?) WHERE idFile = ?
""" """
update_art = """ UPDATE art update_tag = """
SET url = ? INSERT OR REPLACE INTO tag_link(tag_id, media_id, media_type)
WHERE media_id = ? VALUES (?, ?, ?)
AND media_type = ? """
AND type = ? update_art = """
""" UPDATE art
update_actor = """ INSERT OR REPLACE INTO actor_link(actor_id, media_id, media_type, role, cast_order) SET url = ?
VALUES (?, ?, ?, ?, ?) WHERE media_id = ?
""" AND media_type = ?
AND type = ?
"""
update_actor = """
INSERT OR REPLACE INTO actor_link(actor_id, media_id, media_type, role, cast_order)
VALUES (?, ?, ?, ?, ?)
"""
update_link = """ INSERT OR REPLACE INTO {LinkType}(actor_id, media_id, media_type) update_link = """
VALUES (?, ?, ?) INSERT OR REPLACE INTO {LinkType}(actor_id, media_id, media_type)
""" VALUES (?, ?, ?)
update_movie = """ UPDATE movie """
SET c00 = ?, c01 = ?, c02 = ?, c03 = ?, c04 = ?, c05 = ?, c06 = ?, update_movie = """
c07 = ?, c09 = ?, c10 = ?, c11 = ?, c12 = ?, c14 = ?, c15 = ?, UPDATE movie
c16 = ?, c18 = ?, c19 = ?, c21 = ?, userrating = ?, premiered = ? SET c00 = ?, c01 = ?, c02 = ?, c03 = ?, c04 = ?, c05 = ?, c06 = ?,
WHERE idMovie = ? c07 = ?, c09 = ?, c10 = ?, c11 = ?, c12 = ?, c14 = ?, c15 = ?,
""" c16 = ?, c18 = ?, c19 = ?, c21 = ?, userrating = ?, premiered = ?
WHERE idMovie = ?
"""
update_movie_obj = ["{Title}", "{Plot}", "{ShortPlot}", "{Tagline}", "{Votes}", "{RatingId}", update_movie_obj = ["{Title}", "{Plot}", "{ShortPlot}", "{Tagline}", "{Votes}", "{RatingId}",
"{Writers}", "{Year}", "{Unique}", "{SortTitle}", "{Runtime}", "{Writers}", "{Year}", "{Unique}", "{SortTitle}", "{Runtime}",
"{Mpaa}", "{Genre}", "{Directors}", "{Title}", "{Studio}", "{Trailer}", "{Mpaa}", "{Genre}", "{Directors}", "{Title}", "{Studio}", "{Trailer}",
"{Country}", "{CriticRating}", "{Year}", "{MovieId}"] "{Country}", "{CriticRating}", "{Year}", "{MovieId}"]
update_rating = """ UPDATE rating update_rating = """
SET media_id = ?, media_type = ?, rating_type = ?, rating = ?, votes = ? UPDATE rating
WHERE rating_id = ? SET media_id = ?, media_type = ?, rating_type = ?, rating = ?, votes = ?
""" WHERE rating_id = ?
"""
update_rating_movie_obj = ["{MovieId}", "movie", "default", "{Rating}", "{Votes}", "{RatingId}"] update_rating_movie_obj = ["{MovieId}", "movie", "default", "{Rating}", "{Votes}", "{RatingId}"]
update_rating_tvshow_obj = ["{ShowId}", "tvshow", "default", "{Rating}", "{Votes}", "{RatingId}"] update_rating_tvshow_obj = ["{ShowId}", "tvshow", "default", "{Rating}", "{Votes}", "{RatingId}"]
update_rating_episode_obj = ["{EpisodeId}", "episode", "default", "{Rating}", "{Votes}", "{RatingId}"] update_rating_episode_obj = ["{EpisodeId}", "episode", "default", "{Rating}", "{Votes}", "{RatingId}"]
update_unique_id = """ UPDATE uniqueid update_unique_id = """
SET media_id = ?, media_type = ?, value = ?, type = ? UPDATE uniqueid
WHERE uniqueid_id = ? SET media_id = ?, media_type = ?, value = ?, type = ?
""" WHERE uniqueid_id = ?
"""
update_unique_id_movie_obj = ["{MovieId}", "movie", "{UniqueId}", "{ProviderName}", "{Unique}"] update_unique_id_movie_obj = ["{MovieId}", "movie", "{UniqueId}", "{ProviderName}", "{Unique}"]
update_unique_id_tvshow_obj = ["{ShowId}", "tvshow", "{UniqueId}", "{ProviderName}", "{Unique}"] update_unique_id_tvshow_obj = ["{ShowId}", "tvshow", "{UniqueId}", "{ProviderName}", "{Unique}"]
update_unique_id_episode_obj = ["{EpisodeId}", "episode", "{UniqueId}", "{ProviderName}", "{Unique}"] update_unique_id_episode_obj = ["{EpisodeId}", "episode", "{UniqueId}", "{ProviderName}", "{Unique}"]
update_country = """ INSERT OR REPLACE INTO country_link(country_id, media_id, media_type) update_country = """
VALUES (?, ?, ?) INSERT OR REPLACE INTO country_link(country_id, media_id, media_type)
""" VALUES (?, ?, ?)
"""
update_country_obj = ["{Countries}", "{MovieId}", "movie"] update_country_obj = ["{Countries}", "{MovieId}", "movie"]
update_set = """ UPDATE sets update_set = """
SET strSet = ?, strOverview = ? UPDATE sets
WHERE idSet = ? SET strSet = ?, strOverview = ?
""" WHERE idSet = ?
"""
update_set_obj = ["{Title}", "{Overview}", "{SetId}"] update_set_obj = ["{Title}", "{Overview}", "{SetId}"]
update_movie_set = """ UPDATE movie update_movie_set = """
SET idSet = ? UPDATE movie
WHERE idMovie = ? SET idSet = ?
""" WHERE idMovie = ?
"""
update_movie_set_obj = ["{SetId}", "{MovieId}"] update_movie_set_obj = ["{SetId}", "{MovieId}"]
update_musicvideo = """ UPDATE musicvideo update_musicvideo = """
SET c00 = ?, c04 = ?, c05 = ?, c06 = ?, c07 = ?, c08 = ?, c09 = ?, c10 = ?, UPDATE musicvideo
c11 = ?, c12 = ?, premiered = ? SET c00 = ?, c04 = ?, c05 = ?, c06 = ?, c07 = ?, c08 = ?, c09 = ?, c10 = ?,
WHERE idMVideo = ? c11 = ?, c12 = ?, premiered = ?
""" WHERE idMVideo = ?
"""
update_musicvideo_obj = ["{Title}", "{Runtime}", "{Directors}", "{Studio}", "{Year}", "{Plot}", "{Album}", update_musicvideo_obj = ["{Title}", "{Runtime}", "{Directors}", "{Studio}", "{Year}", "{Plot}", "{Album}",
"{Artists}", "{Genre}", "{Index}", "{Premiere}", "{MvideoId}"] "{Artists}", "{Genre}", "{Index}", "{Premiere}", "{MvideoId}"]
update_tvshow = """ UPDATE tvshow update_tvshow = """
SET c00 = ?, c01 = ?, c02 = ?, c04 = ?, c05 = ?, c08 = ?, c09 = ?, c10 = ?, UPDATE tvshow
c12 = ?, c13 = ?, c14 = ?, c15 = ? SET c00 = ?, c01 = ?, c02 = ?, c04 = ?, c05 = ?, c08 = ?, c09 = ?, c10 = ?,
WHERE idShow = ? c12 = ?, c13 = ?, c14 = ?, c15 = ?
""" WHERE idShow = ?
"""
update_tvshow_obj = ["{Title}", "{Plot}", "{Status}", "{RatingId}", "{Premiere}", "{Genre}", "{Title}", update_tvshow_obj = ["{Title}", "{Plot}", "{Status}", "{RatingId}", "{Premiere}", "{Genre}", "{Title}",
"disintegrate browse bug", "{Unique}", "{Mpaa}", "{Studio}", "{SortTitle}", "{ShowId}"] "disintegrate browse bug", "{Unique}", "{Mpaa}", "{Studio}", "{SortTitle}", "{ShowId}"]
update_tvshow_link = """ INSERT OR REPLACE INTO tvshowlinkpath(idShow, idPath) update_tvshow_link = """
VALUES (?, ?) INSERT OR REPLACE INTO tvshowlinkpath(idShow, idPath)
""" VALUES (?, ?)
"""
update_tvshow_link_obj = ["{ShowId}", "{PathId}"] update_tvshow_link_obj = ["{ShowId}", "{PathId}"]
update_season = """ UPDATE seasons update_season = """
SET name = ? UPDATE seasons
WHERE idSeason = ? SET name = ?
""" WHERE idSeason = ?
update_episode = """ UPDATE episode """
SET c00 = ?, c01 = ?, c03 = ?, c04 = ?, c05 = ?, c09 = ?, c10 = ?, update_episode = """
c12 = ?, c13 = ?, c14 = ?, c15 = ?, c16 = ?, idSeason = ?, idShow = ? UPDATE episode
WHERE idEpisode = ? SET c00 = ?, c01 = ?, c03 = ?, c04 = ?, c05 = ?, c09 = ?, c10 = ?,
""" c12 = ?, c13 = ?, c14 = ?, c15 = ?, c16 = ?, idSeason = ?, idShow = ?
WHERE idEpisode = ?
"""
update_episode_obj = ["{Title}", "{Plot}", "{RatingId}", "{Writers}", "{Premiere}", "{Runtime}", "{Directors}", update_episode_obj = ["{Title}", "{Plot}", "{RatingId}", "{Writers}", "{Premiere}", "{Runtime}", "{Directors}",
"{Season}", "{Index}", "{Title}", "{AirsBeforeSeason}", "{AirsBeforeEpisode}", "{SeasonId}", "{Season}", "{Index}", "{Title}", "{AirsBeforeSeason}", "{AirsBeforeEpisode}", "{SeasonId}",
"{ShowId}", "{EpisodeId}"] "{ShowId}", "{EpisodeId}"]
delete_path = """ DELETE FROM path delete_path = """
WHERE idPath = ? DELETE FROM path
""" WHERE idPath = ?
"""
delete_path_obj = ["{PathId}"] delete_path_obj = ["{PathId}"]
delete_file = """ DELETE FROM files delete_file = """
WHERE idFile = ? DELETE FROM files
""" WHERE idFile = ?
"""
delete_file_obj = ["{Path}", "{Filename}"] delete_file_obj = ["{Path}", "{Filename}"]
delete_file_by_path = """ DELETE FROM files delete_file_by_path = """
WHERE idPath = ? DELETE FROM files
AND strFileName = ? WHERE idPath = ?
""" AND strFileName = ?
delete_genres = """ DELETE FROM genre_link """
WHERE media_id = ? delete_genres = """
AND media_type = ? DELETE FROM genre_link
""" WHERE media_id = ?
delete_bookmark = """ DELETE FROM bookmark AND media_type = ?
WHERE idFile = ? """
""" delete_bookmark = """
delete_streams = """ DELETE FROM streamdetails DELETE FROM bookmark
WHERE idFile = ? WHERE idFile = ?
""" """
delete_tags = """ DELETE FROM tag_link delete_streams = """
WHERE media_id = ? DELETE FROM streamdetails
AND media_type = ? WHERE idFile = ?
""" """
delete_tag = """ DELETE FROM tag_link delete_tags = """
WHERE tag_id = ? DELETE FROM tag_link
AND media_id = ? WHERE media_id = ?
AND media_type = ? AND media_type = ?
""" """
delete_tag = """
DELETE FROM tag_link
WHERE tag_id = ?
AND media_id = ?
AND media_type = ?
"""
delete_tag_movie_obj = ["Favorite movies", "{MovieId}", "movie"] delete_tag_movie_obj = ["Favorite movies", "{MovieId}", "movie"]
delete_tag_mvideo_obj = ["Favorite musicvideos", "{MvideoId}", "musicvideo"] delete_tag_mvideo_obj = ["Favorite musicvideos", "{MvideoId}", "musicvideo"]
delete_tag_episode_obj = ["Favorite tvshows", "{KodiId}", "tvshow"] delete_tag_episode_obj = ["Favorite tvshows", "{KodiId}", "tvshow"]
delete_movie = """ DELETE FROM movie delete_movie = """
WHERE idMovie = ? DELETE FROM movie
""" WHERE idMovie = ?
"""
delete_movie_obj = ["{KodiId}", "{FileId}"] delete_movie_obj = ["{KodiId}", "{FileId}"]
delete_set = """ DELETE FROM sets delete_set = """
WHERE idSet = ? DELETE FROM sets
""" WHERE idSet = ?
"""
delete_set_obj = ["{KodiId}"] delete_set_obj = ["{KodiId}"]
delete_movie_set = """ UPDATE movie delete_movie_set = """
SET idSet = null UPDATE movie
WHERE idMovie = ? SET idSet = null
""" WHERE idMovie = ?
"""
delete_movie_set_obj = ["{MovieId}"] delete_movie_set_obj = ["{MovieId}"]
delete_musicvideo = """ DELETE FROM musicvideo delete_musicvideo = """
WHERE idMVideo = ? DELETE FROM musicvideo
""" WHERE idMVideo = ?
"""
delete_musicvideo_obj = ["{MvideoId}", "{FileId}"] delete_musicvideo_obj = ["{MvideoId}", "{FileId}"]
delete_tvshow = """ DELETE FROM tvshow delete_tvshow = """
WHERE idShow = ? DELETE FROM tvshow
""" WHERE idShow = ?
delete_season = """ DELETE FROM seasons """
WHERE idSeason = ? delete_season = """
""" DELETE FROM seasons
delete_episode = """ DELETE FROM episode WHERE idSeason = ?
WHERE idEpisode = ? """
""" delete_episode = """
delete_backdrops = """ DELETE FROM art DELETE FROM episode
WHERE media_id = ? WHERE idEpisode = ?
AND media_type = ? """
AND type LIKE ? delete_backdrops = """
""" DELETE FROM art
WHERE media_id = ?
AND media_type = ?
AND type LIKE ?
"""

View file

@ -1,212 +1,260 @@
create_artist = """ SELECT coalesce(max(idArtist), 1) create_artist = """
FROM artist SELECT coalesce(max(idArtist), 1)
""" FROM artist
create_album = """ SELECT coalesce(max(idAlbum), 0) """
FROM album create_album = """
""" SELECT coalesce(max(idAlbum), 0)
create_song = """ SELECT coalesce(max(idSong), 0) FROM album
FROM song """
""" create_song = """
create_genre = """ SELECT coalesce(max(idGenre), 0) SELECT coalesce(max(idSong), 0)
FROM genre FROM song
""" """
create_genre = """
SELECT coalesce(max(idGenre), 0)
FROM genre
"""
get_artist = """ SELECT idArtist, strArtist get_artist = """
FROM artist SELECT idArtist, strArtist
WHERE strMusicBrainzArtistID = ? FROM artist
""" WHERE strMusicBrainzArtistID = ?
"""
get_artist_obj = ["{ArtistId}", "{Name}", "{UniqueId}"] get_artist_obj = ["{ArtistId}", "{Name}", "{UniqueId}"]
get_artist_by_name = """ SELECT idArtist get_artist_by_name = """
FROM artist SELECT idArtist
WHERE strArtist = ? FROM artist
COLLATE NOCASE WHERE strArtist = ?
""" COLLATE NOCASE
get_artist_by_id = """ SELECT * """
FROM artist get_artist_by_id = """
WHERE idArtist = ? SELECT *
""" FROM artist
WHERE idArtist = ?
"""
get_artist_by_id_obj = ["{ArtistId}"] get_artist_by_id_obj = ["{ArtistId}"]
get_album_by_id = """ SELECT * get_album_by_id = """
FROM album SELECT *
WHERE idAlbum = ? FROM album
""" WHERE idAlbum = ?
"""
get_album_by_id_obj = ["{AlbumId}"] get_album_by_id_obj = ["{AlbumId}"]
get_song_by_id = """ SELECT * get_song_by_id = """
FROM song SELECT *
WHERE idSong = ? FROM song
""" WHERE idSong = ?
"""
get_song_by_id_obj = ["{SongId}"] get_song_by_id_obj = ["{SongId}"]
get_album = """ SELECT idAlbum get_album = """
FROM album SELECT idAlbum
WHERE strMusicBrainzAlbumID = ? FROM album
""" WHERE strMusicBrainzAlbumID = ?
"""
get_album_obj = ["{AlbumId}", "{Title}", "{UniqueId}", "{Artists}", "album"] get_album_obj = ["{AlbumId}", "{Title}", "{UniqueId}", "{Artists}", "album"]
get_album_by_name = """ SELECT idAlbum, strArtists get_album_by_name = """
FROM album SELECT idAlbum, strArtists
WHERE strAlbum = ? FROM album
""" WHERE strAlbum = ?
get_album_by_name72 = """ SELECT idAlbum, strArtistDisp """
FROM album get_album_by_name72 = """
WHERE strAlbum = ? SELECT idAlbum, strArtistDisp
""" FROM album
get_album_artist = """ SELECT strArtists WHERE strAlbum = ?
FROM album """
WHERE idAlbum = ? get_album_artist = """
""" SELECT strArtists
get_album_artist72 = """ SELECT strArtistDisp FROM album
FROM album WHERE idAlbum = ?
WHERE idAlbum = ? """
""" get_album_artist72 = """
SELECT strArtistDisp
FROM album
WHERE idAlbum = ?
"""
get_album_artist_obj = ["{AlbumId}", "{strAlbumArtists}"] get_album_artist_obj = ["{AlbumId}", "{strAlbumArtists}"]
get_genre = """ SELECT idGenre get_genre = """
FROM genre SELECT idGenre
WHERE strGenre = ? FROM genre
COLLATE NOCASE WHERE strGenre = ?
""" COLLATE NOCASE
get_total_episodes = """ SELECT totalCount """
FROM tvshowcounts get_total_episodes = """
WHERE idShow = ? SELECT totalCount
""" FROM tvshowcounts
WHERE idShow = ?
"""
add_artist = """ INSERT INTO artist(idArtist, strArtist, strMusicBrainzArtistID) add_artist = """
VALUES (?, ?, ?) INSERT INTO artist(idArtist, strArtist, strMusicBrainzArtistID)
""" VALUES (?, ?, ?)
add_album = """ INSERT INTO album(idAlbum, strAlbum, strMusicBrainzAlbumID, strReleaseType) """
VALUES (?, ?, ?, ?) add_album = """
""" INSERT INTO album(idAlbum, strAlbum, strMusicBrainzAlbumID, strReleaseType)
add_album72 = """ INSERT INTO album(idAlbum, strAlbum, strMusicBrainzAlbumID, strReleaseType, bScrapedMBID) VALUES (?, ?, ?, ?)
VALUES (?, ?, ?, ?, 1) """
""" add_album72 = """
add_single = """ INSERT INTO album(idAlbum, strGenres, iYear, strReleaseType) INSERT INTO album(idAlbum, strAlbum, strMusicBrainzAlbumID, strReleaseType, bScrapedMBID)
VALUES (?, ?, ?, ?) VALUES (?, ?, ?, ?, 1)
""" """
add_single = """
INSERT INTO album(idAlbum, strGenres, iYear, strReleaseType)
VALUES (?, ?, ?, ?)
"""
add_single_obj = ["{AlbumId}", "{Genre}", "{Year}", "single"] add_single_obj = ["{AlbumId}", "{Genre}", "{Year}", "single"]
add_song = """ INSERT INTO song(idSong, idAlbum, idPath, strArtists, strGenres, strTitle, iTrack, add_song = """
iDuration, iYear, strFileName, strMusicBrainzTrackID, iTimesPlayed, lastplayed, INSERT INTO song(idSong, idAlbum, idPath, strArtists, strGenres, strTitle, iTrack,
rating, comment, dateAdded) iDuration, iYear, strFileName, strMusicBrainzTrackID, iTimesPlayed, lastplayed,
VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?) rating, comment, dateAdded)
""" VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)
add_song72 = """ INSERT INTO song(idSong, idAlbum, idPath, strArtistDisp, strGenres, strTitle, iTrack, """
iDuration, iYear, strFileName, strMusicBrainzTrackID, iTimesPlayed, lastplayed, add_song72 = """
rating, comment, dateAdded) INSERT INTO song(idSong, idAlbum, idPath, strArtistDisp, strGenres, strTitle, iTrack,
VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?) iDuration, iYear, strFileName, strMusicBrainzTrackID, iTimesPlayed, lastplayed,
""" rating, comment, dateAdded)
VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)
"""
add_song_obj = ["{SongId}", "{AlbumId}", "{PathId}", "{Artists}", "{Genre}", "{Title}", "{Index}", add_song_obj = ["{SongId}", "{AlbumId}", "{PathId}", "{Artists}", "{Genre}", "{Title}", "{Index}",
"{Runtime}", "{Year}", "{Filename}", "{UniqueId}", "{PlayCount}", "{DatePlayed}", "{Rating}", "{Runtime}", "{Year}", "{Filename}", "{UniqueId}", "{PlayCount}", "{DatePlayed}", "{Rating}",
"{Comment}", "{DateAdded}"] "{Comment}", "{DateAdded}"]
add_genre = """ INSERT INTO genre(idGenre, strGenre) add_genre = """
VALUES (?, ?) INSERT INTO genre(idGenre, strGenre)
""" VALUES (?, ?)
"""
add_genres_obj = ["{AlbumId}", "{Genres}", "album"] add_genres_obj = ["{AlbumId}", "{Genres}", "album"]
update_path = """ UPDATE path update_path = """
SET strPath = ? UPDATE path
WHERE idPath = ? SET strPath = ?
""" WHERE idPath = ?
"""
update_path_obj = ["{Path}", "{PathId}"] update_path_obj = ["{Path}", "{PathId}"]
update_role = """ INSERT OR REPLACE INTO role(idRole, strRole) update_role = """
VALUES (?, ?) INSERT OR REPLACE INTO role(idRole, strRole)
""" VALUES (?, ?)
"""
update_role_obj = [1, "Composer"] update_role_obj = [1, "Composer"]
update_artist_name = """ UPDATE artist update_artist_name = """
SET strArtist = ? UPDATE artist
WHERE idArtist = ? SET strArtist = ?
""" WHERE idArtist = ?
"""
update_artist_name_obj = ["{Name}", "{ArtistId}"] update_artist_name_obj = ["{Name}", "{ArtistId}"]
update_artist = """ UPDATE artist update_artist = """
SET strGenres = ?, strBiography = ?, strImage = ?, strFanart = ?, lastScraped = ? UPDATE artist
WHERE idArtist = ? SET strGenres = ?, strBiography = ?, strImage = ?, strFanart = ?, lastScraped = ?
""" WHERE idArtist = ?
update_link = """ INSERT OR REPLACE INTO album_artist(idArtist, idAlbum, strArtist) """
VALUES (?, ?, ?) update_link = """
""" INSERT OR REPLACE INTO album_artist(idArtist, idAlbum, strArtist)
VALUES (?, ?, ?)
"""
update_link_obj = ["{ArtistId}", "{AlbumId}", "{Name}"] update_link_obj = ["{ArtistId}", "{AlbumId}", "{Name}"]
update_discography = """ INSERT OR REPLACE INTO discography(idArtist, strAlbum, strYear) update_discography = """
VALUES (?, ?, ?) INSERT OR REPLACE INTO discography(idArtist, strAlbum, strYear)
""" VALUES (?, ?, ?)
"""
update_discography_obj = ["{ArtistId}", "{Title}", "{Year}"] update_discography_obj = ["{ArtistId}", "{Title}", "{Year}"]
update_album = """ UPDATE album update_album = """
SET strArtists = ?, iYear = ?, strGenres = ?, strReview = ?, strImage = ?, UPDATE album
iUserrating = ?, lastScraped = ?, strReleaseType = ? SET strArtists = ?, iYear = ?, strGenres = ?, strReview = ?, strImage = ?,
WHERE idAlbum = ? iUserrating = ?, lastScraped = ?, strReleaseType = ?
""" WHERE idAlbum = ?
update_album72 = """ UPDATE album """
SET strArtistDisp = ?, iYear = ?, strGenres = ?, strReview = ?, strImage = ?, update_album72 = """
iUserrating = ?, lastScraped = ?, bScrapedMBID = 1, strReleaseType = ? UPDATE album
WHERE idAlbum = ? SET strArtistDisp = ?, iYear = ?, strGenres = ?, strReview = ?, strImage = ?,
""" iUserrating = ?, lastScraped = ?, bScrapedMBID = 1, strReleaseType = ?
WHERE idAlbum = ?
"""
update_album_obj = ["{Artists}", "{Year}", "{Genre}", "{Bio}", "{Thumb}", "{Rating}", "{LastScraped}", "album", "{AlbumId}"] update_album_obj = ["{Artists}", "{Year}", "{Genre}", "{Bio}", "{Thumb}", "{Rating}", "{LastScraped}", "album", "{AlbumId}"]
update_album_artist = """ UPDATE album update_album_artist = """
SET strArtists = ? UPDATE album
WHERE idAlbum = ? SET strArtists = ?
""" WHERE idAlbum = ?
update_album_artist72 = """ UPDATE album """
SET strArtistDisp = ? update_album_artist72 = """
WHERE idAlbum = ? UPDATE album
""" SET strArtistDisp = ?
update_song = """ UPDATE song WHERE idAlbum = ?
SET idAlbum = ?, strArtists = ?, strGenres = ?, strTitle = ?, iTrack = ?, """
iDuration = ?, iYear = ?, strFilename = ?, iTimesPlayed = ?, lastplayed = ?, update_song = """
rating = ?, comment = ?, dateAdded = ? UPDATE song
WHERE idSong = ? SET idAlbum = ?, strArtists = ?, strGenres = ?, strTitle = ?, iTrack = ?,
""" iDuration = ?, iYear = ?, strFilename = ?, iTimesPlayed = ?, lastplayed = ?,
update_song72 = """ UPDATE song rating = ?, comment = ?, dateAdded = ?
SET idAlbum = ?, strArtistDisp = ?, strGenres = ?, strTitle = ?, iTrack = ?, WHERE idSong = ?
iDuration = ?, iYear = ?, strFilename = ?, iTimesPlayed = ?, lastplayed = ?, """
rating = ?, comment = ?, dateAdded = ? update_song72 = """
WHERE idSong = ? UPDATE song
""" SET idAlbum = ?, strArtistDisp = ?, strGenres = ?, strTitle = ?, iTrack = ?,
iDuration = ?, iYear = ?, strFilename = ?, iTimesPlayed = ?, lastplayed = ?,
rating = ?, comment = ?, dateAdded = ?
WHERE idSong = ?
"""
update_song_obj = ["{AlbumId}", "{Artists}", "{Genre}", "{Title}", "{Index}", "{Runtime}", "{Year}", update_song_obj = ["{AlbumId}", "{Artists}", "{Genre}", "{Title}", "{Index}", "{Runtime}", "{Year}",
"{Filename}", "{PlayCount}", "{DatePlayed}", "{Rating}", "{Comment}", "{Filename}", "{PlayCount}", "{DatePlayed}", "{Rating}", "{Comment}",
"{DateAdded}", "{SongId}"] "{DateAdded}", "{SongId}"]
update_song_artist = """ INSERT OR REPLACE INTO song_artist(idArtist, idSong, idRole, iOrder, strArtist) update_song_artist = """
VALUES (?, ?, ?, ?, ?) INSERT OR REPLACE INTO song_artist(idArtist, idSong, idRole, iOrder, strArtist)
""" VALUES (?, ?, ?, ?, ?)
"""
update_song_artist_obj = ["{ArtistId}", "{SongId}", 1, "{Index}", "{Name}"] update_song_artist_obj = ["{ArtistId}", "{SongId}", 1, "{Index}", "{Name}"]
update_song_album = """ INSERT OR REPLACE INTO albuminfosong(idAlbumInfoSong, idAlbumInfo, iTrack, update_song_album = """
strTitle, iDuration) INSERT OR REPLACE INTO albuminfosong(idAlbumInfoSong, idAlbumInfo, iTrack,
VALUES (?, ?, ?, ?, ?) strTitle, iDuration)
""" VALUES (?, ?, ?, ?, ?)
"""
update_song_album_obj = ["{SongId}", "{AlbumId}", "{Index}", "{Title}", "{Runtime}"] update_song_album_obj = ["{SongId}", "{AlbumId}", "{Index}", "{Title}", "{Runtime}"]
update_song_rating = """ UPDATE song update_song_rating = """
SET iTimesPlayed = ?, lastplayed = ?, rating = ? UPDATE song
WHERE idSong = ? SET iTimesPlayed = ?, lastplayed = ?, rating = ?
""" WHERE idSong = ?
"""
update_song_rating_obj = ["{PlayCount}", "{DatePlayed}", "{Rating}", "{KodiId}"] update_song_rating_obj = ["{PlayCount}", "{DatePlayed}", "{Rating}", "{KodiId}"]
update_genre_album = """ INSERT OR REPLACE INTO album_genre(idGenre, idAlbum) update_genre_album = """
VALUES (?, ?) INSERT OR REPLACE INTO album_genre(idGenre, idAlbum)
""" VALUES (?, ?)
update_genre_song = """ INSERT OR REPLACE INTO song_genre(idGenre, idSong) """
VALUES (?, ?) update_genre_song = """
""" INSERT OR REPLACE INTO song_genre(idGenre, idSong)
VALUES (?, ?)
"""
update_genre_song_obj = ["{SongId}", "{Genres}", "song"] update_genre_song_obj = ["{SongId}", "{Genres}", "song"]
delete_genres_album = """ DELETE FROM album_genre delete_genres_album = """
WHERE idAlbum = ? DELETE FROM album_genre
""" WHERE idAlbum = ?
delete_genres_song = """ DELETE FROM song_genre """
WHERE idSong = ? delete_genres_song = """
""" DELETE FROM song_genre
delete_artist = """ DELETE FROM artist WHERE idSong = ?
WHERE idArtist = ? """
""" delete_artist = """
delete_album = """ DELETE FROM album DELETE FROM artist
WHERE idAlbum = ? WHERE idArtist = ?
""" """
delete_song = """ DELETE FROM song delete_album = """
WHERE idSong = ? DELETE FROM album
""" WHERE idAlbum = ?
get_version = """ SELECT idVersion """
FROM version delete_song = """
""" DELETE FROM song
update_versiontag = """ INSERT OR REPLACE INTO versiontagscan(idVersion, iNeedsScan) WHERE idSong = ?
VALUES (?, 0) """
""" get_version = """
get_versiontagcount = """ SELECT COUNT(*) SELECT idVersion
FROM versiontagscan FROM version
""" """
update_versiontag = """
INSERT OR REPLACE INTO versiontagscan(idVersion, iNeedsScan)
VALUES (?, 0)
"""
get_versiontagcount = """
SELECT COUNT (*)
FROM versiontagscan
"""

View file

@ -1,10 +1,12 @@
get_cache = """ SELECT cachedurl get_cache = """
FROM texture SELECT cachedurl
WHERE url = ? FROM texture
""" WHERE url = ?
"""
delete_cache = """ DELETE FROM texture delete_cache = """
WHERE url = ? DELETE FROM texture
""" WHERE url = ?
"""