Jump to content

Automatic version grouping for movies


MikePlanet

Recommended Posts

bakes82

It's very easy to rewrite this simple plugin lol, took maybe an hour, I did it last year, you can basically go use the Jellyfin logic.  The original code is pretty messy and could have been simplified to make the logic and readability much easier.

image.png.2011202b682217fd4bac9b9d6cef3869.png

 

This is basically the key logic, get all movies and then determine the grouping key, some movies only have imdb, some only have tmdb, hence the group key logic, you could expand this to if it doesnt have either (I dont know of a use case) but then you could use title/year. 

private List<IGrouping<object, Movie>> GetDuplicates(List<Movie> movies, long libraryId)
    {
        return new List<IGrouping<object, Movie>>(movies.Where(m => m.ProviderIds != null)
                                                        .GroupBy(m =>
                                                                 {
                                                                     var imdbId = m.GetProviderId(MetadataProviders.Imdb);
                                                                     var tmdbId = m.GetProviderId(MetadataProviders.Tmdb);

                                                                     if (imdbId != null && tmdbId == null)
                                                                         return new
                                                                                {
                                                                                    GroupKey = imdbId + libraryId
                                                                                };

                                                                     if (tmdbId != null && imdbId == null)
                                                                         return new
                                                                                {
                                                                                    GroupKey = tmdbId + libraryId
                                                                                };

                                                                     if (tmdbId != null && imdbId != null)
                                                                         return new
                                                                                {
                                                                                    GroupKey = tmdbId + imdbId + libraryId
                                                                                };

                                                                     return null;
                                                                 })
                                                        .Where(g => g != null && g.Count() > 1)
                                                        .Distinct()
                                                        .ToList());
    }

Then based on other logic IE if you want to ignore paths, locked items, or already merged items in your "merge" function you can then weed out those, and if you want to merge across all libraries(ui variable) IE you have 4 movie folders you would set a generic libraryId ex: 0 when you get the movies out.

Link to comment
Share on other sites

Hoptional

That is essentially what the plugin is already doing. I agree it could be cleaned up, but that is not the problem. The most critical part is the check whether or not the movies are already grouped so it doesn't attempt a regroup on each run. This requires that the plugin picks up all files that exist for a movie. Due to the way the movies are currently queried, strm files or files in subfolders (and possibly other cases that I am not aware of) will be missed and the plugin gets an incorrect item count and the movies won't be grouped. It is probably easy to fix (just use recursive = true), but would require testing the various different cases also in combination with other plugins, which I am not willing to do, mostly because it works fine for me as it is but honestly also because I don't really like to do free work for a profit-oriented company that has been ignoring this (in my opinion basic) functionality for many years.

But it seems like you already did the work. Would you be willing to share?

Edited by Hoptional
  • Like 1
  • Agree 1
Link to comment
Share on other sites

Edrock200
22 hours ago, Luke said:

Is that version even in the first post?

Not that I saw. 

Link to comment
Share on other sites

Happy2Play

@Hoptional Looks like the variable in my case is nested folder structure.

library point to C:\Users\Media\Desktop\Videos\Movies - nfo

items in C:\Users\Media\Desktop\Videos\Movies - nfo\Test 1\Star Wars Collection folder

Removing Testing 1 did not work, had to remove both folder structures.

Moving items to C:\Users\Media\Desktop\Videos\Movies - nfo resolves the issues.  Everything grouped as expected in this specific example.  

 

 

 

 

  • Like 1
Link to comment
Share on other sites

SShzin
On 2/17/2024 at 2:19 PM, Hoptional said:

That is essentially what the plugin is already doing. I agree it could be cleaned up, but that is not the problem. The most critical part is the check whether or not the movies are already grouped so it doesn't attempt a regroup on each run. This requires that the plugin picks up all files that exist for a movie. Due to the way the movies are currently queried, strm files or files in subfolders (and possibly other cases that I am not aware of) will be missed and the plugin gets an incorrect item count and the movies won't be grouped. It is probably easy to fix (just use recursive = true), but would require testing the various different cases also in combination with other plugins, which I am not willing to do, mostly because it works fine for me as it is but honestly also because I don't really like to do free work for a profit-oriented company that has been ignoring this (in my opinion basic) functionality for many years.

But it seems like you already did the work. Would you be willing to share?

Well said. I think that this should be something that the Emby devs implement. As it's been said many of times, it's available with TV but not Movies. I don't really understand why. @Lukecan we get some clarification as to why this wouldn't just be implemented directly? Thanks for your time.

  • Agree 1
Link to comment
Share on other sites

8 minutes ago, SShzin said:

Well said. I think that this should be something that the Emby devs implement. As it's been said many of times, it's available with TV but not Movies. I don't really understand why. @Lukecan we get some clarification as to why this wouldn't just be implemented directly? Thanks for your time.

We never said it wouldn't. It just hasn't been done yet.

  • Like 1
Link to comment
Share on other sites

lorac

😂

It's a true statement but people have been asking for how many years and how many revisions has emby gone through since then?

 

  • Like 2
Link to comment
Share on other sites

svyaznoy362

Server version 4.9.0.8, which version is working I tried 1.0.0.0, 1.0.0.8. Result 0, does not group anything.

Link to comment
Share on other sites

Happy2Play
35 minutes ago, svyaznoy362 said:

Server version 4.9.0.8, which version is working I tried 1.0.0.0, 1.0.0.8. Result 0, does not group anything.

I honestly do not pay attention to the log as items are group when I go to them in the UI.

1.0.0.0 just works even though logging doesn't in my tests.

 

1.0.0.8 appears to have a nesting structure issue in my testing.

Applies to both 4.8 and 4.9 and I mentioned my discovery of the nesting issue a couple posts later.

Link to comment
Share on other sites

bakes82
On 3/3/2024 at 3:59 PM, svyaznoy362 said:

Server version 4.9.0.8, which version is working I tried 1.0.0.0, 1.0.0.8. Result 0, does not group anything.

none, this plugin is dead, the original owner abandoned it, they should honestly mark it as such.  it doesnt even work correctly on 4.8

Link to comment
Share on other sites

Happy2Play
7 minutes ago, bakes82 said:

none, this plugin is dead, the original owner abandoned it, they should honestly mark it as such.  it doesnt even work correctly on 4.8

Works just fine beside logging.  But it is a community plugin so why don't you pick it up?

Link to comment
Share on other sites

bakes82
24 minutes ago, Happy2Play said:

Works just fine beside logging.  But it is a community plugin so why don't you pick it up?

Because it’s not worth it for me to publish my own version and deal with the community issues that I don’t care about plus 99% of issues never come with logs or repeatable steps, so then they just ask when’s it going to be fix and they claimed 5+ years ago they would implement it into the base. I would publish to the store if I could charge a subscription model like 5$ a month per server but a 1x payment doesn’t make me want to contribute to anything for emby as support and the constant updates make it pretty much not worth it and not sustainable.  Hence why people stop doing plugins. Also there is no api for the store for me to auto deploy built dlls to so it’s a manual upload which doesn’t fit in to my devops process.  The store isn’t that dev friendly and many have asked for this to be improved but as like most things sure we can do that and then it never comes.

 

also what version works for 4.8. I see like 5 diff versions and everyone says use one that’s not listed.

Edited by bakes82
  • Facepalm 2
Link to comment
Share on other sites

Happy2Play
10 minutes ago, bakes82 said:

Because it’s not worth it for me to publish my own version and deal with the community issues that I don’t care about plus 99% of issues never come with logs or repeatable steps, so then they just ask when’s it going to be fix and they claimed 5+ years ago they would implement it into the base. I would publish to the store if I could charge a subscription model like 5$ a month per server but a 1x payment doesn’t make me want to contribute to anything for emby as support and the constant updates make it pretty much not worth it and not sustainable.  Hence why people stop doing plugins. Also there is no api for the store for me to auto deploy built dlls to so it’s a manual upload which doesn’t fit in to my devops process.  The store isn’t that dev friendly and many have asked for this to be improved but as like most things sure we can do that and then it never comes.

 

also what version works for 4.8. I see like 5 diff versions and everyone says use one that’s not listed.

I have already tested multiple time but the 1.0.0.0 (4.6.0.22-betaServer.zip) but logging does not work.

Depending on if you have a nested structure or not as 1.0.0.8 works on a flat structure.

Link to comment
Share on other sites

bakes82
12 minutes ago, Happy2Play said:

I have already tested multiple time but the 1.0.0.0 (4.6.0.22-betaServer.zip) but logging does not work.

Depending on if you have a nested structure or not as 1.0.0.8 works on a flat structure.

There is no posted 1.0.0.0 or 1.0.0.8 in the first post so just like I said lol. People saying use versions not posted.   4.6.022 is posted but if logging doesn’t work when well no point running it since you won’t be able to see issues and would be using the server api from 4.6.

Link to comment
Share on other sites

Happy2Play
8 minutes ago, bakes82 said:

There is no posted 1.0.0.0 or 1.0.0.8 in the first post so just like I said lol. People saying use versions not posted.   4.6.022 is posted but if logging doesn’t work when well no point running it since you won’t be able to see issues and would be using the server api from 4.6.

Well it works no matter what the log say so use it or not but your comments on a Community plugin are useless.

Link to comment
Share on other sites

svyaznoy362

1.0.0.0 works, but not everything adds up to one poster, if I combine movie versions with my hands, the filter is reset, how can I fix this?

 

Screenshot_2024-03-05-07-11-22-157_ellipi.messenger.jpg

Edited by svyaznoy362
Link to comment
Share on other sites

bakes82
12 hours ago, Happy2Play said:

Well it works no matter what the log say so use it or not but your comments on a Community plugin are useless.

Odd why so many people say it doesn’t work then lol.  Oh look someone saying it doesn’t work.

Link to comment
Share on other sites

Hoptional

It may not work for everybody, but it is wrong to say it does not work at all. The limitations were already discussed in this thread and to avoid burying them further, I suggest we keep the discussion among those who use or would like to use the plugin.

Edited by Hoptional
Link to comment
Share on other sites

svyaznoy362

There are 9511 movies in the folder , if I install version 1.0.0.8, then the number of movies becomes 7652, if I use the 1.0.0.0 plugin, then the number of movies is 6400 and that's not all , about 300 should be combined with one poster , so the working version of the plugin is 1.0.0.0

Edited by svyaznoy362
  • Like 1
Link to comment
Share on other sites

lorac
On 06/10/2019 at 06:25, Luke said:

If there's enough demand for it, sure.

What level of demand would be enough?

  • Agree 2
Link to comment
Share on other sites

SShzin
6 hours ago, lorac said:

What level of demand would be enough?

You'll need to @ him I'm guessing.

Link to comment
Share on other sites

Happy2Play
4 minutes ago, SShzin said:

You'll need to @ him I'm guessing.

Quoting does the same in reference to notifications.

  • Thanks 1
Link to comment
Share on other sites

bakes82
On 3/5/2024 at 9:27 AM, svyaznoy362 said:

the number of movies is 6400 and that's not all , about 300 should be combined with one poster ,

Typical emby folks. It works some of the time but not fully… that means it’s not working then lol. For all you know it combined wrong movies also.

  • Disagree 3
Link to comment
Share on other sites

Anielarias
2 hours ago, bakes82 said:

Typical emby folks. It works some of the time but not fully… that means it’s not working then lol. For all you know it combined wrong movies also.

dude u have to be grateful that @Hoptional resuscitated what was an otherwise dead community plug-in.

  • Agree 2
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...