Skip to content
New issue

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

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

Already on GitHub? # to your account

Media content may be improperly imported into Ombi #4472

Closed
sephrat opened this issue Jan 14, 2022 · 5 comments · Fixed by #4493
Closed

Media content may be improperly imported into Ombi #4472

sephrat opened this issue Jan 14, 2022 · 5 comments · Fixed by #4493

Comments

@sephrat
Copy link
Contributor

sephrat commented Jan 14, 2022

Describe the bug
If Ombi fetches content from a media server when it isn't done fetching the metadata, it will save the content in the database in an incorrect state:
image

Upon the next sync, Ombi considers the content as already added so it won't try to update its information. This ends up in content that can never be marked as available unless you manually run a "Clear data and resync" in Ombi settings.

This causes other issues in another context: if the media was first scanned incorrectly by the media server and you manually correct the identification, Ombi will keep the incorrect state in the database.

To Reproduce
Steps to reproduce the behavior:

  1. Add new content to media server
  2. Immediately run a sync (after it has detected new content but before the metadata are recognized).
  3. Wait for the metadata to be added in the media server and run a new sync
  4. The media is not available in Ombi

Expected behavior
Ombi should update the media information if it detects a difference.

Proposed solution

  • Do not add content to the database when its metadata is empty (no external IDs, no episode/season number)
  • Update content when there's a difference between the media server state and Ombi internal state (an ID has changed, an episode number was changed, etc. )

Ombi Version (please complete the following information):

  • Version 4.9.1
  • Media Server Emby

Trying to get some feedback before working on a PR.

@github-actions
Copy link

Hi!

Thanks for the issue report. Before a real human comes by, please make sure you used our bug report format.

Have you looked at the wiki yet? https://docs.ombi.app/

Before posting make sure you also read our FAQ.

Make the title describe your issue. Having 'not working' or 'I get this bug' for 100 issues, isn't really helpful.

If we need more information or there is some progress we tag the issue or update the tag and keep you updated.

Thanks!

Ombi Bot.

@tidusjar
Copy link
Member

I think the first proposed solution is what we should go with:
Do not add content to the database when its metadata is empty (no external IDs, no episode/season number)

I think having to do a diff on each item is going to be a real pain to do and track. If the user has had a large restructure of their libraries then they should do a clear and re-sync.

But yeah good ideas here 👍

@sephrat
Copy link
Contributor Author

sephrat commented Jan 14, 2022

I think having to do a diff on each item is going to be a real pain to do and track.

This is not tested and I haven't looked into every case, but can't we just compare existingMovie with movieInfo here:

private async Task ProcessMovies(EmbyMovie movieInfo, ICollection<EmbyContent> content, EmbyServers server)
{
// Check if it exists
var existingMovie = await _repo.GetByEmbyId(movieInfo.Id);

and if they're not similar, update instead of adding? We already fetch the content details so a simple comparison should do the trick.

Anyway this can be done in two steps, so I'll work on a PR for the first task. Depending on your answer, I may take try something out for the second task and we'll see how it goes.

@tidusjar
Copy link
Member

Actually yes I guess so. Just had a quick look at the Plex Sync too and you are right it shouldn't be that bad, I thought it would be a lot worse!

@sephrat
Copy link
Contributor Author

sephrat commented Feb 4, 2022

I suggest to implement my first suggestion (PR incoming) and close this issue. We can open a new issue for the second suggestion, which should fix the issue being that Ombi doesn't update its cache when the media identification is changed on the media server.

sephrat added a commit to sephrat/Ombi that referenced this issue Feb 4, 2022
Fixes Media content may be improperly imported into Ombi Ombi-app#4472
tidusjar pushed a commit that referenced this issue Feb 5, 2022
* Add sanity checks upon media server sync

Fixes Media content may be improperly imported into Ombi #4472

* Fix Jellyfin sync

* Refactor Emby and Jellyfin provider ids

* Use new method Any

* Fix log formatting
@sephrat sephrat mentioned this issue Mar 22, 2022
4 tasks
# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants