Pass PlexServer object to modify_episode_artwork function

This commit is contained in:
JonnyWong16 2021-11-23 09:29:00 -08:00
parent f706e57701
commit a81ff1fdf9
No known key found for this signature in database
GPG Key ID: B1F1F9807184697A

View File

@ -40,8 +40,7 @@ PLEX_URL = os.getenv('PLEX_URL', PLEX_URL)
PLEX_TOKEN = os.getenv('PLEX_TOKEN', PLEX_TOKEN)
def modify_episode_artwork(rating_key, image=None, blur=None, summary_prefix=None, remove=False):
plex = PlexServer(PLEX_URL, PLEX_TOKEN)
def modify_episode_artwork(plex, rating_key, image=None, blur=None, summary_prefix=None, remove=False):
item = plex.fetchItem(rating_key)
if item.type == 'show':
@ -116,4 +115,5 @@ if __name__ == "__main__":
parser.add_argument('--remove', action='store_true')
opts = parser.parse_args()
modify_episode_artwork(**vars(opts))
plex = PlexServer(PLEX_URL, PLEX_TOKEN)
modify_episode_artwork(plex, **vars(opts))