mirror of
https://github.com/jeffvli/feishin.git
synced 2026-07-24 19:36:30 +02:00
Add support for OpenSubsonic enhanced lyrics (#2208)
This commit is contained in:
@@ -0,0 +1,14 @@
|
||||
const textEncoder = new TextEncoder();
|
||||
const textDecoder = new TextDecoder();
|
||||
|
||||
export const sliceUtf8Bytes = (value: string, byteStart: number, byteEnd: number): string => {
|
||||
const bytes = textEncoder.encode(value);
|
||||
const start = Math.max(0, byteStart);
|
||||
const end = Math.min(bytes.length - 1, byteEnd);
|
||||
|
||||
if (start > end || bytes.length === 0) {
|
||||
return '';
|
||||
}
|
||||
|
||||
return textDecoder.decode(bytes.slice(start, end + 1));
|
||||
};
|
||||
Reference in New Issue
Block a user