Skip to content

Commit

Permalink
Optionally set "use_mdblist_collection_description = True" to grab th…
Browse files Browse the repository at this point in the history
…e 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.
  • Loading branch information
jonjonsson committed Jan 9, 2025
1 parent 29b05af commit 63ba054
Show file tree
Hide file tree
Showing 3 changed files with 39 additions and 5 deletions.
10 changes: 8 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
@@ -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.

Expand All @@ -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:
Expand Down Expand Up @@ -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.
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.
20 changes: 19 additions & 1 deletion app.py
Original file line number Diff line number Diff line change
Expand Up @@ -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")
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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(
Expand Down Expand Up @@ -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("=========================================")


Expand Down Expand Up @@ -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:
Expand Down
14 changes: 12 additions & 2 deletions config.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down Expand Up @@ -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.

Expand All @@ -90,13 +97,15 @@ 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
[Kids Trending]
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.
Expand All @@ -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.
Expand Down

0 comments on commit 63ba054

Please sign in to comment.