From 06336caef4d14beb6dce152481518a95b48680ea Mon Sep 17 00:00:00 2001 From: meisnate12 Date: Sat, 19 Mar 2022 01:16:25 -0400 Subject: [PATCH] [10] adds reciperr_list builder --- VERSION | 2 +- docs/conf.py | 1 + docs/config/operations.md | 2 +- docs/metadata/builders/reciperr.md | 25 +++++++++++++++++++++ modules/builder.py | 30 ++++++++++++++----------- modules/config.py | 4 ++-- modules/flixpatrol.py | 2 +- modules/icheckmovies.py | 2 +- modules/mdblist.py | 2 +- modules/reciperr.py | 36 ++++++++++++++++++++++++++++++ modules/stevenlu.py | 18 --------------- 11 files changed, 86 insertions(+), 38 deletions(-) create mode 100644 docs/metadata/builders/reciperr.md create mode 100644 modules/reciperr.py delete mode 100644 modules/stevenlu.py diff --git a/VERSION b/VERSION index adf7a09b..196f4a12 100644 --- a/VERSION +++ b/VERSION @@ -1 +1 @@ -1.16.2-develop9 +1.16.2-develop10 diff --git a/docs/conf.py b/docs/conf.py index 061dddd0..7c392ffa 100644 --- a/docs/conf.py +++ b/docs/conf.py @@ -182,6 +182,7 @@ html_theme_options = { ("Letterboxd Builders", "metadata/builders/letterboxd"), ("ICheckMovies Builders", "metadata/builders/icheckmovies"), ("FlixPatrol Builders", "metadata/builders/flixpatrol"), + ("Reciperr Builders", "metadata/builders/reciperr"), ("StevenLu Builders", "metadata/builders/stevenlu"), ("AniDB Builders", "metadata/builders/anidb"), ("AniList Builders", "metadata/builders/anilist"), diff --git a/docs/config/operations.md b/docs/config/operations.md index f098e202..0eb753c3 100644 --- a/docs/config/operations.md +++ b/docs/config/operations.md @@ -22,7 +22,7 @@ The available attributes for the operations attribute are as follows | `delete_collections_with_less` | Deletes every collection with less than the given number of items.
**Values:** number greater then 0 | | `delete_unmanaged_collections` | Deletes every unmanaged collection
**Values:** `true` or `false` | | `mass_genre_update` | Updates every item's genres in the library to the chosen site's genres
**Values:**
`tmdb`Use TMDb for Genres
`tvdb`Use TVDb for Genres
`omdb`Use IMDb through OMDb for Genres
`anidb`Use AniDB Tags for Genres
| -| `mass_content_rating_update` | Updates every item's content rating in the library to the chosen site's genres
**Values:**
`mdb`Use MdbList for Content Ratings
`mdb_commonsense`Use Commonsense Rating through MDbList for Content Ratings
`omdb`Use IMDb through OMDb for Content Ratings
| +| `mass_content_rating_update` | Updates every item's content rating in the library to the chosen site's content rating
**Values:**
`mdb`Use MdbList for Content Ratings
`mdb_commonsense`Use Commonsense Rating through MDbList for Content Ratings
`omdb`Use IMDb through OMDb for Content Ratings
| | `mass_originally_available_update` | Updates every item's originally available date in the library to the chosen site's date
**Values:**
`tmdb`Use TMDb Release Date
`tvdb`Use TVDb Release Date
`omdb`Use IMDb Release Date through OMDb
`mdb`Use MdbList Release Date
`anidb`Use AniDB Release Date
| | `mass_audience_rating_update`/
`mass_critic_rating_update` | Updates every item's audience/critic rating in the library to the chosen site's rating
**Values:**
`tmdb`Use TMDb Rating
`omdb`Use IMDbRating through OMDb
`mdb`Use MdbList Score
`mdb_imdb`Use IMDb Rating through MDbList
`mdb_metacritic`Use Metacritic Rating through MDbList
`mdb_metacriticuser`Use Metacritic User Rating through MDbList
`mdb_trakt`Use Trakt Rating through MDbList
`mdb_tomatoes`Use Rotten Tomatoes Rating through MDbList
`mdb_tomatoesaudience`Use Rotten Tomatoes Audience Rating through MDbList
`mdb_tmdb`Use TMDb Rating through MDbList
`mdb_letterboxd`Use Letterboxd Rating through MDbList
`anidb_rating`Use AniDB Rating
`anidb_average`Use AniDB Average
| | `mass_imdb_parental_labels` | Updates every item's labels in the library to match the IMDb Parental Guide
**Values** `with_none` or `without_none` | diff --git a/docs/metadata/builders/reciperr.md b/docs/metadata/builders/reciperr.md new file mode 100644 index 00000000..fcfcc3d7 --- /dev/null +++ b/docs/metadata/builders/reciperr.md @@ -0,0 +1,25 @@ +# Reciperr Builders + +You can find movies using a Reciperr list on [reciperr.com](https://reciperr.com/) (Reciperr). + +No configuration is required for this builder. + +| Attribute | Description | Works with Movies | Works with Shows | Works with Playlists and Custom Sort | +|:----------------------------------|:-----------------------------------------------|:-----------------:|:----------------:|:------------------------------------:| +| [`reciperr_list`](#reciperr-list) | Finds every movie at a Reciperr JSON data URL. | ✅ | ❌ | ✅ | + +## Reciperr List + +Finds every movie on Reciperr a list. + +The expected input is the url that points to the JSON data or a list of urls that do. + +The `sync_mode: sync` and `collection_order: custom` Details are recommended since the lists are continuously updated and in a specific order. + +```yaml +collections: + Reciperr Movies: + reciperr_list: https://reciperr.com/api/recipe/list/params?recipeMetadataId=62354f0e89a919001d650fa3 + collection_order: custom + sync_mode: sync +``` diff --git a/modules/builder.py b/modules/builder.py index 32e6f40e..203c8b6c 100644 --- a/modules/builder.py +++ b/modules/builder.py @@ -1,6 +1,6 @@ import os, re, time from datetime import datetime, timedelta -from modules import anidb, anilist, flixpatrol, icheckmovies, imdb, letterboxd, mal, plex, radarr, sonarr, stevenlu, tautulli, tmdb, trakt, tvdb, mdblist, util +from modules import anidb, anilist, flixpatrol, icheckmovies, imdb, letterboxd, mal, plex, radarr, reciperr, sonarr, tautulli, tmdb, trakt, tvdb, mdblist, util from modules.util import Failed, ImageData, NotScheduled, NotScheduledRange from PIL import Image from plexapi.audio import Artist, Album, Track @@ -71,13 +71,13 @@ filter_translation = { } modifier_alias = {".greater": ".gt", ".less": ".lt"} all_builders = anidb.builders + anilist.builders + flixpatrol.builders + icheckmovies.builders + imdb.builders + \ - letterboxd.builders + mal.builders + plex.builders + stevenlu.builders + tautulli.builders + \ + letterboxd.builders + mal.builders + plex.builders + reciperr.builders + tautulli.builders + \ tmdb.builders + trakt.builders + tvdb.builders + mdblist.builders show_only_builders = ["tmdb_network", "tmdb_show", "tmdb_show_details", "tvdb_show", "tvdb_show_details", "collection_level", "item_tmdb_season_titles"] movie_only_builders = [ "letterboxd_list", "letterboxd_list_details", "icheckmovies_list", "icheckmovies_list_details", "stevenlu_popular", "tmdb_collection", "tmdb_collection_details", "tmdb_movie", "tmdb_movie_details", "tmdb_now_playing", - "tvdb_movie", "tvdb_movie_details", "trakt_boxoffice" + "tvdb_movie", "tvdb_movie_details", "trakt_boxoffice", "reciperr_list" ] music_only_builders = ["item_album_sorting"] summary_details = [ @@ -170,7 +170,7 @@ smart_invalid = ["collection_order", "collection_level"] smart_url_invalid = ["minimum_items", "filters", "run_again", "sync_mode", "show_filtered", "show_missing", "save_missing", "smart_label"] + radarr_details + sonarr_details custom_sort_builders = [ "plex_search", "plex_pilots", "tmdb_list", "tmdb_popular", "tmdb_now_playing", "tmdb_top_rated", - "tmdb_trending_daily", "tmdb_trending_weekly", "tmdb_discover", + "tmdb_trending_daily", "tmdb_trending_weekly", "tmdb_discover", "reciperr_list", "tvdb_list", "imdb_chart", "imdb_list", "stevenlu_popular", "anidb_popular", "trakt_list", "trakt_watchlist", "trakt_collection", "trakt_trending", "trakt_popular", "trakt_boxoffice", "trakt_collected_daily", "trakt_collected_weekly", "trakt_collected_monthly", "trakt_collected_yearly", "trakt_collected_all", @@ -640,8 +640,8 @@ class CollectionBuilder: self._mal(method_name, method_data) elif method_name in plex.builders or method_final in plex.searches: self._plex(method_name, method_data) - elif method_name in stevenlu.builders: - self._stevenlu(method_name, method_data) + elif method_name in reciperr.builders: + self._reciperr(method_name, method_data) elif method_name in tautulli.builders: self._tautulli(method_name, method_data) elif method_name in tmdb.builders: @@ -1145,8 +1145,12 @@ class CollectionBuilder: else: self.builders.append(("plex_search", self.build_filter("plex_search", {"any": {method_name: method_data}}))) - def _stevenlu(self, method_name, method_data): - self.builders.append((method_name, util.parse(self.Type, method_name, method_data, "bool"))) + def _reciperr(self, method_name, method_data): + if method_name == "reciperr_list": + for reciperr_list in self.config.Reciperr.validate_list(method_data): + self.builders.append((method_name, reciperr_list)) + elif method_name == "stevenlu_popular": + self.builders.append((method_name, util.parse(self.Type, method_name, method_data, "bool"))) def _mdblist(self, method_name, method_data): for mdb_dict in self.config.Mdblist.validate_mdblist_lists(self.Type, method_data): @@ -1339,15 +1343,15 @@ class CollectionBuilder: elif "imdb" in method: ids = self.config.IMDb.get_imdb_ids(method, value, self.language) elif "flixpatrol" in method: - ids = self.config.FlixPatrol.get_flixpatrol_ids(method, value, self.language, self.library.is_movie) + ids = self.config.FlixPatrol.get_tmdb_ids(method, value, self.language, self.library.is_movie) elif "icheckmovies" in method: - ids = self.config.ICheckMovies.get_icheckmovies_ids(method, value, self.language) + ids = self.config.ICheckMovies.get_imdb_ids(method, value, self.language) elif "letterboxd" in method: ids = self.config.Letterboxd.get_tmdb_ids(method, value, self.language) - elif "stevenlu" in method: - ids = self.config.StevenLu.get_stevenlu_ids(method) + elif "reciperr" in method or "stevenlu" in method: + ids = self.config.Reciperr.get_imdb_ids(method, value) elif "mdblist" in method: - ids = self.config.Mdblist.get_mdblist_ids(method, value) + ids = self.config.Mdblist.get_imdb_ids(method, value) elif "tmdb" in method: ids = self.config.TMDb.get_tmdb_ids(method, value, self.library.is_movie) elif "trakt" in method: diff --git a/modules/config.py b/modules/config.py index 2bce62db..f09cbaae 100644 --- a/modules/config.py +++ b/modules/config.py @@ -18,7 +18,7 @@ from modules.omdb import OMDb from modules.plex import Plex from modules.radarr import Radarr from modules.sonarr import Sonarr -from modules.stevenlu import StevenLu +from modules.reciperr import Reciperr from modules.mdblist import Mdblist from modules.tautulli import Tautulli from modules.tmdb import TMDb @@ -541,7 +541,7 @@ class ConfigFile: self.FlixPatrol = FlixPatrol(self) self.ICheckMovies = ICheckMovies(self) self.Letterboxd = Letterboxd(self) - self.StevenLu = StevenLu(self) + self.Reciperr = Reciperr(self) logger.separator() diff --git a/modules/flixpatrol.py b/modules/flixpatrol.py index 66742dc3..83f0f09a 100644 --- a/modules/flixpatrol.py +++ b/modules/flixpatrol.py @@ -109,7 +109,7 @@ class FlixPatrol: else: raise Failed(f"FlixPatrol Error: Method {method} not supported") - def get_flixpatrol_ids(self, method, data, language, is_movie): + def get_tmdb_ids(self, method, data, language, is_movie): if method == "flixpatrol_demographics": logger.info("Processing FlixPatrol Demographics:") logger.info(f"\tGeneration: {generations_pretty[data['generation']]}") diff --git a/modules/icheckmovies.py b/modules/icheckmovies.py index 866be78d..4d627bce 100644 --- a/modules/icheckmovies.py +++ b/modules/icheckmovies.py @@ -35,7 +35,7 @@ class ICheckMovies: raise Failed(f"ICheckMovies Error: {list_url} failed to parse") return valid_lists - def get_icheckmovies_ids(self, method, data, language): + def get_imdb_ids(self, method, data, language): if method == "icheckmovies_list": logger.info(f"Processing ICheckMovies List: {data}") return self._parse_list(data, language) diff --git a/modules/mdblist.py b/modules/mdblist.py index cd205e46..2e4f0c1c 100644 --- a/modules/mdblist.py +++ b/modules/mdblist.py @@ -158,7 +158,7 @@ class Mdblist: valid_lists.append({"url": mdb_url, "limit": list_count, "sort_by": sort_by}) return valid_lists - def get_mdblist_ids(self, method, data): + def get_imdb_ids(self, method, data): if method == "mdblist_list": logger.info(f"Processing Mdblist.com List: {data['url']}") logger.info(f"Sort By: {data['sort_by']}") diff --git a/modules/reciperr.py b/modules/reciperr.py new file mode 100644 index 00000000..06361364 --- /dev/null +++ b/modules/reciperr.py @@ -0,0 +1,36 @@ +from modules import util +from modules.util import Failed + +logger = util.logger + +builders = ["reciperr_list", "stevenlu_popular"] + +stevenlu_url = "https://s3.amazonaws.com/popular-movies/movies.json" + +class Reciperr: + def __init__(self, config): + self.config = config + + def _request(self, url, name="Reciperr"): + response = self.config.get(url) + if response.status_code >= 400: + raise Failed(f"{name} Error: JSON not found at {url}") + return response.json() + + def validate_list(self, data): + valid_lists = [] + for reciperr_list in util.get_list(data, split=False): + if "imdb_id" not in self._request(reciperr_list)[0]: + raise Failed(f"Reciperr Error: imdb_id not found in the JSON at {reciperr_list}") + valid_lists.append(reciperr_list) + return valid_lists + + def get_imdb_ids(self, method, data): + if method == "reciperr_list": + logger.info(f"Processing Reciperr Movies") + return [(i["imdb_id"], "imdb") for i in self._request(data)] + elif method == "stevenlu_popular": + logger.info(f"Processing StevenLu Popular Movies") + return [(i["imdb_id"], "imdb") for i in self._request(stevenlu_url, name="StevenLu")] + else: + raise Failed(f"Reciperr Error: Method {method} not supported") diff --git a/modules/stevenlu.py b/modules/stevenlu.py deleted file mode 100644 index 8ac03a79..00000000 --- a/modules/stevenlu.py +++ /dev/null @@ -1,18 +0,0 @@ -from modules import util -from modules.util import Failed - -logger = util.logger - -builders = ["stevenlu_popular"] -base_url = "https://s3.amazonaws.com/popular-movies/movies.json" - -class StevenLu: - def __init__(self, config): - self.config = config - - def get_stevenlu_ids(self, method): - if method == "stevenlu_popular": - logger.info(f"Processing StevenLu Popular Movies") - return [(i["imdb_id"], "imdb") for i in self.config.get_json(base_url)] - else: - raise Failed(f"StevenLu Error: Method {method} not supported")