Skip to content

Commit

Permalink
Added dubug logging when the file is not to be ignored
Browse files Browse the repository at this point in the history
  • Loading branch information
Josh5 committed Mar 11, 2023
1 parent 73a27b0 commit 4b58a28
Show file tree
Hide file tree
Showing 5 changed files with 38 additions and 11 deletions.
8 changes: 7 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,9 @@
# Ignore files over resolution
Plugin for [Unmanic](https://github.com/Unmanic)

plugin for [Unmanic](https://github.com/Unmanic)
---

### Information:

- [Description](description.md)
- [Changelog](changelog.md)
3 changes: 3 additions & 0 deletions changelog.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@

**<span style="color:#56adda">0.0.2</span>**
- Added dubug logging when the file is not to be ignored

**<span style="color:#56adda">0.0.1</span>**
- Initial version
8 changes: 8 additions & 0 deletions description.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,3 +3,11 @@ Files will be inspected with FFprobe to retrieve their video stream width and he

If the resolution's width or height are **over** the configured limit,
the file will be ignored from all subsequent file tests and prevented from being added to the pending tasks lists.

---

##### Links:

- [Support](https://unmanic.app/discord)
- [Issues/Feature Requests](https://github.com/Josh5/unmanic.plugin.ignore_video_file_over_resolution/issues)
- [Pull Requests](https://github.com/Josh5/unmanic.plugin.ignore_video_file_over_resolution/pulls)
2 changes: 1 addition & 1 deletion info.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,5 +11,5 @@
"on_library_management_file_test": 0
},
"tags": "library file test",
"version": "0.0.1"
"version": "0.0.2"
}
28 changes: 19 additions & 9 deletions plugin.py
Original file line number Diff line number Diff line change
Expand Up @@ -270,16 +270,26 @@ def on_library_management_file_test(data):
# Get the test resolution
test_resolution = get_test_resolution(settings)

limit_label = default_resolutions.get(settings.get_setting('target_resolution'), {}).get('label')
limit_width = default_resolutions.get(settings.get_setting('target_resolution'), {}).get('width')
limit_height = default_resolutions.get(settings.get_setting('target_resolution'), {}).get('height')
if int(vid_width) > int(test_resolution['width']) or int(vid_height) > int(test_resolution['height']):
# Ignore this file
data['add_file_to_pending_tasks'] = False
limit_label = default_resolutions.get(settings.get_setting('target_resolution'), {}).get('label')
limit_width = default_resolutions.get(settings.get_setting('target_resolution'), {}).get('width')
limit_height = default_resolutions.get(settings.get_setting('target_resolution'), {}).get('height')
logger.debug(
"File '{}' should be ignored - resolution {}x{} is over the set limit of {} {}x{}.".format(abspath,
vid_width,
vid_height,
limit_label,
limit_width,
limit_height))
"File '%s' should be ignored - resolution %sx%s is over the set limit of %s %sx%s.",
abspath,
vid_width,
vid_height,
limit_label,
limit_width,
limit_height)
return
logger.debug(
"File '%s' will not be ignored - resolution %sx%s is under the set limit of %s %sx%s.",
abspath,
vid_width,
vid_height,
limit_label,
limit_width,
limit_height)

0 comments on commit 4b58a28

Please sign in to comment.