Uh oh!
There was an error while loading. Please reload this page.
Library Hubs and Music Stations - #518
Conversation
referencing #209
…ories from LibrarySection.filterFields() instead of using hardcoded ALLOWED_FILTERS or BOOLEAN_FILTERS.
…ys from LibrarySection._sorts() instead of using hardcoded ALLOWED_SORT.
…es and docstring references.
blacktwin
commented
Jun 30, 2020
Code snippets: foryinplex.library.section('Music').filterFields(mediaType='album'):
print(vars(y))
break"""{ '_data': <Element 'Field' at 0x0000022F716CF638>, '_details_key': '', '_initpath': '/library/sections/27/all?type=9', '_server': <PlexServer:http://127.0.0.1:324>, 'key': 'album.title', 'operators': [ <Operator:=:contains>, <Operator:!=:does-not-contain>, <Operator:==:is>, <Operator:!==:is-not>, <Operator:<=:begins-with>, <Operator:>=:ends-with>], 'subType': None, 'title': 'Album Title', 'type': 'string'}"""forsortinplex.library.section('TV Shows')._sorts():
print(vars(sort))
break"""{ '_data': <Element 'Directory' at 0x0000022F716C73B8>, '_details_key': '', '_initpath': '/library/sections/3/sorts', '_server': <PlexServer:http://127.0.0.1:324>, 'defaultDirection': 'asc', 'descKey': 'titleSort:desc', 'firstCharacterKey': '/library/sections/3/firstCharacter', 'key': 'titleSort', 'title': 'Title'}"""forfirstinplex.library.section('Movies').firstCharacter():
print(vars(first))
break"""{ '_data': <Element 'Directory' at 0x0000022F716D69A8>, '_details_key': '', '_initpath': '/library/sections/2/firstCharacter', '_server': <PlexServer:http://127.0.0.1:324>, 'key': '%23', 'size': '16', 'title': '#'}""" |
blacktwin
commented
Jun 30, 2020
With the removal of the hardcoded |
| data = self._server.query(key) | ||
| for meta in data.iter('Meta'): | ||
| for metaType in meta.iter('Type'): | ||
| if mediaType and metaType.attrib.get('type') == mediaType: |
There was a problem hiding this comment.
simplify this one.
if not mediatype or ...
There was a problem hiding this comment.
Yeah, that one was tripping me up. I'm repeating the same for loop for both but I get the mediaType isolated when called. I'll move this PR to draft while I figure it out. I'm open to suggestions, of course.
There was a problem hiding this comment.
What your doing is fine, but just use the or so you check both conditions at the same time.
| self.firstCharacterKey = data.attrib.get('firstCharacterKey') | ||
| class Field(PlexObject): |
There was a problem hiding this comment.
We already have a class called Field. Maybe change the name or atleast make a better docstring.
There was a problem hiding this comment.
oh yeah docstrings need updated. I based the name off the xml tagging. Technically they can both exist after 3746b4e . But, yeah, I can change it.
update library.LibrarySection.filterFields() usage
folders and subfolders method is kinda neat. foriteminplex.library.section('Music').folders():
forsubinitem.subfolders():
fortrackinsub.subfolders():
print(vars(track))We can get to the media item through the |
coveralls
commented
Sep 28, 2020
blacktwin
commented
Sep 30, 2020
With the exception of the decrease in coverage, this PR is gtg. |
Adding Station support as requested in #361
Adding Library Hubs. Returns "More By {ARTIST}" or "Rediscover"