From 7bc9b7f95be5aa07255904015df1bda0915ace66 Mon Sep 17 00:00:00 2001 From: meisnate12 Date: Mon, 18 Apr 2022 15:35:48 -0400 Subject: [PATCH] [3] fix small overlay errors --- VERSION | 2 +- config/config.yml.template | 2 ++ docs/config/paths.md | 2 +- docs/metadata/overlay.md | 4 ++-- modules/cache.py | 33 ++++++++------------------------- 5 files changed, 14 insertions(+), 29 deletions(-) diff --git a/VERSION b/VERSION index 5eb0e463..03d22ea9 100644 --- a/VERSION +++ b/VERSION @@ -1 +1 @@ -1.16.5-develop2 +1.16.5-develop3 diff --git a/config/config.yml.template b/config/config.yml.template index 08dfb185..c7c1a283 100644 --- a/config/config.yml.template +++ b/config/config.yml.template @@ -6,6 +6,8 @@ libraries: # This is called out once within - file: config/Movies.yml # This is a local file on the system - folder: config/Movies/ # This is a local directory on the system - git: meisnate12/MovieCharts # This is a file within the GitHub Repository + overlay_path: + - file: config/Overlays.yml # This is a local file on the system TV Shows: metadata_path: - file: config/TVShows.yml diff --git a/docs/config/paths.md b/docs/config/paths.md index 27048d64..7927cd39 100644 --- a/docs/config/paths.md +++ b/docs/config/paths.md @@ -1,6 +1,6 @@ # Path Types -YAML Files are defined by their path type and path location for the [`metadata_path`](libraries.md#metadata-path), [`playlist_files`](libraries.md#metadata-path), and [`external_templates`](libraries.md#metadata-path) attributes. +YAML Files are defined by their path type and path location for the [`metadata_path`](libraries.md#metadata-path), [`overlay_path`](libraries.md#overlay-path), [`playlist_files`](libraries.md#metadata-path), and [`external_templates`](libraries.md#metadata-path) attributes. They can either be on the local system, online at an url, directly from the [Plex Meta Manager Configs](https://github.com/meisnate12/Plex-Meta-Manager-Configs) repository, or from another [`Custom Repository`](settings.md#custom-repo). diff --git a/docs/metadata/overlay.md b/docs/metadata/overlay.md index af229328..ecd6bbc0 100644 --- a/docs/metadata/overlay.md +++ b/docs/metadata/overlay.md @@ -21,7 +21,7 @@ These are the attributes which can be used within the Overlay File: ## Overlay Attributes -Each overlay requires its own section within the `overalys` attribute. +Each overlay requires its own section within the `overlays` attribute. ```yaml overlays: @@ -107,7 +107,7 @@ overlays: Dolby: overlay: name: Dolby - url: https://somewebsite.com/dobly_overlay.png + url: https://somewebsite.com/dolby_overlay.png plex_all: true filters: has_dolby_vision: true diff --git a/modules/cache.py b/modules/cache.py index 631fd055..642b8210 100644 --- a/modules/cache.py +++ b/modules/cache.py @@ -575,6 +575,14 @@ class Cache: with closing(connection.cursor()) as cursor: cursor.execute(f"SELECT * FROM image_maps WHERE library = ?", (library,)) row = cursor.fetchone() + cursor.execute( + f"""CREATE TABLE IF NOT EXISTS {table_name}_overlays ( + key INTEGER PRIMARY KEY, + rating_key TEXT UNIQUE, + overlay TEXT, + compare TEXT, + location TEXT)""" + ) if row and row["key"]: table_name = f"image_map_{row['key']}" else: @@ -599,33 +607,8 @@ class Cache: compare TEXT, location TEXT)""" ) - cursor.execute( - f"""CREATE TABLE IF NOT EXISTS {table_name}_overlays ( - key INTEGER PRIMARY KEY, - rating_key TEXT UNIQUE, - overlay TEXT, - compare TEXT, - location TEXT)""" - ) return table_name - def query_image_map_overlay(self, table_name, overlay): - rks = [] - with sqlite3.connect(self.cache_path) as connection: - connection.row_factory = sqlite3.Row - with closing(connection.cursor()) as cursor: - cursor.execute(f"SELECT * FROM {table_name} WHERE overlay = ?", (overlay,)) - rows = cursor.fetchall() - for row in rows: - rks.append(int(row["rating_key"])) - return rks - - def update_remove_overlay(self, table_name, overlay): - with sqlite3.connect(self.cache_path) as connection: - connection.row_factory = sqlite3.Row - with closing(connection.cursor()) as cursor: - cursor.execute(f"UPDATE {table_name} SET overlay = ? WHERE overlay = ?", ("", overlay)) - def query_image_map(self, rating_key, table_name): with sqlite3.connect(self.cache_path) as connection: connection.row_factory = sqlite3.Row