Skip to content

Commit

Permalink
Account for v3 API Now Returning the Preferred Poster First
Browse files Browse the repository at this point in the history
- incidentally fixes a bug introduced here: 28ba49a (thanks to flashmeow for reporting)
- option spacing
- bump versions
  • Loading branch information
natyusha committed Sep 29, 2024
1 parent 8b00f3f commit f5a20d1
Show file tree
Hide file tree
Showing 5 changed files with 7 additions and 10 deletions.
9 changes: 3 additions & 6 deletions Contents/Code/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ def ValidatePrefs():
pass

def Start():
Log('======================[Shoko Relay Agent v1.2.10]======================')
Log('======================[Shoko Relay Agent v1.2.11]======================')
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 @@ -192,11 +192,8 @@ def Update(self, metadata, media, lang, force):
# Get Posters & Backgrounds
if Prefs['addEveryImage']:
series_images = HttpReq('api/v3/Series/%s/Images?includeDisabled=false' % series_id) # http://127.0.0.1:8111/api/v3/Series/24/Images?includeDisabled=false
posters, backgrounds = try_get(series_images, 'Posters', []), try_get(series_images, 'Backdrops', [])
for poster in [p for p in posters if poster['Preferred']]: posters.insert(0, posters.pop(posters.index(poster))) # Move preferred poster to the top of the list
self.image_add(metadata.posters, posters, '(Poster): ')
for background in [b for b in backgrounds if backdrop['Preferred']]: backgrounds.insert(0, backgrounds.pop(backgrounds.index(background))) # Move preferred backdrop to the top of the list
self.image_add(metadata.art, backgrounds, '(Background): ')
self.image_add(metadata.posters, try_get(series_images, 'Posters', []), '(Poster): ')
self.image_add(metadata.art, try_get(series_images, 'Backdrops', []), '(Background): ')
else: # Series data only contains the preferred image for each type
self.image_add(metadata.posters, try_get(series_data['Images'], 'Posters', []), '(Poster): ')
self.image_add(metadata.art, try_get(series_data['Images'], 'Backdrops', []), '(Background): ')
Expand Down
2 changes: 1 addition & 1 deletion Contents/DefaultPrefs.json
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,7 @@

{
"id": "sanitizeSummary",
"label": "The degree to which the summary is cleansed of extraneous info ⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀ This includes lines starting with general info (\"Source: \", \"Note: \", \"Summary: \"), as well as other miscellaneous lines (\"* \", \"\", \"- \", \"~ \").",
"label": "The degree to which the summary is cleansed of extraneous info ⠀⠀⠀⠀⠀⠀⠀⠀⠀⠀ This includes lines starting with general info (\"Source: \", \"Note: \", \"Summary: \"), as well as other miscellaneous lines (\"* \", \"\", \"- \", \"~ \").",
"type": "enum",
"values" : ["Fully Sanitize", "Allow Info Lines", "Allow Misc. Lines", "Allow Both Types"],
"default": "Fully Sanitize"
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.10</string>
<string>1.2.11</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 @@ -73,7 +73,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.10]' + '=' * 244)
Log.info('===========================[Shoko Relay Scanner v1.2.11]' + '=' * 244)

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.161+) 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.176+) 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 f5a20d1

Please sign in to comment.