parent
fa9eba300a
commit
930100798a
@ -74,6 +74,8 @@ public class AutoSkip : IServerEntryPoint
|
|||||||
private void UserDataManager_UserDataSaved(object? sender, UserDataSaveEventArgs e)
|
private void UserDataManager_UserDataSaved(object? sender, UserDataSaveEventArgs e)
|
||||||
{
|
{
|
||||||
var itemId = e.Item.Id;
|
var itemId = e.Item.Id;
|
||||||
|
var newState = false;
|
||||||
|
var episodeNumber = e.Item.IndexNumber.GetValueOrDefault(-1);
|
||||||
|
|
||||||
// Ignore all events except playback start & end
|
// Ignore all events except playback start & end
|
||||||
if (e.SaveReason != UserDataSaveReason.PlaybackStart && e.SaveReason != UserDataSaveReason.PlaybackFinished)
|
if (e.SaveReason != UserDataSaveReason.PlaybackStart && e.SaveReason != UserDataSaveReason.PlaybackFinished)
|
||||||
@ -106,13 +108,19 @@ public class AutoSkip : IServerEntryPoint
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// If this is the first episode in the season, and SkipFirstEpisode is false, pretend that we've already sent the seek command for this playback session.
|
||||||
|
if (!Plugin.Instance!.Configuration.SkipFirstEpisode && episodeNumber == 1)
|
||||||
|
{
|
||||||
|
newState = true;
|
||||||
|
}
|
||||||
|
|
||||||
// Reset the seek command state for this device.
|
// Reset the seek command state for this device.
|
||||||
lock (_sentSeekCommandLock)
|
lock (_sentSeekCommandLock)
|
||||||
{
|
{
|
||||||
var device = session.DeviceId;
|
var device = session.DeviceId;
|
||||||
|
|
||||||
_logger.LogDebug("Resetting seek command state for session {Session}", device);
|
_logger.LogDebug("Resetting seek command state for session {Session}", device);
|
||||||
_sentSeekCommand[device] = false;
|
_sentSeekCommand[device] = newState;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -78,4 +78,9 @@ public class PluginConfiguration : BasePluginConfiguration
|
|||||||
/// Gets or sets the seconds after the intro starts to hide the skip prompt at.
|
/// Gets or sets the seconds after the intro starts to hide the skip prompt at.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public int HidePromptAdjustment { get; set; } = 10;
|
public int HidePromptAdjustment { get; set; } = 10;
|
||||||
|
|
||||||
|
/// <summary>
|
||||||
|
/// Gets or sets a value indicating whether the introduction in the first episode of a season should be skipped.
|
||||||
|
/// </summary>
|
||||||
|
public bool SkipFirstEpisode { get; set; } = true;
|
||||||
}
|
}
|
||||||
|
@ -171,6 +171,17 @@
|
|||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
|
<div class="checkboxContainer checkboxContainer-withDescription">
|
||||||
|
<label class="emby-checkbox-label">
|
||||||
|
<input id="SkipFirstEpisode" type="checkbox" is="emby-checkbox" />
|
||||||
|
<span>Automatically skip intros in the first episode of a season</span>
|
||||||
|
</label>
|
||||||
|
|
||||||
|
<div class="fieldDescription">
|
||||||
|
If checked, auto skip will skip introductions in the first episode of a season.<br />
|
||||||
|
</div>
|
||||||
|
</div>
|
||||||
|
|
||||||
<div class="inputContainer">
|
<div class="inputContainer">
|
||||||
<label class="inputLabel inputLabelUnfocused" for="ShowPromptAdjustment">
|
<label class="inputLabel inputLabelUnfocused" for="ShowPromptAdjustment">
|
||||||
Show skip prompt at
|
Show skip prompt at
|
||||||
@ -347,6 +358,13 @@
|
|||||||
"HidePromptAdjustment"
|
"HidePromptAdjustment"
|
||||||
]
|
]
|
||||||
|
|
||||||
|
var booleanConfigurationFields = [
|
||||||
|
"CacheFingerprints",
|
||||||
|
"RegenerateEdl",
|
||||||
|
"AutoSkip",
|
||||||
|
"SkipFirstEpisode"
|
||||||
|
]
|
||||||
|
|
||||||
// visualizer elements
|
// visualizer elements
|
||||||
var canvas = document.querySelector("canvas#troubleshooter");
|
var canvas = document.querySelector("canvas#troubleshooter");
|
||||||
var selectShow = document.querySelector("select#troubleshooterShow");
|
var selectShow = document.querySelector("select#troubleshooterShow");
|
||||||
@ -664,14 +682,14 @@
|
|||||||
.addEventListener('pageshow', function () {
|
.addEventListener('pageshow', function () {
|
||||||
Dashboard.showLoadingMsg();
|
Dashboard.showLoadingMsg();
|
||||||
ApiClient.getPluginConfiguration("c83d86bb-a1e0-4c35-a113-e2101cf4ee6b").then(function (config) {
|
ApiClient.getPluginConfiguration("c83d86bb-a1e0-4c35-a113-e2101cf4ee6b").then(function (config) {
|
||||||
document.querySelector('#AutoSkip').checked = config.AutoSkip;
|
|
||||||
document.querySelector('#RegenerateEdl').checked = config.RegenerateEdlFiles;
|
|
||||||
document.querySelector('#CacheFingerprints').checked = config.CacheFingerprints;
|
|
||||||
|
|
||||||
for (const field of configurationFields) {
|
for (const field of configurationFields) {
|
||||||
document.querySelector("#" + field).value = config[field];
|
document.querySelector("#" + field).value = config[field];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
for (const field of booleanConfigurationFields) {
|
||||||
|
document.querySelector("#" + field).checked = config[field];
|
||||||
|
}
|
||||||
|
|
||||||
Dashboard.hideLoadingMsg();
|
Dashboard.hideLoadingMsg();
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
@ -680,14 +698,14 @@
|
|||||||
.addEventListener('submit', function (e) {
|
.addEventListener('submit', function (e) {
|
||||||
Dashboard.showLoadingMsg();
|
Dashboard.showLoadingMsg();
|
||||||
ApiClient.getPluginConfiguration("c83d86bb-a1e0-4c35-a113-e2101cf4ee6b").then(function (config) {
|
ApiClient.getPluginConfiguration("c83d86bb-a1e0-4c35-a113-e2101cf4ee6b").then(function (config) {
|
||||||
config.AutoSkip = document.querySelector('#AutoSkip').checked;
|
|
||||||
config.RegenerateEdlFiles = document.querySelector('#RegenerateEdl').checked;
|
|
||||||
config.CacheFingerprints = document.querySelector('#CacheFingerprints').checked;
|
|
||||||
|
|
||||||
for (const field of configurationFields) {
|
for (const field of configurationFields) {
|
||||||
config[field] = document.querySelector("#" + field).value;
|
config[field] = document.querySelector("#" + field).value;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
for (const field of booleanConfigurationFields) {
|
||||||
|
config[field] = document.querySelector("#" + field).checked;
|
||||||
|
}
|
||||||
|
|
||||||
ApiClient.updatePluginConfiguration("c83d86bb-a1e0-4c35-a113-e2101cf4ee6b", config)
|
ApiClient.updatePluginConfiguration("c83d86bb-a1e0-4c35-a113-e2101cf4ee6b", config)
|
||||||
.then(function (result) {
|
.then(function (result) {
|
||||||
Dashboard.processPluginConfigurationUpdateResult(result);
|
Dashboard.processPluginConfigurationUpdateResult(result);
|
||||||
|
Loading…
x
Reference in New Issue
Block a user