Compare commits
28 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
7cb03410ee | ||
|
|
17c8681e93 | ||
|
|
3a4c663c0e | ||
|
|
3385196611 | ||
|
|
2538556f7c | ||
|
|
550ebed942 | ||
|
|
21d55711d4 | ||
|
|
81a0d375be | ||
|
|
23cbc0a85a | ||
|
|
2de066cca8 | ||
|
|
138e50ff15 | ||
|
|
bf72dc08a3 | ||
|
|
65a63b4aa0 | ||
|
|
a1df756c56 | ||
|
|
f2d383ec61 | ||
|
|
b85f52d8d3 | ||
|
|
ad18acb011 | ||
|
|
2ae147ac01 | ||
|
|
9896044988 | ||
|
|
93e91e2e60 | ||
|
|
b613b028d0 | ||
|
|
9906784845 | ||
|
|
009a3c4720 | ||
|
|
595056230a | ||
|
|
b18060dfd7 | ||
|
|
ebb2af9d24 | ||
|
|
743af20b8e | ||
|
|
9844b186d7 |
@@ -34,8 +34,10 @@ namespace Jellyfin.Plugin.MediaBarEnhanced.Configuration
|
||||
public bool EnableCustomMediaIds { get; set; } = true;
|
||||
public string PreferredVideoQuality { get; set; } = "Auto";
|
||||
public bool EnableSeasonalContent { get; set; } = false;
|
||||
public string SeasonalSections { get; set; } = "[]";
|
||||
public bool IsEnabled { get; set; } = true;
|
||||
public bool EnableClientSideSettings { get; set; } = false;
|
||||
public bool ApplyLimitsToCustomIds { get; set; } = false;
|
||||
public string SortBy { get; set; } = "Random";
|
||||
public string SortOrder { get; set; } = "Ascending";
|
||||
}
|
||||
|
||||
@@ -94,6 +94,7 @@
|
||||
|
||||
<!-- CUSTOM CONTENT TAB -->
|
||||
<div id="custom" class="tab-content" style="display:none;">
|
||||
<!-- Default Custom Media IDs -->
|
||||
<h2 class="sectionTitle">Custom Media IDs</h2>
|
||||
<div class="checkboxContainer checkboxContainer-withDescription">
|
||||
<label>
|
||||
@@ -101,61 +102,74 @@
|
||||
name="EnableCustomMediaIds" />
|
||||
<span>Enable Custom Media IDs</span>
|
||||
</label>
|
||||
<div class="fieldDescription">If enabled, the slideshow will try to show the items listed
|
||||
below. If the list is empty, default behavior (random items) is used. Disable this
|
||||
to temporarily ignore your custom list without deleting it.</div>
|
||||
<div class="fieldDescription">If enabled, the slideshow will show the items listed
|
||||
below as the default content. If the list is empty, random items from your library are used.</div>
|
||||
</div>
|
||||
<div class="checkboxContainer checkboxContainer-withDescription">
|
||||
<label>
|
||||
<input is="emby-checkbox" type="checkbox" id="ApplyLimitsToCustomIds"
|
||||
name="ApplyLimitsToCustomIds" />
|
||||
<span>Apply Limits to Custom IDs</span>
|
||||
</label>
|
||||
<div class="fieldDescription">If enabled, the Max Items limit (Advanced → Content Limits) will also apply to Custom Media IDs and Collections. By default, custom lists are not limited.</div>
|
||||
</div>
|
||||
<div id="customMediaIdsContainer">
|
||||
<div class="inputContainer">
|
||||
<label class="inputLabel inputLabelUnfocused" for="CustomMediaIds">Default Media/Collection/Playlist
|
||||
IDs
|
||||
(Newline or Comma separated)</label>
|
||||
<textarea class="emby-textarea" is="emby-textarea" id="CustomMediaIds" name="CustomMediaIds"
|
||||
style="width: 100%; height: 150px; font-family: monospace;"></textarea>
|
||||
<div class="fieldDescription">Enter the IDs of the items you want to show in the slideshow as
|
||||
your default content.
|
||||
You can separate them by new line or comma.
|
||||
<br><br>
|
||||
<b>Manual Trailer/Video Override:</b> You can specify a YouTube URL <b>OR</b> a Jellyfin Item ID (e.g. for a Theme Video) for an item by adding it in
|
||||
brackets: <br> <code>e.g. ID DESCRIPTION [https://youtu.be/...]</code> or <code>ID [JellyfinItemId] DESCRIPTION</code>.
|
||||
<br>
|
||||
Methods:
|
||||
<ul>
|
||||
<li><b>YouTube URL:</b> Play a remote trailer from YouTube.</li>
|
||||
<li><b>Jellyfin Item ID (GUID):</b> Play the video of another library item (e.g. a Theme Video or Backdrop Video) using the native player.</li>
|
||||
</ul>
|
||||
You can also add a description after the ID using any separator like space, pipe
|
||||
(|) or dash (-): <br>e.g. <code>ID DESCRIPTION</code> or <code>ID | DESCRIPTION</code>
|
||||
<br><br>
|
||||
<b>Note:</b> If using a <b>Collection Name</b> (instead of an ID) combined with a description, you <b>MUST</b> use
|
||||
the pipe (|) separator.
|
||||
<br>
|
||||
<b>Note:</b> The separator <b>MUST NOT</b> be a hex character (0-9, a-f).
|
||||
</div>
|
||||
<p>You can find the IDs of your items in the URL of the item page in the web interface.<br>
|
||||
Example:
|
||||
<code>https://your-jellyfin-url/web/#/details?id=<b style="color:red;">your-item-id</b>&serverId=your-server-id</code><br><br>
|
||||
You can also insert a name of a collection or playlist to fetch the IDs of all items in
|
||||
it (will take the first hit.<br><b>Note:</b> there is currently no feedback if the name
|
||||
resolution succeeded, you will have to look if the bar displays the correct items).
|
||||
</p>
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<!-- Seasonal Content -->
|
||||
<h2 class="sectionTitle" style="margin-top: 2em;">Seasonal Content</h2>
|
||||
<div class="checkboxContainer checkboxContainer-withDescription">
|
||||
<label>
|
||||
<input is="emby-checkbox" type="checkbox" id="EnableSeasonalContent"
|
||||
name="EnableSeasonalContent" />
|
||||
<span>Enable Seasonal Content Mode</span>
|
||||
<span>Enable Seasonal Content</span>
|
||||
</label>
|
||||
<div class="fieldDescription">Enable this to define time-based lists in the field below.
|
||||
</div>
|
||||
<div class="fieldDescription">When enabled, seasonal sections below will override the default list
|
||||
during their active date ranges. If no season matches the current date, the default Custom Media IDs above are used as fallback.</div>
|
||||
</div>
|
||||
<div class="inputContainer">
|
||||
<label class="inputLabel inputLabelUnfocused" for="CustomMediaIds">Media/Collection/Playlist
|
||||
IDs
|
||||
(Newline or Comma separated)</label>
|
||||
<textarea is="emby-textarea" id="CustomMediaIds" name="CustomMediaIds"
|
||||
style="width: 100%; height: 150px; font-family: monospace;"></textarea>
|
||||
<div class="fieldDescription" id="customMediaIdsDesc">Enter the IDs of the items you want to show in the slideshow.
|
||||
You can separate them by new line or comma.
|
||||
<br><br>
|
||||
<b>Manual Trailer/Video Override:</b> You can specify a YouTube URL <b>OR</b> a Jellyfin Item ID (e.g. for a Theme Video) for an item by adding it in
|
||||
brackets: <br> <code>e.g. ID DESCRIPTION [https://youtu.be/...]</code> or <code>ID [Method] DESCRIPTION</code>.
|
||||
<br>
|
||||
Methods:
|
||||
<ul>
|
||||
<li><b>YouTube URL:</b> Play a remote trailer from YouTube.</li>
|
||||
<li><b>Jellyfin Item ID (GUID):</b> Play the video of another library item (e.g. a Theme Video or Backdrop Video) using the native player.</li>
|
||||
</ul>
|
||||
<br>
|
||||
You can also add a description after the ID using any separator like space, pipe
|
||||
(|) or dash (-): <br>e.g. <code>ID DESCRIPTION</code> or <code>ID | DESCRIPTION</code>
|
||||
<br><br>
|
||||
<b>Note:</b> If using a <b>Collection Name</b> (instead of an ID) combined with a description, you <b>MUST</b> use
|
||||
the pipe (|) separator.
|
||||
<br>
|
||||
<b>Note:</b> The separator <b>MUST NOT</b> be a hex character (0-9, a-f).</div>
|
||||
<div class="fieldDescription" id="seasonalMediaIdsDesc" style="display: none;">
|
||||
<b>Seasonal Mode Enabled:</b> Define lines with date ranges (Format: DD.MM-DD.MM |
|
||||
<i>name</i> | <i>IDs</i>).<br>
|
||||
Example:<br>
|
||||
<code>20.10-31.10 | Halloween | ID1, ID2 [https://youtu.be/...]</code><br>
|
||||
<code>01.12-26.12 | Christmas | ID3, ID4</code><br>
|
||||
<i>Only lines matching the current date will be used. If no line matches, it will try to
|
||||
fetch the list.txt or use random items.</i>
|
||||
</div>
|
||||
<p>You can find the IDs of your items in the URL of the item page in the web interface.<br>
|
||||
Example:
|
||||
<code>https://your-jellyfin-url/web/#/details?id=<b style="color:red;">your-item-id</b>&serverId=your-server-id</code><br><br>
|
||||
You can also insert a name of a collection or playlist to fetch the IDs of all items in
|
||||
it (will take the first hit.<br><b>Note:</b> there is currently no feedback if the name
|
||||
resolution succeeded, you will have to look if the bar displays the correct items.).
|
||||
</p>
|
||||
<div id="seasonalContentContainer" style="display: none;">
|
||||
<div id="seasonalSectionsList"></div>
|
||||
<button is="emby-button" type="button" id="addSeasonBtn" class="raised emby-button"
|
||||
style="margin-top: 1em; display: inline-flex; align-items: center; gap: 0.4em;">
|
||||
<i class="material-icons" style="font-size: 24px;">add</i>
|
||||
<span>Add Season</span>
|
||||
</button>
|
||||
</div>
|
||||
<input type="hidden" id="SeasonalSections" name="SeasonalSections" value="[]" />
|
||||
</div>
|
||||
|
||||
<!-- ADVANCED TAB -->
|
||||
@@ -188,7 +202,7 @@
|
||||
</div>
|
||||
<div class="selectContainer">
|
||||
<label class="selectLabel" for="PreferredVideoQuality">Preferred YouTube Quality</label>
|
||||
<select is="emby-select" id="PreferredVideoQuality" name="PreferredVideoQuality" class="selectLayout emby-select-withcolor emby-select">
|
||||
<select is="emby-select" id="PreferredVideoQuality" name="PreferredVideoQuality" class="selectLayout emby-select-withcolor emby-select" style="width: 100%; -webkit-appearance: menulist; appearance: menulist;">
|
||||
<option value="Auto">Auto (Smart)</option>
|
||||
<option value="Maximum">Maximum (4K+)</option>
|
||||
<option value="1080p">1080p</option>
|
||||
@@ -290,7 +304,7 @@
|
||||
<h2 class="sectionTitle">Content Sorting</h2>
|
||||
<div class="selectContainer">
|
||||
<label class="selectLabel" for="SortBy">Sort By</label>
|
||||
<select is="emby-select" id="SortBy" name="SortBy" class="selectLayout emby-select-withcolor emby-select">
|
||||
<select is="emby-select" id="SortBy" name="SortBy" class="selectLayout emby-select-withcolor emby-select" style="width: 100%; -webkit-appearance: menulist; appearance: menulist;">
|
||||
<option value="Random">Random</option>
|
||||
<option value="Original">Original (Custom List Order)</option>
|
||||
<option value="PremiereDate">Premiere Date</option>
|
||||
@@ -304,7 +318,7 @@
|
||||
</div>
|
||||
<div class="selectContainer">
|
||||
<label class="selectLabel" for="SortOrder">Sort Order</label>
|
||||
<select is="emby-select" id="SortOrder" name="SortOrder" class="selectLayout emby-select-withcolor emby-select">
|
||||
<select is="emby-select" id="SortOrder" name="SortOrder" class="selectLayout emby-select-withcolor emby-select" style="width: 100%; -webkit-appearance: menulist; appearance: menulist;">
|
||||
<option value="Ascending">Ascending</option>
|
||||
<option value="Descending">Descending</option>
|
||||
</select>
|
||||
@@ -411,7 +425,7 @@
|
||||
'ShowTrailerButton', 'AlwaysShowArrows', 'EnableKeyboardControls',
|
||||
'EnableCustomMediaIds', 'CustomMediaIds', 'EnableLoadingScreen',
|
||||
'EnableSeasonalContent', 'EnableClientSideSettings', 'SortBy', 'SortOrder',
|
||||
'PreferLocalTrailers'
|
||||
'PreferLocalTrailers', 'ApplyLimitsToCustomIds', 'SeasonalSections'
|
||||
];
|
||||
|
||||
keys.forEach(function (key) {
|
||||
@@ -425,24 +439,38 @@
|
||||
}
|
||||
});
|
||||
|
||||
// Handle Seasonal UI logic
|
||||
var seasonalCheckbox = page.querySelector('#EnableSeasonalContent');
|
||||
var normalDesc = page.querySelector('#customMediaIdsDesc');
|
||||
var seasonalDesc = page.querySelector('#seasonalMediaIdsDesc');
|
||||
// Render Seasonal Sections
|
||||
try {
|
||||
var sections = JSON.parse(config.SeasonalSections || "[]");
|
||||
MediaBarEnhancedConfigurationPage.renderSeasonalSections(page, sections);
|
||||
} catch (e) {
|
||||
console.error("Error parsing SeasonalSections", e);
|
||||
}
|
||||
|
||||
function updateDesc() {
|
||||
if (seasonalCheckbox && seasonalCheckbox.checked) {
|
||||
if (normalDesc) normalDesc.style.display = 'none';
|
||||
if (seasonalDesc) seasonalDesc.style.display = 'block';
|
||||
} else {
|
||||
if (normalDesc) normalDesc.style.display = 'block';
|
||||
if (seasonalDesc) seasonalDesc.style.display = 'none';
|
||||
// Handle Seasonal UI visibility
|
||||
var seasonalCheckbox = page.querySelector('#EnableSeasonalContent');
|
||||
var seasonalContainer = page.querySelector('#seasonalContentContainer');
|
||||
|
||||
function updateSeasonalVisibility() {
|
||||
if (seasonalContainer) {
|
||||
seasonalContainer.style.display = seasonalCheckbox && seasonalCheckbox.checked ? 'block' : 'none';
|
||||
}
|
||||
}
|
||||
|
||||
if (seasonalCheckbox) {
|
||||
seasonalCheckbox.addEventListener('change', updateDesc);
|
||||
updateDesc();
|
||||
seasonalCheckbox.addEventListener('change', updateSeasonalVisibility);
|
||||
updateSeasonalVisibility();
|
||||
}
|
||||
|
||||
// Add Season Button
|
||||
var addSeasonBtn = page.querySelector('#addSeasonBtn');
|
||||
if (addSeasonBtn) {
|
||||
// Remove existing listeners to avoid duplicates if re-attached
|
||||
var newBtn = addSeasonBtn.cloneNode(true);
|
||||
addSeasonBtn.parentNode.replaceChild(newBtn, addSeasonBtn);
|
||||
newBtn.addEventListener('click', function() {
|
||||
MediaBarEnhancedConfigurationPage.addSeasonalSection(page);
|
||||
});
|
||||
}
|
||||
|
||||
// Handle Prefer Local Trailers visibility
|
||||
@@ -468,6 +496,11 @@
|
||||
saveConfiguration: function (page) {
|
||||
Dashboard.showLoadingMsg();
|
||||
|
||||
var sections = MediaBarEnhancedConfigurationPage.getSeasonalSectionsFromUI(page);
|
||||
var sectionsJson = JSON.stringify(sections);
|
||||
var seasonalInput = page.querySelector('#SeasonalSections');
|
||||
if (seasonalInput) seasonalInput.value = sectionsJson;
|
||||
|
||||
var config = {};
|
||||
var keys = [
|
||||
'IsEnabled', 'ShuffleInterval', 'RetryInterval', 'MinSwipeDistance',
|
||||
@@ -478,7 +511,7 @@
|
||||
'ShowTrailerButton', 'AlwaysShowArrows', 'EnableKeyboardControls',
|
||||
'EnableCustomMediaIds', 'CustomMediaIds', 'EnableLoadingScreen',
|
||||
'EnableSeasonalContent', 'EnableClientSideSettings', 'SortBy', 'SortOrder',
|
||||
'PreferLocalTrailers'
|
||||
'PreferLocalTrailers', 'ApplyLimitsToCustomIds', 'SeasonalSections'
|
||||
];
|
||||
|
||||
keys.forEach(function (key) {
|
||||
@@ -495,6 +528,105 @@
|
||||
ApiClient.updatePluginConfiguration(MediaBarEnhancedConfigurationPage.pluginId, config).then(function (result) {
|
||||
Dashboard.processPluginConfigurationUpdateResult(result);
|
||||
});
|
||||
},
|
||||
|
||||
renderSeasonalSections: function(page, sections) {
|
||||
var container = page.querySelector('#seasonalSectionsList');
|
||||
if (!container) return;
|
||||
container.innerHTML = '';
|
||||
sections.forEach(function(section, index) {
|
||||
MediaBarEnhancedConfigurationPage.createSectionElement(container, section, index + 1);
|
||||
});
|
||||
},
|
||||
|
||||
addSeasonalSection: function(page) {
|
||||
var container = page.querySelector('#seasonalSectionsList');
|
||||
if (!container) return;
|
||||
var index = container.children.length + 1;
|
||||
MediaBarEnhancedConfigurationPage.createSectionElement(container, {
|
||||
Name: 'New Season',
|
||||
StartDay: 1, StartMonth: 1,
|
||||
EndDay: 1, EndMonth: 1,
|
||||
MediaIds: ''
|
||||
}, index);
|
||||
},
|
||||
|
||||
createSectionElement: function(container, data, index) {
|
||||
var div = document.createElement('div');
|
||||
div.className = 'seasonal-section';
|
||||
div.style.cssText = 'background: rgba(0,0,0,0.2); padding: 1em; margin-bottom: 1em; border-radius: 4px; border: 1px solid rgba(255,255,255,0.1);';
|
||||
|
||||
var days = [];
|
||||
for(var i=1; i<=31; i++) days.push(i);
|
||||
var months = [
|
||||
{v:1, n:'Jan'}, {v:2, n:'Feb'}, {v:3, n:'Mar'}, {v:4, n:'Apr'},
|
||||
{v:5, n:'May'}, {v:6, n:'Jun'}, {v:7, n:'Jul'}, {v:8, n:'Aug'},
|
||||
{v:9, n:'Sep'}, {v:10, n:'Oct'}, {v:11, n:'Nov'}, {v:12, n:'Dec'}
|
||||
];
|
||||
|
||||
function mkSelect(val, opts, cls) {
|
||||
var h = '<select class="emby-select emby-select-withcolor ' + cls + '" style="width: auto; display: inline-block; margin-right: 5px; -webkit-appearance: menulist; appearance: menulist;">';
|
||||
opts.forEach(function(o) {
|
||||
var v = o.v || o;
|
||||
var n = o.n || o;
|
||||
h += '<option value="'+v+'" ' + (v == val ? 'selected' : '') + '>' + n + '</option>';
|
||||
});
|
||||
h += '</select>';
|
||||
return h;
|
||||
}
|
||||
|
||||
var labelText = 'Season list #' + (index || 1);
|
||||
|
||||
div.innerHTML =
|
||||
'<div class="inputContainer" style="margin-bottom: 0.5em;">' +
|
||||
' <label class="inputLabel" style="margin-bottom:0.5em; display:block;">' + labelText + '</label>' +
|
||||
' <div style="display: flex; align-items: center;">' +
|
||||
' <div style="flex-grow:1;">' +
|
||||
' <input is="emby-input" type="text" class="emby-input section-name" value="' + (data.Name || '') + '" />' +
|
||||
' </div>' +
|
||||
' <button type="button" class="raised emby-button remove-section" style="background: #a94442; min-width: unset; margin-left: 1em;">Remove</button>' +
|
||||
' </div>' +
|
||||
' <div class="fieldDescription">Name of the season</div>' +
|
||||
'</div>' +
|
||||
'<div class="inputContainer" style="margin-bottom: 1em;">' +
|
||||
' <label class="inputLabel" style="margin-bottom:0.5em; display:block;">Active Period</label>' +
|
||||
' <div style="display: flex; align-items: center; flex-wrap: wrap; gap: 0.5em; padding-left: 0.2em;">' +
|
||||
' <span>From:</span>' +
|
||||
mkSelect(data.StartDay, days, 'start-day') +
|
||||
mkSelect(data.StartMonth, months, 'start-month') +
|
||||
' <span style="margin-left: 1em;">To:</span>' +
|
||||
mkSelect(data.EndDay, days, 'end-day') +
|
||||
mkSelect(data.EndMonth, months, 'end-month') +
|
||||
' </div>' +
|
||||
' <div class="fieldDescription">Date range (inclusive) when this content is active.</div>' +
|
||||
'</div>' +
|
||||
'<div class="inputContainer">' +
|
||||
' <label class="inputLabel" style="margin-bottom:0.5em; display:block;">Media IDs</label>' +
|
||||
' <textarea is="emby-textarea" class="emby-textarea section-ids" style="width: 100%; height: 80px; font-family: monospace;">' + (data.MediaIds || '') + '</textarea>' +
|
||||
' <div class="fieldDescription">Comma-separated list of Movie/Series/Collection IDs to show during this season.</div>' +
|
||||
'</div>';
|
||||
|
||||
div.querySelector('.remove-section').addEventListener('click', function() {
|
||||
div.remove();
|
||||
});
|
||||
|
||||
container.appendChild(div);
|
||||
},
|
||||
|
||||
getSeasonalSectionsFromUI: function(page) {
|
||||
var sections = [];
|
||||
var els = page.querySelectorAll('.seasonal-section');
|
||||
els.forEach(function(el) {
|
||||
sections.push({
|
||||
Name: el.querySelector('.section-name').value,
|
||||
StartDay: parseInt(el.querySelector('.start-day').value),
|
||||
StartMonth: parseInt(el.querySelector('.start-month').value),
|
||||
EndDay: parseInt(el.querySelector('.end-day').value),
|
||||
EndMonth: parseInt(el.querySelector('.end-month').value),
|
||||
MediaIds: el.querySelector('.section-ids').value
|
||||
});
|
||||
});
|
||||
return sections;
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
@@ -12,7 +12,7 @@
|
||||
<!-- <TreatWarningsAsErrors>false</TreatWarningsAsErrors> -->
|
||||
<Title>Jellyfin Media Bar Enhanced Plugin</Title>
|
||||
<Authors>CodeDevMLH</Authors>
|
||||
<Version>1.6.1.5</Version>
|
||||
<Version>1.6.1.13</Version>
|
||||
<RepositoryUrl>https://github.com/CodeDevMLH/jellyfin-plugin-media-bar-enhanced</RepositoryUrl>
|
||||
</PropertyGroup>
|
||||
|
||||
|
||||
@@ -175,6 +175,7 @@
|
||||
overflow: hidden;
|
||||
margin: 0 auto;
|
||||
pointer-events: auto;
|
||||
outline: none;
|
||||
}
|
||||
|
||||
#slides-container[style*="display: none"],
|
||||
|
||||
@@ -57,6 +57,8 @@ const CONFIG = {
|
||||
enableClientSideSettings: false,
|
||||
sortBy: "Random",
|
||||
sortOrder: "Ascending",
|
||||
applyLimitsToCustomIds: false,
|
||||
seasonalSections: "[]",
|
||||
};
|
||||
|
||||
// State management
|
||||
@@ -611,7 +613,8 @@ const SlideUtils = {
|
||||
if (!container) {
|
||||
container = this.createElement("div", {
|
||||
id: "slides-container",
|
||||
className: "noautofocus"
|
||||
className: "noautofocus",
|
||||
tabIndex: "-1"
|
||||
});
|
||||
document.body.appendChild(container);
|
||||
}
|
||||
@@ -1316,7 +1319,7 @@ const ApiUtils = {
|
||||
async fetchCollectionItems(collectionId) {
|
||||
try {
|
||||
const response = await fetch(
|
||||
`${STATE.jellyfinData.serverAddress}/Items?ParentId=${collectionId}&Recursive=true&IncludeItemTypes=Movie,Series&fields=Id&userId=${STATE.jellyfinData.userId}`,
|
||||
`${STATE.jellyfinData.serverAddress}/Items?ParentId=${collectionId}&Recursive=true&IncludeItemTypes=Movie,Series&fields=Id,Type&userId=${STATE.jellyfinData.userId}`,
|
||||
{
|
||||
headers: this.getAuthHeaders(),
|
||||
}
|
||||
@@ -1330,7 +1333,7 @@ const ApiUtils = {
|
||||
const data = await response.json();
|
||||
const items = data.Items || [];
|
||||
console.log(`Resolved collection ${collectionId} to ${items.length} items`);
|
||||
return items.map(i => i.Id);
|
||||
return items.map(i => ({ Id: i.Id, Type: i.Type }));
|
||||
} catch (error) {
|
||||
console.error(`Error fetching collection items for ${collectionId}:`, error);
|
||||
return [];
|
||||
@@ -1488,12 +1491,12 @@ const VisibilityObserver = {
|
||||
*/
|
||||
init() {
|
||||
// MARK: Mark
|
||||
// const observer = new MutationObserver(() => this.updateVisibility());
|
||||
let debounceTimer = null;
|
||||
const observer = new MutationObserver(() => {
|
||||
if (debounceTimer) clearTimeout(debounceTimer);
|
||||
debounceTimer = setTimeout(() => this.updateVisibility(), 250);
|
||||
});
|
||||
const observer = new MutationObserver(() => this.updateVisibility());
|
||||
// let debounceTimer = null;
|
||||
// const observer = new MutationObserver(() => {
|
||||
// if (debounceTimer) clearTimeout(debounceTimer);
|
||||
// debounceTimer = setTimeout(() => this.updateVisibility(), 250);
|
||||
// });
|
||||
observer.observe(document.body, { childList: true, subtree: true });
|
||||
|
||||
document.body.addEventListener("click", () => this.updateVisibility());
|
||||
@@ -1780,11 +1783,7 @@ const SlideCreator = {
|
||||
},
|
||||
'onStateChange': (event) => {
|
||||
if (event.data === YT.PlayerState.ENDED) {
|
||||
if (CONFIG.waitForTrailerToEnd) {
|
||||
SlideshowManager.nextSlide();
|
||||
} else {
|
||||
event.target.playVideo(); // Loop if not waiting for end if trailer is shorter than slide duration
|
||||
}
|
||||
SlideshowManager.nextSlide();
|
||||
}
|
||||
},
|
||||
'onError': (event) => {
|
||||
@@ -1809,6 +1808,7 @@ const SlideCreator = {
|
||||
autoplay: false,
|
||||
preload: "auto",
|
||||
loop: false,
|
||||
disablePictureInPicture: true,
|
||||
style: "object-fit: cover; object-position: center center; width: 100%; height: 100%; position: absolute; top: 0; left: 0; pointer-events: none;"
|
||||
};
|
||||
|
||||
@@ -1842,9 +1842,7 @@ const SlideCreator = {
|
||||
});
|
||||
|
||||
backdrop.addEventListener('ended', () => {
|
||||
if (CONFIG.waitForTrailerToEnd) {
|
||||
SlideshowManager.nextSlide();
|
||||
}
|
||||
SlideshowManager.nextSlide();
|
||||
});
|
||||
|
||||
backdrop.addEventListener('error', () => {
|
||||
@@ -2516,10 +2514,13 @@ const SlideshowManager = {
|
||||
document.documentElement.classList.contains('layout-tv') ||
|
||||
document.body.classList.contains('layout-tv');
|
||||
if (isTvMode) {
|
||||
const container = document.getElementById("slides-container");
|
||||
if (container) {
|
||||
container.focus({ preventScroll: true });
|
||||
}
|
||||
// Use setTimeout to execute AFTER Jellyfin's focus manager processes the iframe removal
|
||||
setTimeout(() => {
|
||||
const container = document.getElementById("slides-container");
|
||||
if (container && container.style.display !== 'none') {
|
||||
container.focus({ preventScroll: true });
|
||||
}
|
||||
}, 0);
|
||||
}
|
||||
}
|
||||
},
|
||||
@@ -2703,7 +2704,7 @@ const SlideshowManager = {
|
||||
|
||||
videoBackdrop.play().catch(() => {
|
||||
setTimeout(() => {
|
||||
if (videoBackdrop.paused) {
|
||||
if (videoBackdrop.paused && slide.classList.contains('active')) {
|
||||
console.warn(`Autoplay blocked for ${itemId}, attempting muted fallback`);
|
||||
videoBackdrop.muted = true;
|
||||
videoBackdrop.play().catch(err => console.error("Muted fallback failed", err));
|
||||
@@ -2721,7 +2722,7 @@ const SlideshowManager = {
|
||||
startSeconds: player._startTime || 0,
|
||||
endSeconds: player._endTime
|
||||
});
|
||||
|
||||
|
||||
if (STATE.slideshow.isMuted) {
|
||||
player.mute();
|
||||
} else {
|
||||
@@ -2730,6 +2731,8 @@ const SlideshowManager = {
|
||||
}
|
||||
|
||||
setTimeout(() => {
|
||||
if (!slide.classList.contains('active')) return;
|
||||
|
||||
if (player.getPlayerState &&
|
||||
player.getPlayerState() !== YT.PlayerState.PLAYING &&
|
||||
player.getPlayerState() !== YT.PlayerState.BUFFERING) {
|
||||
@@ -2740,7 +2743,9 @@ const SlideshowManager = {
|
||||
}, 1000);
|
||||
return true;
|
||||
} else if (player && typeof player.seekTo === 'function') {
|
||||
player.seekTo(player._startTime || 0);
|
||||
// Fallback if loadVideoById is not available or videoId missing but player object exists
|
||||
const startTime = player._startTime || 0;
|
||||
player.seekTo(startTime);
|
||||
player.playVideo();
|
||||
return true;
|
||||
}
|
||||
@@ -2969,22 +2974,96 @@ const SlideshowManager = {
|
||||
},
|
||||
|
||||
/**
|
||||
* Parses custom media IDs, handling seasonal content if enabled
|
||||
* Parses custom media IDs, handling seasonal content if enabled.
|
||||
* If Seasonal Content is enabled:
|
||||
* - Check if any defined season matches the current date.
|
||||
* - If match: Return IDs from that season.
|
||||
* - If NO match: Fall back to Default Custom IDs.
|
||||
* If Custom Media IDs are enabled (and no seasonal match):
|
||||
* - Return Default Custom IDs.
|
||||
* If no Custom Media IDs are enabled:
|
||||
* - Return empty array (triggering random fallback).
|
||||
* @returns {string[]} Array of media IDs
|
||||
*/
|
||||
parseCustomIds() {
|
||||
if (!CONFIG.enableSeasonalContent) {
|
||||
return CONFIG.customMediaIds
|
||||
.split(/[\n,]/).map((line) => {
|
||||
let idsString = CONFIG.customMediaIds;
|
||||
let usingSeasonal = false;
|
||||
|
||||
if (CONFIG.enableSeasonalContent) {
|
||||
try {
|
||||
const sections = JSON.parse(CONFIG.seasonalSections || "[]");
|
||||
const currentDate = new Date();
|
||||
const currentMonth = currentDate.getMonth() + 1; // 1-12
|
||||
const currentDay = currentDate.getDate(); // 1-31
|
||||
|
||||
for (const section of sections) {
|
||||
const startDay = parseInt(section.StartDay);
|
||||
const startMonth = parseInt(section.StartMonth);
|
||||
const endDay = parseInt(section.EndDay);
|
||||
const endMonth = parseInt(section.EndMonth);
|
||||
|
||||
let isInRange = false;
|
||||
|
||||
if (startMonth === endMonth) {
|
||||
if (currentMonth === startMonth && currentDay >= startDay && currentDay <= endDay) {
|
||||
isInRange = true;
|
||||
}
|
||||
} else if (startMonth < endMonth) {
|
||||
// Normal range
|
||||
if (
|
||||
(currentMonth > startMonth && currentMonth < endMonth) ||
|
||||
(currentMonth === startMonth && currentDay >= startDay) ||
|
||||
(currentMonth === endMonth && currentDay <= endDay)
|
||||
) {
|
||||
isInRange = true;
|
||||
}
|
||||
} else {
|
||||
// Wrap around year
|
||||
if (
|
||||
(currentMonth > startMonth || currentMonth < endMonth) ||
|
||||
(currentMonth === startMonth && currentDay >= startDay) ||
|
||||
(currentMonth === endMonth && currentDay <= endDay)
|
||||
) {
|
||||
isInRange = true;
|
||||
}
|
||||
}
|
||||
|
||||
if (isInRange) {
|
||||
console.log(`Seasonal match found: ${section.Name}`);
|
||||
idsString = section.MediaIds;
|
||||
usingSeasonal = true;
|
||||
break; // Use first matching season
|
||||
}
|
||||
}
|
||||
} catch (e) {
|
||||
console.error("Error parsing seasonal sections in JS:", e);
|
||||
}
|
||||
}
|
||||
|
||||
// If NOT using seasonal content (disabled or no match),
|
||||
// Custom IDs are disabled, return empty to skip to random
|
||||
if (!usingSeasonal && !CONFIG.enableCustomMediaIds) {
|
||||
return [];
|
||||
}
|
||||
|
||||
// Parse the resulting string (either seasonal or default)
|
||||
if (!idsString) return [];
|
||||
|
||||
return idsString
|
||||
.split(/[\n,]/)
|
||||
.map((line) => {
|
||||
const urlMatch = line.match(/\[(.*?)\]/);
|
||||
let id = line;
|
||||
if (urlMatch) {
|
||||
const url = urlMatch[1];
|
||||
// Remove the [url] part from the ID string for parsing
|
||||
id = line.replace(/\[.*?\]/, '').trim();
|
||||
// Attempt to extract GUID if present
|
||||
const guidMatch = id.match(/([0-9a-f]{32})/i);
|
||||
if (guidMatch) {
|
||||
id = guidMatch[1];
|
||||
} else {
|
||||
// Fallback: split by pipe if used
|
||||
id = id.split('|')[0].trim();
|
||||
}
|
||||
STATE.slideshow.customTrailerUrls[id] = url;
|
||||
@@ -2993,83 +3072,6 @@ const SlideshowManager = {
|
||||
})
|
||||
.map((id) => id.trim())
|
||||
.filter((id) => id);
|
||||
} else {
|
||||
return this.parseSeasonalIds();
|
||||
}
|
||||
},
|
||||
|
||||
/**
|
||||
* Parses custom media IDs, handling seasonal content if enabled
|
||||
* @returns {string[]} Array of media IDs
|
||||
*/
|
||||
parseSeasonalIds() {
|
||||
console.log("Using Seasonal Content Mode");
|
||||
const lines = CONFIG.customMediaIds.split('\n');
|
||||
const currentDate = new Date();
|
||||
const currentMonth = currentDate.getMonth() + 1; // 1-12
|
||||
const currentDay = currentDate.getDate(); // 1-31
|
||||
const rawIds = [];
|
||||
|
||||
for (const line of lines) {
|
||||
const match = line.match(/^\s*(\d{1,2})\.(\d{1,2})-(\d{1,2})\.(\d{1,2})\s*\|.*\|(.*)$/) ||
|
||||
line.match(/^\s*(\d{1,2})\.(\d{1,2})-(\d{1,2})\.(\d{1,2})\s*\|(.*)$/);
|
||||
|
||||
if (match) {
|
||||
const startDay = parseInt(match[1]);
|
||||
const startMonth = parseInt(match[2]);
|
||||
const endDay = parseInt(match[3]);
|
||||
const endMonth = parseInt(match[4]);
|
||||
const idsPart = match[5];
|
||||
|
||||
let isInRange = false;
|
||||
|
||||
if (startMonth === endMonth) {
|
||||
if (currentMonth === startMonth && currentDay >= startDay && currentDay <= endDay) {
|
||||
isInRange = true;
|
||||
}
|
||||
} else if (startMonth < endMonth) {
|
||||
// Normal range spanning months (e.g. 15.06 - 15.08)
|
||||
if (
|
||||
(currentMonth > startMonth && currentMonth < endMonth) ||
|
||||
(currentMonth === startMonth && currentDay >= startDay) ||
|
||||
(currentMonth === endMonth && currentDay <= endDay)
|
||||
) {
|
||||
isInRange = true;
|
||||
}
|
||||
} else {
|
||||
// Wrap around year (e.g. 01.12 - 15.01)
|
||||
if (
|
||||
(currentMonth > startMonth || currentMonth < endMonth) ||
|
||||
(currentMonth === startMonth && currentDay >= startDay) ||
|
||||
(currentMonth === endMonth && currentDay <= endDay)
|
||||
) {
|
||||
isInRange = true;
|
||||
}
|
||||
}
|
||||
|
||||
if (isInRange) {
|
||||
console.log(`Seasonal match found: ${line}`);
|
||||
const ids = idsPart.split(/[,]/).map(line => {
|
||||
const urlMatch = line.match(/\[(.*?)\]/);
|
||||
let id = line;
|
||||
if (urlMatch) {
|
||||
const url = urlMatch[1];
|
||||
id = line.replace(/\[.*?\]/, '').trim();
|
||||
const guidMatch = id.match(/([0-9a-f]{32})/i);
|
||||
if (guidMatch) {
|
||||
id = guidMatch[1];
|
||||
} else {
|
||||
id = id.split('|')[0].trim();
|
||||
}
|
||||
STATE.slideshow.customTrailerUrls[id] = url;
|
||||
}
|
||||
return id.trim();
|
||||
}).filter(id => id);
|
||||
rawIds.push(...ids);
|
||||
}
|
||||
}
|
||||
}
|
||||
return rawIds;
|
||||
},
|
||||
|
||||
/**
|
||||
@@ -3111,7 +3113,7 @@ const SlideshowManager = {
|
||||
const children = await ApiUtils.fetchCollectionItems(id);
|
||||
finalIds.push(...children);
|
||||
} else if (item) {
|
||||
finalIds.push(id);
|
||||
finalIds.push({ Id: item.Id, Type: item.Type });
|
||||
}
|
||||
} catch (e) {
|
||||
console.warn(`Error resolving item ${rawId}:`, e);
|
||||
@@ -3129,10 +3131,41 @@ const SlideshowManager = {
|
||||
let itemIds = [];
|
||||
|
||||
// 1. Try Custom Media/Collection IDs from Config & seasonal content
|
||||
if (CONFIG.enableCustomMediaIds && CONFIG.customMediaIds) {
|
||||
if (CONFIG.enableCustomMediaIds || CONFIG.enableSeasonalContent) {
|
||||
console.log("Using Custom Media IDs from configuration");
|
||||
const rawIds = this.parseCustomIds();
|
||||
itemIds = await this.resolveCollectionsAndItems(rawIds);
|
||||
const resolvedItems = await this.resolveCollectionsAndItems(rawIds);
|
||||
|
||||
// Apply max items limit to custom IDs if enabled
|
||||
if (CONFIG.applyLimitsToCustomIds) {
|
||||
let movieCount = 0;
|
||||
let showCount = 0;
|
||||
let keptItems = [];
|
||||
|
||||
for (const item of resolvedItems) {
|
||||
if (keptItems.length >= CONFIG.maxItems) break;
|
||||
|
||||
if (item.Type === 'Movie') {
|
||||
if (movieCount < CONFIG.maxMovies) {
|
||||
movieCount++;
|
||||
keptItems.push(item);
|
||||
}
|
||||
} else if (item.Type === 'Series' || item.Type === 'Season' || item.Type === 'Episode') {
|
||||
// Count Seasons/Episodes as TV Shows
|
||||
if (showCount < CONFIG.maxTvShows) {
|
||||
showCount++;
|
||||
keptItems.push(item);
|
||||
}
|
||||
} else {
|
||||
// Other types: count towards total only
|
||||
keptItems.push(item);
|
||||
}
|
||||
}
|
||||
itemIds = keptItems.map(i => i.Id);
|
||||
console.log(`Applied limits to custom IDs: ${itemIds.length} items (Movies: ${movieCount}, Shows: ${showCount})`);
|
||||
} else {
|
||||
itemIds = resolvedItems.map(i => i.Id);
|
||||
}
|
||||
}
|
||||
|
||||
// 2. Try Avatar List (list.txt)
|
||||
@@ -3513,17 +3546,61 @@ const MediaBarEnhancedSettingsManager = {
|
||||
*/
|
||||
const initPageVisibilityHandler = () => {
|
||||
document.addEventListener("visibilitychange", () => {
|
||||
const isVideoPlayerOpen = document.querySelector('.videoPlayerContainer:not(.hide)') ||
|
||||
document.querySelector('.youtubePlayerContainer:not(.hide)');
|
||||
|
||||
if (document.hidden) {
|
||||
console.log("Tab inactive - stopping all slideshow playback");
|
||||
// Stop slide timer
|
||||
if (STATE.slideshow.slideInterval) {
|
||||
STATE.slideshow.slideInterval.stop();
|
||||
}
|
||||
SlideshowManager.stopAllPlayback();
|
||||
|
||||
if (isVideoPlayerOpen) {
|
||||
// Jellyfin video is playing --> full stop to free all resources
|
||||
console.log("Tab inactive and Jellyfin player active - stopping all playback");
|
||||
SlideshowManager.stopAllPlayback();
|
||||
} else {
|
||||
// Simple tab switch: stop all others, pause only the current
|
||||
console.log("Tab inactive. Pausing current video, stopping others");
|
||||
const currentItemId = STATE.slideshow.itemIds?.[STATE.slideshow.currentSlideIndex];
|
||||
|
||||
// Stop all players except the current one
|
||||
if (STATE.slideshow.videoPlayers) {
|
||||
Object.keys(STATE.slideshow.videoPlayers).forEach(id => {
|
||||
if (id === currentItemId) return;
|
||||
const p = STATE.slideshow.videoPlayers[id];
|
||||
if (p) {
|
||||
try {
|
||||
if (typeof p.stopVideo === 'function') {
|
||||
p.stopVideo();
|
||||
if (typeof p.clearVideo === 'function') p.clearVideo();
|
||||
} else if (p.tagName === 'VIDEO') {
|
||||
p.pause();
|
||||
p.muted = true;
|
||||
p.currentTime = 0;
|
||||
}
|
||||
} catch (e) { console.warn("Error stopping background player", id, e); }
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
// Pause only the current video
|
||||
if (currentItemId) {
|
||||
const player = STATE.slideshow.videoPlayers?.[currentItemId];
|
||||
if (player) {
|
||||
try {
|
||||
if (typeof player.pauseVideo === 'function') {
|
||||
player.pauseVideo();
|
||||
} else if (player.tagName === 'VIDEO') {
|
||||
player.pause();
|
||||
}
|
||||
} catch (e) { console.warn("Error pausing video on tab hide:", e); }
|
||||
}
|
||||
}
|
||||
}
|
||||
} else {
|
||||
console.log("Tab active - resuming slideshow");
|
||||
// Only resume if we're on the home page and not paused
|
||||
console.log("Tab active. Resuming slideshow");
|
||||
const isOnHome = window.location.hash === "#/home.html" || window.location.hash === "#/home";
|
||||
const isVideoPlayerOpen = document.querySelector('.videoPlayerContainer:not(.hide)') || document.querySelector('.youtubePlayerContainer:not(.hide)');
|
||||
|
||||
if (isOnHome && !STATE.slideshow.isPaused && !isVideoPlayerOpen) {
|
||||
SlideshowManager.resumeActivePlayback();
|
||||
|
||||
@@ -9,12 +9,12 @@
|
||||
"imageUrl": "https://git.mahom03-spacecloud.de/CodeDevMLH/jellyfin-plugin-media-bar-enhanced/raw/branch/main/logo.png",
|
||||
"versions": [
|
||||
{
|
||||
"version": "1.6.1.5",
|
||||
"version": "1.6.1.13",
|
||||
"changelog": "- fix tv mode issue\n- refactor video playback management",
|
||||
"targetAbi": "10.11.0.0",
|
||||
"sourceUrl": "https://git.mahom03-spacecloud.de/CodeDevMLH/jellyfin-plugin-media-bar-enhanced/releases/download/v1.6.1.5/Jellyfin.Plugin.MediaBarEnhanced.zip",
|
||||
"checksum": "f5d4a593c0f498fab61bb17b588d1b3f",
|
||||
"timestamp": "2026-02-12T01:51:52Z"
|
||||
"sourceUrl": "https://git.mahom03-spacecloud.de/CodeDevMLH/jellyfin-plugin-media-bar-enhanced/releases/download/v1.6.1.13/Jellyfin.Plugin.MediaBarEnhanced.zip",
|
||||
"checksum": "abd9afe0897be90c37ef2789ccc7ec4b",
|
||||
"timestamp": "2026-02-13T02:02:19Z"
|
||||
},
|
||||
{
|
||||
"version": "1.6.0.2",
|
||||
|
||||
Reference in New Issue
Block a user