1
0
Fork 0
mirror of https://github.com/jellyfin/jellyfin-web synced 2025-03-30 19:56:21 +00:00

add Lyrics

This commit is contained in:
robert-hamilton36 2023-04-28 15:38:51 +12:00
parent 5defb79271
commit c42b96df3e
13 changed files with 456 additions and 7 deletions

View file

@ -183,6 +183,14 @@ export function getCommands(options) {
id: 'delete',
icon: 'delete'
});
if (item.Type === 'Audio' && item.HasLyrics && window.location.href.includes(item.Id)) {
commands.push({
name: globalize.translate('DeleteLyrics'),
id: 'deleteLyrics',
icon: 'delete_sweep'
});
}
}
// Books are promoted to major download Button and therefor excluded in the context menu
@ -313,6 +321,14 @@ export function getCommands(options) {
});
}
if (item.HasLyrics) {
commands.push({
name: globalize.translate('ViewLyrics'),
id: 'lyrics',
icon: 'lyrics'
});
}
return commands;
}
@ -495,6 +511,9 @@ function executeCommand(item, id, options) {
case 'delete':
deleteItem(apiClient, item).then(getResolveFunction(resolve, id, true, true), getResolveFunction(resolve, id));
break;
case 'deleteLyrics':
deleteLyrics(apiClient, item).then(getResolveFunction(resolve, id, true), getResolveFunction(resolve, id));
break;
case 'share':
navigator.share({
title: item.Name,
@ -510,6 +529,15 @@ function executeCommand(item, id, options) {
appRouter.showItem(item.AlbumArtists[0].Id, item.ServerId);
getResolveFunction(resolve, id)();
break;
case 'lyrics': {
if (options.isMobile) {
appRouter.show('lyrics');
} else {
appRouter.showItem(item.Id, item.ServerId);
}
getResolveFunction(resolve, id)();
break;
}
case 'playallfromhere':
getResolveFunction(resolve, id)();
break;
@ -636,6 +664,12 @@ function deleteItem(apiClient, item) {
});
}
function deleteLyrics(apiClient, item) {
return import('../scripts/deleteHelper').then((deleteHelper) => {
return deleteHelper.deleteLyrics(item);
});
}
function refresh(apiClient, item) {
import('./refreshdialog/refreshdialog').then(({ default: RefreshDialog }) => {
new RefreshDialog({