Jump to content

Hide series from resume in .Net plugin


Recommended Posts

pünktchen

@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 by pünktchen
Link to post
Share on other sites
Luke

Actually call it directly on the episode. That's how the UI works. episode.UpdateHideFromResume(xxx)

Link to post
Share on other sites
pünktchen
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.

Link to post
Share on other sites
pünktchen

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

Link to post
Share on other sites
BillOatman
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 by BillOatman
Link to post
Share on other sites
pünktchen
Posted (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 by pünktchen
Link to post
Share on other sites
crusher11

It shows the first unwatched episode that comes after the episode that was most recently played.

 

  • Thanks 1
Link to post
Share on other sites
BillOatman
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.

Link to post
Share on other sites
Luke
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?

Link to post
Share on other sites
pünktchen
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.

Link to post
Share on other sites
Luke

Do you want to get the continue watching list, or the next up list for a single series?

Link to post
Share on other sites
pünktchen

The very first next up item for a series that the apps will show.

Link to post
Share on other sites
Luke

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.

Link to post
Share on other sites
pünktchen

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?

Link to post
Share on other sites
Luke

You need to do what I mentioned earlier and call the method on the episode rather than setting the property directly.

Link to post
Share on other sites
pünktchen

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?!

Link to post
Share on other sites
Luke

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.

Link to post
Share on other sites
  • 2 weeks later...
pünktchen

@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?

Link to post
Share on other sites
pünktchen

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.

Link to post
Share on other sites
Luke
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.

Link to post
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...