Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(lyrics-plus): add japanese lyrics conversion tool #1990

Merged
merged 37 commits into from
Dec 26, 2022
Merged
Show file tree
Hide file tree
Changes from 10 commits
Commits
Show all changes
37 commits
Select commit Hold shift + click to select a range
d75977b
feat(lyricsplus): Added conversion tools for Japanese Lyrics (#1988)
41pha1 Oct 22, 2022
d9afcb2
feat(lyricsplus): Added conversion tools for Japanese Lyrics
41pha1 Oct 22, 2022
f95981a
Merge branch 'lyrics-converter' of https://github.com/41pha1/spicetif…
41pha1 Oct 22, 2022
74da324
feat: added conversion tools for japanese lyrics
41pha1 Oct 22, 2022
2caeb23
Merge branch 'lyrics-converter' of https://github.com/41pha1/spicetif…
41pha1 Oct 22, 2022
2042f54
fix: added dictionary files
41pha1 Oct 22, 2022
7642f4e
fix: added dictionary files
41pha1 Oct 22, 2022
9928723
fix: prettified dicts
41pha1 Oct 22, 2022
2e50943
feat: added lyric conversion description to readme
41pha1 Oct 22, 2022
6757de1
fix: added credit to the original kuroshiro repo
41pha1 Oct 22, 2022
6de3761
fix: capitalization in readme credits
41pha1 Oct 23, 2022
8fb0a2c
fix: capitalization and style in readme
41pha1 Oct 23, 2022
9f785e5
fix: load the correct lyrics for unsynced lyrics
41pha1 Oct 23, 2022
d581a0c
fix: fetch dicts via jsdeliver if not found
41pha1 Oct 23, 2022
fccc83f
fix: prettfied translator
41pha1 Oct 23, 2022
45de998
fix: properly assigning the japanese lyric variables to null
41pha1 Oct 23, 2022
76649eb
fix: conversion tools work for unsynced songs too now
41pha1 Oct 23, 2022
2c9d7b1
Merge branch 'lyrics-converter' of https://github.com/41pha1/spicetif…
41pha1 Oct 23, 2022
6190cb2
refactor: use nullish coalescing operator
rxri Oct 23, 2022
3373878
refactor: changing let to const in utils.js
41pha1 Oct 23, 2022
2b2e340
refactor: changing let to const in index.js translate
41pha1 Oct 23, 2022
a55b865
refactor: changing let to const for translated lyrics var
41pha1 Oct 23, 2022
fd715a7
refactor: changing let to const for conversion menu paramaters
41pha1 Oct 23, 2022
16c7c37
refactor: prettified files
41pha1 Oct 23, 2022
d28c271
refactor: use cont instead of let for clarity in util.js
41pha1 Oct 23, 2022
7e2b63f
Merge remote-tracking branch 'upstream/master' into lyrics-converter
41pha1 Oct 29, 2022
94098b4
merge: resolved merge conflicts from #1992
41pha1 Oct 29, 2022
ba86eee
feat: changed urls to load dictionaries from new origin
41pha1 Oct 30, 2022
392a6e9
Merge branch 'spicetify:master' into lyrics-converter
41pha1 Oct 30, 2022
46acc2d
fix: added a check if lyrics are japanese
41pha1 Nov 1, 2022
dfceb90
refactor: prettiefied lyrics-plus with correct config.
41pha1 Nov 1, 2022
2d67f8e
refactor: added uncompressed code into separate files
41pha1 Nov 5, 2022
a77b2df
Revert "refactor: added uncompressed code into separate files"
41pha1 Nov 5, 2022
a5bfbac
refactor: now loading kuroshiro from npm
41pha1 Dec 25, 2022
99a90ea
Merge remote-tracking branch 'origin/master' into lyrics-converter
41pha1 Dec 25, 2022
38a6eb8
fix: prevent applying the xmlhttp fix twice
41pha1 Dec 25, 2022
f6cf5f8
style: prettier
41pha1 Dec 25, 2022
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
70 changes: 70 additions & 0 deletions CustomApps/lyrics-plus/OptionsMenu.js
Original file line number Diff line number Diff line change
Expand Up @@ -85,6 +85,76 @@ const OptionsMenu = react.memo(({ options, onSelect, selected, defaultValue, bol
);
});

const TranslationMenu = react.memo(({ showTranslationButton, translatorLoaded }) => {
if (!showTranslationButton) return null;

return react.createElement(
Spicetify.ReactComponent.ContextMenu,
{
menu: react.createElement(
Spicetify.ReactComponent.Menu,
{},
react.createElement("h3", null, " Conversions"),
translatorLoaded
? react.createElement(OptionList, {
items: [
{
desc: "Mode",
key: "translation-mode",
type: ConfigSelection,
options: {
furigana: "Furigana",
romaji: "Romaji",
hiragana: "Hiragana",
katakana: "Katakana",
},
renderInline: true,
},
{
desc: "Convert",
key: "translate",
type: ConfigSlider,
trigger: "click",
action: "toggle",
renderInline: true,
},
],
onChange: (name, value) => {
CONFIG.visual[name] = value;
localStorage.setItem(`${APP_NAME}:visual:${name}`, value);
lyricContainerUpdate && lyricContainerUpdate();
},
})
: react.createElement(
"div",
null,
react.createElement("p1", null, "Loading"),
react.createElement("div", { class: "lyircs-translation-spinner" }, "")
)
),
trigger: "click",
action: "toggle",
renderInline: true,
},
react.createElement(
"button",
{
className: "lyrics-config-button",
},
react.createElement(
"p1",
{
width: 16,
height: 16,
viewBox: "0 0 16 10.3",
fill: "currentColor",
},
"あ"
)
)
);
});

const AdjustmentsMenu = react.memo(({ mode }) => {
return react.createElement(
Spicetify.ReactComponent.ContextMenu,
Expand Down
42 changes: 35 additions & 7 deletions CustomApps/lyrics-plus/Pages.js
Original file line number Diff line number Diff line change
Expand Up @@ -30,9 +30,15 @@ const IdlingIndicator = ({ isActive, progress, delay }) => {
"--indicator-delay": delay + "ms",
},
},
react.createElement("div", { className: `lyrics-idling-indicator__circle ${progress >= 0.05 ? "active" : ""}` }),
react.createElement("div", { className: `lyrics-idling-indicator__circle ${progress >= 0.33 ? "active" : ""}` }),
react.createElement("div", { className: `lyrics-idling-indicator__circle ${progress >= 0.66 ? "active" : ""}` })
react.createElement("div", {
className: `lyrics-idling-indicator__circle ${progress >= 0.05 ? "active" : ""}`,
}),
react.createElement("div", {
className: `lyrics-idling-indicator__circle ${progress >= 0.33 ? "active" : ""}`,
}),
react.createElement("div", {
className: `lyrics-idling-indicator__circle ${progress >= 0.66 ? "active" : ""}`,
})
);
};

Expand Down Expand Up @@ -204,7 +210,14 @@ const SyncedLyricsPage = react.memo(({ lyrics = [], provider, copyright, isKara
.catch(() => Spicetify.showNotification("Failed to copy lyrics to clipboard"));
},
},
!isKara ? text : react.createElement(KaraokeLine, { text, startTime, position, isActive })
!isKara
? text
: react.createElement(KaraokeLine, {
text,
startTime,
position,
isActive,
})
);
})
),
Expand Down Expand Up @@ -458,7 +471,14 @@ const SyncedExpandedLyricsPage = react.memo(({ lyrics, provider, copyright, isKa
.catch(() => Spicetify.showNotification("Failed to copy lyrics to clipboard"));
},
},
!isKara ? text : react.createElement(KaraokeLine, { text, startTime, position, isActive })
!isKara
? text
: react.createElement(KaraokeLine, {
text,
startTime,
position,
isActive,
})
);
}),
react.createElement("p", {
Expand Down Expand Up @@ -581,7 +601,11 @@ const GeniusPage = react.memo(
const lyricsEl1 = react.createElement(
"div",
null,
react.createElement(VersionSelector, { items: versions, index: versionIndex, callback: onVersionChange }),
react.createElement(VersionSelector, {
items: versions,
index: versionIndex,
callback: onVersionChange,
}),
react.createElement("div", {
className: "lyrics-lyricsContainer-LyricsLine lyrics-lyricsContainer-LyricsLine-active",
ref: (c) => (container = c),
Expand All @@ -599,7 +623,11 @@ const GeniusPage = react.memo(
const lyricsEl2 = react.createElement(
"div",
null,
react.createElement(VersionSelector, { items: versions, index: versionIndex2, callback: onVersionChange2 }),
react.createElement(VersionSelector, {
items: versions,
index: versionIndex2,
callback: onVersionChange2,
}),
react.createElement("div", {
className: "lyrics-lyricsContainer-LyricsLine lyrics-lyricsContainer-LyricsLine-active",
ref: (c) => (container2 = c),
Expand Down
5 changes: 5 additions & 0 deletions CustomApps/lyrics-plus/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,10 @@ Lyrics in Unsynced and Genius modes can be search and jump to. Hit Ctrl + Shift

![search](./search.png)

Choose between different option of displaying japanese lyrics. [Furigana, Romaji, Hirgana, Katakana]
41pha1 marked this conversation as resolved.
Show resolved Hide resolved

![conversion](./conversion.png)

Customise colors, change providers' priorities in config menu. Config menu locates in Profile Menu (top right button with your user name).

To install, run:
Expand All @@ -35,3 +39,4 @@ spicetify apply

- A few parts of app code are taken from Spotify official app, including SyncedLyricsPage, CSS animation and TabBar. Please do not distribute these code else where out of Spotify/Spicetify context.
- Netease synced lyrics parser is adapted from [mantou132/Spotify-Lyrics](https://github.com/mantou132/Spotify-Lyrics). Give it a Star if you like this app.
- The Algorithm for converting japanese lyrics is based on [Hexenq's Kuroshiro](https://github.com/hexenq/kuroshiro).
41pha1 marked this conversation as resolved.
Show resolved Hide resolved
Loading