Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Feature]: Only remove actual bloat images (i.e. EXIF tagged) #82

Open
planetrocky opened this issue Oct 8, 2024 · 1 comment
Open
Assignees
Labels
enhancement New feature or request

Comments

@planetrocky
Copy link

planetrocky commented Oct 8, 2024

Describe the Feature Request

This script is great, but it removes all the alternate artwork and posters that are stored. On a large collection it can take Plex a very long time to repopulate these, and on a CPU bound low-power NAS, it really impacts operation for a few days until it’s restored.

Ideally only the Kometa “bloat” images should be removed or at least an option to control this.

A check on each image before removal should be easy to add:

Taken from modules/library.py of Kometa as an example.

This shows the operation from Kometa:

with Image.open(image_path) as image:
            exif_tags = image.getexif()
        if 0x04bc in exif_tags and exif_tags[0x04bc] == "overlay":
            os.remove(image_path)
            raise Failed("This item's poster already has an Overlay. There is no Kometa setting to change; manual attention required.")
        if remove:
            os.remove(image_path)
        else:
            return image_path
@planetrocky
Copy link
Author

planetrocky commented Oct 8, 2024

I've made a quick test run of this locally, and it seems to be good :)
It won't remove any posters that have been manually uploaded.

changes.patch

Pull request: #84

three line snippet from the log file for operation report, showing one file that is skipped (custom upload file):

[2024-10-09 01:00:59,117] [imagemaid.py:336]          [DEBUG]    | BLOAT FILE: \\fs2\docker\plex\Library\Application Support\Plex Media Server\Metadata\Movies\9\90c7a3c30a60d1150d94205109a5a2b74485cdf.bundle\Uploads\posters\36e4a268b6d4df0bc9f66aa775d3704a1eb44619 |
[2024-10-09 01:00:59,117] [imagemaid.py:336]          [DEBUG]    | IMAGE FILE: \\fs2\docker\plex\Library\Application Support\Plex Media Server\Metadata\Movies\a\ade61580dc88ae8181b9df68aba0b59d40c5a93.bundle\Uploads\posters\d2a12a4a004bcdb4b4269560f8ce868ceae9f6d9 does not have EXIF overlay tag and won't be considered. |
[2024-10-09 01:00:59,117] [imagemaid.py:336]          [DEBUG]    | BLOAT FILE: \\fs2\docker\plex\Library\Application Support\Plex Media Server\Metadata\Movies\a\eb03f784819ccf7eac36ecbe03bded317864837.bundle\Uploads\posters\e12984d3d6cdc86dc085a924b3bdbeb1c862f66c |

three line snippet from the log file for operation remove, showing one file that is skipped (custom upload file):

[2024-10-09 01:32:24,708] [imagemaid.py:338]          [TRACE]    | REMOVE: \\fs2\docker\plex\Library\Application Support\Plex Media Server\Metadata\Movies\9\90c7a3c30a60d1150d94205109a5a2b74485cdf.bundle\Uploads\posters\36e4a268b6d4df0bc9f66aa775d3704a1eb44619 |
[2024-10-09 01:32:24,708] [imagemaid.py:338]          [TRACE]    | IMAGE FILE: \\fs2\docker\plex\Library\Application Support\Plex Media Server\Metadata\Movies\a\ade61580dc88ae8181b9df68aba0b59d40c5a93.bundle\Uploads\posters\d2a12a4a004bcdb4b4269560f8ce868ceae9f6d9 does not have EXIF overlay tag and won't be considered. |
[2024-10-09 01:32:24,708] [imagemaid.py:338]          [TRACE]    | REMOVE: \\fs2\docker\plex\Library\Application Support\Plex Media Server\Metadata\Movies\a\eb03f784819ccf7eac36ecbe03bded317864837.bundle\Uploads\posters\e12984d3d6cdc86dc085a924b3bdbeb1c862f66c |

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants