예제 #1
0
파일: metadata.py 프로젝트: naterh/plex.py
    def children(self, key):
        response = self.http.get(key, 'children')

        return self.parse(
            response,
            idict({
                'MediaContainer': {
                    '_':
                    'viewGroup',

                    # ---------------------------------------
                    # Music
                    # ---------------------------------------
                    'album': ('ArtistChildrenContainer',
                              idict({'Directory': {
                                  'album': 'Album'
                              }})),
                    'track':
                    ('AlbumChildrenContainer', idict({'Track': 'Track'})),

                    # ---------------------------------------
                    # TV
                    # ---------------------------------------
                    'season': ('ShowChildrenContainer',
                               idict({'Directory': {
                                   'season': 'Season'
                               }})),
                    'episode': ('SeasonChildrenContainer',
                                idict({'Video': {
                                    'episode': 'Episode'
                                }}))
                }
            }))
예제 #2
0
 def primary_agent(self, guid, media_type):
     response = self.http.get('/system/agents/%s/config/%s' % (guid, media_type))
     return self.parse(response, idict({
         'MediaContainer': ('Container', idict({
             'Agent': 'Agent'
         }))
     }))
예제 #3
0
    def agents(self):
        response = self.http.get('system/agents')

        return self.parse(
            response,
            idict({'MediaContainer': ('Container', idict({'Agent':
                                                          'Agent'}))}))
예제 #4
0
    def first_character(self, key, character=None):
        if character:
            response = self.http.get(key, ['firstCharacter', character])

            # somehow plex wrongly returns items of other libraries when character is #
            return self.parse(response, idict({
                'MediaContainer': ('MediaContainer', idict({
                    'Directory': {
                        'album':    'Album',
                        'artist':   'Artist',

                        'season':   'Season',
                        'show':     'Show'
                    },
                    'Video': {
                        'episode':  'Episode',
                        'clip':     'Clip',
                        'movie':    'Movie'
                    },
                    'Track': 'Track'
                }))
            }))

        response = self.http.get(key, 'firstCharacter')

        return self.parse(response, idict({
            'MediaContainer': ('MediaContainer', idict({
                'Directory': 'Directory'
            }))
        }))
예제 #5
0
    def all(self, playlist_id, include_related=None, start=None, size=None):
        response = self.http.get('/playlists/%s/items' % playlist_id,
                                 query=[
                                     ('includeRelated', include_related),
                                     ('X-Plex-Container-Start', start),
                                     ('X-Plex-Container-Size', size),
                                 ])

        return self.parse(
            response,
            idict({
                'MediaContainer': ('PlaylistItemContainer',
                                   idict({
                                       'Directory': {
                                           'album': 'Album',
                                           'artist': 'Artist',
                                           'season': 'Season',
                                           'show': 'Show'
                                       },
                                       'Video': {
                                           'episode': 'Episode',
                                           'clip': 'Clip',
                                           'movie': 'Movie'
                                       },
                                       'Track': 'Track'
                                   }))
            }))
예제 #6
0
 def primary_agent(self, guid, media_type):
     response = self.http.get('/system/agents/%s/config/%s' %
                              (guid, media_type))
     return self.parse(
         response,
         idict({'MediaContainer': ('Container', idict({'Agent':
                                                       'Agent'}))}))
예제 #7
0
    def all(self, playlist_id, include_related=None, start=None, size=None):
        response = self.http.get(
            "/playlists/%s/items" % playlist_id,
            query=[
                ("includeRelated", include_related),
                ("X-Plex-Container-Start", start),
                ("X-Plex-Container-Size", size),
            ],
        )

        return self.parse(
            response,
            idict(
                {
                    "MediaContainer": (
                        "PlaylistItemContainer",
                        idict(
                            {
                                "Directory": {"album": "Album", "artist": "Artist", "season": "Season", "show": "Show"},
                                "Video": {"episode": "Episode", "clip": "Clip", "movie": "Movie"},
                                "Track": "Track",
                            }
                        ),
                    )
                }
            ),
        )
예제 #8
0
    def servers(self):
        response = self.http.get('servers')

        return self.parse(response, idict({
            'MediaContainer': ('Container', idict({
                'Server': 'Server'
            }))
        }))
예제 #9
0
    def agents(self):
        response = self.http.get('system/agents')

        return self.parse(response, idict({
            'MediaContainer': ('Container', idict({
                'Agent': 'Agent'
            }))
        }))
예제 #10
0
    def detail(self):
        response = self.http.get()

        return self.parse(response, idict({
            'MediaContainer': ('Detail', idict({
                'Directory': 'Directory'
            }))
        }))
예제 #11
0
    def get(self, key):
        response = self.http.get(key)

        return self.parse(response, idict({
            'MediaContainer': ('MediaContainer', idict({
                'Playlist': 'Playlist'
            }))
        }))
예제 #12
0
    def servers(self):
        response = self.http.get('servers')

        return self.parse(
            response,
            idict(
                {'MediaContainer': ('Container', idict({'Server':
                                                        'Server'}))}))
예제 #13
0
    def detail(self):
        response = self.http.get()

        return self.parse(
            response,
            idict({
                'MediaContainer': ('Detail', idict({'Directory': 'Directory'}))
            }))
예제 #14
0
    def clients(self):
        response = self.http.get('clients')

        return self.parse(response, idict({
            'MediaContainer': ('ClientContainer', idict({
                'Server': 'Client'
            }))
        }))
예제 #15
0
    def clients(self):
        response = self.http.get('clients')

        return self.parse(
            response,
            idict({
                'MediaContainer':
                ('ClientContainer', idict({'Server': 'Client'}))
            }))
예제 #16
0
    def sections(self):
        response = self.http.get('sections')

        return self.parse(response, idict({
            'MediaContainer': ('SectionContainer', idict({
                'Directory': ('Section', idict({
                    'Location': 'Location'
                }))
            }))
        }))
예제 #17
0
파일: __init__.py 프로젝트: naterh/plex.py
    def sections(self):
        response = self.http.get('sections')

        return self.parse(response, idict({
            'MediaContainer': ('SectionContainer', idict({
                'Directory': ('Section', idict({
                    'Location': 'Location'
                }))
            }))
        }))
예제 #18
0
    def add(self, playlist_id, item_uri):
        response = self.http.put('/playlists/%s/items' % playlist_id,
                                 query=[('uri', item_uri)])

        return self.parse(
            response,
            idict({
                'MediaContainer':
                ('MediaContainer', idict({'Playlist': 'Playlist'}))
            }))
예제 #19
0
    def remove(self, playlist_id, item_id):
        response = self.http.delete('/playlists/%s/items/%s' %
                                    (playlist_id, item_id))

        return self.parse(
            response,
            idict({
                'MediaContainer':
                ('MediaContainer', idict({'Playlist': 'Playlist'}))
            }))
예제 #20
0
    def on_deck(self):
        response = self.http.get('onDeck')

        return self.parse(response, idict({
            'MediaContainer': ('MediaContainer', idict({
                'Video': {
                    'movie':    'Movie',
		    'episode': 	'Episode'
                }
            }))
        }))
예제 #21
0
    def move(self, playlist_id, item_id, after=None):
        response = self.http.put('/playlists/%s/items/%s/move' %
                                 (playlist_id, item_id),
                                 query=[('after', after)])

        return self.parse(
            response,
            idict({
                'MediaContainer':
                ('MediaContainer', idict({'Playlist': 'Playlist'}))
            }))
예제 #22
0
    def sessions(self):
        response = self.http.get('sessions')

        return self.parse(response, idict({
            'MediaContainer': ('SessionContainer', idict({
                'Track': 'Track',

                'Video': {
                    'episode':  'Episode',
                    'movie':    'Movie'
                }
            }))
        }))
예제 #23
0
    def all(self, type=15, sort=None, playlist_type=None, smart=None):
        response = self.http.get('all', query=[
            ('type', type),
            ('sort', sort),
            ('playlistType', playlist_type),
            ('smart', smart)
        ])

        return self.parse(response, idict({
            'MediaContainer': ('MediaContainer', idict({
                'Playlist': 'Playlist'
            }))
        }))
예제 #24
0
    def on_deck(self):
        response = self.http.get('onDeck')

        return self.parse(
            response,
            idict({
                'MediaContainer':
                ('MediaContainer',
                 idict({'Video': {
                     'movie': 'Movie',
                     'episode': 'Episode'
                 }}))
            }))
예제 #25
0
    def all(self, key):
        response = self.http.get(key, 'all')

        return self.parse(response, idict({
            'MediaContainer': ('MediaContainer', idict({
                'Directory': {
                    'artist':   'Artist',
                    'show':     'Show'
                },
                'Video': {
                    'movie':    'Movie'
                }
            }))
        }))
예제 #26
0
    def recently_added(self):
        response = self.http.get('recentlyAdded')

        return self.parse(response, idict({
            'MediaContainer': ('MediaContainer', idict({
                'Directory': {
                    'album':    'Album',
                    'season':   'Season'
                },
                'Video': {
                    'movie':    'Movie'
                }
            }))
        }))
예제 #27
0
    def create(self, type, title, uri, smart=False):
        response = self.http.post(query=[
            ('type', type),
            ('title', title),
            ('uri', uri),

            ('smart', int(smart))
        ])

        return self.parse(response, idict({
            'MediaContainer': ('MediaContainer', idict({
                'Playlist': 'Playlist'
            }))
        }))
예제 #28
0
파일: __init__.py 프로젝트: naterh/plex.py
    def recently_added(self):
        response = self.http.get('recentlyAdded')

        return self.parse(response, idict({
            'MediaContainer': ('MediaContainer', idict({
                'Directory': {
                    'album':    'Album',
                    'season':   'Season'
                },
                'Video': {
                    'movie':    'Movie'
                }
            }))
        }))
예제 #29
0
    def all(self):
        response = self.http.get('all')

        return self.parse(response, idict({
            'MediaContainer': ('MediaContainer', idict({
                'Directory': {
                    'artist':    'Artist',
                    'show':     'Show'
                },
                'Video': {
                    'movie':    'Movie'
                }
            }))
        }))
예제 #30
0
    def all_leaves(self, key):
        response = self.http.get(key, "allLeaves")

        return self.parse(
            response,
            idict(
                {
                    "MediaContainer": {
                        "_": "viewGroup",
                        "episode": ("ShowLeavesContainer", idict({"Video": {"episode": "Episode"}})),
                        "track": ("ArtistLeavesContainer", idict({"Track": "Track"})),
                    }
                }
            ),
        )
예제 #31
0
    def recently_added(self, key):
        response = self.http.get(key, 'recentlyAdded')

        return self.parse(response, idict({
            'MediaContainer': ('MediaContainer', idict({
                'Directory': {
                    'artist':   'Artist',
                    'show':     'Show'
                },
                'Video': {
                    'movie':    'Movie',
                    'episode':  'Episode',
                    'clip':     'Clip',
                }
            }))
        }))
예제 #32
0
    def sessions(self):
        response = self.http.get('sessions')

        return self.parse(
            response,
            idict({
                'MediaContainer': ('SessionContainer',
                                   idict({
                                       'Track': 'Track',
                                       'Video': {
                                           'episode': 'Episode',
                                           'clip': 'Clip',
                                           'movie': 'Movie'
                                       }
                                   }))
            }))
예제 #33
0
    def get(self, id=None):
        response = self.http.get()

        container = self.parse(response, idict({
            'MediaContainer': ('MediaContainer', idict({
                'Setting': 'Setting'
            }))
        }))

        if container is None or id is None:
            return container

        for setting in container:
            if setting.id == id:
                return setting

        return None
예제 #34
0
파일: metadata.py 프로젝트: naterh/plex.py
    def all_leaves(self, key):
        response = self.http.get(key, 'allLeaves')

        return self.parse(
            response,
            idict({
                'MediaContainer': {
                    '_':
                    'viewGroup',
                    'episode': ('ShowLeavesContainer',
                                idict({'Video': {
                                    'episode': 'Episode'
                                }})),
                    'track':
                    ('ArtistLeavesContainer', idict({'Track': 'Track'}))
                }
            }))
예제 #35
0
    def all_leaves(self, key):
        response = self.http.get(key, 'allLeaves')

        return self.parse(response, idict({
            'MediaContainer': {
                '_': 'viewGroup',

                'episode': ('ShowLeavesContainer', idict({
                    'Video': {
                        'episode': 'Episode'
                    }
                })),

                'track': ('ArtistLeavesContainer', idict({
                    'Track': 'Track'
                }))
            }
        }))
예제 #36
0
    def get(self, plugin_id, id=None):
        response = self.http.get('/:/plugins/%s/prefs' % plugin_id)

        container = self.parse(
            response,
            idict({
                'MediaContainer':
                ('MediaContainer', idict({'Setting': 'Setting'}))
            }))

        if container is None or id is None:
            return container

        for setting in container:
            if setting.id == id:
                return setting

        return None
예제 #37
0
    def all(self):
        response = self.http.get("all")

        return self.parse(
            response,
            idict(
                {
                    "MediaContainer": (
                        "MediaContainer",
                        idict(
                            {
                                "Directory": {"artist": "Artist", "show": "Show"},
                                "Photo": {"photo": "Photo"},
                                "Video": {"movie": "Movie"},
                            }
                        ),
                    )
                }
            ),
        )
예제 #38
0
    def metadata(self, rating_key):
        response = self.http.get('metadata', rating_key)

        return self.parse(response, idict({
            'MediaContainer': ('MediaContainer', idict({
                'Directory': {
                    'album':    'Album',
                    'artist':   'Artist',

                    'season':   'Season',
                    'show':     'Show'
                },
                'Video': {
                    'episode':  'Episode',
                    'movie':    'Movie'
                },

                'Track': 'Track'
            }))
        }))
예제 #39
0
파일: __init__.py 프로젝트: naterh/plex.py
    def metadata(self, rating_key):
        response = self.http.get('metadata', rating_key)

        return self.parse(response, idict({
            'MediaContainer': ('MediaContainer', idict({
                'Directory': {
                    'album':    'Album',
                    'artist':   'Artist',

                    'season':   'Season',
                    'show':     'Show'
                },
                'Video': {
                    'episode':  'Episode',
                    'clip':     'Clip',
                    'movie':    'Movie'
                },

                'Track': 'Track'
            }))
        }))
예제 #40
0
    def children(self, key):
        response = self.http.get(key, "children")

        return self.parse(
            response,
            idict(
                {
                    "MediaContainer": {
                        "_": "viewGroup",
                        # ---------------------------------------
                        # Music
                        # ---------------------------------------
                        "album": ("ArtistChildrenContainer", idict({"Directory": {"album": "Album"}})),
                        "track": ("AlbumChildrenContainer", idict({"Track": "Track"})),
                        # ---------------------------------------
                        # TV
                        # ---------------------------------------
                        "season": ("ShowChildrenContainer", idict({"Directory": {"season": "Season"}})),
                        "episode": ("SeasonChildrenContainer", idict({"Video": {"episode": "Episode"}})),
                    }
                }
            ),
        )
예제 #41
0
    def children(self, key):
        response = self.http.get(key, 'children')

        return self.parse(response, idict({
            'MediaContainer': {
                '_': 'viewGroup',

                # ---------------------------------------
                # Music
                # ---------------------------------------
                'album': ('ArtistChildrenContainer', idict({
                    'Directory': {
                        'album': 'Album'
                    }
                })),

                'track': ('AlbumChildrenContainer', idict({
                    'Track': 'Track'
                })),

                # ---------------------------------------
                # TV
                # ---------------------------------------
                'season': ('ShowChildrenContainer', idict({
                    'Directory': {
                        'season': 'Season'
                    }
                })),

                'episode': ('SeasonChildrenContainer', idict({
                    'Video': {
                        'episode': 'Episode'
                    }
                }))
            }
        }))
예제 #42
0
    def add(self, playlist_id, item_uri):
        response = self.http.put("/playlists/%s/items" % playlist_id, query=[("uri", item_uri)])

        return self.parse(response, idict({"MediaContainer": ("MediaContainer", idict({"Playlist": "Playlist"}))}))
예제 #43
0
    def remove(self, playlist_id, item_id):
        response = self.http.delete("/playlists/%s/items/%s" % (playlist_id, item_id))

        return self.parse(response, idict({"MediaContainer": ("MediaContainer", idict({"Playlist": "Playlist"}))}))
예제 #44
0
    def clients(self):
        response = self.http.get("clients")

        return self.parse(response, idict({"MediaContainer": ("ClientContainer", idict({"Server": "Client"}))}))
예제 #45
0
    def servers(self):
        response = self.http.get("servers")

        return self.parse(response, idict({"MediaContainer": ("Container", idict({"Server": "Server"}))}))
예제 #46
0
    def move(self, playlist_id, item_id, after=None):
        response = self.http.put("/playlists/%s/items/%s/move" % (playlist_id, item_id), query=[("after", after)])

        return self.parse(response, idict({"MediaContainer": ("MediaContainer", idict({"Playlist": "Playlist"}))}))
예제 #47
0
    def detail(self):
        response = self.http.get()

        return self.parse(response, idict({"MediaContainer": ("Detail", idict({"Directory": "Directory"}))}))