Skip to content

Commit

Permalink
Compress Summary Options / Fix Theme Song Error with Missing TMDB Match
Browse files Browse the repository at this point in the history
  • Loading branch information
natyusha committed Aug 25, 2024
1 parent 16cfef0 commit 2442b57
Show file tree
Hide file tree
Showing 6 changed files with 20 additions and 39 deletions.
11 changes: 6 additions & 5 deletions Contents/Code/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -364,7 +364,7 @@ def Update(self, metadata, media, lang, force):

# Get Plex theme music using a TvDB ID cross referenced from TMDB
if Prefs['themeMusic']:
if try_get(series_data['TMDB'][tmdb_type][0], 'TvdbID', None):
if tmdb_type and try_get(series_data['TMDB'][tmdb_type][0], 'TvdbID', None):
THEME_URL = 'http://tvthemes.plexapp.com/%s.mp3' % series_data['TMDB'][tmdb_type][0]['TvdbID']
if THEME_URL not in metadata.themes:
try:
Expand All @@ -391,10 +391,11 @@ def image_add(self, meta, images):
del meta[key]

def summary_sanitizer(summary):
if Prefs['synposisCleanLinks'] : summary = re.sub(r'https?:\/\/\w+.\w+(?:\/?\w+)? \[([^\]]+)\]', r'\1', summary) # Replace links
if Prefs['synposisCleanMiscLines'] : summary = re.sub(r'^(\*|--|~) .*', '', summary, flags=re.M) # Remove the line if it starts with ('* ' / '-- ' / '~ ')
if Prefs['synposisRemoveSummary'] : summary = re.sub(r'\n(Source|Note|Summary):.*', '', summary, flags=re.S) # Remove all lines after this is seen
if Prefs['synposisCleanMultiEmptyLines'] : summary = re.sub(r'\n\n+', r'\n\n', summary, flags=re.S) # Condense multiple empty lines
summary = re.sub(r'https?:\/\/\w+.\w+(?:\/?\w+)? \[([^\]]+)\]', r'\1', summary) # Replace links
summary = re.sub(r'\n\n+', r'\n\n', summary, flags=re.S) # Condense stacked empty lines
if Prefs['sanitizeSummary'] != 'Allow Info & Misc. Lines':
if Prefs['sanitizeSummary'] != 'Allow Info Lines' : summary = re.sub(r'\n(Source|Note|Summary):.*', '', summary, flags=re.S) # Remove the line if it starts with ("Source: ", "Note: ", "Summary: ")
if Prefs['sanitizeSummary'] != 'Allow Misc. Lines' : summary = re.sub(r'^(\*|--|~) .*', '', summary, flags=re.M) # Remove the line if it starts with ("* ", "-- ", "~ ")
return summary.strip(' \n')

def title_case(text):
Expand Down
36 changes: 8 additions & 28 deletions Contents/DefaultPrefs.json
Original file line number Diff line number Diff line change
Expand Up @@ -93,41 +93,21 @@
"default": true
},

{
"id": "synposisCleanLinks",
"label": "Synopsis: Remove links",
"type": "bool",
"default": true
},

{
"id": "synposisCleanMiscLines",
"label": "Synopsis: Remove the line if it starts with ('* ' / '-- ' / '~ ')",
"type": "bool",
"default": true
},

{
"id": "synposisRemoveSummary",
"label": "Synopsis: Remove anything after Source, Note or Summary",
"type": "bool",
"default": true
},

{
"id": "synposisCleanMultiEmptyLines",
"label": "Synopsis: Collapse excessive empty lines",
"type": "bool",
"default": true
},

{
"id": "shokoThumbs",
"label": "Use Shoko's episode thumbnails",
"type": "bool",
"default": false
},

{
"id": "sanitizeSummary",
"label": "The degree to which the summary is cleaned of extraneous info. This includes info lines (\"Source: \", \"Note: \", \"Summary: \"), and miscellaneous lines (\"* \", \"-- \", \"~ \").",
"type": "enum",
"values" : ["Fully Clean", "Allow Info Lines", "Allow Misc. Lines", "Allow Info & Misc. Lines"],
"default": "Fully Clean"
},

{
"id": "disableNegativeSeasonAirdates",
"label": "Leave the \"Originally Available\" field blank for \"Credits\", \"Trailers\", \"Parodies\", and \"Other\" episode types. This is a workaround to prevent Plex from playing them before regular episodes and specials.",
Expand Down
2 changes: 1 addition & 1 deletion Contents/Scripts/collection-posters.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
Author:
- natyusha
Requirements:
- Python 3.7+, Python-PlexAPI (pip install plexapi), Requests Library (pip install requests), Plex, ShokoRelay, Shoko Server
- Python 3.7+, Python-PlexAPI (pip install plexapi), Requests Library (pip install requests), Plex, Shoko Relay, Shoko Server
Preferences:
- Before doing anything with this script you must enter your Plex and Shoko Server credentials into config.py.
- If your anime is split across multiple libraries they can all be added in a python list under "LibraryNames".
Expand Down
2 changes: 1 addition & 1 deletion Contents/Scripts/force-metadata.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
Author:
- natyusha
Requirements:
- Python 3.7+, Python-PlexAPI (pip install plexapi), Plex, ShokoRelay, Shoko Server
- Python 3.7+, Python-PlexAPI (pip install plexapi), Plex, Shoko Relay, Shoko Server
Preferences:
- Before doing anything with this script you must enter your Plex credentials into config.py.
- If your anime is split across multiple libraries they can all be added in a python list under Plex "LibraryNames".
Expand Down
2 changes: 1 addition & 1 deletion Contents/Scripts/watched-sync.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
Author:
- natyusha
Requirements:
- Python 3.7+, Python-PlexAPI (pip install plexapi), Requests Library (pip install requests), Plex, ShokoRelay, Shoko Server
- Python 3.7+, Python-PlexAPI (pip install plexapi), Requests Library (pip install requests), Plex, Shoko Relay, Shoko Server
Preferences:
- Before doing anything with this script you must enter your Plex and Shoko Server credentials into config.py.
- If your anime is split across multiple libraries they can all be added in a python list under Plex "LibraryNames".
Expand Down
6 changes: 3 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -167,7 +167,7 @@ After installing the dependencies you must use a text editor to enter your Shoko
<summary><b>Additional Information</b></summary><br>

**Requirements:**
- Python 3.7+, Python-PlexAPI (pip install plexapi), Requests Library (pip install requests), Plex, ShokoRelay, Shoko Server
- Python 3.7+, Python-PlexAPI (pip install plexapi), Requests Library (pip install requests), Plex, Shoko Relay, Shoko Server

**Preferences:**
- Before doing anything with this script you must enter your Plex and Shoko Server credentials into `config.py`.
Expand Down Expand Up @@ -195,7 +195,7 @@ After installing the dependencies you must use a text editor to enter your Shoko
<summary><b>Additional Information</b></summary><br>

**Requirements:**
- Python 3.7+, Python-PlexAPI (pip install plexapi), Plex, ShokoRelay, Shoko Server
- Python 3.7+, Python-PlexAPI (pip install plexapi), Plex, Shoko Relay, Shoko Server

**Preferences:**
- Before doing anything with this script you must enter your Plex credentials into `config.py`.
Expand Down Expand Up @@ -255,7 +255,7 @@ After installing the dependencies you must use a text editor to enter your Shoko
<summary><b>Additional Information</b></summary><br>

**Requirements:**
- Python 3.7+, Python-PlexAPI (pip install plexapi), Requests Library (pip install requests), Plex, ShokoRelay, Shoko Server
- Python 3.7+, Python-PlexAPI (pip install plexapi), Requests Library (pip install requests), Plex, Shoko Relay, Shoko Server

**Preferences:**
- Before doing anything with this script you must enter your Plex and Shoko Server credentials into `config.py`.
Expand Down

0 comments on commit 2442b57

Please sign in to comment.