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

AvalailbilitySync method mediaExistsInPlex() not full working #3857

Open
1 task done
cedricdu78 opened this issue May 10, 2024 · 0 comments
Open
1 task done

AvalailbilitySync method mediaExistsInPlex() not full working #3857

cedricdu78 opened this issue May 10, 2024 · 0 comments

Comments

@cedricdu78
Copy link

cedricdu78 commented May 10, 2024

Description

Method mediaExistsInPlex not find all series or movies removed with ratingKey.

Desired Behavior

In plexapi.ts

  public async getAllTmdbIds(): Promise<Number[]> {

    const settings = getSettings();
    const tmdbIds : Number[] = []

    for (const library in settings.plex.libraries) {
      const response = await this.getLibraryContents(settings.plex.libraries[library].id, {
        size: 5000,
        offset: 0,
      });

      for (const entry in response.items) {
        const tmdbString = response.items[entry].Guid?.find((guid) =>
          guid.id.startsWith('tmdb')
        );

        if (tmdbString) {
          tmdbIds.push(Number(tmdbString.id.split('//')[1]))
        } else {
          logger.error(`Failed to fetch tmdbId : ${JSON.stringify(response.items[entry])}`, { label: 'Plex API' });
        }
      }
    }

    return tmdbIds
  }

In run()

      this.plexMediaCache = await this.plexClient?.getAllTmdbIds();

In mediaExistsInPlex()

    const existsInPlex = this.plexMediaCache.indexOf(media.tmdbId) > -1;

    if (! existsInPlex) {
      return { existsInPlex };
    }

Additional Context

No response

Code of Conduct

  • I agree to follow Overseerr's Code of Conduct
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant