Skip to content

Commit

Permalink
[13] #818 fix and metadata_backup fix
Browse files Browse the repository at this point in the history
  • Loading branch information
meisnate12 committed Apr 8, 2022
1 parent 14fae1b commit fcf2f25
Show file tree
Hide file tree
Showing 6 changed files with 23 additions and 8 deletions.
2 changes: 1 addition & 1 deletion VERSION
Original file line number Diff line number Diff line change
@@ -1 +1 @@
1.16.3-develop12
1.16.3-develop13
2 changes: 1 addition & 1 deletion docs/config/settings.md
Original file line number Diff line number Diff line change
Expand Up @@ -527,7 +527,7 @@ Specify where the `repo` attribute's base is when defining `metadata_paths` and
</table>

## Verify SSL
Turn SSl Verification on or off.
Turn SSL Verification on or off.

<table class="dualTable colwidths-auto align-default table">
<tr>
Expand Down
2 changes: 1 addition & 1 deletion modules/builder.py
Original file line number Diff line number Diff line change
Expand Up @@ -181,7 +181,7 @@
"tvdb_list", "imdb_chart", "imdb_list", "stevenlu_popular", "anidb_popular", "tmdb_upcoming", "tmdb_airing_today",
"tmdb_on_the_air", "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",
"flixpatrol_url", "flixpatrol_demographics", "flixpatrol_popular", "flixpatrol_top",
"flixpatrol_url", "flixpatrol_demographics", "flixpatrol_popular", "flixpatrol_top", "trakt_recommendations",
"trakt_recommended_personal", "trakt_recommended_daily", "trakt_recommended_weekly", "trakt_recommended_monthly", "trakt_recommended_yearly", "trakt_recommended_all",

This comment has been minimized.

Copy link
@fouadchamoun

fouadchamoun Apr 13, 2022

Contributor

quick note: trakt_recommended_personal can be removed if it has been replaced with trakt_recommendations.
thank you again for your work !

This comment has been minimized.

Copy link
@meisnate12

meisnate12 Apr 13, 2022

Author Member

its still in the code for legacy but its no longer on this page https://metamanager.wiki/en/latest/metadata/builders/trakt.html

theres actaully 3 different ways to get trakt Recommendations trakt_recommendations, trakt_chart with type: recommended, and trakt_userlist with userlist: recommended and each one hits a different endpoint in the api

"trakt_watched_daily", "trakt_watched_weekly", "trakt_watched_monthly", "trakt_watched_yearly", "trakt_watched_all",
"tautulli_popular", "tautulli_watched", "mdblist_list", "letterboxd_list", "icheckmovies_list",
Expand Down
2 changes: 1 addition & 1 deletion modules/meta.py
Original file line number Diff line number Diff line change
Expand Up @@ -626,6 +626,7 @@ def update_metadata(self):
logger.info("")
logger.separator("Running Metadata")
logger.info("")
next_year = datetime.now().year + 1
for mapping_name, meta in self.metadata.items():
methods = {mm.lower(): mm for mm in meta}

Expand Down Expand Up @@ -687,7 +688,6 @@ def finish_edit(current_item, description):
logger.info("")
year = None
if "year" in methods and not self.library.is_music:
next_year = datetime.now().year + 1
if meta[methods["year"]] is None:
raise Failed("Metadata Error: year attribute is blank")
try:
Expand Down
2 changes: 1 addition & 1 deletion modules/plex.py
Original file line number Diff line number Diff line change
Expand Up @@ -1137,4 +1137,4 @@ def _recur(sub):
elif isinstance(item, Album):
_recur("tracks")

return map_key, attrs if attrs else None
return map_key, attrs
21 changes: 18 additions & 3 deletions plex_meta_manager.py
Original file line number Diff line number Diff line change
Expand Up @@ -835,15 +835,30 @@ def get_rating(attribute):
meta = {}
if "metadata" not in meta:
meta["metadata"] = {}
special_names = {}
for mk, mv in meta["metadata"].items():
if "title" in mv:
special_names[mv["title"]] = mk
if "year" in mv:
special_names[f"{mv['title']} ({mv['year']})"] = mk
items = library.get_all(load=True)
titles = [i.title for i in items]
for i, item in enumerate(items, 1):
logger.ghost(f"Processing: {i}/{len(items)} {item.title}")
map_key, attrs = library.get_locked_attributes(item, titles)
if attrs or library.metadata_backup["add_blank_entries"]:
if map_key in special_names:
map_key = special_names[map_key]
og_dict = meta["metadata"][map_key] if map_key in meta["metadata"] and meta["metadata"][map_key] else {}
if attrs or (library.metadata_backup["add_blank_entries"] and not og_dict):
def get_dict(attrs_dict):
return {ak: get_dict(av) if isinstance(av, dict) else av for ak, av in attrs_dict.items()} if isinstance(attrs_dict, dict) else attrs_dict
meta["metadata"][map_key] = get_dict(attrs)
return {ak: get_dict(av) if isinstance(av, dict) else av for ak, av in attrs_dict.items()}
def loop_dict(looping, dest_dict):
if not looping:
return None
for lk, lv in looping:
dest_dict[lk] = loop_dict(lv, dest_dict[lk] if lk in dest_dict and dest_dict[lk] else {}) if isinstance(lv, dict) else lv
return dest_dict
meta["metadata"][map_key] = loop_dict(get_dict(attrs), og_dict)
logger.exorcise()
try:
yaml.round_trip_dump(meta, open(library.metadata_backup["path"], "w", encoding="utf-8"), block_seq_indent=2)
Expand Down

0 comments on commit fcf2f25

Please sign in to comment.