2019-06-11 05:29:42 +10:00
|
|
|
#!/usr/bin/env python
|
|
|
|
# -*- coding: utf-8 -*-
|
|
|
|
"""
|
|
|
|
plex_api interfaces with all Plex Media Server (and plex.tv) xml responses
|
|
|
|
"""
|
|
|
|
from __future__ import absolute_import, division, unicode_literals
|
|
|
|
|
|
|
|
from .base import Base
|
|
|
|
from .artwork import Artwork
|
|
|
|
from .file import File
|
|
|
|
from .media import Media
|
|
|
|
from .user import User
|
2019-08-25 21:46:47 +10:00
|
|
|
from .playback import Playback
|
2019-06-11 05:29:42 +10:00
|
|
|
|
|
|
|
from ..plex_db import PlexDB
|
|
|
|
|
|
|
|
|
2019-08-25 21:46:47 +10:00
|
|
|
class API(Base, Artwork, File, Media, User, Playback):
|
2019-06-11 05:29:42 +10:00
|
|
|
pass
|
|
|
|
|
|
|
|
|
|
|
|
def mass_api(xml):
|
|
|
|
"""
|
|
|
|
Pass in an entire XML PMS response with e.g. several movies or episodes
|
|
|
|
Will Look-up Kodi ids in the Plex.db for every element (thus speeding up
|
|
|
|
this process for several PMS items!)
|
|
|
|
"""
|
|
|
|
apis = [API(x) for x in xml]
|
|
|
|
with PlexDB(lock=False) as plexdb:
|
|
|
|
for api in apis:
|
|
|
|
api.check_db(plexdb=plexdb)
|
|
|
|
return apis
|