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

Commit

Permalink
feat: add option to ignore locked fields (#347)
Browse files Browse the repository at this point in the history
  • Loading branch information
ReenigneArcher authored Jan 29, 2024
1 parent 5e4da42 commit df2de0b
Show file tree
Hide file tree
Showing 4 changed files with 20 additions and 3 deletions.
1 change: 1 addition & 0 deletions Contents/Code/default_prefs.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,4 +23,5 @@
bool_webapp_log_werkzeug_messages='False',
bool_migrate_locked_themes='False',
bool_migrate_locked_collection_fields='False',
bool_ignore_locked_fields='False',
)
6 changes: 3 additions & 3 deletions Contents/Code/plex_api_helper.py
Original file line number Diff line number Diff line change
Expand Up @@ -166,7 +166,7 @@ def update_plex_item(rating_key):
else:
add_media(item=item, media_type='art', media_url_id=data['backdrop_path'], media_url=url)
# update summary
if item.isLocked(field='summary'):
if item.isLocked(field='summary') and not Prefs['bool_ignore_locked_fields']:
Log.Debug('Not overwriting locked summary for collection: {}'.format(item.title))
else:
try:
Expand All @@ -181,7 +181,7 @@ def update_plex_item(rating_key):
except Exception as e:
Log.Error('{}: Error updating summary: {}'.format(item.ratingKey, e))

if item.isLocked(field='theme'):
if item.isLocked(field='theme') and not Prefs['bool_ignore_locked_fields']:
Log.Debug('Not overwriting locked theme for {}: {}'.format(item.type, item.title))
else:
# get youtube_url
Expand Down Expand Up @@ -250,7 +250,7 @@ def add_media(item, media_type, media_url_id, media_file=None, media_url=None):
settings_hash = general_helper.get_themerr_settings_hash()
themerr_data = general_helper.get_themerr_json_data(item=item)

if item.isLocked(field=media_type_dict[media_type]['plex_field']):
if item.isLocked(field=media_type_dict[media_type]['plex_field']) and not Prefs['bool_ignore_locked_fields']:
Log.Info('Not overwriting locked "{}" for {}: {}'.format(
media_type_dict[media_type]['name'], item.type, item.title
))
Expand Down
7 changes: 7 additions & 0 deletions Contents/DefaultPrefs.json
Original file line number Diff line number Diff line change
Expand Up @@ -161,5 +161,12 @@
"label": "Migrate collection metadata from < v0.3.0 (If you used Themerr before v0.3.0, set this to True)",
"default": "False",
"secure": "false"
},
{
"id": "bool_ignore_locked_fields",
"type": "bool",
"label": "Ignore locked fields (Always upload media, even if fields are locked)",
"default": "False",
"secure": "false"
}
]
9 changes: 9 additions & 0 deletions docs/source/about/usage.rst
Original file line number Diff line number Diff line change
Expand Up @@ -319,3 +319,12 @@ Description

Default
``False``

Ignore locked fields
^^^^^^^^^^^^^^^^^^^^

Description
When enabled, Themerr-plex will ignore locked fields when updating themes and collection metadata.

Default
``False``

0 comments on commit df2de0b

Please sign in to comment.