Compare commits
No commits in common. "master" and "v0.0.2" have entirely different histories.
@ -123,51 +123,3 @@ jobs:
|
|||||||
|
|
||||||
echo "Release created successfully!"
|
echo "Release created successfully!"
|
||||||
echo "View at: ${GITEA_URL}/${REPO_OWNER}/${REPO_NAME}/releases/tag/${{ steps.get_version.outputs.version }}"
|
echo "View at: ${GITEA_URL}/${REPO_OWNER}/${REPO_NAME}/releases/tag/${{ steps.get_version.outputs.version }}"
|
||||||
|
|
||||||
- name: Calculate checksum
|
|
||||||
id: checksum
|
|
||||||
run: |
|
|
||||||
CHECKSUM=$(md5sum "${{ steps.jprm.outputs.artifact }}" | awk '{print $1}')
|
|
||||||
echo "checksum=${CHECKSUM}" >> $GITHUB_OUTPUT
|
|
||||||
echo "MD5 checksum: ${CHECKSUM}"
|
|
||||||
|
|
||||||
- name: Update manifest.json
|
|
||||||
run: |
|
|
||||||
VERSION="${{ steps.get_version.outputs.version_number }}"
|
|
||||||
CHECKSUM="${{ steps.checksum.outputs.checksum }}"
|
|
||||||
TIMESTAMP=$(date -u +"%Y-%m-%dT%H:%M:%SZ")
|
|
||||||
ARTIFACT_NAME="${{ steps.jprm.outputs.artifact_name }}"
|
|
||||||
REPO_OWNER="${{ github.repository_owner }}"
|
|
||||||
REPO_NAME="${{ github.event.repository.name }}"
|
|
||||||
GITEA_URL="${{ github.server_url }}"
|
|
||||||
DOWNLOAD_URL="${GITEA_URL}/${REPO_OWNER}/${REPO_NAME}/releases/download/${{ steps.get_version.outputs.version }}/${ARTIFACT_NAME}"
|
|
||||||
|
|
||||||
# Create the new version entry
|
|
||||||
NEW_VERSION=$(cat <<EOF
|
|
||||||
{
|
|
||||||
"version": "${VERSION}",
|
|
||||||
"changelog": "Release ${VERSION}",
|
|
||||||
"targetAbi": "10.10.0.0",
|
|
||||||
"sourceUrl": "${DOWNLOAD_URL}",
|
|
||||||
"checksum": "${CHECKSUM}",
|
|
||||||
"timestamp": "${TIMESTAMP}"
|
|
||||||
}
|
|
||||||
EOF
|
|
||||||
)
|
|
||||||
|
|
||||||
# Prepend new version to the versions array in manifest.json
|
|
||||||
jq --argjson newver "${NEW_VERSION}" '.[0].versions = [$newver] + .[0].versions' manifest.json > manifest.tmp.json
|
|
||||||
mv manifest.tmp.json manifest.json
|
|
||||||
|
|
||||||
echo "Updated manifest.json:"
|
|
||||||
cat manifest.json
|
|
||||||
|
|
||||||
- name: Commit and push manifest
|
|
||||||
env:
|
|
||||||
GITEA_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
|
||||||
run: |
|
|
||||||
git config user.name "Gitea Actions"
|
|
||||||
git config user.email "actions@gitea.tourolle.paris"
|
|
||||||
git add manifest.json
|
|
||||||
git commit -m "Update manifest.json for ${{ steps.get_version.outputs.version }}"
|
|
||||||
git push origin HEAD:master
|
|
||||||
|
|||||||
@ -1,16 +1,10 @@
|
|||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.ComponentModel.DataAnnotations;
|
using System.ComponentModel.DataAnnotations;
|
||||||
using System.Linq;
|
|
||||||
using System.Net.Mime;
|
using System.Net.Mime;
|
||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
using Jellyfin.Data.Enums;
|
|
||||||
using Jellyfin.Plugin.JellyLMS.Models;
|
using Jellyfin.Plugin.JellyLMS.Models;
|
||||||
using Jellyfin.Plugin.JellyLMS.Services;
|
using Jellyfin.Plugin.JellyLMS.Services;
|
||||||
using MediaBrowser.Controller.Entities;
|
|
||||||
using MediaBrowser.Controller.Entities.Audio;
|
|
||||||
using MediaBrowser.Controller.Library;
|
|
||||||
using MediaBrowser.Model.Entities;
|
|
||||||
using Microsoft.AspNetCore.Authorization;
|
using Microsoft.AspNetCore.Authorization;
|
||||||
using Microsoft.AspNetCore.Http;
|
using Microsoft.AspNetCore.Http;
|
||||||
using Microsoft.AspNetCore.Mvc;
|
using Microsoft.AspNetCore.Mvc;
|
||||||
@ -29,7 +23,6 @@ public class JellyLmsController : ControllerBase
|
|||||||
private readonly ILmsApiClient _lmsClient;
|
private readonly ILmsApiClient _lmsClient;
|
||||||
private readonly LmsPlayerManager _playerManager;
|
private readonly LmsPlayerManager _playerManager;
|
||||||
private readonly LmsSessionManager _sessionManager;
|
private readonly LmsSessionManager _sessionManager;
|
||||||
private readonly ILibraryManager _libraryManager;
|
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Initializes a new instance of the <see cref="JellyLmsController"/> class.
|
/// Initializes a new instance of the <see cref="JellyLmsController"/> class.
|
||||||
@ -37,17 +30,14 @@ public class JellyLmsController : ControllerBase
|
|||||||
/// <param name="lmsClient">The LMS API client.</param>
|
/// <param name="lmsClient">The LMS API client.</param>
|
||||||
/// <param name="playerManager">The player manager.</param>
|
/// <param name="playerManager">The player manager.</param>
|
||||||
/// <param name="sessionManager">The session manager.</param>
|
/// <param name="sessionManager">The session manager.</param>
|
||||||
/// <param name="libraryManager">The library manager.</param>
|
|
||||||
public JellyLmsController(
|
public JellyLmsController(
|
||||||
ILmsApiClient lmsClient,
|
ILmsApiClient lmsClient,
|
||||||
LmsPlayerManager playerManager,
|
LmsPlayerManager playerManager,
|
||||||
LmsSessionManager sessionManager,
|
LmsSessionManager sessionManager)
|
||||||
ILibraryManager libraryManager)
|
|
||||||
{
|
{
|
||||||
_lmsClient = lmsClient;
|
_lmsClient = lmsClient;
|
||||||
_playerManager = playerManager;
|
_playerManager = playerManager;
|
||||||
_sessionManager = sessionManager;
|
_sessionManager = sessionManager;
|
||||||
_libraryManager = libraryManager;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
@ -295,87 +285,6 @@ public class JellyLmsController : ControllerBase
|
|||||||
var success = await _sessionManager.SetVolumeAsync(sessionId, request.Volume).ConfigureAwait(false);
|
var success = await _sessionManager.SetVolumeAsync(sessionId, request.Volume).ConfigureAwait(false);
|
||||||
return success ? Ok() : NotFound();
|
return success ? Ok() : NotFound();
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Discovers file paths used by Jellyfin's music libraries.
|
|
||||||
/// Helps users configure path mappings for direct file access.
|
|
||||||
/// </summary>
|
|
||||||
/// <returns>Sample file paths from each music library.</returns>
|
|
||||||
[HttpGet("DiscoverPaths")]
|
|
||||||
[ProducesResponseType(StatusCodes.Status200OK)]
|
|
||||||
public ActionResult<DiscoveredPathsResponse> DiscoverPaths()
|
|
||||||
{
|
|
||||||
var response = new DiscoveredPathsResponse();
|
|
||||||
|
|
||||||
// Get sample audio files from the library
|
|
||||||
var query = new InternalItemsQuery
|
|
||||||
{
|
|
||||||
IncludeItemTypes = [BaseItemKind.Audio],
|
|
||||||
Limit = 50,
|
|
||||||
Recursive = true
|
|
||||||
};
|
|
||||||
|
|
||||||
var items = _libraryManager.GetItemsResult(query).Items;
|
|
||||||
|
|
||||||
// Extract unique path prefixes
|
|
||||||
var pathPrefixes = new HashSet<string>();
|
|
||||||
|
|
||||||
foreach (var item in items)
|
|
||||||
{
|
|
||||||
if (string.IsNullOrEmpty(item.Path))
|
|
||||||
{
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Add sample paths
|
|
||||||
if (response.SamplePaths.Count < 5)
|
|
||||||
{
|
|
||||||
response.SamplePaths.Add(item.Path);
|
|
||||||
}
|
|
||||||
|
|
||||||
// Try to find common path prefixes
|
|
||||||
var path = item.Path.Replace('\\', '/');
|
|
||||||
var parts = path.Split('/');
|
|
||||||
|
|
||||||
// Build prefix from first few directory levels
|
|
||||||
if (parts.Length > 2)
|
|
||||||
{
|
|
||||||
// Try different prefix lengths to find common ones
|
|
||||||
for (var i = 2; i <= Math.Min(4, parts.Length - 1); i++)
|
|
||||||
{
|
|
||||||
var prefix = string.Join('/', parts.Take(i));
|
|
||||||
if (!string.IsNullOrEmpty(prefix) && !prefix.Contains('.', StringComparison.Ordinal))
|
|
||||||
{
|
|
||||||
pathPrefixes.Add(prefix);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// Sort prefixes by length (shorter = more general)
|
|
||||||
response.DetectedPrefixes = pathPrefixes
|
|
||||||
.OrderBy(p => p.Length)
|
|
||||||
.Take(10)
|
|
||||||
.ToList();
|
|
||||||
|
|
||||||
return Ok(response);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Response containing discovered file paths from Jellyfin libraries.
|
|
||||||
/// </summary>
|
|
||||||
public class DiscoveredPathsResponse
|
|
||||||
{
|
|
||||||
/// <summary>
|
|
||||||
/// Gets or sets sample file paths from the music library.
|
|
||||||
/// </summary>
|
|
||||||
public List<string> SamplePaths { get; set; } = [];
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Gets or sets detected common path prefixes.
|
|
||||||
/// </summary>
|
|
||||||
public List<string> DetectedPrefixes { get; set; } = [];
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
|||||||
@ -1,24 +1,7 @@
|
|||||||
using System.Collections.Generic;
|
|
||||||
using MediaBrowser.Model.Plugins;
|
using MediaBrowser.Model.Plugins;
|
||||||
|
|
||||||
namespace Jellyfin.Plugin.JellyLMS.Configuration;
|
namespace Jellyfin.Plugin.JellyLMS.Configuration;
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Represents a path mapping between Jellyfin and LMS file paths.
|
|
||||||
/// </summary>
|
|
||||||
public class PathMapping
|
|
||||||
{
|
|
||||||
/// <summary>
|
|
||||||
/// Gets or sets the path prefix as seen by Jellyfin.
|
|
||||||
/// </summary>
|
|
||||||
public string JellyfinPath { get; set; } = string.Empty;
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Gets or sets the same path prefix as seen by LMS.
|
|
||||||
/// </summary>
|
|
||||||
public string LmsPath { get; set; } = string.Empty;
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Plugin configuration for JellyLMS.
|
/// Plugin configuration for JellyLMS.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
@ -89,46 +72,14 @@ public class PluginConfiguration : BasePluginConfiguration
|
|||||||
/// <summary>
|
/// <summary>
|
||||||
/// Gets or sets the media path prefix as seen by Jellyfin.
|
/// Gets or sets the media path prefix as seen by Jellyfin.
|
||||||
/// Used for path mapping when UseDirectFilePath is enabled.
|
/// Used for path mapping when UseDirectFilePath is enabled.
|
||||||
/// Deprecated: Use PathMappings instead. Kept for backwards compatibility.
|
/// Example: /media/music or C:\Music.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public string JellyfinMediaPath { get; set; } = string.Empty;
|
public string JellyfinMediaPath { get; set; } = string.Empty;
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Gets or sets the media path prefix as seen by LMS.
|
/// Gets or sets the media path prefix as seen by LMS.
|
||||||
/// Used for path mapping when UseDirectFilePath is enabled.
|
/// Used for path mapping when UseDirectFilePath is enabled.
|
||||||
/// Deprecated: Use PathMappings instead. Kept for backwards compatibility.
|
/// Example: /mnt/music or //nas/music.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public string LmsMediaPath { get; set; } = string.Empty;
|
public string LmsMediaPath { get; set; } = string.Empty;
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Gets or sets the list of path mappings between Jellyfin and LMS.
|
|
||||||
/// Each mapping allows files from different locations to be played via direct file access.
|
|
||||||
/// </summary>
|
|
||||||
public List<PathMapping> PathMappings { get; set; } = new();
|
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Gets all effective path mappings, including legacy single mapping if configured.
|
|
||||||
/// </summary>
|
|
||||||
/// <returns>Enumerable of all configured path mappings.</returns>
|
|
||||||
public IEnumerable<PathMapping> GetAllPathMappings()
|
|
||||||
{
|
|
||||||
// Return configured list mappings first
|
|
||||||
foreach (var mapping in PathMappings)
|
|
||||||
{
|
|
||||||
if (!string.IsNullOrEmpty(mapping.JellyfinPath) && !string.IsNullOrEmpty(mapping.LmsPath))
|
|
||||||
{
|
|
||||||
yield return mapping;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
// Fall back to legacy single mapping for backwards compatibility
|
|
||||||
if (!string.IsNullOrEmpty(JellyfinMediaPath) && !string.IsNullOrEmpty(LmsMediaPath))
|
|
||||||
{
|
|
||||||
yield return new PathMapping
|
|
||||||
{
|
|
||||||
JellyfinPath = JellyfinMediaPath,
|
|
||||||
LmsPath = LmsMediaPath
|
|
||||||
};
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|||||||
@ -154,30 +154,16 @@
|
|||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div id="directPathSettings" style="margin-top: 15px;">
|
<div id="directPathSettings" style="margin-top: 15px;">
|
||||||
<h4 style="margin-bottom: 10px;">Path Mappings</h4>
|
<div class="inputContainer">
|
||||||
<p class="fieldDescription">Map Jellyfin paths to LMS paths. Add multiple mappings if your music and podcasts are in different locations.</p>
|
<label class="inputLabel inputLabelUnfocused" for="JellyfinMediaPath">Jellyfin Media Path</label>
|
||||||
|
<input id="JellyfinMediaPath" name="JellyfinMediaPath" type="text" is="emby-input" placeholder="/media/music" />
|
||||||
<div style="margin-bottom: 15px;">
|
<div class="fieldDescription">The path prefix as Jellyfin sees your media library (e.g., /media/music)</div>
|
||||||
<button is="emby-button" type="button" id="btnDiscoverPaths" class="raised button-alt emby-button">
|
|
||||||
<span>Discover Jellyfin Paths</span>
|
|
||||||
</button>
|
|
||||||
<span id="discoverStatus" style="margin-left: 10px;"></span>
|
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div id="discoveredPaths" style="display: none; margin-bottom: 15px; padding: 10px; background: rgba(0,0,0,0.2); border-radius: 4px;">
|
<div class="inputContainer">
|
||||||
<strong>Detected Jellyfin paths:</strong>
|
<label class="inputLabel inputLabelUnfocused" for="LmsMediaPath">LMS Media Path</label>
|
||||||
<ul id="detectedPrefixList" style="margin: 5px 0; padding-left: 20px;"></ul>
|
<input id="LmsMediaPath" name="LmsMediaPath" type="text" is="emby-input" placeholder="/mnt/music" />
|
||||||
<div class="fieldDescription">Click a path to use it as the Jellyfin path in a new mapping</div>
|
<div class="fieldDescription">The same location as LMS sees it (e.g., /mnt/music or //nas/music)</div>
|
||||||
</div>
|
|
||||||
|
|
||||||
<div id="pathMappingsList">
|
|
||||||
<!-- Dynamic path mappings will be added here -->
|
|
||||||
</div>
|
|
||||||
|
|
||||||
<div style="margin-top: 10px;">
|
|
||||||
<button is="emby-button" type="button" id="btnAddMapping" class="raised button-alt emby-button">
|
|
||||||
<span>+ Add Mapping</span>
|
|
||||||
</button>
|
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
@ -447,113 +433,6 @@
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
// Path Mapping Functions
|
|
||||||
function renderPathMappings(mappings) {
|
|
||||||
var container = document.querySelector('#pathMappingsList');
|
|
||||||
if (!mappings || mappings.length === 0) {
|
|
||||||
container.innerHTML = '<p class="fieldDescription">No path mappings configured. Click "Discover Jellyfin Paths" to get started.</p>';
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
var html = '';
|
|
||||||
mappings.forEach(function(mapping, index) {
|
|
||||||
html += '<div class="path-mapping-row" style="display: flex; gap: 10px; align-items: flex-end; margin-bottom: 10px; padding: 10px; background: rgba(0,0,0,0.1); border-radius: 4px;">';
|
|
||||||
html += '<div style="flex: 1;">';
|
|
||||||
html += '<label class="inputLabel inputLabelUnfocused">Jellyfin Path</label>';
|
|
||||||
html += '<input type="text" is="emby-input" class="mapping-jellyfin-path" data-index="' + index + '" value="' + (mapping.JellyfinPath || '') + '" placeholder="/media/music" />';
|
|
||||||
html += '</div>';
|
|
||||||
html += '<div style="flex: 1;">';
|
|
||||||
html += '<label class="inputLabel inputLabelUnfocused">LMS Path</label>';
|
|
||||||
html += '<input type="text" is="emby-input" class="mapping-lms-path" data-index="' + index + '" value="' + (mapping.LmsPath || '') + '" placeholder="/mnt/music" />';
|
|
||||||
html += '</div>';
|
|
||||||
html += '<button is="emby-button" type="button" class="raised button-alt emby-button btnRemoveMapping" data-index="' + index + '" style="margin-bottom: 0;">';
|
|
||||||
html += '<span>Remove</span>';
|
|
||||||
html += '</button>';
|
|
||||||
html += '</div>';
|
|
||||||
});
|
|
||||||
container.innerHTML = html;
|
|
||||||
|
|
||||||
// Add remove handlers
|
|
||||||
container.querySelectorAll('.btnRemoveMapping').forEach(function(btn) {
|
|
||||||
btn.addEventListener('click', function() {
|
|
||||||
var idx = parseInt(this.getAttribute('data-index'));
|
|
||||||
JellyLmsConfig.pathMappings.splice(idx, 1);
|
|
||||||
renderPathMappings(JellyLmsConfig.pathMappings);
|
|
||||||
});
|
|
||||||
});
|
|
||||||
|
|
||||||
// Update stored mappings when inputs change
|
|
||||||
container.querySelectorAll('.mapping-jellyfin-path, .mapping-lms-path').forEach(function(input) {
|
|
||||||
input.addEventListener('change', function() {
|
|
||||||
var idx = parseInt(this.getAttribute('data-index'));
|
|
||||||
if (this.classList.contains('mapping-jellyfin-path')) {
|
|
||||||
JellyLmsConfig.pathMappings[idx].JellyfinPath = this.value;
|
|
||||||
} else {
|
|
||||||
JellyLmsConfig.pathMappings[idx].LmsPath = this.value;
|
|
||||||
}
|
|
||||||
});
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
function addPathMapping(jellyfinPath, lmsPath) {
|
|
||||||
JellyLmsConfig.pathMappings = JellyLmsConfig.pathMappings || [];
|
|
||||||
JellyLmsConfig.pathMappings.push({
|
|
||||||
JellyfinPath: jellyfinPath || '',
|
|
||||||
LmsPath: lmsPath || ''
|
|
||||||
});
|
|
||||||
renderPathMappings(JellyLmsConfig.pathMappings);
|
|
||||||
}
|
|
||||||
|
|
||||||
function discoverPaths() {
|
|
||||||
var statusDiv = document.querySelector('#discoverStatus');
|
|
||||||
statusDiv.innerHTML = '<span style="color: orange;">Discovering...</span>';
|
|
||||||
|
|
||||||
ApiClient.ajax({
|
|
||||||
url: ApiClient.getUrl('JellyLms/DiscoverPaths'),
|
|
||||||
type: 'GET',
|
|
||||||
dataType: 'json'
|
|
||||||
}).then(function(result) {
|
|
||||||
statusDiv.innerHTML = '';
|
|
||||||
var discoveredDiv = document.querySelector('#discoveredPaths');
|
|
||||||
var prefixList = document.querySelector('#detectedPrefixList');
|
|
||||||
|
|
||||||
if (result.DetectedPrefixes && result.DetectedPrefixes.length > 0) {
|
|
||||||
discoveredDiv.style.display = 'block';
|
|
||||||
var html = '';
|
|
||||||
result.DetectedPrefixes.forEach(function(prefix) {
|
|
||||||
html += '<li><a href="#" class="detected-prefix-link" data-path="' + prefix + '" style="color: #00a4dc;">' + prefix + '</a></li>';
|
|
||||||
});
|
|
||||||
prefixList.innerHTML = html;
|
|
||||||
|
|
||||||
// Add click handlers to use detected paths
|
|
||||||
prefixList.querySelectorAll('.detected-prefix-link').forEach(function(link) {
|
|
||||||
link.addEventListener('click', function(e) {
|
|
||||||
e.preventDefault();
|
|
||||||
addPathMapping(this.getAttribute('data-path'), '');
|
|
||||||
});
|
|
||||||
});
|
|
||||||
} else {
|
|
||||||
discoveredDiv.style.display = 'block';
|
|
||||||
prefixList.innerHTML = '<li>No audio files found in library</li>';
|
|
||||||
}
|
|
||||||
}).catch(function(err) {
|
|
||||||
statusDiv.innerHTML = '<span style="color: red;">Discovery failed</span>';
|
|
||||||
console.error('Path discovery failed:', err);
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
function getPathMappingsFromUI() {
|
|
||||||
var mappings = [];
|
|
||||||
document.querySelectorAll('.path-mapping-row').forEach(function(row) {
|
|
||||||
var jellyfinPath = row.querySelector('.mapping-jellyfin-path').value;
|
|
||||||
var lmsPath = row.querySelector('.mapping-lms-path').value;
|
|
||||||
if (jellyfinPath || lmsPath) {
|
|
||||||
mappings.push({ JellyfinPath: jellyfinPath, LmsPath: lmsPath });
|
|
||||||
}
|
|
||||||
});
|
|
||||||
return mappings;
|
|
||||||
}
|
|
||||||
|
|
||||||
document.querySelector('#JellyLmsConfigPage')
|
document.querySelector('#JellyLmsConfigPage')
|
||||||
.addEventListener('pageshow', function() {
|
.addEventListener('pageshow', function() {
|
||||||
Dashboard.showLoadingMsg();
|
Dashboard.showLoadingMsg();
|
||||||
@ -567,18 +446,8 @@
|
|||||||
document.querySelector('#EnableAutoSync').checked = config.EnableAutoSync !== false;
|
document.querySelector('#EnableAutoSync').checked = config.EnableAutoSync !== false;
|
||||||
document.querySelector('#DefaultPlayerMac').value = config.DefaultPlayerMac || '';
|
document.querySelector('#DefaultPlayerMac').value = config.DefaultPlayerMac || '';
|
||||||
document.querySelector('#UseDirectFilePath').checked = config.UseDirectFilePath || false;
|
document.querySelector('#UseDirectFilePath').checked = config.UseDirectFilePath || false;
|
||||||
|
document.querySelector('#JellyfinMediaPath').value = config.JellyfinMediaPath || '';
|
||||||
// Load path mappings (new list format, with fallback to legacy single mapping)
|
document.querySelector('#LmsMediaPath').value = config.LmsMediaPath || '';
|
||||||
JellyLmsConfig.pathMappings = config.PathMappings || [];
|
|
||||||
// If no list mappings but legacy single mapping exists, show it
|
|
||||||
if (JellyLmsConfig.pathMappings.length === 0 && config.JellyfinMediaPath && config.LmsMediaPath) {
|
|
||||||
JellyLmsConfig.pathMappings = [{
|
|
||||||
JellyfinPath: config.JellyfinMediaPath,
|
|
||||||
LmsPath: config.LmsMediaPath
|
|
||||||
}];
|
|
||||||
}
|
|
||||||
renderPathMappings(JellyLmsConfig.pathMappings);
|
|
||||||
|
|
||||||
Dashboard.hideLoadingMsg();
|
Dashboard.hideLoadingMsg();
|
||||||
|
|
||||||
loadPlayers();
|
loadPlayers();
|
||||||
@ -622,10 +491,8 @@
|
|||||||
config.EnableAutoSync = document.querySelector('#EnableAutoSync').checked;
|
config.EnableAutoSync = document.querySelector('#EnableAutoSync').checked;
|
||||||
config.DefaultPlayerMac = document.querySelector('#DefaultPlayerMac').value;
|
config.DefaultPlayerMac = document.querySelector('#DefaultPlayerMac').value;
|
||||||
config.UseDirectFilePath = document.querySelector('#UseDirectFilePath').checked;
|
config.UseDirectFilePath = document.querySelector('#UseDirectFilePath').checked;
|
||||||
// Save path mappings (clear legacy single mapping when using list)
|
config.JellyfinMediaPath = document.querySelector('#JellyfinMediaPath').value;
|
||||||
config.PathMappings = getPathMappingsFromUI();
|
config.LmsMediaPath = document.querySelector('#LmsMediaPath').value;
|
||||||
config.JellyfinMediaPath = '';
|
|
||||||
config.LmsMediaPath = '';
|
|
||||||
ApiClient.updatePluginConfiguration(JellyLmsConfig.pluginUniqueId, config).then(function (result) {
|
ApiClient.updatePluginConfiguration(JellyLmsConfig.pluginUniqueId, config).then(function (result) {
|
||||||
Dashboard.processPluginConfigurationUpdateResult(result);
|
Dashboard.processPluginConfigurationUpdateResult(result);
|
||||||
});
|
});
|
||||||
@ -634,16 +501,6 @@
|
|||||||
e.preventDefault();
|
e.preventDefault();
|
||||||
return false;
|
return false;
|
||||||
});
|
});
|
||||||
|
|
||||||
document.querySelector('#btnDiscoverPaths')
|
|
||||||
.addEventListener('click', function() {
|
|
||||||
discoverPaths();
|
|
||||||
});
|
|
||||||
|
|
||||||
document.querySelector('#btnAddMapping')
|
|
||||||
.addEventListener('click', function() {
|
|
||||||
addPathMapping('', '');
|
|
||||||
});
|
|
||||||
</script>
|
</script>
|
||||||
</div>
|
</div>
|
||||||
</body>
|
</body>
|
||||||
|
|||||||
@ -422,7 +422,14 @@ public class LmsSessionController : ISessionController, IDisposable
|
|||||||
var positionSeconds = positionTicks / TimeSpan.TicksPerSecond;
|
var positionSeconds = positionTicks / TimeSpan.TicksPerSecond;
|
||||||
|
|
||||||
// Check if we're using direct file path mode - if so, LMS can seek natively
|
// Check if we're using direct file path mode - if so, LMS can seek natively
|
||||||
if (CanSeekNatively())
|
var config = Plugin.Instance?.Configuration;
|
||||||
|
var canSeekNatively = config?.UseDirectFilePath == true
|
||||||
|
&& !string.IsNullOrEmpty(config.JellyfinMediaPath)
|
||||||
|
&& !string.IsNullOrEmpty(config.LmsMediaPath)
|
||||||
|
&& _currentItem?.Path != null
|
||||||
|
&& _currentItem.Path.StartsWith(config.JellyfinMediaPath, StringComparison.OrdinalIgnoreCase);
|
||||||
|
|
||||||
|
if (canSeekNatively)
|
||||||
{
|
{
|
||||||
// Use native LMS seeking - much smoother!
|
// Use native LMS seeking - much smoother!
|
||||||
_logger.LogInformation("Seeking natively to {Seconds}s using LMS time command", positionSeconds);
|
_logger.LogInformation("Seeking natively to {Seconds}s using LMS time command", positionSeconds);
|
||||||
@ -558,27 +565,24 @@ public class LmsSessionController : ISessionController, IDisposable
|
|||||||
{
|
{
|
||||||
var config = Plugin.Instance?.Configuration;
|
var config = Plugin.Instance?.Configuration;
|
||||||
|
|
||||||
// Check if direct file path mode is enabled
|
// Check if direct file path mode is enabled and configured
|
||||||
if (config?.UseDirectFilePath == true && _currentItem?.Path != null)
|
if (config?.UseDirectFilePath == true
|
||||||
|
&& !string.IsNullOrEmpty(config.JellyfinMediaPath)
|
||||||
|
&& !string.IsNullOrEmpty(config.LmsMediaPath)
|
||||||
|
&& _currentItem?.Path != null)
|
||||||
{
|
{
|
||||||
// Try each path mapping until one matches
|
var directPath = BuildDirectFilePath(_currentItem.Path, config.JellyfinMediaPath, config.LmsMediaPath);
|
||||||
foreach (var mapping in config.GetAllPathMappings())
|
if (directPath != null)
|
||||||
{
|
{
|
||||||
var directPath = BuildDirectFilePath(_currentItem.Path, mapping.JellyfinPath, mapping.LmsPath);
|
_logger.LogDebug(
|
||||||
if (directPath != null)
|
"Using direct file path: {OriginalPath} -> {MappedPath}",
|
||||||
{
|
_currentItem.Path,
|
||||||
_logger.LogDebug(
|
directPath);
|
||||||
"Using direct file path with mapping '{JellyfinPath}' -> '{LmsPath}': {OriginalPath} -> {MappedPath}",
|
return (directPath, true);
|
||||||
mapping.JellyfinPath,
|
|
||||||
mapping.LmsPath,
|
|
||||||
_currentItem.Path,
|
|
||||||
directPath);
|
|
||||||
return (directPath, true);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
_logger.LogWarning(
|
_logger.LogWarning(
|
||||||
"Direct file path mode enabled but no path mapping matched for: {Path}",
|
"Direct file path mode enabled but path mapping failed for: {Path}",
|
||||||
_currentItem.Path);
|
_currentItem.Path);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -586,31 +590,6 @@ public class LmsSessionController : ISessionController, IDisposable
|
|||||||
return (BuildStreamUrlWithPosition(itemId, startPositionTicks), false);
|
return (BuildStreamUrlWithPosition(itemId, startPositionTicks), false);
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
|
||||||
/// Checks if the current item can use native LMS seeking (direct file path mode).
|
|
||||||
/// </summary>
|
|
||||||
private bool CanSeekNatively()
|
|
||||||
{
|
|
||||||
var config = Plugin.Instance?.Configuration;
|
|
||||||
if (config?.UseDirectFilePath != true || _currentItem?.Path == null)
|
|
||||||
{
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
// Check if any mapping matches the current item's path
|
|
||||||
foreach (var mapping in config.GetAllPathMappings())
|
|
||||||
{
|
|
||||||
var normalizedPath = _currentItem.Path.Replace('\\', '/');
|
|
||||||
var normalizedPrefix = mapping.JellyfinPath.TrimEnd('/', '\\').Replace('\\', '/');
|
|
||||||
if (normalizedPath.StartsWith(normalizedPrefix, StringComparison.OrdinalIgnoreCase))
|
|
||||||
{
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
/// Maps a Jellyfin file path to an LMS file path using the configured path prefixes.
|
/// Maps a Jellyfin file path to an LMS file path using the configured path prefixes.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
|
|||||||
14
README.md
14
README.md
@ -2,20 +2,6 @@
|
|||||||
|
|
||||||
A Jellyfin plugin that bridges audio playback to Logitech Media Server (LMS) for multi-room synchronized playback.
|
A Jellyfin plugin that bridges audio playback to Logitech Media Server (LMS) for multi-room synchronized playback.
|
||||||
|
|
||||||
## Quick Install
|
|
||||||
|
|
||||||
Add the following repository URL to your Jellyfin server to install JellyLMS directly from the plugin catalog:
|
|
||||||
|
|
||||||
```
|
|
||||||
https://gitea.tourolle.paris/dtourolle/jellyLMS/raw/branch/master/manifest.json
|
|
||||||
```
|
|
||||||
|
|
||||||
**Steps:**
|
|
||||||
1. Go to **Dashboard** → **Plugins** → **Repositories**
|
|
||||||
2. Click **Add** and paste the URL above
|
|
||||||
3. Go to **Catalog** and find "JellyLMS"
|
|
||||||
4. Click **Install** and restart Jellyfin
|
|
||||||
|
|
||||||
## Overview
|
## Overview
|
||||||
|
|
||||||
JellyLMS enables Jellyfin to stream audio to LMS, which acts as a multi-room speaker system. The architecture is:
|
JellyLMS enables Jellyfin to stream audio to LMS, which acts as a multi-room speaker system. The architecture is:
|
||||||
|
|||||||
@ -1,20 +0,0 @@
|
|||||||
[
|
|
||||||
{
|
|
||||||
"guid": "a5b8c9d0-1e2f-3a4b-5c6d-7e8f9a0b1c2d",
|
|
||||||
"name": "JellyLMS",
|
|
||||||
"description": "Stream Jellyfin audio to Logitech Media Server (LMS) for multi-room playback",
|
|
||||||
"overview": "Bridges Jellyfin audio playback to LMS for synchronized multi-room playback across Squeezebox players",
|
|
||||||
"owner": "dtourolle",
|
|
||||||
"category": "Music",
|
|
||||||
"versions": [
|
|
||||||
{
|
|
||||||
"version": "1.0.0",
|
|
||||||
"changelog": "Release 1.0.0",
|
|
||||||
"targetAbi": "10.10.0.0",
|
|
||||||
"sourceUrl": "https://gitea.tourolle.paris/dtourolle/jellyLMS/releases/download/v1.0.0/jellylms_1.0.0.0.zip",
|
|
||||||
"checksum": "b6194d5ceb5ec0ea711a48f6d34a290d",
|
|
||||||
"timestamp": "2025-12-20T13:54:14Z"
|
|
||||||
}
|
|
||||||
]
|
|
||||||
}
|
|
||||||
]
|
|
||||||
Loading…
x
Reference in New Issue
Block a user