Compare commits

..

11 Commits

Author SHA1 Message Date
CodeDevMLH
63be8214d0 Update manifest.json for release v1.5.0.6 [skip ci] 2026-02-09 00:31:35 +00:00
CodeDevMLH
99411afffd Bump version to 1.5.0.6; update changelog and fix keyboard controls in TV mode
All checks were successful
Auto Release Plugin / build-and-release (push) Successful in 58s
2026-02-09 01:30:36 +01:00
CodeDevMLH
9510ae6ba7 Add sorting options for content in configuration and update sorting logic 2026-02-09 01:30:28 +01:00
CodeDevMLH
2030538acc Update manifest.json for release v1.5.0.5 [skip ci] 2026-02-08 02:20:04 +00:00
CodeDevMLH
463e9ef424 Bump version to 1.5.0.5; update keyboard controls and changelog
All checks were successful
Auto Release Plugin / build-and-release (push) Successful in 51s
2026-02-08 03:19:12 +01:00
CodeDevMLH
dbe9ce97d2 Update manifest.json for release v1.5.0.4 [skip ci] 2026-02-08 01:32:40 +00:00
CodeDevMLH
45c780c018 Bump version to 1.5.0.4 and update changelog for mediaBarEnhanced.js and manifest.json; enhance keyboard navigation controls
All checks were successful
Auto Release Plugin / build-and-release (push) Successful in 53s
2026-02-08 02:31:49 +01:00
CodeDevMLH
9de268caa7 , 2026-02-08 02:28:06 +01:00
CodeDevMLH
a8298461f9 Update manifest.json for release v1.5.0.3 [skip ci] 2026-02-08 00:41:45 +00:00
CodeDevMLH
aa369e5c7b Merge branch 'main' of ssh://git.mahom03-spacecloud.de:44322/CodeDevMLH/jellyfin-plugin-media-bar-enhanced
All checks were successful
Auto Release Plugin / build-and-release (push) Successful in 53s
2026-02-08 01:40:53 +01:00
CodeDevMLH
f62dc853be Bump version to 1.5.0.3 and update changelog for mediaBarEnhanced.js and manifest.json; improve keyboard controls in TV mode 2026-02-08 01:40:50 +01:00
5 changed files with 136 additions and 38 deletions

View File

@@ -35,5 +35,7 @@ namespace Jellyfin.Plugin.MediaBarEnhanced.Configuration
public bool EnableSeasonalContent { get; set; } = false; public bool EnableSeasonalContent { get; set; } = false;
public bool IsEnabled { get; set; } = true; public bool IsEnabled { get; set; } = true;
public bool EnableClientSideSettings { get; set; } = false; public bool EnableClientSideSettings { get; set; } = false;
public string SortBy { get; set; } = "Random";
public string SortOrder { get; set; } = "Ascending";
} }
} }

View File

@@ -274,6 +274,32 @@
mobile).</div> mobile).</div>
</div> </div>
<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="emby-select-withcolor emby-select">
<option value="Random">Random</option>
<option value="Original">Original (Custom List Order)</option>
<option value="PremiereDate">Premiere Date</option>
<option value="DateCreated">Date Created</option>
<option value="CommunityRating">Community Rating</option>
<option value="Name">Name</option>
<option value="Runtime">Runtime</option>
</select>
<div class="fieldDescription">Sort items by the selected criteria.</div>
</div>
<div class="selectContainer">
<label class="selectLabel" for="SortOrder">Sort Order</label>
<select is="emby-select" id="SortOrder" name="SortOrder" class="emby-select-withcolor emby-select">
<option value="Ascending">Ascending</option>
<option value="Descending">Descending</option>
</select>
<div class="fieldDescription">Sort items in Ascending or Descending order.</div>
</div>
<div class="fieldDescription" style="margin-bottom: 2em; color: #ffcc00;">
<b>Note:</b> Sorting settings apply to both Server content and Custom IDs. 'Original' preserves Custom List order.
</div>
<h2 class="sectionTitle">Content Limits</h2> <h2 class="sectionTitle">Content Limits</h2>
<p>Leave a setting blank to use the default value.</p> <p>Leave a setting blank to use the default value.</p>
<div class="inputContainer"> <div class="inputContainer">
@@ -370,7 +396,7 @@
'WaitForTrailerToEnd', 'StartMuted', 'FullWidthVideo', 'EnableMobileVideo', 'WaitForTrailerToEnd', 'StartMuted', 'FullWidthVideo', 'EnableMobileVideo',
'ShowTrailerButton', 'AlwaysShowArrows', 'EnableKeyboardControls', 'ShowTrailerButton', 'AlwaysShowArrows', 'EnableKeyboardControls',
'EnableCustomMediaIds', 'CustomMediaIds', 'EnableLoadingScreen', 'EnableCustomMediaIds', 'CustomMediaIds', 'EnableLoadingScreen',
'EnableSeasonalContent', 'EnableClientSideSettings' 'EnableSeasonalContent', 'EnableClientSideSettings', 'SortBy', 'SortOrder'
]; ];
keys.forEach(function (key) { keys.forEach(function (key) {
@@ -419,7 +445,7 @@
'WaitForTrailerToEnd', 'StartMuted', 'FullWidthVideo', 'EnableMobileVideo', 'WaitForTrailerToEnd', 'StartMuted', 'FullWidthVideo', 'EnableMobileVideo',
'ShowTrailerButton', 'AlwaysShowArrows', 'EnableKeyboardControls', 'ShowTrailerButton', 'AlwaysShowArrows', 'EnableKeyboardControls',
'EnableCustomMediaIds', 'CustomMediaIds', 'EnableLoadingScreen', 'EnableCustomMediaIds', 'CustomMediaIds', 'EnableLoadingScreen',
'EnableSeasonalContent', 'EnableClientSideSettings' 'EnableSeasonalContent', 'EnableClientSideSettings', 'SortBy', 'SortOrder'
]; ];
keys.forEach(function (key) { keys.forEach(function (key) {

View File

@@ -12,7 +12,7 @@
<!-- <TreatWarningsAsErrors>false</TreatWarningsAsErrors> --> <!-- <TreatWarningsAsErrors>false</TreatWarningsAsErrors> -->
<Title>Jellyfin Media Bar Enhanced Plugin</Title> <Title>Jellyfin Media Bar Enhanced Plugin</Title>
<Authors>CodeDevMLH</Authors> <Authors>CodeDevMLH</Authors>
<Version>1.5.0.2</Version> <Version>1.5.0.6</Version>
<RepositoryUrl>https://github.com/CodeDevMLH/jellyfin-plugin-media-bar-enhanced</RepositoryUrl> <RepositoryUrl>https://github.com/CodeDevMLH/jellyfin-plugin-media-bar-enhanced</RepositoryUrl>
</PropertyGroup> </PropertyGroup>

View File

@@ -51,6 +51,8 @@ const CONFIG = {
customMediaIds: "", customMediaIds: "",
enableLoadingScreen: true, enableLoadingScreen: true,
enableClientSideSettings: false, enableClientSideSettings: false,
sortBy: "Random",
sortOrder: "Ascending",
}; };
// State management // State management
@@ -460,6 +462,62 @@ waitForApiClientAndInitialize();
* Utility functions for slide creation and management * Utility functions for slide creation and management
*/ */
const SlideUtils = { const SlideUtils = {
/**
* Sorts items based on configuration
* @param {Array<Object>} items - Array of item objects
* @param {string} sortBy - Sort criteria
* @param {string} sortOrder - Sort order 'Ascending' or 'Descending'
* @returns {Array<Object>} Sorted array of items
*/
sortItems(items, sortBy, sortOrder) {
if (sortBy === 'Random' || sortBy === 'Original') {
return items;
}
const simpleCompare = (a, b) => {
if (a < b) return -1;
if (a > b) return 1;
return 0;
};
const sorted = [...items].sort((a, b) => {
let valA, valB;
switch (sortBy) {
case 'DateCreated':
valA = new Date(a.DateCreated).getTime();
valB = new Date(b.DateCreated).getTime();
break;
case 'PremiereDate':
valA = new Date(a.PremiereDate).getTime();
valB = new Date(b.PremiereDate).getTime();
break;
case 'CommunityRating':
valA = a.CommunityRating || 0;
valB = b.CommunityRating || 0;
break;
case 'Runtime':
valA = a.RunTimeTicks || 0;
valB = b.RunTimeTicks || 0;
break;
case 'Name':
valA = (a.Name || '').toLowerCase();
valB = (b.Name || '').toLowerCase();
break;
default:
return 0;
}
return simpleCompare(valA, valB);
});
if (sortOrder === 'Descending') {
sorted.reverse();
}
return sorted;
},
/** /**
* Shuffles array elements randomly * Shuffles array elements randomly
* @param {Array} array - Array to shuffle * @param {Array} array - Array to shuffle
@@ -960,8 +1018,8 @@ const ApiUtils = {
} }
const response = await fetch( const response = await fetch(
`${STATE.jellyfinData.serverAddress}/Items/${itemId}`, // `${STATE.jellyfinData.serverAddress}/Items/${itemId}`,
// `${STATE.jellyfinData.serverAddress}/Users/${STATE.jellyfinData.userId}/Items/${itemId}?Fields=Overview,RemoteTrailers,Genres,CommunityRating,CriticRating,OfficialRating,PremiereDate,RunTimeTicks,ProductionYear,MediaSources`, `${STATE.jellyfinData.serverAddress}/Items/${itemId}?Fields=Overview,RemoteTrailers,Genres,CommunityRating,CriticRating,OfficialRating,PremiereDate,ProductionYear,MediaSources,RunTimeTicks`,
{ {
headers: this.getAuthHeaders(), headers: this.getAuthHeaders(),
} }
@@ -1033,8 +1091,16 @@ const ApiUtils = {
console.log("Fetching random items from server..."); console.log("Fetching random items from server...");
let sortParams = `sortBy=${CONFIG.sortBy}`;
if (CONFIG.sortBy === 'Random' || CONFIG.sortBy === 'Original') {
sortParams = 'sortBy=Random';
} else {
sortParams += `&sortOrder=${CONFIG.sortOrder}`;
}
const response = await fetch( const response = await fetch(
`${STATE.jellyfinData.serverAddress}/Items?IncludeItemTypes=Movie,Series&Recursive=true&hasOverview=true&imageTypes=Logo,Backdrop&sortBy=Random&isPlayed=False&enableUserData=true&Limit=${CONFIG.maxItems}&fields=Id`, `${STATE.jellyfinData.serverAddress}/Items?IncludeItemTypes=Movie,Series&Recursive=true&hasOverview=true&imageTypes=Logo,Backdrop&${sortParams}&isPlayed=False&enableUserData=true&Limit=${CONFIG.maxItems}&fields=Id`,
{ {
headers: this.getAuthHeaders(), headers: this.getAuthHeaders(),
} }
@@ -2533,7 +2599,6 @@ const SlideshowManager = {
document.addEventListener("keydown", (e) => { document.addEventListener("keydown", (e) => {
const container = document.getElementById("slides-container"); const container = document.getElementById("slides-container");
// Allow interaction if container is visible, even if not strictly focused
if (!container || container.style.display === "none") { if (!container || container.style.display === "none") {
return; return;
} }
@@ -2552,20 +2617,12 @@ const SlideshowManager = {
switch (e.key) { switch (e.key) {
case "ArrowRight": case "ArrowRight":
if (focusElement && focusElement.classList.contains("detail-button")) { SlideshowManager.nextSlide();
focusElement.previousElementSibling.focus();
} else {
SlideshowManager.nextSlide();
}
e.preventDefault(); e.preventDefault();
break; break;
case "ArrowLeft": case "ArrowLeft":
if (focusElement && focusElement.classList.contains("play-button")) { SlideshowManager.prevSlide();
focusElement.nextElementSibling.focus();
} else {
SlideshowManager.prevSlide();
}
e.preventDefault(); e.preventDefault();
break; break;
@@ -2581,20 +2638,15 @@ const SlideshowManager = {
break; break;
case "Enter": case "Enter":
if (focusElement && focusElement.tagName !== "BODY" && focusElement.id !== "slides-container") { const currentItemId = STATE.slideshow.itemIds[STATE.slideshow.currentSlideIndex];
focusElement.click(); if (currentItemId) {
} else { if (window.Emby && window.Emby.Page) {
// If no specific element is focused (Remote/TV mode default), open details for current item Emby.Page.show(
const currentItemId = STATE.slideshow.itemIds[STATE.slideshow.currentSlideIndex]; `/details?id=${currentItemId}&serverId=${STATE.jellyfinData.serverId}`
if (currentItemId) { );
if (window.Emby && window.Emby.Page) { } else {
Emby.Page.show( window.location.href = `#/details?id=${currentItemId}&serverId=${STATE.jellyfinData.serverId}`;
`/details?id=${currentItemId}&serverId=${STATE.jellyfinData.serverId}` }
);
} else {
window.location.href = `#/details?id=${currentItemId}&serverId=${STATE.jellyfinData.serverId}`;
}
}
} }
e.preventDefault(); e.preventDefault();
break; break;
@@ -2788,9 +2840,27 @@ const SlideshowManager = {
if (itemIds.length === 0) { if (itemIds.length === 0) {
console.log("No custom list found, fetching random items from server..."); console.log("No custom list found, fetching random items from server...");
itemIds = await ApiUtils.fetchItemIdsFromServer(); itemIds = await ApiUtils.fetchItemIdsFromServer();
}
itemIds = SlideUtils.shuffleArray(itemIds); if (CONFIG.sortBy === 'Random') {
itemIds = SlideUtils.shuffleArray(itemIds);
}
} else {
// Custom IDs
if (CONFIG.sortBy === 'Random') {
itemIds = SlideUtils.shuffleArray(itemIds);
} else if (CONFIG.sortBy !== 'Original') {
// Client-side sort required...
console.log(`Sorting ${itemIds.length} custom items by ${CONFIG.sortBy} ${CONFIG.sortOrder}`);
const itemsWithDetails = [];
for (const id of itemIds) {
const item = await ApiUtils.fetchItemDetails(id);
if (item) itemsWithDetails.push(item);
}
const sortedItems = SlideUtils.sortItems(itemsWithDetails, CONFIG.sortBy, CONFIG.sortOrder);
itemIds = sortedItems.map(i => i.Id);
}
}
STATE.slideshow.itemIds = itemIds; STATE.slideshow.itemIds = itemIds;
STATE.slideshow.totalItems = itemIds.length; STATE.slideshow.totalItems = itemIds.length;

View File

@@ -9,12 +9,12 @@
"imageUrl": "https://git.mahom03-spacecloud.de/CodeDevMLH/jellyfin-plugin-media-bar-enhanced/raw/branch/main/logo.png", "imageUrl": "https://git.mahom03-spacecloud.de/CodeDevMLH/jellyfin-plugin-media-bar-enhanced/raw/branch/main/logo.png",
"versions": [ "versions": [
{ {
"version": "1.5.0.2", "version": "1.5.0.6",
"changelog": "- fix: keyboard controls in TV mode \n- Update mediaBarEnhanced.js and mediaBarEnhanced.css with version 4.0.1 from original repo", "changelog": "- fix: keyboard controls in TV mode\n- Add sorting options for content in configuration\n- Update mediaBarEnhanced.js and mediaBarEnhanced.css with version 4.0.1 from original repo",
"targetAbi": "10.11.0.0", "targetAbi": "10.11.0.0",
"sourceUrl": "https://git.mahom03-spacecloud.de/CodeDevMLH/jellyfin-plugin-media-bar-enhanced/releases/download/v1.5.0.2/Jellyfin.Plugin.MediaBarEnhanced.zip", "sourceUrl": "https://git.mahom03-spacecloud.de/CodeDevMLH/jellyfin-plugin-media-bar-enhanced/releases/download/v1.5.0.6/Jellyfin.Plugin.MediaBarEnhanced.zip",
"checksum": "e09f14313642dd4bd954c55e8cebcdf1", "checksum": "c1c0736b06b3855523fe2eac25e6b34b",
"timestamp": "2026-02-08T00:10:29Z" "timestamp": "2026-02-09T00:31:34Z"
}, },
{ {
"version": "1.3.0.3", "version": "1.3.0.3",