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

feat: add option to ignore locked fields #347

Merged
merged 1 commit into from
Jan 29, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
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 @@
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']:

Check warning on line 169 in Contents/Code/plex_api_helper.py

View check run for this annotation

Codecov / codecov/patch

Contents/Code/plex_api_helper.py#L169

Added line #L169 was not covered by tests
Log.Debug('Not overwriting locked summary for collection: {}'.format(item.title))
else:
try:
Expand All @@ -181,7 +181,7 @@
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 @@
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']:

Check warning on line 253 in Contents/Code/plex_api_helper.py

View check run for this annotation

Codecov / codecov/patch

Contents/Code/plex_api_helper.py#L253

Added line #L253 was not covered by tests
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``
Loading