-
-
Notifications
You must be signed in to change notification settings - Fork 1.4k
Implement playback inactivity timeout #6686
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Conversation
Stub out `playTimeout` plugin
- Updated `saveUser()` to persist both `stillWatchingTimeout` and `askAfterNumEpisodes`, regardless of mode, preserving values across toggles. - Added new helper `displayStillWatchingMode(context, userSettings)` to `loadForm()` to correctly display the relevant input (time or episode) based on saved mode.
Refactor still watching mode: save both values, display only active mode
Still watching plugin impl
Cloudflare Pages deployment
|
This pull request has merge conflicts. Please resolve the conflicts so the PR can be successfully reviewed and merged. |
|
I think you should squash your commit as it contains an unrelated commit history.
Translations except for en-US are provided by weblate. Also something happened with the updated en-US json which now contains unrelated format changes which makes the whole commit look huge (+4,537 −3,899 ). |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's also a good idea to make changes in a separate branch rather than using master
.
if (stillWatchingEnabled) { | ||
optionsContainer.classList.remove('hide'); | ||
} else { | ||
optionsContainer.classList.add('hide'); | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
if (stillWatchingEnabled) { | |
optionsContainer.classList.remove('hide'); | |
} else { | |
optionsContainer.classList.add('hide'); | |
} | |
optionsContainer.classList.toggle('hide', !stillWatchingEnabled); |
loading.hide(); | ||
initStillWatchingControls(context); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Let's hide the loading indicator at the end.
loading.hide(); | |
initStillWatchingControls(context); | |
initStillWatchingControls(context); | |
loading.hide(); |
@@ -347,9 +388,13 @@ function onSubmit(e) { | |||
|
|||
function embed(options, self) { | |||
options.element.innerHTML = globalize.translateHtml(template, 'core'); | |||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please revert unnecessary changes (blank line removal).
@@ -361,6 +406,35 @@ function embed(options, self) { | |||
} | |||
} | |||
|
|||
function displayStillWatchingMode(context, userSettings) { | |||
// Determine saved mode | |||
const isTimeMode = userSettings.timeBasedStillWatching?.() === true; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why do you need optional chain for userSettings.timeBasedStillWatching
?
// Determine saved mode | ||
const isTimeMode = userSettings.timeBasedStillWatching?.() === true; | ||
const mode = isTimeMode ? 'time' : 'episodes'; | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It would be better to make time
and episodes
consts.
timeInput.value = userSettings.stillWatchingTimeout() || 300; | ||
} else { | ||
episodeInput.value = userSettings.askAfterNumEpisodes() || 5; | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You already have default values.
return parseInt(this.get('stillWatchingTimeout') || '60', 10); |
return parseInt(this.get('askAfterNumEpisodes') || '0', 10); |
Normally we put the default value in the setting getter.
@@ -1,11 +1,13 @@ | |||
<form style="margin: 0 auto;"> | |||
<form style="margin: 0 auto"> |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please revert unnecessary changes.
* @returns {number} Returns the time in milliseconds after which a timeout should occur | ||
*/ | ||
private getTimeoutTime(): number { | ||
return userSettings.stillWatchingTimeout(undefined) * 6 * (10 ** 4); // convert from minutes to milliseconds |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why not just 60_000
?
Also, there is a const, but it's too long.
jellyfin-web/src/constants/time.ts
Line 2 in 48f9111
export const MILLISECONDS_PER_SECOND = 1_000; |
Implements an "Are you still there?" popup after user-defined criterion are met.
User may change the behaviour in playback settings. Users can set the prompt to appear after a set number of episodes with no ineraction (e.g. mouse movement), or after a set amount of time with no interaction.
Changes
playTimeout
pluginplaybackSettings.js
,playbackSettings.template.html
, anduserSettings.js
playmanager.js
Issues
Work based off of conversations on feature request 814
Planned work discussed on GitHub discussions