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

Sonarr v3 adding <tag> </tag> lines in tvshow.nfo, causing duplicate show entries in Plex for each tag #116

Open
ghost opened this issue Jan 17, 2021 · 4 comments

Comments

@ghost
Copy link

ghost commented Jan 17, 2021

@gboudreau

XBMCnfoTVImporter (V 1.1-93)

Host OS: UnRAID 6.8.3
Plex Install Type: Docker
Docker version 19.03.5, build 633a0ea838
Plex Server version: 1.21.1.3876
Plex docker repo: https://registry.hub.docker.com/r/binhex/arch-plex/

Issue

In Sonarr v3, when using the Kodi (XBMC) / Emby Metadata option, it looks like they are now adding into the tvshow.nfo file, a separate entry for each Sonarr tag that is assigned for that show. This then results in XBMCnfoTVImporter to create duplicate show entries in Plex, with the names of each tag.

Example:

Sonarr v3 show with tags assigned

Screen Shot 2021-01-17 at 6 49 51 pm

image

Sonarr v3 metadata agent

image

Resulting duplicate show entries in Plex

image

Suggested solution?

Hardcode in to ignore the lines in nfo files, or maybe better yet, a new option that allows the user to specify any line entries to ignore in nfo files. e.g.
"Ignore lines in NFO that start with (separate entries with comma) : ,,"

Workarounds?

  • Least painful = disable metadata agent in Sonarr and use a different metadata scraper like TinyMM that doesn't include the lines in NFO
  • Quite painful = keep using Sonarr metadata agent, then create a script that recursively scans all tvshow.nfo files and removes any lines beginning with .
  • Most painful - Not use any local NFO and not use XMBCnfo* ....nooooooooooooooo! ;)

NOTE: Radarr v3 doesn't seem to be adding in the same lines for tags assigned to movies, however if you decide to implement a fix for the above, its probably worth adding into both then TV and Movie bundles.

Hopefully this is enough info for you, let me know if you need/want any more.

Cheers,

blade

@ghost
Copy link
Author

ghost commented Jan 17, 2021

OK so just an update to this, I have also just tested with TinyMM, and that too seems to add in lines with , and results in the same issue.

Here is the TinyMM entries

Screen Shot 2021-01-17 at 7 50 23 pm

Here is the duplicate entries in Plex for each line in the tvshow.nfo

Screen Shot 2021-01-17 at 7 50 53 pm

I tried unticking the tag option in TinyMM, however the tags are still added to the NFO, they must be default tags or something.

Screen Shot 2021-01-17 at 8 38 19 pm

@ghost
Copy link
Author

ghost commented Jan 17, 2021

OK so another update ... I did some manual entry of the lines, and it turns out that the entry ends up creating a collection for separate tag ... this is obviously mostly (if not always) used for movie collections, so it's definitely an issue with TV content. Here's what happens:

Screen Shot 2021-01-17 at 10 25 19 pm

Another update

I have tested all 4 scrapers in TinyMM and also Emby's own scraper and they are all adding in the lines.

Another issue is that once Plex scans in a show that has duplicate entries cause by tags, you can't just do a Refresh Metadata to remove the duplicates, as they are now collection entries. You need to remove each collection entry one at a time.

Screen Shot 2021-01-17 at 10 26 05 pm

As a quick very dirty workaround, I have spun up a one liner to scan for NFO files that contain lines with and remove those lines from the NFO file. Absolutely not a good solution AT ALL, I mean it's better than nothing, but the problem is that if you have your media scraper going in the background, once every hour checking for new shows, and Plex is set to either monitor the folder in realtime, or every hour ... you will 100% get duplicate collection entries for each new show that gets added, if the NFO hasn't had the lines removed first.

One liner: 'find /foldername/ -type f -name '.nfo' -print -exec sed -i -e '//d' {} ;'
e.g. 'find /mnt/user/tv_shows/ -type f -name '
.nfo' -print -exec sed -i -e '//d' {} ;

The command runs pretty quick (well at least on Linux), so a workaround is to have the script run every 10mins and have Plex update every couple of hours instead or even once per day. Remember the duplicate issue will only happen for new TV shows that are added, not for new episodes. However if your NFO gets overwritten with the lines again, if you do a Refresh Metadata in Plex, you will get duplicate collection entries for each show.

Now I also went a step further and spun up a docker container with MediaElch ... I have not used it before, but I was pretty impressed within only a few minutes, especially with the level customization you can make to what and how you want to scrape each piece of data. The other good thing is it looks like it has very active development - https://mediaelch.github.io/mediaelch-blog/posts/

One really cool thing is you can set custom scraper options, and specify which source you want to get each piece of info from:

image

So in regards to the line issue, MediaElch allows you to specify exactly which items you want to include in the NFO file for the tvshow.nfo and the episode NFOs.

image

Tested it and XBMCnfoTVImporter picks it up properly very quickly, as it doesn't have any lines in the nfo.

The only other problem is that MediaElch doesn't run unattended, you have to run the scraper manually ... It syncs to Kodi which I believe just tells Kodi to do a refresh after each scrape is finished, but MediaElch still has to be run manually.

Obviously this is a VERY long winded workaround, so I am hoping having the ability to ignore lines (and whatever else they specify) in NFO files (or equivalent) can be added, as it will solve this issue completely, and allow people to use whatever NFO files they want, and have Sonarr, SickRage, SickChill etc create their normal metadata files that include the line, and have the best of both worlds.

@SweetMNM
Copy link

I made a quick fix in my fork https://github.com/SweetMNM/XBMCnfoTVImporter.bundle

It will now by default not create collections from all of the tags but you can still do so if you wish by toggling options in the agent settings or the library advanced settings

@Squazz
Copy link

Squazz commented Nov 29, 2022

@SweetMNM you should make a PR with your changes. They look fine :)

But, make sure to do it on it's own branch, PRs can take some time to get pulled in ;)

I made this PR with the change in question: #128
It was irritating me as wall

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

No branches or pull requests

2 participants