Skip to content

Commit

Permalink
Merge pull request #613 from linaspurinis/master
Browse files Browse the repository at this point in the history
mdblist.com list support
  • Loading branch information
meisnate12 authored Jan 19, 2022
2 parents 3acb867 + 101ee7d commit 38818e8
Show file tree
Hide file tree
Showing 3 changed files with 31 additions and 2 deletions.
11 changes: 9 additions & 2 deletions modules/builder.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import logging, 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, util
from modules import anidb, anilist, flixpatrol, icheckmovies, imdb, letterboxd, mal, plex, radarr, sonarr, stevenlu, 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
Expand Down Expand Up @@ -70,7 +70,7 @@
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 + \
tmdb.builders + trakt.builders + tvdb.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",
Expand Down Expand Up @@ -551,6 +551,8 @@ def cant_interact(attr1, attr2, fail=False):
self._trakt(method_name, method_data)
elif method_name in tvdb.builders:
self._tvdb(method_name, method_data)
elif method_name in mdblist.builders:
self._mdblist(method_name, method_data)
elif method_name == "filters":
self._filters(method_name, method_data)
else:
Expand Down Expand Up @@ -1077,6 +1079,9 @@ def _plex(self, method_name, method_data):
def _stevenlu(self, method_name, method_data):
self.builders.append((method_name, self._parse(method_name, method_data, "bool")))

def _mdblist(self, method_name, method_data):
self.builders.append((method_name, self._parse(method_name, method_data, datatype="true")))

def _tautulli(self, method_name, method_data):
for dict_data, dict_methods in self._parse(method_name, method_data, datatype="dictlist"):
self.builders.append((method_name, {
Expand Down Expand Up @@ -1263,6 +1268,8 @@ def gather_ids(self, method, value):
return self.config.Letterboxd.get_tmdb_ids(method, value, self.language)
elif "stevenlu" in method:
return self.config.StevenLu.get_stevenlu_ids(method)
elif "mdblist" in method:
return self.config.Mdblist.get_mdblist_ids(method, value)
elif "tmdb" in method:
return self.config.TMDb.get_tmdb_ids(method, value, self.library.is_movie)
elif "trakt" in method:
Expand Down
2 changes: 2 additions & 0 deletions modules/config.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@
from modules.radarr import Radarr
from modules.sonarr import Sonarr
from modules.stevenlu import StevenLu
from modules.mdblist import Mdblist
from modules.tautulli import Tautulli
from modules.tmdb import TMDb
from modules.trakt import Trakt
Expand Down Expand Up @@ -480,6 +481,7 @@ def check_dict(attr):
self.ICheckMovies = ICheckMovies(self)
self.Letterboxd = Letterboxd(self)
self.StevenLu = StevenLu(self)
self.Mdblist = Mdblist(self)

util.separator()

Expand Down
20 changes: 20 additions & 0 deletions modules/mdblist.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
import logging
from modules.util import Failed

logger = logging.getLogger("Plex Meta Manager")

builders = ["mdblist_list"]
base_url = "https://mdblist.com/lists"

headers = { 'User-Agent': 'Plex-Meta-Manager' }

class Mdblist:
def __init__(self, config):
self.config = config

def get_mdblist_ids(self, method, data):
if method == "mdblist_list":
logger.info(f"Processing Mdblist.com List: {data}")
return [(i["imdb_id"], "imdb") for i in self.config.get_json(data,headers=headers)]
else:
raise Failed(f"Mdblist Error: Method {method} not supported")

0 comments on commit 38818e8

Please sign in to comment.