everettsouthwick / Eraserr

Python script for deleting unwatched or stale media from Plex servers using Radarr, Sonarr, and Overseerr.
GNU General Public License v3.0
24 stars 1 forks source link

Select only specific libraries #67

Open hacktek opened 10 months ago

hacktek commented 10 months ago

Is your feature request related to a problem? Please describe.

Kinda. For combined servers (cloud storage and local storage libraries), it makes sense to create local only libraries and then point the script to only operate on those.

Describe the solution you'd like

A configuration option that limits the script's operations to a set of plex library IDs.

Describe alternatives you've considered

None, my library is very large, so operating the script on all of it is impossible (would take way too long and it would process items that it should not act upon anyways). Pointing it specifically to local libraries would speed up the process since those would be much smaller.

hacktek commented 10 months ago

Seems like somewhat of a trivial change in get_media

def __get_media(self, section_type,section_ids):
    sections = self.__get_sections_by_type(section_type)
    media_list = []
    print(sections)
    for section in sections:
        if section.key in section_ids:
            for media in section.all():
                media_list.append(media)
    return media_list

section_ids is simply a list of IDs for a particular section_type, so the specific list from the configuration file would be sent when calling get_expired_media for either "movie" or "show" section_type.

I can create a PR if you want although I did notice an issue. It appears that Plex does not sync watch status across libraries, so if a movie is marked watched on Library "A" (id 1 for example) and the script only runs on Library "B" (id 2), then the script will consider the item unwatched. Not sure if there's a mechanism to mark watch status across libraries.