mirror of
https://github.com/KevinMidboe/seasoned.git
synced 2026-03-11 11:55:38 +00:00
Update Plex library item URLs to use app.plex.tv format
Change library item links to use the official Plex Web App URL format
instead of direct server URLs. This ensures items open correctly in
the Plex web interface.
Changes:
- usePlexApi.fetchPlexServers() now returns machineIdentifier (clientIdentifier)
- PlexSettings stores and passes machineId through the library loading flow
- usePlexLibraries.loadLibraries() accepts machineIdentifier parameter
- processLibrarySection() passes machineIdentifier to processLibraryItem()
- plexHelpers.processLibraryItem() updated signature and URL generation
New URL format:
https://app.plex.tv/desktop/#!/server/{machineId}/details?key=%2Flibrary%2Fmetadata%2F{ratingKey}
Example:
fe85f47ef9/details
Benefits:
- Links work universally (not dependent on local server URL)
- Opens in official Plex Web App with full functionality
- Consistent with Plex's own linking conventions
- Works from any network location
This commit is contained in:
@@ -86,6 +86,7 @@
|
|||||||
|
|
||||||
const plexServer = ref("");
|
const plexServer = ref("");
|
||||||
const plexServerUrl = ref("");
|
const plexServerUrl = ref("");
|
||||||
|
const plexMachineId = ref("");
|
||||||
const lastSync = ref("");
|
const lastSync = ref("");
|
||||||
const libraryStats = ref({
|
const libraryStats = ref({
|
||||||
movies: 0,
|
movies: 0,
|
||||||
@@ -153,6 +154,7 @@
|
|||||||
|
|
||||||
plexServer.value = server.name;
|
plexServer.value = server.name;
|
||||||
plexServerUrl.value = server.url;
|
plexServerUrl.value = server.url;
|
||||||
|
plexMachineId.value = server.machineIdentifier;
|
||||||
lastSync.value = new Date().toLocaleString();
|
lastSync.value = new Date().toLocaleString();
|
||||||
|
|
||||||
const sections = await fetchLibrarySections(authToken, server.url);
|
const sections = await fetchLibrarySections(authToken, server.url);
|
||||||
@@ -165,6 +167,7 @@
|
|||||||
sections,
|
sections,
|
||||||
authToken,
|
authToken,
|
||||||
server.url,
|
server.url,
|
||||||
|
server.machineIdentifier,
|
||||||
plexUsername.value,
|
plexUsername.value,
|
||||||
fetchLibraryDetails
|
fetchLibraryDetails
|
||||||
);
|
);
|
||||||
|
|||||||
@@ -100,7 +100,11 @@ export function usePlexApi() {
|
|||||||
if (connection) {
|
if (connection) {
|
||||||
plexServerUrl.value = connection.uri;
|
plexServerUrl.value = connection.uri;
|
||||||
}
|
}
|
||||||
return { name: ownedServer.name, url: plexServerUrl.value };
|
return {
|
||||||
|
name: ownedServer.name,
|
||||||
|
url: plexServerUrl.value,
|
||||||
|
machineIdentifier: ownedServer.clientIdentifier
|
||||||
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
return null;
|
return null;
|
||||||
|
|||||||
@@ -9,6 +9,7 @@ export function usePlexLibraries() {
|
|||||||
sections: any[],
|
sections: any[],
|
||||||
authToken: string,
|
authToken: string,
|
||||||
serverUrl: string,
|
serverUrl: string,
|
||||||
|
machineIdentifier: string,
|
||||||
username: string,
|
username: string,
|
||||||
fetchLibraryDetailsFn: any
|
fetchLibraryDetailsFn: any
|
||||||
) {
|
) {
|
||||||
@@ -40,6 +41,7 @@ export function usePlexLibraries() {
|
|||||||
await processLibrarySection(
|
await processLibrarySection(
|
||||||
authToken,
|
authToken,
|
||||||
serverUrl,
|
serverUrl,
|
||||||
|
machineIdentifier,
|
||||||
key,
|
key,
|
||||||
"movies",
|
"movies",
|
||||||
stats,
|
stats,
|
||||||
@@ -50,6 +52,7 @@ export function usePlexLibraries() {
|
|||||||
await processLibrarySection(
|
await processLibrarySection(
|
||||||
authToken,
|
authToken,
|
||||||
serverUrl,
|
serverUrl,
|
||||||
|
machineIdentifier,
|
||||||
key,
|
key,
|
||||||
"shows",
|
"shows",
|
||||||
stats,
|
stats,
|
||||||
@@ -60,6 +63,7 @@ export function usePlexLibraries() {
|
|||||||
await processLibrarySection(
|
await processLibrarySection(
|
||||||
authToken,
|
authToken,
|
||||||
serverUrl,
|
serverUrl,
|
||||||
|
machineIdentifier,
|
||||||
key,
|
key,
|
||||||
"music",
|
"music",
|
||||||
stats,
|
stats,
|
||||||
@@ -102,6 +106,7 @@ export function usePlexLibraries() {
|
|||||||
async function processLibrarySection(
|
async function processLibrarySection(
|
||||||
authToken: string,
|
authToken: string,
|
||||||
serverUrl: string,
|
serverUrl: string,
|
||||||
|
machineIdentifier: string,
|
||||||
sectionKey: string,
|
sectionKey: string,
|
||||||
libraryType: string,
|
libraryType: string,
|
||||||
stats: any,
|
stats: any,
|
||||||
@@ -129,7 +134,13 @@ export function usePlexLibraries() {
|
|||||||
|
|
||||||
// Process recently added items
|
// Process recently added items
|
||||||
const recentItems = data.recentMetadata.map((item: any) =>
|
const recentItems = data.recentMetadata.map((item: any) =>
|
||||||
processLibraryItem(item, libraryType, authToken, serverUrl)
|
processLibraryItem(
|
||||||
|
item,
|
||||||
|
libraryType,
|
||||||
|
authToken,
|
||||||
|
serverUrl,
|
||||||
|
machineIdentifier
|
||||||
|
)
|
||||||
);
|
);
|
||||||
|
|
||||||
// Calculate stats
|
// Calculate stats
|
||||||
|
|||||||
@@ -56,7 +56,8 @@ export function processLibraryItem(
|
|||||||
item: any,
|
item: any,
|
||||||
libraryType: string,
|
libraryType: string,
|
||||||
authToken: string,
|
authToken: string,
|
||||||
serverUrl: string
|
serverUrl: string,
|
||||||
|
machineIdentifier: string
|
||||||
) {
|
) {
|
||||||
// Get poster/thumbnail URL
|
// Get poster/thumbnail URL
|
||||||
let posterUrl = null;
|
let posterUrl = null;
|
||||||
@@ -67,13 +68,12 @@ export function processLibraryItem(
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Build Plex Web App URL
|
// Build Plex Web App URL
|
||||||
// Format: https://app.plex.tv/desktop/#!/server/{machineId}/details?key=/library/metadata/{ratingKey}
|
// Format: https://app.plex.tv/desktop/#!/server/{machineId}/details?key=%2Flibrary%2Fmetadata%2F{ratingKey}
|
||||||
const ratingKey = item.ratingKey || item.key;
|
const ratingKey = item.ratingKey || item.key;
|
||||||
let plexUrl = null;
|
let plexUrl = null;
|
||||||
if (ratingKey) {
|
if (ratingKey && machineIdentifier) {
|
||||||
// Extract machine ID from serverUrl or use a placeholder
|
const encodedKey = encodeURIComponent(`/library/metadata/${ratingKey}`);
|
||||||
// For now, we'll create a direct link to the library metadata
|
plexUrl = `https://app.plex.tv/desktop/#!/server/${machineIdentifier}/details?key=${encodedKey}`;
|
||||||
plexUrl = `${serverUrl}/web/index.html#!/server/library/metadata/${ratingKey}`;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
const baseItem = {
|
const baseItem = {
|
||||||
|
|||||||
Reference in New Issue
Block a user