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' }})) } }))
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' })) }))
def agents(self): response = self.http.get('system/agents') return self.parse( response, idict({'MediaContainer': ('Container', idict({'Agent': 'Agent'}))}))
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' })) }))
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' })) }))
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'}))}))
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", } ), ) } ), )
def servers(self): response = self.http.get('servers') return self.parse(response, idict({ 'MediaContainer': ('Container', idict({ 'Server': 'Server' })) }))
def agents(self): response = self.http.get('system/agents') return self.parse(response, idict({ 'MediaContainer': ('Container', idict({ 'Agent': 'Agent' })) }))
def detail(self): response = self.http.get() return self.parse(response, idict({ 'MediaContainer': ('Detail', idict({ 'Directory': 'Directory' })) }))
def get(self, key): response = self.http.get(key) return self.parse(response, idict({ 'MediaContainer': ('MediaContainer', idict({ 'Playlist': 'Playlist' })) }))
def servers(self): response = self.http.get('servers') return self.parse( response, idict( {'MediaContainer': ('Container', idict({'Server': 'Server'}))}))
def detail(self): response = self.http.get() return self.parse( response, idict({ 'MediaContainer': ('Detail', idict({'Directory': 'Directory'})) }))
def clients(self): response = self.http.get('clients') return self.parse(response, idict({ 'MediaContainer': ('ClientContainer', idict({ 'Server': 'Client' })) }))
def clients(self): response = self.http.get('clients') return self.parse( response, idict({ 'MediaContainer': ('ClientContainer', idict({'Server': 'Client'})) }))
def sections(self): response = self.http.get('sections') return self.parse(response, idict({ 'MediaContainer': ('SectionContainer', idict({ 'Directory': ('Section', idict({ 'Location': 'Location' })) })) }))
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'})) }))
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'})) }))
def on_deck(self): response = self.http.get('onDeck') return self.parse(response, idict({ 'MediaContainer': ('MediaContainer', idict({ 'Video': { 'movie': 'Movie', 'episode': 'Episode' } })) }))
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'})) }))
def sessions(self): response = self.http.get('sessions') return self.parse(response, idict({ 'MediaContainer': ('SessionContainer', idict({ 'Track': 'Track', 'Video': { 'episode': 'Episode', 'movie': 'Movie' } })) }))
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' })) }))
def on_deck(self): response = self.http.get('onDeck') return self.parse( response, idict({ 'MediaContainer': ('MediaContainer', idict({'Video': { 'movie': 'Movie', 'episode': 'Episode' }})) }))
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' } })) }))
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' } })) }))
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' })) }))
def all(self): response = self.http.get('all') return self.parse(response, idict({ 'MediaContainer': ('MediaContainer', idict({ 'Directory': { 'artist': 'Artist', 'show': 'Show' }, 'Video': { 'movie': 'Movie' } })) }))
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"})), } } ), )
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', } })) }))
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' } })) }))
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
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'})) } }))
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' })) } }))
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
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"}, } ), ) } ), )
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' })) }))
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' })) }))
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"}})), } } ), )
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' } })) } }))
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"}))}))
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"}))}))
def clients(self): response = self.http.get("clients") return self.parse(response, idict({"MediaContainer": ("ClientContainer", idict({"Server": "Client"}))}))
def servers(self): response = self.http.get("servers") return self.parse(response, idict({"MediaContainer": ("Container", idict({"Server": "Server"}))}))
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"}))}))
def detail(self): response = self.http.get() return self.parse(response, idict({"MediaContainer": ("Detail", idict({"Directory": "Directory"}))}))