bakes82 167 Posted December 5, 2020 Posted December 5, 2020 1 minute ago, MikePlanet said: If you create items that are type filesystem, have a valid path, the plugin will include (and possibly merge) them - basically you're creating "duplicate" entries each pointing to the same media file!? My guess is you just need to do something like this: (IsVirtualItem = false) @Luke: Can you confirm, that using filter "virtualitem=false" is the right approach? That would be easy to add/change. But the plugin UI should also contain a checkbox list of the librarys it should merge items. I don't think this is needed, as only Type "movie" with "physical" file is inspected anyway. Either ppl want to merge their versions or they don't want to. Anyway, attached file added "IsVirtualItem=false" - so if your assumption is right that this excludes "Channelitems" it might work AutoCollections.dll 26.5 kB · 0 downloads Ill give it a whirl. Why are you opposed to putting the code on github? You arent charging for it lol. This way I could build my own version and send you the PR Im not sure how a "Channel" is configured in Emby, thats why I think I ended up having to do a duplicate match/search against all my other channels because they are pointing to the same physical file. In IMDB Top 100 channel is Movie A, in James Bond Channel Movie A also appears, they both point to /emby/Movies/JamesBondMovieA/movieA.mkv So currently your code says Okay I see Movie A in the "Movies" library, in the IMDB Top 100 Channel , and the James Bond Channel and merges them all together. Is there a way to say when merging, if youre in the "Movies" library if the parent id of said movies isnt the same as "Movies" dont include it? I dont understand why its trying to merge things from other libraries, IMDB Top 100 and James Bond dont have the same parent ID for sure
bakes82 167 Posted December 5, 2020 Posted December 5, 2020 @MikePlanet Here is a link to my code where I made my channels. Line 120 should be where I start making the channels, the code above is to turn the channel on/off in the users permissions. https://github.com/bakes82/TraktLists/blob/master/TraktLists/Channels/ChannelHelper.cs
MikePlanet 144 Posted December 5, 2020 Author Posted December 5, 2020 afair a mediaFILE only exists ONCE in the DB and this is a reason why Emby does not support to add same pathes to multiple libraries - then you'd get multiple entries for the same media file.However, I checked at least with my DB, that none of the mediafiles has "IsVirtualItem=true" - so adding this filter won't change anything here. Is there a way to say when merging, if youre in the "Movies" library if the parent id of said movies isnt the same as "Movies" dont include it? I dont understand why its trying to merge things from other libraries, IMDB Top 100 and James Bond dont have the same parent ID for sure :) Plugin is not based on libraries, but on "type" (=movie), regardless in which library they're placed. That's the purpose of the "version grouping". If however the principle of only one MediaItem per mediafile istn't valid anymore, that needs adaption, would need confirmation from Luke for this.
MikePlanet 144 Posted December 5, 2020 Author Posted December 5, 2020 3 minutes ago, bakes82 said: @MikePlanet Here is a link to my code where I made my channels. Line 120 should be where I start making the channels, the code above is to turn the channel on/off in the users permissions. https://github.com/bakes82/TraktLists/blob/master/TraktLists/Channels/ChannelHelper.cs If created Channelitems do set IsVirtualItem=true then all should be fine (with new dll) - I don't have Channels here, so you might simply check it in your DB when you have created some.
bakes82 167 Posted December 5, 2020 Posted December 5, 2020 Yeah not limiting to "library" is most likely an issue. Let say I make 1 Library that has Movies and 4k Movies, I want those grouped together, but nothing stops me from having another Library called "4k" movies and it having the 4k path only.
MikePlanet 144 Posted December 5, 2020 Author Posted December 5, 2020 1 minute ago, bakes82 said: Yeah not limiting to "library" is most likely an issue. Let say I make 1 Library that has Movies and 4k Movies, I want those grouped together, but nothing stops me from having another Library called "4k" movies and it having the 4k path only. That is what afaik is NOT supported by Emby (adding the same path to multiple libraries) - and you don't want to have the same mediaitem multiple times in your db - access control should be done via security/filters - so you CAN have a 4K library and the rest in standard library - and e.g. let users only access the standard versions by not adding the standard library to them. But the view for "movies" should always be the same. And this plugin is not meant to be limited to a library, as it works on "movie level", merging the underlying mediaitems (versions) to single movie items. Initially I had a feature to avoind the merging based on the "locked" tag of a mediaitem to allow prevention of the merging, but as I said above: either you want to have single movie items and have all versions merged to them - or youi don't want that and prefer to have separate items - if the latter, you simply would remove the plugin...
bakes82 167 Posted December 5, 2020 Posted December 5, 2020 5 minutes ago, MikePlanet said: That is what afaik is NOT supported by Emby (adding the same path to multiple libraries) - and you don't want to have the same mediaitem multiple times in your db - access control should be done via security/filters - so you CAN have a 4K library and the rest in standard library - and e.g. let users only access the standard versions by not adding the standard library to them. But the view for "movies" should always be the same. And this plugin is not meant to be limited to a library, as it works on "movie level", merging the underlying mediaitems (versions) to single movie items. Initially I had a feature to avoind the merging based on the "locked" tag of a mediaitem to allow prevention of the merging, but as I said above: either you want to have single movie items and have all versions merged to them - or youi don't want that and prefer to have separate items - if the latter, you simply would remove the plugin... Nothing in Emby prevents me from having the same path in multiple libraries. I can even have the same named library multiple times. I think your code is just wrong. If I have 2 libraries I dont want things merged from Library A in Library B. Example below Movies also has the Movies 4k Path. You should only be grouping items in the "Movies" library. But your code will see the items from the 4 other libraries now also. Why I think your code should be library specific Just like why in my code I have to prevent items from the other channels being seen.
Luke 42077 Posted December 5, 2020 Posted December 5, 2020 7 minutes ago, bakes82 said: Nothing in Emby prevents me from having the same path in multiple libraries. I can even have the same named library multiple times. I think your code is just wrong. If I have 2 libraries I dont want things merged from Library A in Library B. Example below Movies also has the Movies 4k Path. You should only be grouping items in the "Movies" library. But your code will see the items from the 4 other libraries now also. Why I think your code should be library specific Just like why in my code I have to prevent items from the other channels being seen. It generally works when it's the exact same path used multiple times, with the same content type in every single library that it's used. Where you run into trouble is if you try to use multiple content types, or do some kind of parent/child duplication such as adding /home/media/movies to one library and then /home/media to another.
MikePlanet 144 Posted December 5, 2020 Author Posted December 5, 2020 2 minutes ago, bakes82 said: [...] If I have 2 libraries I dont want things merged from Library A in Library B. [...] sorry, that is not the intended purpose of the plugin, if you want something like that I think the plugin simply isn't what you're looking for
bakes82 167 Posted December 5, 2020 Posted December 5, 2020 (edited) 7 minutes ago, MikePlanet said: sorry, that is not the intended purpose of the plugin, if you want something like that I think the plugin simply isn't what you're looking for Hence why I said can we have the code Because your plugin doesnt work with channel plugins then. Restricting per library should be a very quick modification, but to rebuild it all, Im sure would take me more time. Edited December 5, 2020 by bakes82
MikePlanet 144 Posted December 5, 2020 Author Posted December 5, 2020 4 minutes ago, Luke said: It generally works when it's the exact same path used multiple times, with the same content type in every single library that it's used. Where you run into trouble is if you try to use multiple content types, or do some kind of parent/child duplication such as adding /home/media/movies to one library and then /home/media to another. hmmm, ok, so if you say it is supported to add same media multiple times, then I understand what bakes82 wants to achieve - then grouping only "per/within library" makes sense - but it is a completely different use case - the intended use case is to merge versions across "everywhere" to only have single items of movies with multiple versions - thats more or less the opposite, as it is desired to have versions merged cross library.
bakes82 167 Posted December 5, 2020 Posted December 5, 2020 (edited) 7 minutes ago, MikePlanet said: hmmm, ok, so if you say it is supported to add same media multiple times, then I understand what bakes82 wants to achieve - then grouping only "per/within library" makes sense - but it is a completely different use case - the intended use case is to merge versions across "everywhere" to only have single items of movies with multiple versions - thats more or less the opposite, as it is desired to have versions merged cross library. If you want to test use the "New Release Channels" Plugin https://github.com/chefbennyj1/Emby.NewReleasesChannel He has forum post someplace with the dll already. But yeah I dont want everything across all libraries merged. Only where the library has multiple sources. I might have 1 library for Movies and 4k, but then a 2nd for Dolby Vision that I wouldnt want merged. But mainly the issue is with the channels currently When the files are across libraries how do you know what library it will be merged in to? If you have Movies, 4k, 4k remux, and the same movie in all 3, does the drop down show in all 3 libraries? or does it all get merged into just movies? what if you wanted them to merged all to 4k remux? This is where Im confused maybe, I assume the merge only ever happened on a library with multi folders lol, i never would of assumed it when across libraries. Edited December 5, 2020 by bakes82
Carlo 4560 Posted December 5, 2020 Posted December 5, 2020 (edited) It merges them across all the Movie type libraries. Of course it also works really well with folder based access control as well which is another cool way to use this plugin and not need a separate 4K or 3D Library but just a single Movie library that you can grant access to 3D and 4K material. https://emby.media/support/articles/Folder-based-Access-Control.html I think this is one of the best ways to use this cool plugin. Edited November 6, 2025 by GrimReaper KB article link updated
bakes82 167 Posted December 6, 2020 Posted December 6, 2020 9 hours ago, cayars said: It merges them across all the Movie type libraries. Of course it also works really well with folder based access control as well which is another cool way to use this plugin and not need a separate 4K or 3D Library but just a single Movie library that you can grant access to 3D and 4K material. https://support.emby.media/a/solutions/articles/44001160108 I think this is one of the best ways to use this cool plugin. Not sure what youre trying to say lol. If thats the state then it doesnt work correctly when you have the same exact path in another location. This would be an ideal plugin in Emby had the built in auto grouping of items like it does with TV Shows but it doesnt. Im just asking for the code so I could not reinvent the wheel and/or issue a PR with a config screen to have the option to do what I wish or maybe @MikePlanet will implement it since it wont work with Channels or duplicating file paths. Im not saying having everything in one library is good or bad, its a preference and one I would like to be able to support. Should we not take the great plugin that already exists and make it that much better to fit more use cases?
Carlo 4560 Posted December 6, 2020 Posted December 6, 2020 "same path in another location" Don't do that! Make sure your media shows up in one and only one library. or sometimes strange things can happen. I don't think he wants to provide the code or he would have by now. Why he hasn't posted code is HIS business/interest and not for us to question. The plugin works great for it's intended purpose. You may have a slightly different use for it than what the plugin is trying to do. I am curious however what you issue is with some channels links that cause you issues. Can you elaborate or send me a PM on this?
bakes82 167 Posted December 6, 2020 Posted December 6, 2020 (edited) 9 hours ago, cayars said: "same path in another location" Don't do that! Make sure your media shows up in one and only one library. or sometimes strange things can happen. I don't think he wants to provide the code or he would have by now. Why he hasn't posted code is HIS business/interest and not for us to question. The plugin works great for it's intended purpose. You may have a slightly different use for it than what the plugin is trying to do. I am curious however what you issue is with some channels links that cause you issues. Can you elaborate or send me a PM on this? It duplicates the movies, Ive said it already. In MY channels plugin Im making I have a Trakt List, it finds all the moves on that trakt list and makes a channel with the movies in the library. So now when the auto merge process runs you will see said movie duplicated because it appears in the movie library and now also the IMDB Top 100 Movies channel. See my note above, install the New Release Plugin, should give you the same issue. Edited December 6, 2020 by bakes82
Carlo 4560 Posted December 6, 2020 Posted December 6, 2020 I'm not sure I know exactly how your plugin works but by any chance are you marking your channel items with a Type of 8 which are movies? If so that is likely your problem.
bakes82 167 Posted December 6, 2020 Posted December 6, 2020 (edited) 3 hours ago, cayars said: I'm not sure I know exactly how your plugin works but by any chance are you marking your channel items with a Type of 8 which are movies? If so that is likely your problem. Well if you want it to be a link to a movie in your library already wouldnt you use a movie lol. This is from chefs code var items = sortedList.Select(id => LibraryManager.GetItemById(id)) .Select(movie => new ChannelItemInfo { Name = movie.Name, ImageUrl = movie.PrimaryImagePath, Id = movie.Id.ToString(), Type = ChannelItemType.Media, ContentType = ChannelMediaContentType.Movie, MediaType = ChannelMediaType.Video, IsLiveStream = false, MediaSources = new List<MediaSourceInfo> {new ChannelMediaInfo {Path = movie.Path, Protocol = MediaProtocol.File}.ToMediaSource()}, OriginalTitle = movie.OriginalTitle }); The only options are: public enum ChannelMediaContentType { Clip, Podcast, Trailer, Movie, Episode, Song, MovieExtra, TvExtra, GameExtra, } Edited December 6, 2020 by bakes82
Carlo 4560 Posted December 6, 2020 Posted December 6, 2020 I really don't know how it works so maybe just ignore me. But I was thinking there shouldn't be a difference between a playlist created by that plugin vs one manually created on the server. If you don't get the movie dupe problem with normal playlists then you shouldn't get them with the trakt playlist unless it's doing something incorrectly. I would compare the two playlists (system vs trakt). 1
bakes82 167 Posted December 6, 2020 Posted December 6, 2020 5 minutes ago, cayars said: I really don't know how it works so maybe just ignore me. But I was thinking there shouldn't be a difference between a playlist created by that plugin vs one manually created on the server. If you don't get the movie dupe problem with normal playlists then you shouldn't get them with the trakt playlist unless it's doing something incorrectly. I would compare the two playlists (system vs trakt). Ill just ignore you lol. Im not making a playlist. Im make a custom channel with the plugin SDK. Im taking a trak list then making a channel in emby not a playlist. Its searches the imdbs of the items on the play list in trakt with whats in emby and makes the channel with references to the movie, just like a playlist, but not a playlist, cus those look ugly af. Channels look/operate like a normal library, but they CAN reference other things like non emby stuff, some of the the other ones like the blueray release channel is just a info screen, but no reason it could show you what movies you have in your collection so you could open the chennel see you have it, play w.out having to go back to find it.
Carlo 4560 Posted December 6, 2020 Posted December 6, 2020 Your using the wrong type then for your entries. If it's not a movie then you shouldn't be using type 8. The movies already exists so you can use that ID instead of adding a new movie record.
Carlo 4560 Posted December 6, 2020 Posted December 6, 2020 PS I agree with your comment about playlists.
bakes82 167 Posted December 6, 2020 Posted December 6, 2020 1 minute ago, cayars said: Your using the wrong type then for your entries. If it's not a movie then you shouldn't be using type 8. The movies already exists so you can use that ID instead of adding a new movie record. Please point me to developer documentation This is correct as far as I know the code is from @chef. I think you just dont know how channels works as you cant do it from the UI. I'm also already using the movie ID as the ID for the channel item I found this looking for his forum post about his channel, maybe he doesnt have one lol, but anyways doesnt matter seems like channels will create a new db item. One option would be to get a list of all the "Channels" and ignore those movies with those parent ids from channels when "merging". But it doesnt fix the issue with being allowed to have the same root folder in multiple libraries they Luke said is something that is supported. var channels = libraryManager.GetItemList(new InternalItemsQuery { Recursive = true, IncludeItemTypes = new[] {"Channel"} }).Where(x => !string.IsNullOrEmpty(x.Name)).ToList();
chef 3810 Posted December 7, 2020 Posted December 7, 2020 this was the issue I came across. I couldn't figure out how to point to an item in the database in my channel, I had to create the item in my channel, which would create a new entry and a duplicate item.
Carlo 4560 Posted December 7, 2020 Posted December 7, 2020 Yea, you shouldn't have to do that as it causes dupes in the DB. I get the fact there might not have been an alternative however. @chef By any chance did you try a type other than 8 for the new records? I'm sure you never gave it a thought since other than this plugin what you did would work well. I can't really comment other than working with the DB as I haven't done any Emby plugin dev (yet) but this would be the root of this problem. The automatic group plugin is doing things correctly grouping them if they are marked as movies (type=8). Possible "hack" that could work between the two plugins. You could try doing a DB update for the channels that are type 9 and mark them virtual and see if the channel still works. If so grouping could eliminate the virtual entries from grouping.
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now