From b55f17072cf78ecdb59a3ce935b4ae71c0b8fd1f Mon Sep 17 00:00:00 2001 From: qwqVictor Date: Thu, 26 Jan 2023 20:28:38 +0800 Subject: [PATCH 1/2] fix extracting lyrics with CR newline --- .../naman14/timber/utils/LyricsExtractor.java | 17 +++++++++++++---- 1 file changed, 13 insertions(+), 4 deletions(-) diff --git a/app/src/main/java/com/naman14/timber/utils/LyricsExtractor.java b/app/src/main/java/com/naman14/timber/utils/LyricsExtractor.java index 151bac513..6cc3bda66 100644 --- a/app/src/main/java/com/naman14/timber/utils/LyricsExtractor.java +++ b/app/src/main/java/com/naman14/timber/utils/LyricsExtractor.java @@ -15,20 +15,29 @@ public class LyricsExtractor { public static String getLyrics(File file){ String filename = file.getName(); String fileending = filename.substring(filename.lastIndexOf('.')+1,filename.length()).toLowerCase(); + String lyric = null; try{ switch(fileending){ case "mp3": - return getLyricsID3(file); + lyric = getLyricsID3(file); + break; case "mp4": case "m4a": case "aac": - return getLyricsMP4(file); + lyric = getLyricsMP4(file); + break; case "ogg": case "oga": - return getLyricsVorbis(file); + lyric = getLyricsVorbis(file); + break; } }catch(Exception e){} - return null; + /* iTunes and some music manager use CR as newline, we replace CRLF and CR to LF to ensure it + * be correctly displayed */ + if (lyric != null) { + lyric = lyric.replace("\r\n", "\n").replace("\r", "\n"); + } + return lyric; } private static int readOgg(byte[] buf, InputStream in, int bytesinpage, int skip) throws IOException { From 6266b70602c96bcc567eae373752c6184cca3a27 Mon Sep 17 00:00:00 2001 From: qwqVictor Date: Thu, 26 Jan 2023 20:38:44 +0800 Subject: [PATCH 2/2] add localization strings for Simplified Chinese --- app/src/main/res/values-zh/strings.xml | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/app/src/main/res/values-zh/strings.xml b/app/src/main/res/values-zh/strings.xml index 64f8886c6..d293a71bf 100644 --- a/app/src/main/res/values-zh/strings.xml +++ b/app/src/main/res/values-zh/strings.xml @@ -149,4 +149,10 @@ 取消 + 显示歌词 + 找不到歌词 + 歌词由 makeitpersonal.co提供 + Cast + \"没有选中的播放中曲目 + 加载中...