Commit graph

178 commits

Author SHA1 Message Date
JonnyWong16
e23cd8d158
Sanitize XML strings before parsing (#1452) 2024-08-17 14:07:12 -07:00
JonnyWong16
0601aaa40e
Add helper object to retrieve PlexObject (#1369) 2024-03-16 15:03:44 -07:00
Dr.Blank
ba384e0be5
Refactor cast function in utils.py (#1340)
- less indentation, more readable code
- early return
2024-02-04 11:22:37 -08:00
JonnyWong16
654ed506f4
Also catch ValueError when converting timestamp to datetime (#1329) 2024-02-04 10:52:34 -08:00
Elan Ruusamäe
8bb9f5f213
Use 4k chunk size (powers of 2) for download (#1326) 2024-02-04 10:50:50 -08:00
Marc Mueller
dcedde1947
Fix datetime returning UTC (#1262)
* Replace datetime.utcfromtimestamp

* Update plexapi/utils.py

Co-authored-by: JonnyWong16 <9099342+JonnyWong16@users.noreply.github.com>

* Default using `fromtimestamp` and fallback to using `timedelta` from 0

---------

Co-authored-by: JonnyWong16 <9099342+JonnyWong16@users.noreply.github.com>
2023-10-03 20:30:32 -07:00
JonnyWong16
b98b6050fe
Add properties to return the Plex Media Server data metadata paths (#1207)
* Add property to return the Plex Media Server data metadata path

* Add property to return the filepath for a resource

* Add tests for metadataDirectory and resourceFilepath
2023-08-27 12:59:53 -07:00
JonnyWong16
35008908fc
Improve parsing to datetime and add error handling (#1203)
* Improve parsing to datetime and add error handling

* Fix utils.millisecondToHumanstr for days and negatives

* Update tests for millisecondToHumanstr
2023-08-27 12:06:07 -07:00
JonnyWong16
ba0c27c6ef
Remove support for Python 3.7 (#1198)
* Remove support for Python 3.7

* Update CI workflow

* Manually update dependencies
2023-07-27 20:05:40 -07:00
JonnyWong16
58e279b837
Create separate PlexHistory objects (#1185)
* Create new PlexHistory object

* Add test for PlexHistory object
2023-07-27 17:45:51 -07:00
JonnyWong16
cde1e04495
Refactor fetchItems for pagination (#1143)
* Refactor base fetchItems for pagination

* Use base fetchItems for LibrarySection methods

* Use base fetchItems for MyPlexAccount watchlist

* Use base fetchItems for PlexServer history

* Fix imports
2023-05-24 14:50:30 -07:00
JonnyWong16
c49697b74b
Do not add blank string to secrets log filter (#1142) 2023-05-24 13:53:55 -07:00
meisnate12
abc3464de3
Raise Exceptions on bad Download Responses (#1109)
* expose showstatus to downloadDatabases and downloadLogs

* throw errors for bad download responses
2023-05-24 11:37:37 -07:00
JonnyWong16
63fe34c2f4
Speed up searchType and tagType lookups (#1097) 2023-03-09 14:21:45 -08:00
JonnyWong16
9b8c7d522d
Properly close file object in mixin uploads (#1074)
* Properly close file object in mixin uploads

* Also support a file-like object as the upload `filepath` parameter

* Update image upload tests for file-like object
2022-12-21 13:56:02 -08:00
Elan Ruusamäe
7580fc84a9
Use cached_property decorator (#1065)
* Use @cached_property in PlexSession.user

* Use @cached_property in PlexServer.library

* Use @cached_property in PlexServer.settings

* Tests: Update clearing plex.settings cache

* Use @cached_property in LibrarySection.totalSize

* Add backports.cached-property==1.0.2; python_version<="3.7" dependency

* Import cached_property from dist or backports

* Add backports.cached-property to requirements_dev.txt

* Remove version pin for backports.cached-property in requirements.txt

Co-authored-by: JonnyWong16 <9099342+JonnyWong16@users.noreply.github.com>

Co-authored-by: JonnyWong16 <9099342+JonnyWong16@users.noreply.github.com>
2022-12-21 11:51:45 -08:00
JonnyWong16
020a32f2b8
Update PlexAPI to f-strings (#1000)
* Update plexapi to f-strings

* Update tests to f-strings
2022-08-27 22:56:01 -07:00
JonnyWong16
e640f57319
Add utils.toJson(obj) function to convert an object to a JSON string (#998)
* Add `utils.toJson(obj)` function to convert an object to a JSON string

* Add test for utils.toJson()
2022-08-27 00:13:41 -07:00
JonnyWong16
f62dcbc5a4
Fix Video.optimize() method (#965)
* Add PlexObjects for all library media tags

* Add method to return all library media tags

* Add test for Library.tags

* Update Video.optimize

* Update video optimize test

* Use TAGTYPE for LibraryMediaTags

* Accept LibraryMediaTag as a search filter

* Use ratingKey and id before key in repr
2022-07-20 20:07:39 -07:00
JonnyWong16
925f573ced
Create separate PlexSession objects (#931)
* Add base findItem method

* Create new PlexSession objects

* PlexSession objects are unique from their base media objects. These objects are built from `/status/sessions` instead of `/library/metadata/<ratingKey>`. This allows reloading data from sessions without overwriting them.

* Add some media and client attributes for sessions

* Add separater property to return the PlexSession user object

* This speeds up building the `PlexSession` object since it doesn't need to lookup the user.
* The user object is also cached for future lookups.

* Remove PlexSession attributes from tests

* Never auto reload a PlexSession object

* Rename PlexSession.usernames for backwards compatibility

Co-authored-by: jjlawren <jjlawren@users.noreply.github.com>

* Don't cache myPlexAccount in PlexSession

* Move session stop method to PlexSession

Co-authored-by: jjlawren <jjlawren@users.noreply.github.com>
2022-07-20 20:03:20 -07:00
JonnyWong16
9f7f11ba9c
Add support for Plex OAuth (#974)
* Add method to return Plex OAuth url

* Add helper utils function for Plex OAuth
2022-07-20 19:48:52 -07:00
Karthikeyan Singaravelan
e0eb619561
Set daemon attribute instead of using setDaemon method that was deprecated in Python 3.10. (#913) 2022-05-16 19:46:21 -07:00
JonnyWong16
82aede202d
Use breadth-first search when using rtag (#912) 2022-05-16 19:46:10 -07:00
Kian-Meng Ang
398c058f18
Fix typos (#939) 2022-05-16 15:39:42 -05:00
JonnyWong16
870ba6664f
Refactor and cleanup tag methods (#875)
* Refactor tag functions into EditTagsMixin

* Fix test mixins tag use of _tagSingular

* Add kwargs to editTags

* Fix _tagSingular and _tagPlural if tag is already singular or plural

* Make editing tags chainable

* Add chaining example to doc string

* Update editTags doc string for batch editing
2022-02-26 21:50:48 -08:00
ReenigneArcher
3917b335ca
Fix various typos (#880)
* Fix various typos

* Fix various typos in tests

* Fix typos in `tests`

* Fix more typos

* Fix hasScalingMatrix test

Co-authored-by: JonnyWong16 <9099342+JonnyWong16@users.noreply.github.com>
2022-02-26 19:26:08 -08:00
JonnyWong16
01131c95cf
Cleanup download methods (#847)
* Add utils.cleanFilename

* Refactor download methods

* Add option to download episodes, tracks, photos into subfolders

* Update download tests

* Test download keep_original_filename
2021-11-20 14:16:58 -08:00
JonnyWong16
2562334ad4
Add reverseSearchType util 2021-06-18 14:21:43 -07:00
JonnyWong16
975a9eb3a2
Limit toDatetime to 32-bit integer 2021-05-10 16:11:16 -07:00
Shubhendra Singh Chauhan
12cf146ace
fix: code quality issues (#670)
* Remove unnecessary use of comprehension

* Remove unnecessary comprehension

* Use literal syntax instead of function calls to create data structure

* Pass string format arguments as logging method parameters

* Remove unused imports

* Remove unnecessary generator

* Refactor `if` expression

* fixed typo

Co-authored-by: jjlawren <jjlawren@users.noreply.github.com>

* Update tests/test_audio.py

Co-authored-by: jjlawren <jjlawren@users.noreply.github.com>
2021-02-24 11:55:53 -06:00
JonnyWong16
110fb2e94c
Flip default warning stack level 2021-02-15 16:57:16 -08:00
JonnyWong16
8af8ed9d1a
Fix deprecation warnings 2021-02-15 16:51:37 -08:00
JonnyWong16
7fedd01371
Test locking/unlocking fields when adding/removing tags 2021-02-14 14:52:33 -08:00
JonnyWong16
22bc55a74e
Rename tag plural helper function 2021-01-24 19:44:36 -08:00
JonnyWong16
1b378d3f1c
Add helper function to get the plural tag 2021-01-24 14:40:39 -08:00
JonnyWong16
dfc5aa1eef
Fix server hub searches (#643)
* Add hub search media tag objects

* Fix server search

* Fix hub media tag thumb

* Update server search test with tags
2021-01-24 15:48:38 -05:00
blacktwin
4f0910ab79
Update to MediaPartStream and inheriting classes (#590)
* moving common child (VideoStream, AudioStream, SubtitleStream) attributes to the parent (MediaPartStream)

* removal of no longer present attribs in video, audio, subtitle streams

* additional attribs to video and mediapart streams

* removal of previously unique subtitleStream attribs. attribs are now common or no longer present.

* docstring cleanup of video, audio, and subtitle stream; pass 1

* remove codecID checks as this attribute is now longer used.

* adding key attrib to parent MediaPartStream.

* add transient to SubtitleStream, found in uploaded subtitles

* removing dialogNorm related assertion as this attrib has been removed.

* update Media class based on PR comments
optimizedVersion to be added, need SEARCHTYPES

* update MediaPartStream class based on PR comments

* update VideoStream class based on PR comments

* update AudioStream class based on PR comments

* update SubtitleStream class based on PR comments

* add LyricStream class based on PR comments

* add streamType int and LyricStream to MediaPartStream.parse method

* add MediaPart.lyricStreams method

* spelling correction

* more movement based on PR comments

* alpha ordering MediaPart

* alpha sort VideoStream

* docstring corrections

* remove assert stream.dialogNorm from audio test as dialogNorm has been removed.

* adding LyricStream to _buildStreams function

* adding changes from @johnnywong16
e346f0b4dc

* moving unused imports down and together

* Address docstring review comments

* Change isChildOf for any kwargs

* Add Media.isOptimizedVersion property

* Add photo and track specific attributes

* Remove dead MediaPartStream.parse method

* Update media doc strings

* Add optimized version doc string

* Cast video stream codedHeight and codedWidth to int

* Add required bandwidths to streams

* Update video tests

* Update audio tests

* Fix video tests

* Fix video tests

* Fix video tests

Co-authored-by: Jason Lawrence <jjlawren@users.noreply.github.com>
Co-authored-by: JonnyWong16 <9099342+JonnyWong16@users.noreply.github.com>
2021-01-24 15:21:56 -05:00
JonnyWong16
9d23ec072e
Fix race condition in create MyPlexDevice from #620 (#625)
* Make test Plex Pass entitlements a subset

* Fix create MyPlexDevice race condition

* Rename to clientId to be consistent

* Move link method to MyPlexAccount
2020-12-15 22:41:04 -06:00
JonnyWong16
aa9b530b2e
Fix doc building with DeprecationWarning 2020-12-13 12:36:43 -08:00
JonnyWong16
110789dd0c
Add utils.deprecated decorator function 2020-12-13 12:08:38 -08:00
JonnyWong16
d88d5f7290
No cover for createMyPlexDevice 2020-12-06 17:42:44 -08:00
JonnyWong16
f70058ad13
Add helper function to create a Plex device 2020-12-06 17:42:44 -08:00
Steffen Fredriksen
ad7709611e
Merge pull request #608 from JonnyWong16/bugfix/doc_build
Update building documentation using napoleon
2020-12-05 14:12:21 +01:00
jjlawren
f4229050d4
Allow setting token env in tests (#610)
* Allow setting token env for test runs

* Use existing config option

* Use token in CI tests
2020-12-04 11:37:19 -06:00
JonnyWong16
b451b22bb8
Fix doc building 2020-11-23 12:20:56 -08:00
Steffen Fredriksen
ae59620e9a
Merge pull request #601 from JonnyWong16/server_browse
Add ability to browse and walk the Plex server system file directories
2020-11-23 07:48:53 +01:00
JonnyWong16
274b05e913
Fix raise exception docs 2020-11-22 20:43:59 -08:00
JonnyWong16
7f7d03236b
Fix docstrings 2020-11-22 19:06:30 -08:00
JonnyWong16
7298b3c606
Add ability to browse and walk the Plex server system file directories 2020-11-15 17:54:48 -08:00
Steffen Fredriksen
d73cec3b7d
Fix some flake issues (#540) 2020-08-07 15:34:57 -05:00