parent
e5f0bea8d6
commit
06336caef4
@ -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
|
||||||
|
```
|
@ -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")
|
@ -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")
|
|
Loading…
Reference in new issue