Merge pull request #49 from RepoDevil/master

The pretty UI update
This commit is contained in:
TwistedUmbrellaX 2024-03-02 13:29:25 -05:00 committed by GitHub
commit 1d3afbb980
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
3 changed files with 144 additions and 119 deletions

View File

@ -9,6 +9,19 @@
<div id="TemplateConfigPage" data-role="page" class="page type-interior pluginConfigurationPage" <div id="TemplateConfigPage" data-role="page" class="page type-interior pluginConfigurationPage"
data-require="emby-input,emby-button,emby-select,emby-checkbox"> data-require="emby-input,emby-button,emby-select,emby-checkbox">
<div data-role="content"> <div data-role="content">
<style>
summary {
cursor: pointer;
padding: 10px;
width: inherit;
margin: auto;
border: none;
text-align: center;
outline: none;
font-size: 1.0em;
outline: 2px solid rgba(155, 155, 155, 0.5);
}
</style>
<div class="content-primary"> <div class="content-primary">
<form id="FingerprintConfigForm"> <form id="FingerprintConfigForm">
<fieldset class="verticalSection-extrabottompadding"> <fieldset class="verticalSection-extrabottompadding">
@ -55,12 +68,15 @@
<div class="fieldDescription"> <div class="fieldDescription">
If checked, episode fingerprints will be cached to the filesystem If checked, episode fingerprints will be cached to the filesystem
<br /> <br />
<strong>WARNING: Disabling cache may result in lengthy detection</strong>
<br />
</div> </div>
</div> </div>
<details id="edl"> <details id="edl">
<summary>EDL file generation</summary> <summary>EDL file generation</summary>
<br />
<div class="selectContainer"> <div class="selectContainer">
<label class="selectLabel" for="EdlAction">EDL Action</label> <label class="selectLabel" for="EdlAction">EDL Action</label>
<select is="emby-select" id="EdlAction" class="emby-select-withcolor emby-select"> <select is="emby-select" id="EdlAction" class="emby-select-withcolor emby-select">
@ -115,6 +131,7 @@
<details id="intro_reqs"> <details id="intro_reqs">
<summary>Modify introduction requirements</summary> <summary>Modify introduction requirements</summary>
<br />
<div class="inputContainer"> <div class="inputContainer">
<label class="inputLabel inputLabelUnfocused" for="AnalysisPercent"> <label class="inputLabel inputLabelUnfocused" for="AnalysisPercent">
Percent of audio to analyze Percent of audio to analyze
@ -179,6 +196,7 @@
<details id="silence"> <details id="silence">
<summary>Silence detection options</summary> <summary>Silence detection options</summary>
<br />
<div class="inputContainer"> <div class="inputContainer">
<label class="inputLabel inputLabelUnfocused" for="SilenceDetectionMaximumNoise"> <label class="inputLabel inputLabelUnfocused" for="SilenceDetectionMaximumNoise">
Noise tolerance Noise tolerance
@ -287,6 +305,7 @@
<details> <details>
<summary>User Interface Customization</summary> <summary>User Interface Customization</summary>
<br />
<div class="inputContainer"> <div class="inputContainer">
<label class="inputLabel" for="SkipButtonIntroText"> <label class="inputLabel" for="SkipButtonIntroText">
Skip intro button text Skip intro button text
@ -325,116 +344,121 @@
</button> </button>
</div> </div>
</form> </form>
<br />
<fieldset class="verticalSection-extrabottompadding">
<legend>Advanced</legend>
<details id="support">
<summary>Support Bundle</summary>
<textarea id="supportBundle" rows="20" cols="75" readonly></textarea>
</details>
<details id="visualizer">
<summary>Fingerprint Editor</summary>
<br />
<h3 style="margin:0">Select episodes to manage</h3>
<br />
<select id="troubleshooterShow"></select>
<select id="troubleshooterSeason"></select>
<br />
<select id="troubleshooterEpisode1"></select>
<select id="troubleshooterEpisode2"></select>
<br />
<br />
<div id="timestampEditor" style="display:none">
<h3 style="margin:0">Introduction timestamp editor</h3>
<p style="margin:0">All times are in seconds.</p>
<p id="editLeftEpisodeTitle" style="margin-bottom:0"></p>
<input style="width:4em" type="number" min="0" id="editLeftEpisodeStart"> to
<input style="width:4em;margin-bottom:10px" type="number" min="0" id="editLeftEpisodeEnd">
<p id="editRightEpisodeTitle" style="margin-top:0;margin-bottom:0"></p>
<input style="width:4em" type="number" min="0" id="editRightEpisodeStart"> to
<input style="width:4em;margin-bottom:10px" type="number" min="0" id="editRightEpisodeEnd">
<br />
<button id="btnUpdateTimestamps" type="button">
Update timestamps
</button>
<br />
<br />
<button id="btnEraseSeasonTimestamps" type="button">
Erase all timestamps for this season
</button>
<hr />
</div>
<button id="btnEraseIntroTimestamps">
Erase all introduction timestamps (globally)
</button>
<br />
<button id="btnEraseCreditTimestamps">
Erase all end credits timestamps (globally)
</button>
<br />
<br />
<h3>Fingerprint Visualizer</h3>
<p>
Interactively compare the audio fingerprints of two episodes. <br />
The blue and red bar to the right of the fingerprint diff turns blue
when the corresponding fingerprint points are at least 80% similar.
</p>
<table>
<thead>
<td style="min-width: 100px; font-weight: bold">Key</td>
<td style="font-weight: bold">Function</td>
</thead>
<tbody>
<tr>
<td>Up arrow</td>
<td>
Shift the left episode up by 0.128 seconds.
Holding control will shift the episode by 10 seconds.
</td>
</tr>
<tr>
<td>Down arrow</td>
<td>
Shift the left episode down by 0.128 seconds.
Holding control will shift the episode by 10 seconds.
</td>
</tr>
<tr>
<td>Right arrow</td>
<td>Advance to the next pair of episodes.</td>
</tr>
<tr>
<td>Left arrow</td>
<td>Go back to the previous pair of episodes.</td>
</tr>
</tbody>
</table>
<br />
<span>Shift amount:</span>
<input type="number" min="-3000" max="3000" value="0" id="offset">
<br />
<span id="suggestedShifts">Suggested shifts:</span>
<br />
<br />
<canvas id="troubleshooter"></canvas>
<span id="timestampContainer">
<span id="timestamps"></span> <br />
<span id="intros"></span>
</span>
</details>
</fieldset>
</div> </div>
<details id="support">
<summary>Support Bundle</summary>
<textarea id="supportBundle" rows="20" cols="75" readonly></textarea>
</details>
<br />
<details id="visualizer">
<summary>Advanced</summary>
<h3 style="margin:0">Select episodes to manage</h3>
<select id="troubleshooterShow"></select>
<select id="troubleshooterSeason"></select>
<br />
<select id="troubleshooterEpisode1"></select>
<select id="troubleshooterEpisode2"></select>
<br />
<br />
<div id="timestampEditor" style="display:none">
<h3 style="margin:0">Introduction timestamp editor</h3>
<p style="margin:0">All times are in seconds.</p>
<p id="editLeftEpisodeTitle" style="margin-bottom:0"></p>
<input style="width:4em" type="number" min="0" id="editLeftEpisodeStart"> to
<input style="width:4em;margin-bottom:10px" type="number" min="0" id="editLeftEpisodeEnd">
<p id="editRightEpisodeTitle" style="margin-top:0;margin-bottom:0"></p>
<input style="width:4em" type="number" min="0" id="editRightEpisodeStart"> to
<input style="width:4em;margin-bottom:10px" type="number" min="0" id="editRightEpisodeEnd">
<br />
<button id="btnUpdateTimestamps" type="button">
Update timestamps
</button>
<br />
<br />
<button id="btnEraseSeasonTimestamps" type="button">
Erase all timestamps for this season
</button>
<hr />
</div>
<button id="btnEraseIntroTimestamps">
Erase all introduction timestamps (globally)
</button>
<br />
<button id="btnEraseCreditTimestamps">
Erase all end credits timestamps (globally)
</button>
<br />
<br />
<h3>Fingerprint Visualizer</h3>
<p>
Interactively compare the audio fingerprints of two episodes. <br />
The blue and red bar to the right of the fingerprint diff turns blue
when the corresponding fingerprint points are at least 80% similar.
</p>
<table>
<thead>
<td style="min-width: 100px; font-weight: bold">Key</td>
<td style="font-weight: bold">Function</td>
</thead>
<tbody>
<tr>
<td>Up arrow</td>
<td>
Shift the left episode up by 0.128 seconds.
Holding control will shift the episode by 10 seconds.
</td>
</tr>
<tr>
<td>Down arrow</td>
<td>
Shift the left episode down by 0.128 seconds.
Holding control will shift the episode by 10 seconds.
</td>
</tr>
<tr>
<td>Right arrow</td>
<td>Advance to the next pair of episodes.</td>
</tr>
<tr>
<td>Left arrow</td>
<td>Go back to the previous pair of episodes.</td>
</tr>
</tbody>
</table>
<br />
<span>Shift amount:</span>
<input type="number" min="-3000" max="3000" value="0" id="offset">
<br />
<span id="suggestedShifts">Suggested shifts:</span>
<br />
<br />
<canvas id="troubleshooter"></canvas>
<span id="timestampContainer">
<span id="timestamps"></span> <br />
<span id="intros"></span>
</span>
</details>
<br />
</div> </div>
<script src="configurationpage?name=visualizer.js"></script> <script src="configurationpage?name=visualizer.js"></script>

View File

@ -85,7 +85,7 @@ public class Plugin : BasePlugin<PluginConfiguration>, IHasWebPages
var indexPath = Path.Join(applicationPaths.WebPath, "index.html"); var indexPath = Path.Join(applicationPaths.WebPath, "index.html");
try try
{ {
InjectSkipButton(indexPath, Path.Join(introsDirectory, "index-pre-skip-button.html")); InjectSkipButton(indexPath);
} }
catch (Exception ex) catch (Exception ex)
{ {
@ -328,14 +328,11 @@ public class Plugin : BasePlugin<PluginConfiguration>, IHasWebPages
/// Inject the skip button script into the web interface. /// Inject the skip button script into the web interface.
/// </summary> /// </summary>
/// <param name="indexPath">Full path to index.html.</param> /// <param name="indexPath">Full path to index.html.</param>
/// <param name="backupPath">Full path to create a backup of index.html at.</param> private void InjectSkipButton(string indexPath)
private void InjectSkipButton(string indexPath, string backupPath)
{ {
// Parts of this code are based off of JellyScrub's script injection code. // Parts of this code are based off of JellyScrub's script injection code.
// https://github.com/nicknsy/jellyscrub/blob/4ce806f602988a662cfe3cdbaac35ee8046b7ec4/Nick.Plugin.Jellyscrub/JellyscrubPlugin.cs // https://github.com/nicknsy/jellyscrub/blob/4ce806f602988a662cfe3cdbaac35ee8046b7ec4/Nick.Plugin.Jellyscrub/JellyscrubPlugin.cs
_logger.LogInformation("Adding skip button to {Path}", indexPath);
_logger.LogDebug("Reading index.html from {Path}", indexPath); _logger.LogDebug("Reading index.html from {Path}", indexPath);
var contents = File.ReadAllText(indexPath); var contents = File.ReadAllText(indexPath);
_logger.LogDebug("Successfully read index.html"); _logger.LogDebug("Successfully read index.html");
@ -349,10 +346,6 @@ public class Plugin : BasePlugin<PluginConfiguration>, IHasWebPages
return; return;
} }
// Backup the original version of the web interface
_logger.LogInformation("Backing up index.html to {Backup}", backupPath);
File.WriteAllText(backupPath, contents);
// Inject a link to the script at the end of the <head> section. // Inject a link to the script at the end of the <head> section.
// A regex is used here to ensure the replacement is only done once. // A regex is used here to ensure the replacement is only done once.
_logger.LogDebug("Injecting script tag"); _logger.LogDebug("Injecting script tag");
@ -363,6 +356,6 @@ public class Plugin : BasePlugin<PluginConfiguration>, IHasWebPages
_logger.LogDebug("Saving modified file"); _logger.LogDebug("Saving modified file");
File.WriteAllText(indexPath, contents); File.WriteAllText(indexPath, contents);
_logger.LogInformation("Skip intro button successfully added to web interface"); _logger.LogInformation("Skip intro button successfully added");
} }
} }

View File

@ -8,6 +8,14 @@
"category": "General", "category": "General",
"imageUrl": "https://raw.githubusercontent.com/jumoog/intro-skipper/master/images/logo.png", "imageUrl": "https://raw.githubusercontent.com/jumoog/intro-skipper/master/images/logo.png",
"versions": [ "versions": [
{
"version": "0.1.12.0",
"changelog": "- See the full changelog at [GitHub](https://github.com/jumoog/intro-skipper/blob/master/CHANGELOG.md)\n",
"targetAbi": "10.8.4.0",
"sourceUrl": "https://github.com/jumoog/intro-skipper/releases/download/v0.1.12/intro-skipper-v0.1.12.zip",
"checksum": "5851f2d7036bcd56817f66983a8e1190",
"timestamp": "2024-03-02T13:21:04Z"
},
{ {
"version": "0.1.11.0", "version": "0.1.11.0",
"changelog": "- See the full changelog at [GitHub](https://github.com/jumoog/intro-skipper/blob/master/CHANGELOG.md)\n", "changelog": "- See the full changelog at [GitHub](https://github.com/jumoog/intro-skipper/blob/master/CHANGELOG.md)\n",