Conversation
|
Code snippets: for y in plex.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'}
"""
for sort in plex.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'}
"""
for first in plex.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': '#'}
""" |
|
With the removal of the hardcoded |
plexapi/library.py
Outdated
| 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.
plexapi/library.py
Outdated
| 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. for item in plex.library.section('Music').folders():
for sub in item.subfolders():
for track in sub.subfolders():
print(vars(track))We can get to the media item through the |
|
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"