pünktchen 1350 Posted April 18, 2021 Posted April 18, 2021 (edited) @Luke the beta server has a method "UnhideSeriesFromResume" in "IUserDataManager" that allows to rearm a previously hidden tv show for Nextup/Continue Watching. Why is there no simple "HideSeriesFromResume"? Instead i first have to query the whole library and filter it down to IsNextUpQuery, IsPlayed, IsInProgress and what ever (i don't even know what's needed here, because i do not always get the same result the web app does) to get the video that will show up under Continue Watching and then set it to "HideFromResume". Edited April 18, 2021 by pünktchen
Luke 40082 Posted April 18, 2021 Posted April 18, 2021 Actually call it directly on the episode. That's how the UI works. episode.UpdateHideFromResume(xxx)
pünktchen 1350 Posted April 18, 2021 Author Posted April 18, 2021 1 hour ago, Luke said: Actually call it directly on the episode. That's how the UI works. episode.UpdateHideFromResume(xxx) And that is the real problem. I don't know how to get that episode that will show up in continue watching. The library query returns all episodes of a tv show that are candidates for continue watching, not only the one that can be seen in the app. A method at the series level would simplify this a lot.
pünktchen 1350 Posted April 19, 2021 Author Posted April 19, 2021 Any tip how to get the next up episode? The behaviour of the web app doesn't make any sense to me. An example for the same tv show below: S1E1, S1E2, S1E3, S1E4 -> watched S1E5 -> unwatched S1E6 -> watched S1E7 -> unwatched S2E1 -> unwatched S2E2 -> watched Result in Continue Watching: S1E5 S1E1, S1E2, S1E3, S1E4 -> watched S1E5 -> unwatched S1E6 -> watched S1E7 -> unwatched S2E1 -> watched S2E2 -> watched Result in Continue Watching: S2E3
BillOatman 575 Posted April 19, 2021 Posted April 19, 2021 (edited) 12 hours ago, pünktchen said: Any tip how to get the next up episode? The behaviour of the web app doesn't make any sense to me. An example for the same tv show below: S1E1, S1E2, S1E3, S1E4 -> watched S1E5 -> unwatched S1E6 -> watched S1E7 -> unwatched S2E1 -> unwatched S2E2 -> watched Result in Continue Watching: S1E5 S1E1, S1E2, S1E3, S1E4 -> watched S1E5 -> unwatched S1E6 -> watched S1E7 -> unwatched S2E1 -> watched S2E2 -> watched Result in Continue Watching: S2E3 This makes sense to me. It looks to be selecting the highest season watched. If you have already started season 2 in this case, why would you want "next" to be in season 1. The key for determining highest season seems to be the first episode of the season being watched or not. Edited April 19, 2021 by BillOatman
pünktchen 1350 Posted April 19, 2021 Author Posted April 19, 2021 (edited) 1 hour ago, BillOatman said: If you have already started season 2 in this case, why would you want "next" to be in season 1. Because i've missed an episode there?! There are many shows where the order for watching doesn't matter. So i would prefer always the first unwatched episode. 1 hour ago, BillOatman said: The key for determining highest season seems to be the first episode of the season being watched or not. Maybe that's true. That's what i like to know from @Luke or a simple way where i can hide the series from continue watching and don't have to care about what will be next up. Edited April 19, 2021 by pünktchen
crusher11 977 Posted April 20, 2021 Posted April 20, 2021 It shows the first unwatched episode that comes after the episode that was most recently played. 1
BillOatman 575 Posted April 20, 2021 Posted April 20, 2021 6 hours ago, crusher11 said: It shows the first unwatched episode that comes after the episode that was most recently played. I would not have thought of that, but it is reasonable I think.
Luke 40082 Posted April 21, 2021 Posted April 21, 2021 On 4/18/2021 at 8:38 PM, pünktchen said: Any tip how to get the next up episode? The behaviour of the web app doesn't make any sense to me. An example for the same tv show below: S1E1, S1E2, S1E3, S1E4 -> watched S1E5 -> unwatched S1E6 -> watched S1E7 -> unwatched S2E1 -> unwatched S2E2 -> watched Result in Continue Watching: S1E5 S1E1, S1E2, S1E3, S1E4 -> watched S1E5 -> unwatched S1E6 -> watched S1E7 -> unwatched S2E1 -> watched S2E2 -> watched Result in Continue Watching: S2E3 Do you need to calculate this for yourself? Why not just use our methods?
pünktchen 1350 Posted April 21, 2021 Author Posted April 21, 2021 9 hours ago, Luke said: Do you need to calculate this for yourself? Why not just use our methods? Because you don't tell what these methods are.
Luke 40082 Posted April 21, 2021 Posted April 21, 2021 Do you want to get the continue watching list, or the next up list for a single series?
pünktchen 1350 Posted April 21, 2021 Author Posted April 21, 2021 The very first next up item for a series that the apps will show.
Luke 40082 Posted April 21, 2021 Posted April 21, 2021 Try MediaBrowser.Controller.TV.ITVSeriesManager.GetNextUp(NextUpQuery query, User user, DtoOptions options); Then in the NextUpQuery object pass in the SeriesId and a Limit of 1. This will mimic what you see on the series detail screen, except limited to one episode.
pünktchen 1350 Posted April 22, 2021 Author Posted April 22, 2021 This works, but if i then hide it from Continue Watching, the episode after the hidden one pops up under Continue Watching on the home screen: var nextUpQuery = new NextUpQuery { Limit = 1, SeriesId = item.DisplayParent.DisplayParentId, UserId = user.InternalId }; var nextEpisodeItem = Emby.TVSeriesManager.GetNextUp(nextUpQuery, user, new DtoOptions()).Items.FirstOrDefault(); var userDataNextEpisodeItem = Emby.UserDataManager.GetUserData(user, nextEpisodeItem); userDataNextEpisodeItem.HideFromResume = true; Emby.UserDataManager.SaveUserData(user.InternalId, nextEpisodeItem, userDataNextEpisodeItem, UserDataSaveReason.UpdateHideFromResume, new CancellationToken()); What i'm doing wrong here?
Luke 40082 Posted April 22, 2021 Posted April 22, 2021 You need to do what I mentioned earlier and call the method on the episode rather than setting the property directly.
pünktchen 1350 Posted April 22, 2021 Author Posted April 22, 2021 If you mean: BaseItem.UpdateHideFromResume(User, UserItemData, bool) that alone doesn't work. I still have to update the user data: IUserDataManager.SaveUserData(long, BaseItem, UserItemData, UserDataSaveReason, CancellationToken) Doesn't make sense to me, especially because the PlaybackPositionTicks property can directly be set on the UserItemData but HideFromResume not?!
Luke 40082 Posted April 22, 2021 Posted April 22, 2021 You do have to call the method to save, yes. Why, because the core server updates it as part of other operations and it avoids having to save it twice. Quote Doesn't make sense to me, especially because the PlaybackPositionTicks property can directly be set on the UserItemData but HideFromResume not?! Because unlike PlaybackPositionTicks, whenever the value changes there are other things that need to happen, so that's what the method takes care of.
pünktchen 1350 Posted May 4, 2021 Author Posted May 4, 2021 @Luke Some more questions: Is there a way to know if the returned episode from the NextUpQuery is currently "Hidden" on the homescreen? And when is a series/episode "Unhidden", after playback start or stop?
pünktchen 1350 Posted May 4, 2021 Author Posted May 4, 2021 To answer one of my questions: 9 hours ago, pünktchen said: And when is a series/episode "Unhidden", after playback start or stop? It's already after playback start it seems.
Luke 40082 Posted May 4, 2021 Posted May 4, 2021 13 hours ago, pünktchen said: @Luke Some more questions: Is there a way to know if the returned episode from the NextUpQuery is currently "Hidden" on the homescreen? And when is a series/episode "Unhidden", after playback start or stop? You can check userdata.HideFromResume.
VicMoore 735 Posted May 27 Posted May 27 (edited) In my virtualTVexample code the session manager runs the code below when a Movie or Episode stops running. The code below sets the HideFromResume flag on the playing object when it stops playing. This works great for Movies but works on and off for Episodes (mostly fails). Why does this code not work for Episodes? They are both videos. The API should work for both. Vic void Test_PlaybackStopped(object sender, PlaybackStopEventArgs e) { // // get the UserId and program playing ID // string UserId = e.Session.UserId; long UserInternalId = e.Session.UserInternalId; // // get the user data for the played Item // BaseItem Item = e.Item; UserItemData UserData = userDataManager.GetUserData(UserId, Item); UserData.HideFromResume = true; userDataManager.SaveUserData(UserInternalId, Item, UserData, UserDataSaveReason.UpdateHideFromResume, new CancellationToken()); } Edited May 27 by VicMoore
VicMoore 735 Posted May 27 Posted May 27 @LukeNot at all. VirtualTV does the same thing. Many users want the content they watch via the TV Guide to be removed from the "Resume Viewing" menu. What I want to know is why the API works for Movies but does not work for Episodes. In the forum topic "Hide series from resume in .Net plugin" you recommended the code above to @pünktchento fix this problem. Vic.
VicMoore 735 Posted May 27 Posted May 27 @pünktchen I used the code below to "HideFromResume" content played from the EPG when the content stops playing. It's based on your code suggestions above. This code works perfectly for Movies but does not work for Episodes. As @Lukesuggested I am setting the "HideFromResume" flag in the UserData for the item. Why does this code not work for Episodes? Is it possible that the UserData for Episodes does not have a "HideFromResume" flag? I would appreciate your help. Vic void Test_PlaybackStopped(object sender, PlaybackStopEventArgs e) { this.Logger.Info("======myTv STOP ))))))))))))))))))))))))))))))))))))))))))))"); // // get the UserId and program playing ID // string UserId = e.Session.UserId; long UserInternalId = e.Session.UserInternalId; // // get the user data for the played Item // BaseItem Item = e.Item; UserItemData UserData = userDataManager.GetUserData(UserId, Item); UserData.HideFromResume = true; //UserData.Played = false; userDataManager.SaveUserData(UserInternalId, Item, UserData, UserDataSaveReason.UpdateHideFromResume, new CancellationToken()); }
pünktchen 1350 Posted May 27 Author Posted May 27 It's all explained above. You are trying to hide the episode that was currently playing. But depending on the playback position, that episode is not necessary the one that will show up in continue watching. You have to get the right one with the NextUpQuery.
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