Commit graph

166 commits

Author SHA1 Message Date
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
jjlawren
dbc5adc744
Fix datetime import error in utils.py (#545) 2020-08-07 15:31:54 -05:00
tdorsey
7c346f9917
chore(utils): fix typo 2020-07-18 08:45:41 -04:00
Hellowlol
d7c215b119 Small change to the repr and add test. 2020-06-14 20:21:46 +02:00
blacktwin
3852ed52a7 create millisecondToHuman method in utils 2020-06-13 22:12:01 -04:00
blacktwin
faeee7d667 import timedelta to utils 2020-06-13 22:11:39 -04:00
Hellowlol
940efc0013 first pass on compat. 2020-05-12 23:15:16 +02:00
Hellowlol
f6e311f056 2nd attempt to fix title bug 2020-05-11 23:12:15 +02:00
Hellowlol
8ac2edb3f6 reduce deps 2020-05-02 01:29:26 +03:00
Hellowlol
e0d5a873e1 misc fixes 2020-04-16 00:30:00 +02:00
blacktwin
2a198f5cb8 flake fix
missing return
2020-04-12 22:35:22 -04:00
blacktwin
54c871fc01 create getAgentIdentifier method in utils
Return the full agent identifier from a short identifier, name, or confirm full identifier
thanks @jonnywong16
2020-03-17 14:00:41 -04:00
blacktwin
8d334ce47f allow for casting str to bool 2020-03-16 11:03:39 -04:00