Skip to content

Commit

Permalink
Remove Main Series Fallback from Season Posters / Remove Leftover BBC…
Browse files Browse the repository at this point in the history
…ode from Descriptions

- the main series fallback was setting itself as the primary season 1 poster even when added last so remove it
- in rare cases leftover bbcode [i] tags are left in the description by the anidb api. this will remove them and the text they contain
- remove double spaces from the description
- bump versions
  • Loading branch information
natyusha committed Aug 30, 2024
1 parent 91a65d8 commit 9e77810
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 7 deletions.
9 changes: 5 additions & 4 deletions Contents/Code/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ def ValidatePrefs():
pass

def Start():
Log('======================[Shoko Relay Agent v1.2.4]=======================')
Log('======================[Shoko Relay Agent v1.2.5]=======================')
HTTP.Headers['Accept'] = 'application/json'
HTTP.ClearCache() # Clear the cache possibly removing stuck metadata
HTTP.CacheTime = 0.1 # Reduce the cache time as much as possible since Shoko has all the metadata
Expand Down Expand Up @@ -366,7 +366,6 @@ def Update(self, metadata, media, lang, force):
for season in seasons:
if int(season_num) == season['SeasonNumber']:
self.image_add(metadata.seasons[season_num].posters, try_get(season['Images'], 'Posters', []))
self.image_add(metadata.seasons[season_num].posters, try_get(series_data['Images'], 'Posters', [])) # Add the preferred main series poster as a fallback in case of bad season posters
break

""" Enable if Plex fixes blocking legacy agent issue
Expand Down Expand Up @@ -411,11 +410,13 @@ def image_add(self, meta, images):
del meta[key]

def summary_sanitizer(summary):
summary = re.sub(r'https?:\/\/\w+.\w+(?:\/?\w+)? \[([^\]]+)\]', r'\1', summary) # Replace links with text
if Prefs['sanitizeSummary'] != 'Allow Both Types':
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(ur'^(\*|\u2014|--|~) .*', '', summary, flags=re.M | re.U) # Remove the line if it starts with ("* ", "— ", "-- ", "~ ")
summary = re.sub(r'\n\n+', r'\n\n', summary, flags=re.S) # Condense stacked empty lines
summary = re.sub(r'https?:\/\/\w+.\w+(?:\/?\w+)? \[([^\]]+)\]', r'\1', summary) # Replace links with text
summary = re.sub(r'\[i\].*\[\/i\]', '', summary, flags=re.S) # Remove leftover BBCode [i] tags
summary = re.sub(r'\n\n+', r'\n\n', summary, flags=re.S) # Condense stacked empty lines
summary = re.sub(r' +', ' ', summary) # Remove double spaces
return summary.strip(' \n')

def title_case(text):
Expand Down
2 changes: 1 addition & 1 deletion Contents/Info.plist
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
<key>CFBundleName</key>
<string>Shoko Relay</string>
<key>CFBundleVersion</key>
<string>1.2.4</string>
<string>1.2.5</string>
<key>CFBundleIdentifier</key>
<string>com.plexapp.agents.shokorelay</string>
<key>PlexClientPlatforms</key>
Expand Down
2 changes: 1 addition & 1 deletion Contents/Scanners/Series/Shoko Relay Scanner.py
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ def Scan(path, files, mediaList, subdirs, language=None, root=None):
if files : Log.debug('[Files] %s' % ', '.join(files))

for subdir in subdirs: Log.debug('[Folder] %s' % os.path.relpath(subdir, root))
Log.info('===========================[Shoko Relay Scanner v1.2.4]' + '=' * 245)
Log.info('===========================[Shoko Relay Scanner v1.2.5]' + '=' * 245)

if files:
# Scan for video files
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
![Shoko Relay Logo](https://github.com/natyusha/ShokoRelay.bundle/assets/985941/23bfd7c2-eb89-46d5-a7cb-558c374393d6 "Shoko Relay")
=======================
This is a bundle containing a Plex metadata agent, scanner, and automation scripts written to work with anything listed on AniDB. All you need to get started is a populated [Shoko Server](https://shokoanime.com/) (v4.2.2.101+) and [Plex Media Server](https://www.plex.tv/media-server-downloads/) (Not running on an Nvidia Shield). Unlike the original metadata bundle for Shoko this one does not include a movie scanner and is intended to work with series of all types within a single "TV Shows" library.
This is a bundle containing a Plex metadata agent, scanner, and automation scripts written to work with anything listed on AniDB. All you need to get started is a populated [Shoko Server](https://shokoanime.com/) (v4.2.2.104+) and [Plex Media Server](https://www.plex.tv/media-server-downloads/) (Not running on an Nvidia Shield). Unlike the original metadata bundle for Shoko this one does not include a movie scanner and is intended to work with series of all types within a single "TV Shows" library.

## Installation
- Extract [the latest release](https://github.com/natyusha/ShokoRelay.bundle/releases/latest/download/ShokoRelay.bundle.zip) into your [Plex Media Server Plug-ins Folder](https://support.plex.tv/articles/201106098-how-do-i-find-the-plug-ins-folder/) `\Plex Media Server\Plug-ins`
Expand Down

0 comments on commit 9e77810

Please sign in to comment.