From 63ba054df1d46e4b98501e884e3dd1fdfe39d877 Mon Sep 17 00:00:00 2001 From: jonjonsson Date: Thu, 9 Jan 2025 16:42:39 +0000 Subject: [PATCH] Optionally set "use_mdblist_collection_description = True" to grab the descriptions from MDBList. Applies to all collections. Optionally set "description" for each collection to set your own custom description. Will overwrite MDBList description if set. See examples in config.cfg. --- README.md | 10 ++++++++-- app.py | 20 +++++++++++++++++++- config.cfg | 14 ++++++++++++-- 3 files changed, 39 insertions(+), 5 deletions(-) diff --git a/README.md b/README.md index 15256a6..b70570e 100644 --- a/README.md +++ b/README.md @@ -1,4 +1,4 @@ -# Emby MDBList Collection Creator 1.81 +# Emby MDBList Collection Creator 1.82 This tool allows you to convert lists from MDBList.com into collections within your Emby media server. MDBList aggregates content lists from various platforms including Trakt and IMDB. @@ -9,6 +9,7 @@ This tool allows you to convert lists from MDBList.com into collections within y * Collection Images: Upload local or remote images for collections posters * Seasonal Collections: Specify when a collections should be visible * Collection Ordering: Show your collections in order of which one was update +* Collection Description: Add description from MDBList or create your own * Backup & Restore: Additional utilities to backup and restore watch history and favorites ## Prerequisites: @@ -196,4 +197,9 @@ Added Docker support thanks to @neoKushan. Minor fix for seasonal lists. Added ability to set collection posters. ### Version 1.81 -Can set custom sort name for a collection. Use "collection_sort_name" in config. \ No newline at end of file +Can set custom sort name for a collection. Use "collection_sort_name" in config. + +### Version 1.82 +Optionally set "use_mdblist_collection_description = True" to grab the descriptions from MDBList. Applies to all collections. +Optionally set "description" for each collection to set your own custom description. Will overwrite MDBList description if set. +See examples in config.cfg. \ No newline at end of file diff --git a/app.py b/app.py index 3c42b14..aefda2d 100644 --- a/app.py +++ b/app.py @@ -15,7 +15,7 @@ config_parser.optionxform = str.lower # Check if config_hidden.cfg exists, if so, use that, otherwise use config.cfg -if config_parser.read("config_hidden.cfg") == []: +if config_parser.read("config_hidden.cfg", encoding="utf-8") == []: config_parser.read("config.cfg") emby_server_url = config_parser.get("admin", "emby_server_url") @@ -43,6 +43,10 @@ refresh_items_max_days_since_premiered = config_parser.getint( "admin", "refresh_items_in_collections_max_days_since_premiered", fallback=30 ) +use_mdblist_collection_description = config_parser.getboolean( + "admin", "use_mdblist_collection_description", fallback=False +) + hours_between_refresh = config_parser.getint("admin", "hours_between_refresh") newly_added = 0 @@ -71,6 +75,8 @@ def process_list(mdblist_list: dict): "update_items_sort_names", update_items_sort_names_default_value ) collection_sort_name = mdblist_list.get("collection_sort_name", None) + description = mdblist_list.get("description", None) # Description from mdblist + overwrite_description = mdblist_list.get("overwrite_description", None) # From cfg collection_id = emby.get_collection_id(collection_name) active_period_str = config_parser.get( @@ -211,6 +217,15 @@ def process_list(mdblist_list: dict): emby.set_item_property(collection_id, "ForcedSortName", collection_sort_name) print(f"Updated sort name for {collection_name} to {collection_sort_name}") + if ( + use_mdblist_collection_description is True + and bool(description) + and overwrite_description is None + ): + emby.set_item_property(collection_id, "Overview", description) + elif overwrite_description is not None: + emby.set_item_property(collection_id, "Overview", overwrite_description) + print("=========================================") @@ -247,6 +262,9 @@ def process_hardcoded_lists(): "collection_sort_name": config_parser.get( section, "collection_sort_name", fallback=None ), + "overwrite_description": config_parser.get( + section, "description", fallback=None + ), } ) except configparser.NoOptionError as e: diff --git a/config.cfg b/config.cfg index 541e778..a77407a 100644 --- a/config.cfg +++ b/config.cfg @@ -22,12 +22,16 @@ emby_api_key = abc123 # https://mdblist.com/preferences/ to "API Access", and generate an API key mdblist_api_key = abc123 -# Set to True to enable downloading of lists added manually +# Set to True to enable downloading of lists added manually below download_manually_added_lists = True # Set to True to enable automatic downloading of your lists from https://mdblist.com/mylists/ download_my_mdblist_lists_automatically = True +# Set to True to use the description of the collection from MDBList.com in Emby +# You can overwrite this description by setting a description below for each collection. +use_mdblist_collection_description = True + # Change Sort Name of Collections so that those that get modified are at the top update_collection_sort_name = True @@ -64,6 +68,9 @@ refresh_items_in_collections_max_days_since_premiered = 30 # COLLECTION TITLE will be the string within the brackets. +# DESCRIPTION is optional. Set a description for the collection that shows up in Emby. +# Overwrites the description from MDBList.com if any. + # SOURCE is the URL to the list you want to add. You can have more than 1 for the # same collection, just separate them with a comma. @@ -90,6 +97,7 @@ refresh_items_in_collections_max_days_since_premiered = 30 source = https://mdblist.com/lists/teddysmoot/trending-new-shows frequency = 100 update_items_sort_names = False +description = The latest trending TV shows. # You can add multiple sources to a list by separating them with a comma. # This examples adds both trending kids movies and TV shows to the same collection @@ -97,6 +105,7 @@ update_items_sort_names = False source = https://mdblist.com/lists/tvgeniekodi/trending-kids-movies, https://mdblist.com/lists/japante/trending-kids-shows frequency = 100 update_items_sort_names = False +description = The latest trending kids movies and TV shows. # Example using a collection poster. Either a local path or an image URL. # https://theposterdb.com/ and https://plexcollectionposters.com/ have a lot of great posters. @@ -106,7 +115,8 @@ source = https://mdblist.com/lists/squint/the-96th-academy-awards poster = https://plexcollectionposters.com/images/2019/01/31/oscars9a7c2bc47188f883.png frequency = 100 update_items_sort_names = False -# Example of using a custom sort name for a collection. +description = All the movies that were nominated for the 96th Academy Awards. +# Example of using a custom sort name for a collection. collection_sort_name = zzzz I want this collection to show up last # Example using a list that should only show during a specific period like Halloween.