Skip to content
This repository has been archived by the owner on Oct 13, 2024. It is now read-only.

v0.3.0 #129

Merged
merged 78 commits into from
Nov 30, 2023
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
78 commits
Select commit Hold shift + click to select a range
acad48e
feat: implement automatic removal of old theme songs (#128)
ReenigneArcher Aug 1, 2023
9d54df5
feat: add theme completion report (#130)
ReenigneArcher Aug 5, 2023
ed1ae2d
fix(ci): localization workflow fails to install python-plexapi (#134)
ReenigneArcher Aug 5, 2023
ddef443
ci(localization): fix git diff (#135)
ReenigneArcher Aug 6, 2023
bbdf774
ci(localization): fix localization path (#136)
ReenigneArcher Aug 6, 2023
ffa4fa6
ci(tests): test python dependencies (#137)
ReenigneArcher Aug 6, 2023
de5aed5
fix(localization): fix translation file names (#138)
ReenigneArcher Aug 6, 2023
02d0977
New Crowdin updates (#133)
ReenigneArcher Aug 7, 2023
aaa5e12
feat: add support for collections (#140)
ReenigneArcher Aug 25, 2023
b5de215
New Babel Updates (#145)
LizardByte-bot Aug 25, 2023
6f45eff
build(deps): bump peter-evans/create-pull-request from 4 to 5 (#139)
dependabot[bot] Aug 25, 2023
7bdcbb4
ci: update global workflows (#146)
LizardByte-bot Aug 25, 2023
b8301e0
ci: update global docker (#147)
LizardByte-bot Aug 25, 2023
5cfd567
docs: fix readthedocs build (#150)
ReenigneArcher Sep 6, 2023
66215e8
build(deps): use python-plexapi-backport (#152)
ReenigneArcher Sep 7, 2023
aacfbe9
ci(tests): bootstrap plex server (#153)
ReenigneArcher Sep 22, 2023
cc33cbf
ci: update global docker (#161)
LizardByte-bot Sep 22, 2023
2603943
ci: update global python (#160)
LizardByte-bot Sep 22, 2023
3f1b450
ci: update global workflows (#159)
LizardByte-bot Sep 22, 2023
95b26d1
build(deps): bump actions/checkout from 3 to 4 (#149)
dependabot[bot] Sep 22, 2023
d2b1c9c
New Crowdin updates (#142)
ReenigneArcher Sep 22, 2023
772499e
build(deps): use plexhints from pypi (#162)
ReenigneArcher Sep 28, 2023
11996a1
ci: update global workflows (#172)
LizardByte-bot Oct 5, 2023
964b3b9
ci: update global workflows (#173)
LizardByte-bot Oct 5, 2023
4778272
ci: use new LizardByte setup python action (#174)
ReenigneArcher Oct 6, 2023
caee348
ci: update global workflows (#177)
LizardByte-bot Oct 9, 2023
71f2d9a
ci: update global workflows (#179)
LizardByte-bot Oct 10, 2023
4269c4c
ci: update release notifier (#180)
LizardByte-bot Oct 10, 2023
761b234
New translations themerr-plex.po (French) (#181)
ReenigneArcher Oct 11, 2023
9475d8a
ci: update global workflows (#182)
LizardByte-bot Oct 12, 2023
9a557b1
ci: update release notifier (#183)
LizardByte-bot Oct 16, 2023
9e18f7c
test: fix macos functional test (#186)
ReenigneArcher Oct 17, 2023
cbbd71a
test: increase plugin log search timeout (#187)
ReenigneArcher Oct 18, 2023
4dcfbb9
build(deps-dev): bump plexhints from 0.1.0 to 0.1.1 (#185)
dependabot[bot] Oct 18, 2023
c5b6196
build(deps): bump LizardByte/plexhints from 0.1.0 to 0.1.1 (#184)
dependabot[bot] Oct 18, 2023
094ffba
build(deps): bump plexapi-backport[alert] from 4.15.2 to 4.15.4 (#171)
dependabot[bot] Oct 18, 2023
41dcc52
build(deps): bump bootstrap from 5.2.2 to 5.3.2 (#165)
dependabot[bot] Oct 18, 2023
8269b52
build(deps): bump jquery from 3.7.0 to 3.7.1 (#167)
dependabot[bot] Oct 18, 2023
f8c0639
build(deps): bump @fortawesome/fontawesome-free from 6.2.0 to 6.4.2 (…
dependabot[bot] Oct 18, 2023
c44d595
build(deps): bump @fontsource/open-sans from 4.5.13 to 5.0.15 (#176)
dependabot[bot] Oct 18, 2023
bd590ca
test: wait until plugin is ready (#188)
ReenigneArcher Oct 18, 2023
f311246
ci: use tagged setup python action (#191)
ReenigneArcher Oct 24, 2023
328c938
build(deps): bump plexhints and plexapi-backport (#198)
ReenigneArcher Nov 6, 2023
15099a5
ci: use commit hash for setup python action (#193)
ReenigneArcher Nov 6, 2023
a1e1847
Fix AlertListener on IPv6-aware hosts (#201)
zdimension Nov 7, 2023
f32a6c9
fix: Add error handling around update_plex_item to prevent hang (#202)
zdimension Nov 7, 2023
4feddda
Add error handling and logging for Youtube-DL (#200)
zdimension Nov 7, 2023
09f5253
build(deps): bump LizardByte/plexhints from 0.1.2 to 0.1.3 (#205)
dependabot[bot] Nov 8, 2023
d7cebc8
build(deps-dev): bump plexhints from 0.1.2 to 0.1.3 (#206)
dependabot[bot] Nov 8, 2023
dadf374
feat: Add support for passing session cookies to Youtube-DL (#203)
zdimension Nov 8, 2023
d04fad4
fix: Move skip check before call to Youtube-DL (#204)
zdimension Nov 8, 2023
2aa84ca
New Crowdin updates (#194)
ReenigneArcher Nov 8, 2023
45ce809
build(deps): bump @fontsource/open-sans from 5.0.15 to 5.0.17 (#190)
dependabot[bot] Nov 8, 2023
b463749
fix: disable auto-reload since it is not needed and only harms perf (…
zdimension Nov 8, 2023
af7462c
fix: use correct types for plex item typehints (#211)
ReenigneArcher Nov 11, 2023
ccee561
feat: Prefetch items from ThemerrDB, and differentiate items with no …
zdimension Nov 11, 2023
3c4c02b
New Babel Updates (#212)
LizardByte-bot Nov 11, 2023
308d1fa
New Crowdin updates (#213)
ReenigneArcher Nov 11, 2023
b9dc77c
fix: fix css (#214)
zdimension Nov 12, 2023
9057aed
build(deps): bump youtube-dl (#164)
ReenigneArcher Nov 13, 2023
aba0560
fix(ui): progress bar will now fill to max (#217)
ReenigneArcher Nov 13, 2023
400052c
feat: allow adding cookies from the UI directly and fix the ytdl bug …
zdimension Nov 14, 2023
5514c6b
build(deps): bump plexapi-backport[alert] from 4.15.5 to 4.15.6 (#219)
dependabot[bot] Nov 15, 2023
1891d60
fix: correct issue where database_cache may be updated in parallel (#…
ReenigneArcher Nov 15, 2023
e2f5240
fix(ui): use correct action button for themerr provided items (#220)
ReenigneArcher Nov 16, 2023
7f3dd86
fix(ui): correct issue where themerr-provided field may not be accura…
ReenigneArcher Nov 16, 2023
4f9ffa3
New Babel Updates (#222)
LizardByte-bot Nov 16, 2023
dfda394
fix(ui): improve speed of dashboard by caching data (#224)
ReenigneArcher Nov 17, 2023
12c78b8
New Babel Updates (#225)
LizardByte-bot Nov 17, 2023
1a91752
fix: don't update locked fields + unlock fields after update (#208)
zdimension Nov 18, 2023
eb07188
fix: use item original title if present (#226)
zdimension Nov 20, 2023
3180e9c
fix: disable Plex plugin framework sandbox and add back all missing b…
zdimension Nov 21, 2023
25a1d83
ci: update global workflows (#230)
LizardByte-bot Nov 24, 2023
4172903
chore: update LizardByte actions (#231)
ReenigneArcher Nov 28, 2023
673fe04
fix: remove unused youtube params (#232)
ReenigneArcher Nov 29, 2023
64f6a71
New Crowdin updates (#223)
ReenigneArcher Nov 29, 2023
7299600
build(deps): bump @fortawesome/fontawesome-free from 6.4.2 to 6.5.0 (…
dependabot[bot] Nov 29, 2023
f94afde
docs: update v0.3.0 changelog (#235)
ReenigneArcher Nov 30, 2023
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions Contents/Code/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,12 +29,12 @@
# local imports
if sys.version_info.major < 3:
from default_prefs import default_prefs
from helpers import issue_url_games, issue_url_movies
from constants import issue_url_games, issue_url_movies
from plex_api_helper import add_themes, get_plex_item, plex_listener
from youtube_dl_helper import process_youtube
else:
from .default_prefs import default_prefs
from .helpers import issue_url_games, issue_url_movies
from .constants import issue_url_games, issue_url_movies
from .plex_api_helper import add_themes, get_plex_item, plex_listener
from .youtube_dl_helper import process_youtube

Expand Down
File renamed without changes.
1 change: 1 addition & 0 deletions Contents/Code/default_prefs.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
default_prefs = dict(
bool_prefer_mp4a_codec='True',
bool_remove_unused_theme_songs='True',
int_plexapi_plexapi_timeout='180',
int_plexapi_upload_retries_max='3',
int_plexapi_upload_threads='3',
Expand Down
64 changes: 62 additions & 2 deletions Contents/Code/plex_api_helper.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
# -*- coding: utf-8 -*-

# standard imports
import hashlib
import os
import shutil
import sys
import time
import threading
Expand All @@ -12,6 +14,7 @@
except ImportError:
pass
else: # the code is running outside of Plex
from plexhints.core_kit import Core # core kit
from plexhints.log_kit import Log # log kit
from plexhints.parse_kit import JSON # parse kit
from plexhints.prefs_kit import Prefs # prefs kit
Expand All @@ -29,10 +32,10 @@

# local imports
if sys.version_info.major < 3:
from helpers import guid_map, issue_url_movies
from constants import guid_map, issue_url_movies
from youtube_dl_helper import process_youtube
else:
from .helpers import guid_map, issue_url_movies
from .constants import guid_map, issue_url_movies
from .youtube_dl_helper import process_youtube

plex = None
Expand All @@ -41,6 +44,10 @@
q = queue.Queue()
processing_completed = []

# constants
app_support_directory = Core.app_support_path
metadata_movie_directory = os.path.join(app_support_directory, 'Metadata', 'Movies')


def setup_plexapi():
"""
Expand Down Expand Up @@ -116,6 +123,10 @@ def add_themes(rating_key, theme_files=None, theme_urls=None):
if plex:
plex_item = plex.fetchItem(ekey=int(rating_key)) # must be an int or weird things happen

# remove existing theme uploads
if Prefs['bool_remove_unused_theme_songs']:
remove_uploaded_themes(plex_item=plex_item)

if theme_files:
for theme_file in theme_files:
Log.Info('Attempting to upload theme file: %s' % theme_file)
Expand All @@ -130,6 +141,55 @@ def add_themes(rating_key, theme_files=None, theme_urls=None):
return uploaded


def remove_uploaded_themes(plex_item):
# type: (any) -> None
"""
Remove themes for the specified item.

Deletes the themes upload directory for the item specified by the ``plex_item``.

Parameters
----------
plex_item : any
The item to remove the themes from.

Returns
-------
bool
True if the themes were removed successfully, False otherwise.

Examples
--------
>>> remove_uploaded_themes(plex_item=...)
...
"""
guid = plex_item.guid
full_hash = hashlib.sha1(guid).hexdigest()
theme_upload_path = os.path.join(
metadata_movie_directory, full_hash[0], full_hash[1:] + '.bundle', 'Uploads', 'themes')
if os.path.isdir(theme_upload_path):
shutil.rmtree(path=theme_upload_path, ignore_errors=True, onerror=remove_uploaded_themes_error_handler)


def remove_uploaded_themes_error_handler(func, path, exc_info):
# type: (any, any, any) -> None
"""
Error handler for removing themes.

Handles errors that occur when removing themes using ``shutil``.

Parameters
----------
func : any
The function that caused the error.
path : str
The path that caused the error.
exc_info : any
The exception information.
"""
Log.Error('Error removing themes with function: %s, path: %s, exception info: %s' % (func, path, exc_info))


def upload_theme(plex_item, filepath=None, url=None):
# type: (any, Optional[str], Optional[str]) -> bool
"""
Expand Down
7 changes: 7 additions & 0 deletions Contents/DefaultPrefs.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,13 @@
"default": "True",
"secure": "false"
},
{
"id": "bool_remove_unused_theme_songs",
"type": "bool",
"label": "Remove unused theme songs (frees up space in your Plex metadata directory)",
"default": "True",
"secure": "false"
},
{
"id": "int_plexapi_plexapi_timeout",
"type": "text",
Expand Down
10 changes: 10 additions & 0 deletions docs/source/about/usage.rst
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,16 @@ Description
Default
True

Remove unused theme songs
^^^^^^^^^^^^^^^^^^^^^^^^^

Description
When Themerr-plex uploads a theme song to the Plex server, it will remove any existing theme songs for the same
movie. With this setting enabled, Themerr-plex can free up space in Plex's metadata directory.

Default
True

PlexAPI Timeout
^^^^^^^^^^^^^^^

Expand Down