jellyfin-plugin-mergeversions icon indicating copy to clipboard operation
jellyfin-plugin-mergeversions copied to clipboard

Not merging tv shows/movies half of the time

Open Cookie-Monster-Coder opened this issue 3 years ago • 25 comments

I noticed that for the past month or so a lot of things aren't getting merged. It seems to be random, some things are and some things aren't. I also try forcing it by going in the add-on setting and clicking on merge all moves/tv shows but still nothing.

prob1 prob2

Cookie-Monster-Coder avatar Oct 02 '21 05:10 Cookie-Monster-Coder

Does it have a tmdb Id?

danieladov avatar Oct 02 '21 17:10 danieladov

This is all the plugins I have installed.

prob3

The closest thing to tmdb is the tmdb box set.

I can't find tmdb by itself in the plugins catalog.

Cookie-Monster-Coder avatar Oct 02 '21 17:10 Cookie-Monster-Coder

I was referring to the movie, click the 3 dots and select "edit metadata", there's a field called "TheMovieDb Movie Id". Both movies should have the same

danieladov avatar Oct 02 '21 21:10 danieladov

Just found another one now. I just checked and they do have the same TheMovieDb Movie id. They also have the same IMDb Id.

Cookie-Monster-Coder avatar Oct 05 '21 07:10 Cookie-Monster-Coder

This is also happening to me, I'll try to find a solution

danieladov avatar Oct 05 '21 10:10 danieladov

Any update on this? Is it possible to use something else like IMDB TVmaze if tmdb doesn't work?

Cookie-Monster-Coder avatar Nov 27 '21 05:11 Cookie-Monster-Coder

I've been working on it, I will release the new version in a day or two.

danieladov avatar Nov 28 '21 15:11 danieladov

Hi, I've just released the new version, let me know if it fixed your problem.

danieladov avatar Dec 02 '21 22:12 danieladov

I'm still getting a few that are not combining. Both in Movies and Tv Shows.

I looked at this one and it doesn't have a TheMovieDb ID input spot in the edit metadata section, so I'm guessing that's why some are failing.

1

Cookie-Monster-Coder avatar Dec 19 '21 04:12 Cookie-Monster-Coder

The plugins depend on TMdb so if there is no id it won't be merged at all. Are the rest of the series being merged?

danieladov avatar Dec 21 '21 16:12 danieladov

I'm having this same issue lately. Do you have recommended library settings to get it working properly? I can't see anything that would prevent TMDb fields from populating, but basically nothing is being merged lately.

captainnapalm avatar Apr 17 '22 16:04 captainnapalm

I'm having this same issue lately. Do you have recommended library settings to get it working properly? I can't see anything that would prevent TMDb fields from populating, but basically nothing is being merged lately.

Yeah, the issue never went away. Both for shows and movies. I still think if there is no TMDb number it should fallback to IMDB or TVmaze

Cookie-Monster-Coder avatar Apr 23 '22 05:04 Cookie-Monster-Coder

So, I just refreshed my movies. All of them now have a TMDb number, but now some of them are not merging. Screenshot 2022-04-25 020258 Screenshot 2022-04-25 020053

Cookie-Monster-Coder avatar Apr 25 '22 07:04 Cookie-Monster-Coder

Having the same issue. Both movies have the same IMDb Id and the same TheMovieDb Movie Id.

alexbgameson avatar Aug 12 '22 13:08 alexbgameson

I installed this plugin a few days ago and initially it worked really well, but now I have this issue as well. I re-organized some parts of my library and added some new versions of some movies and now a lot of them aren't being merged. I've checked and they do have matching id's

Edit to add: I've found a work-around is to completely remove and then re-add the affected movies, they then merged correctly.

cyr123 avatar Aug 14 '22 05:08 cyr123

Could you all post the file names and structure of the movies that are not being merged? I'll be doing some testing.

danieladov avatar Aug 14 '22 10:08 danieladov

/mnt/disk1/movies/4K/Skyfall - 4K.mkv /mnt/disk1/movies/HD/Skyfall.mkv

alexbgameson avatar Aug 14 '22 11:08 alexbgameson

/mnt/disk1/movies/4K/Skyfall - 4K.mkv /mnt/disk1/movies/HD/Skyfall.mkv

I've just tried that structure and it is merging both movies correctly, make sure both have the same TMDB ID. You can also try to split all (from the plugin menu) and merge them again

danieladov avatar Aug 26 '22 21:08 danieladov

I like this feature a lot, made me start the switch from Plex.

Noticed this issue from Game Of Thrones, where I have three versions per episode. Some of them group all three into one, some only two and the third keeps separate. For all of the latter the third version was added later. So I suspect that a new version is not merged into an existing group of versions.

This is shown at the moment. Ilustating the state of some episodes with 3 versions, some with 2+1. image

All are stored the same way: image

The Log shows some activity, but the result shown by the client stays unchanged:

` [2023-01-15 17:54:28.293 +01:00] [INF] [1] Main: Jellyfin version: "10.8.8" [2023-01-15 17:54:28.327 +01:00] [INF] [1] Main: Environment Variables: ["[JELLYFIN_LOG_DIR, C:\ProgramData\Jellyfin\Server\log]"] [2023-01-15 17:54:28.333 +01:00] [INF] [1] Main: Arguments: ["C:\Program Files\Jellyfin\Server\jellyfin.dll", "--datadir", "C:\ProgramData\Jellyfin\Server"] [2023-01-15 17:54:28.337 +01:00] [INF] [1] Main: Operating system: "Windows" [2023-01-15 17:54:28.338 +01:00] [INF] [1] Main: Architecture: X64 [2023-01-15 17:54:28.341 +01:00] [INF] [1] Main: 64-Bit Process: True [2023-01-15 17:54:28.343 +01:00] [INF] [1] Main: User Interactive: True [2023-01-15 17:54:28.344 +01:00] [INF] [1] Main: Processor count: 16 [2023-01-15 17:54:28.346 +01:00] [INF] [1] Main: Program data path: "C:\ProgramData\Jellyfin\Server" [2023-01-15 17:54:28.347 +01:00] [INF] [1] Main: Web resources path: "C:\Program Files\Jellyfin\Server\jellyfin-web" [2023-01-15 17:54:28.349 +01:00] [INF] [1] Main: Application directory: "C:\Program Files\Jellyfin\Server"

[2023-01-15 17:54:35.331 +01:00] [INF] [1] Emby.Server.Implementations.Plugins.PluginManager: Loaded plugin: "AniDB" "7.0.0.0" [2023-01-15 17:54:35.339 +01:00] [INF] [1] Emby.Server.Implementations.Plugins.PluginManager: Loaded plugin: "Bookshelf" "9.0.0.0" [2023-01-15 17:54:35.347 +01:00] [INF] [1] Emby.Server.Implementations.Plugins.PluginManager: Loaded plugin: "Email Notifications" "9.0.0.0" [2023-01-15 17:54:35.354 +01:00] [INF] [1] Emby.Server.Implementations.Plugins.PluginManager: Loaded plugin: "Fanart" "10.0.0.0" [2023-01-15 17:54:35.362 +01:00] [INF] [1] Emby.Server.Implementations.Plugins.PluginManager: Loaded plugin: "Merge Versions" "10.8.0.1" [2023-01-15 17:54:35.368 +01:00] [INF] [1] Emby.Server.Implementations.Plugins.PluginManager: Loaded plugin: "Playback Reporting" "13.0.0.0" [2023-01-15 17:54:35.374 +01:00] [INF] [1] Emby.Server.Implementations.Plugins.PluginManager: Loaded plugin: "TheTVDB" "8.0.0.0" [2023-01-15 17:54:35.380 +01:00] [INF] [1] Emby.Server.Implementations.Plugins.PluginManager: Loaded plugin: "TMDb Box Sets" "10.0.0.0" [2023-01-15 17:54:35.383 +01:00] [INF] [1] Emby.Server.Implementations.Plugins.PluginManager: Loaded plugin: "TMDb" "10.8.8.0" [2023-01-15 17:54:35.384 +01:00] [INF] [1] Emby.Server.Implementations.Plugins.PluginManager: Loaded plugin: "Studio Images" "10.8.8.0" [2023-01-15 17:54:35.386 +01:00] [INF] [1] Emby.Server.Implementations.Plugins.PluginManager: Loaded plugin: "OMDb" "10.8.8.0" [2023-01-15 17:54:35.388 +01:00] [INF] [1] Emby.Server.Implementations.Plugins.PluginManager: Loaded plugin: "MusicBrainz" "10.8.8.0" [2023-01-15 17:54:35.389 +01:00] [INF] [1] Emby.Server.Implementations.Plugins.PluginManager: Loaded plugin: "AudioDB" "10.8.8.0"

[2023-01-15 17:59:47.377 +01:00] [INF] [40] Jellyfin.Api.Controllers.VideosController: Starting a manual refresh, looking up for repeated versions [2023-01-15 17:59:47.396 +01:00] [INF] [40] Jellyfin.Api.Controllers.VideosController: Scanning for repeated episodes [2023-01-15 17:59:47.403 +01:00] [INF] [40] Jellyfin.Api.Controllers.VideosController: Merging 1 (10.5 – Die Erde bebt) [2023-01-15 17:59:47.411 +01:00] [INF] [40] Jellyfin.Api.Controllers.VideosController: Merging 1 (10.5 – Apocalypse) [2023-01-15 17:59:47.414 +01:00] [INF] [40] Jellyfin.Api.Controllers.VideosController: Merging 2 (10.5 – Apocalypse) [2023-01-15 17:59:47.416 +01:00] [INF] [40] Jellyfin.Api.Controllers.VideosController: Merging 10 (Game of Thrones) [2023-01-15 17:59:47.418 +01:00] [INF] [40] Jellyfin.Api.Controllers.VideosController: Merging 2 (Game of Thrones) [2023-01-15 17:59:47.421 +01:00] [INF] [40] Jellyfin.Api.Controllers.VideosController: Merging 3 (Game of Thrones) [2023-01-15 17:59:47.423 +01:00] [INF] [40] Jellyfin.Api.Controllers.VideosController: Merging 8 (Game of Thrones) [2023-01-15 17:59:47.424 +01:00] [INF] [40] Jellyfin.Api.Controllers.VideosController: Merging 10 (Game of Thrones) [2023-01-15 17:59:47.425 +01:00] [INF] [40] Jellyfin.Api.Controllers.VideosController: Merging 6 (Game of Thrones) [2023-01-15 17:59:47.427 +01:00] [INF] [40] Jellyfin.Api.Controllers.VideosController: Merging 2 (Game of Thrones) [2023-01-15 17:59:47.429 +01:00] [INF] [40] Jellyfin.Api.Controllers.VideosController: Merging 7 (Game of Thrones) [2023-01-15 17:59:47.431 +01:00] [INF] [40] Jellyfin.Api.Controllers.VideosController: Merging 8 (Game of Thrones) ... [2023-01-15 17:59:47.538 +01:00] [INF] [40] Jellyfin.Api.Controllers.VideosController: Completed refresh

`

HolgerKuehn avatar Jan 15 '23 16:01 HolgerKuehn

~~I don't think I need to open a new ticket for this, but I will say that I'm slightly confused about the ideal naming scheme here.

Of course Jellyfin handles movies just fine, and generally mine are named with the format [Movie Name] (Year) - 2160p.ext for a 4K file, or with 1080p in place of 2160p for a non 4K file.

What is the intended naming scheme for TV shows using this plugin, as that really isn't clear to me - even from reading various issues here.~~

Turns out I was looking at a season that didn't have both versions. Well played me.

What version plays by default if there's 1080p and 2160p? Assuming it's the 1080p since its name comes first? Is there anyway to force a default version via the normal Jellyfin naming conventions?

madindehead avatar Jan 25 '23 16:01 madindehead

Naming scheme is listed here https://jellyfin.org/docs/general/server/media/shows As for this plugin, the only important is that all files are associated the same episode. The actual naming of the files can differ, as long as jellyfin or the scraper used can associate them with the episode.

As for me, I'm using just "E01 S01 - HD.mkv" for it, and it worked just fine. Adding the show title will also work.

By default the episodes are not merged into one entry and listed all. The plug merges them into one item (if no merged group exists already; needed to split and re-merge them here).

What version is played by default, depends on the client and connection to the server and this independent from this plugin. Basically jellyfin should choose the best quality version the client and (internet-) connection can support. So despite your naming scheme this could be the 2160p version when you are watching on an UHD-Display using a UHD capable player.

I can not test this with UHD, as I don't have a TV for it right now, but it works the same with 1080p and 480p. Usually I get the 1080p but on lower bandwidth on the go it chooses the 480p by default.

There is not option to default to a version that I'm aware of. Limiting the (remote-) bandwidth is the only option I know of.

HolgerKuehn avatar Jan 28 '23 10:01 HolgerKuehn

I'm having the same issue also. Two episodes of the same show are displayed as different shows. They have the same IMDb ID and same TheMovieDb Movie Id.

gVes avatar May 12 '23 09:05 gVes

I just experienced the same issue and decided to investigate a bit. This plugin uses the PrimaryVersionId attribute to link duplicate episodes/movies to the main episode/movie, such that duplicate media is not shown as a separate item, but accessed via the main item. In turn, this plugin only attempts to merge items without PrimaryVersionId (i.e. only non-duplicate items), and items, that don't have any duplicates linked to them: https://github.com/danieladov/jellyfin-plugin-mergeversions/blob/b8d2cf51642e33143a09901d5511fe11e762616f/Jellyfin.Plugin.MergeVersions/MergeVersionsManager.cs#L224

Furthermore, all duplicates in an item group have the same PresentationUniqueKey, which corresponds to the PrimaryVersionId. The PrimaryVersionId is only set for items marked as duplicates, while the PresentationUniqueKey is set for all items, so for duplicates and for the main item.

Now in my case there were a few episodes that had a PrimaryVersionId, but were still shown as independent episodes in the web UI. It seems, that the main item ID had changed for some reason, thus leaving duplicate items with an invalid PrimaryVersionId behind. I recently renamed some files, so that might've caused it, but I'm not entirely sure.

Anyway, if you think that might be the case for you too, here's how to fix it: Stop jellyfin and open its library database with the sqlite3 tool. The database is located here on my system: /var/lib/jellyfin/data/library.db The following query should display all episodes that were merged into a different episode at one point, whose item id changed:

SELECT SeriesName, SeasonName, Name
FROM TypedBaseItems
WHERE PrimaryVersionId NOT IN (
    SELECT PresentationUniqueKey
    FROM TypedBaseItems
    GROUP BY PresentationUniqueKey
    HAVING COUNT(*) > 1
);

The subquery selects all PresentationUniqueKey that occur more than once, so all valid groups of items. The main query then selects all items with a PrimaryVersionId that is not contained in a valid item group. The output shows the guid, series name, season name, and episode name of items grouped with just themselves. Such groups unfortunately aren't resolved by the "Split all" feature, which is why they must be ungrouped manually for now. If the output is correct, we can "ungroup" these items by simply removing the set PrimaryVersionId, which allows this plugin to merge them with different episodes again. Only run the following query if you've verified the output of the previous query. Obviously a stranger on the internet doesn't warrant for any errors.

UPDATE TypedBaseItems
SET PrimaryVersionId = NULL
WHERE guid IN (
    SELECT guid
    FROM TypedBaseItems
    WHERE PrimaryVersionId NOT IN (
        SELECT PresentationUniqueKey
        FROM TypedBaseItems
        GROUP BY PresentationUniqueKey
        HAVING COUNT(*) > 1
    )
);

After running the query, exit the sqlite3 CLI via .quit or CTRL+D. Then you can start jellyfin again. Re-running "Merge all Episodes/Movies" via the plugin should now merge all items correctly.

jkhsjdhjs avatar May 25 '23 17:05 jkhsjdhjs

SELECT SeriesName, SeasonName, Name
FROM TypedBaseItems
WHERE PrimaryVersionId NOT IN (
    SELECT PresentationUniqueKey
    FROM TypedBaseItems
    GROUP BY PresentationUniqueKey
    HAVING COUNT(*) > 1
);

The subquery selects all PresentationUniqueKey that occur more than once, so all valid groups of items. The main query then selects all items with a PrimaryVersionId that is not contained in a valid item group. The output shows the guid, series name, season name, and episode name of items grouped with just themselves. Such groups unfortunately aren't resolved by the "Split all" feature, which is why they must be ungrouped manually for now. If the output is correct, we can "ungroup" these items by simply removing the set PrimaryVersionId, which allows this plugin to merge them with different episodes again. Only run the following query if you've verified the output of the previous query. Obviously a stranger on the internet doesn't warrant for any errors.

So I managed to open my library and the first query, but unfortunately for me, I received no output.
I do have couple movies that are merged and couple that won't merge for life.
I also run only the subsequent query and got some random strings and couple persons(that's weird). 9 hits in total, three of them are almost identical

92ff776ca6cd56b146446471e2488983-002
92ff776ca6cd56b146446471e2488983-003
92ff776ca6cd56b146446471e2488983-004

@jkhsjdhjs are you sure you did write those queries correctly?

@anyone_else it it work for you?

Jurrer avatar Oct 13 '23 13:10 Jurrer

If the first query doesn't show anything for you, then the plugin not merging your shows/movies is caused by something else.

jkhsjdhjs avatar Oct 13 '23 14:10 jkhsjdhjs