-
Notifications
You must be signed in to change notification settings - Fork 201
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Defer XML string cleaning to improve performance #1511
base: master
Are you sure you want to change the base?
Defer XML string cleaning to improve performance #1511
Conversation
…ve) before trying again with cleaning
Replace this with the helper function as well? python-plexapi/plexapi/myplex.py Line 1883 in a8d051f
|
…the logic that previously existed
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could you also change import xml
to from xml.etree import ElementTree
in media.py
.
python-plexapi/plexapi/media.py
Line 2 in a8d051f
import xml |
And update this exception:
python-plexapi/plexapi/media.py
Line 1078 in a8d051f
except xml.etree.ElementTree.ParseError: |
…epo's style guidelines
Description
This PR optimizes XML parsing by deferring the use of
utils.cleanXMLString
, which contains an expensive regex query. Instead of always cleaning the string before parsing, we now attempt to parse the XML string in its raw form, only falling back to cleaning if aParseError
occurs.Originally suggested in #1510 (comment).
Type of change
Checklist: