Skip to content

Commit

Permalink
build(deps): use python-plexapi-backport
Browse files Browse the repository at this point in the history
  • Loading branch information
ReenigneArcher committed Sep 6, 2023
1 parent 5cfd567 commit 32c0097
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 13 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/python-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ jobs:
run: |
# requests is required to install python-plexapi
python -m pip --no-python-version-warning --disable-pip-version-check install --upgrade \
pip setuptools requests
pip setuptools wheel
python -m pip --no-python-version-warning --disable-pip-version-check install -r requirements-dev.txt
python -m pip --no-python-version-warning --disable-pip-version-check install \
--target=./Contents/Libraries/Shared -r requirements.txt --no-warn-script-location
Expand Down
11 changes: 8 additions & 3 deletions Contents/Code/plex_api_helper.py
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,6 @@ def setup_plexapi():
urllib3.disable_warnings(InsecureRequestWarning) # Disable the insecure request warning

# create the plex server object
plexapi.server.TIMEOUT = int(Prefs['int_plexapi_plexapi_timeout'])
plex = plexapi.server.PlexServer(baseurl=plex_url, token=plex_token, session=sess)

return plex
Expand Down Expand Up @@ -338,9 +337,15 @@ def upload_media(item, method, filepath=None, url=None):
while count <= int(Prefs['int_plexapi_upload_retries_max']):
try:
if filepath:
method(filepath=filepath)
if method == item.uploadTheme:
method(filepath=filepath, timeout=int(Prefs['int_plexapi_plexapi_timeout']))
else:
method(filepath=filepath)
elif url:
method(url=url)
if method == item.uploadTheme:
method(url=url, timeout=int(Prefs['int_plexapi_plexapi_timeout']))
else:
method(url=url)
except BadRequest as e:
sleep_time = 2**count
Log.Error('%s: Error uploading media: %s' % (item.ratingKey, e))
Expand Down
11 changes: 2 additions & 9 deletions requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
flask==1.1.4;python_version<"3"
flask-babel==1.0.0;python_version<"3"
future==0.18.3
plexapi-backport==4.15.1 # custom python-plexapi supporting python 2.7
polib==1.2.0;python_version<"3"
requests==2.27.1;python_version<"3" # 2.27 is last version supporting Python 2.7
schedule==0.6.0;python_version<"3"
Expand All @@ -11,18 +12,10 @@ werkzeug==1.0.1;python_version<"3"

# youtube_dl is not capable or willing to create a new release so have to install from git
# youtube_dl==2021.12.17
# unknown if dependabot can update this
# dependabot cannot update this
# git+https://github.com/ytdl-org/youtube-dl.git@26035bde46c0acc30dc053618451d9aeca4b7709#egg=youtube_dl
https://github.com/ytdl-org/youtube-dl/archive/26035bde46c0acc30dc053618451d9aeca4b7709.zip#egg=youtube_dl

# custom python-plexapi supporting python 2.7
# this is used to upload theme songs since Movie agents cannot correctly do so
# git+https://github.com/reenignearcher/python-plexapi.git@master-py2.7#egg=plexapi
https://github.com/reenignearcher/python-plexapi/archive/master-py2.7.zip#egg=plexapi

# websocket-client is required for plexapi alert listener
websocket-client==0.59.0;python_version<"3"

# required for websocket to pass tests
pysocks==1.7.1;python_version<"3"
win-inet-pton==1.1.0;python_version<"3" and platform_system=="Windows"
3 changes: 3 additions & 0 deletions tests/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,9 @@
if os.path.isdir('Contents'):
sys.path.append('Contents')

if os.path.isdir(os.path.join('Contents', 'Libraries', 'Shared')):
sys.path.append(os.path.join('Contents', 'Libraries', 'Shared'))

# local imports
from Code import Themerr
from Code import webapp
Expand Down

0 comments on commit 32c0097

Please sign in to comment.