Script 'mail_helper' called by obssrc Hello community, here is the log from the commit of package waylyrics for openSUSE:Factory checked in at 2024-02-14 23:19:59 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Comparing /work/SRC/openSUSE:Factory/waylyrics (Old) and /work/SRC/openSUSE:Factory/.waylyrics.new.1815 (New) ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "waylyrics" Wed Feb 14 23:19:59 2024 rev:5 rq:1146600 version:0.2.3 Changes: -------- --- /work/SRC/openSUSE:Factory/waylyrics/waylyrics.changes 2024-02-11 15:46:02.951699815 +0100 +++ /work/SRC/openSUSE:Factory/.waylyrics.new.1815/waylyrics.changes 2024-02-14 23:20:11.183384301 +0100 @@ -1,0 +2,22 @@ +Wed Feb 14 07:30:13 UTC 2024 - [email protected] + +- Update to version 0.2.3: + * feat: add `trans` theme [ci skip] + * chore: release 0.2.3 + * ci: migrate to dtolnay/rust-toolchain + * feat: allow to show origin lyric in above + * fix: set 20ms as default lyric update interval + * feat: set empty label explictly + * refactor: apply clippy fix [ci skip] + * chore: remove unreachable `title.unwrap_or()` call + * doc: restate outdated doc of `TrackMeta` + * doc: `lollypop`, GTK3-based local music player + * feat: intro `is_likely_songid` for songid verification + * doc: firefox via Plasma Integration [ci skip] + * doc: explain more fields in `Config` + * doc: add `osdlyrics` to alternatives [ci skip] + * doc: play with musicfox need position fix patch + * refactor: rename confusing `match_lyric` to `verify_lyric` [ci skip] + * test: add unit tests for QQMusic::init + +------------------------------------------------------------------- Old: ---- waylyrics-0.2.2.obscpio New: ---- waylyrics-0.2.3.obscpio ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++ Other differences: ------------------ ++++++ waylyrics.spec ++++++ --- /var/tmp/diff_new_pack.rRTik8/_old 2024-02-14 23:20:12.167419778 +0100 +++ /var/tmp/diff_new_pack.rRTik8/_new 2024-02-14 23:20:12.171419922 +0100 @@ -17,7 +17,7 @@ Name: waylyrics -Version: 0.2.2 +Version: 0.2.3 Release: 0 Summary: The furry way to show desktop lyrics License: MIT ++++++ _service ++++++ --- /var/tmp/diff_new_pack.rRTik8/_old 2024-02-14 23:20:12.199420931 +0100 +++ /var/tmp/diff_new_pack.rRTik8/_new 2024-02-14 23:20:12.199420931 +0100 @@ -3,7 +3,7 @@ <param name="url">https://github.com/waylyrics/waylyrics.git</param> <param name="versionformat">@PARENT_TAG@</param> <param name="scm">git</param> - <param name="revision">v0.2.2</param> + <param name="revision">v0.2.3</param> <param name="match-tag">*</param> <!--<param name="parent-tag">4c93d60a3c95ef2a8a3acc88a9ca11bbd70d2c5a</param>--> <param name="versionrewrite-pattern">v(\d+\.\d+\.\d+)</param> ++++++ _servicedata ++++++ --- /var/tmp/diff_new_pack.rRTik8/_old 2024-02-14 23:20:12.219421652 +0100 +++ /var/tmp/diff_new_pack.rRTik8/_new 2024-02-14 23:20:12.227421941 +0100 @@ -1,6 +1,6 @@ <servicedata> <service name="tar_scm"> <param name="url">https://github.com/waylyrics/waylyrics.git</param> - <param name="changesrevision">81c6155c26573bfc7feee3accdbdb96c41e39a4a</param></service></servicedata> + <param name="changesrevision">a74cbdad5e2296e842386bb78dbf0eee62b97024</param></service></servicedata> (No newline at EOF) ++++++ vendor.tar.zst ++++++ Binary files /var/tmp/diff_new_pack.rRTik8/_old and /var/tmp/diff_new_pack.rRTik8/_new differ ++++++ waylyrics-0.2.2.obscpio -> waylyrics-0.2.3.obscpio ++++++ diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/waylyrics-0.2.2/.github/workflows/docs.yaml new/waylyrics-0.2.3/.github/workflows/docs.yaml --- old/waylyrics-0.2.2/.github/workflows/docs.yaml 2024-02-10 13:24:28.000000000 +0100 +++ new/waylyrics-0.2.3/.github/workflows/docs.yaml 2024-02-13 07:31:55.000000000 +0100 @@ -19,25 +19,16 @@ - name: Checkout Repository uses: actions/checkout@v3 - - name: Install Rust toolchain - uses: actions-rs/toolchain@v1 - with: - toolchain: nightly - profile: minimal - override: true - components: rustfmt, rust-src + - name: Setup Rust Toolchain + uses: dtolnay/rust-toolchain@stable - - name: Install deps run: | sudo apt update sudo apt install -y --no-install-recommends libgtk-4-dev libdbus-1-dev pkg-config - name: Build Documentation - uses: actions-rs/cargo@v1 - with: - command: doc - args: --all --no-deps --document-private-items + run: cargo doc --all --no-deps --document-private-items - name: Deploy Documentation env: diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/waylyrics-0.2.2/.github/workflows/test.yml new/waylyrics-0.2.3/.github/workflows/test.yml --- old/waylyrics-0.2.2/.github/workflows/test.yml 2024-02-10 13:24:28.000000000 +0100 +++ new/waylyrics-0.2.3/.github/workflows/test.yml 2024-02-13 07:31:55.000000000 +0100 @@ -15,8 +15,10 @@ steps: - uses: actions/checkout@v3 - - run: rustup toolchain install nightly --profile minimal - - run: rustup default nightly + + - name: Setup Rust Toolchain + uses: dtolnay/rust-toolchain@stable + - name: Install deps run: | sudo apt update diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/waylyrics-0.2.2/Cargo.lock new/waylyrics-0.2.3/Cargo.lock --- old/waylyrics-0.2.2/Cargo.lock 2024-02-10 13:24:28.000000000 +0100 +++ new/waylyrics-0.2.3/Cargo.lock 2024-02-13 07:31:55.000000000 +0100 @@ -2664,7 +2664,7 @@ [[package]] name = "waylyrics" -version = "0.2.2" +version = "0.2.3" dependencies = [ "anyhow", "async-trait", diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/waylyrics-0.2.2/Cargo.toml new/waylyrics-0.2.3/Cargo.toml --- old/waylyrics-0.2.2/Cargo.toml 2024-02-10 13:24:28.000000000 +0100 +++ new/waylyrics-0.2.3/Cargo.toml 2024-02-13 07:31:55.000000000 +0100 @@ -1,6 +1,6 @@ [package] name = "waylyrics" -version = "0.2.2" +version = "0.2.3" edition = "2021" description = "Simple On Screen lyrics Display for linux/unix" authors = ["poly000"] diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/waylyrics-0.2.2/README.en.md new/waylyrics-0.2.3/README.en.md --- old/waylyrics-0.2.2/README.en.md 2024-02-10 13:24:28.000000000 +0100 +++ new/waylyrics-0.2.3/README.en.md 2024-02-13 07:31:55.000000000 +0100 @@ -13,6 +13,7 @@ - [Requirement](#requirement) - [Recommended Players](#recommended-players) - [online](#online) + - [Browser](#browser) - [GTK+](#gtk) - [Qt](#qt) - [Electron](#electron) @@ -48,6 +49,13 @@ #### online +##### Browser + +[plasma integration]: https://addons.mozilla.org/en-US/firefox/addon/plasma-integration/ + +- Chrome +- Firefox, with [plasma integration] + ##### GTK+ - [netease-cloud-music-gtk](https://github.com/gmg137/netease-cloud-music-gtk) @@ -66,13 +74,14 @@ ##### TUI -- [go-musicfox](https://github.com/go-musicfox/go-musicfox) +- [go-musicfox](https://github.com/go-musicfox/go-musicfox), with [352bd99](https://github.com/go-musicfox/go-musicfox/commit/352bd9903f759eed98b1079fd44dc37a95da85d2) patch #### local ##### GTK+ - [amberol](https://gitlab.gnome.org/World/amberol) +- [lollypop](https://github.com/hamonikr/lollypop) ##### Native @@ -88,11 +97,10 @@ [youtube-music]: https://github.com/th-ch/youtube-music -| Player | OSD | issue | -| ----------------------- | --- | ---------------------------- | -| Firefox | X | do not provide position call | -| qqmusic | O | position stays on 0 | -| [flutter-netease-music] | X | no mpris support | +| Player | OSD | issue | +| ----------------------- | --- | ------------------- | +| qqmusic | O | position stays on 0 | +| [flutter-netease-music] | X | no mpris support | ## Directories @@ -114,16 +122,18 @@ [desktop-lyric]: https://github.com/tuberry/desktop-lyric [AutoLyric]: https://www.autolyric.com/ [Lyricify]: https://github.com/WXRIW/Lyricify-App +[osdlyrics]: https://github.com/osdlyrics/osdlyrics ### Linux -| Name | Stack | DE/WM | Player Support | # | -| ----------------------------- | ----------- | ---------- | ---------------------------------- | --- | -| [waybar-netease-music-lyrics] | bash | Sway | Any NetEase Cloud Music Player[^0] | | -| [Sunamu] | Electron/TS | X/Xwayland | MPRIS | | -| [desktop-lyric] | JavaScript | GNOME | MPRIS | | -| [lyricsSeeker] | Python+QML | Plasma | | WIP | -| [caraoke-plasmoid] | QML | Plasma | MPRIS | | +| Name | Stack | DE/WM | Player Support | # | +| ----------------------------- | ------------- | ---------- | ------------------ | --- | +| [waybar-netease-music-lyrics] | bash | Sway | Any NCM Player[^0] | | +| [Sunamu] | Electron/TS | X/Xwayland | MPRIS | | +| [desktop-lyric] | JavaScript | GNOME | MPRIS | | +| [caraoke-plasmoid] | QML | Plasma | MPRIS | | +| [osdlyrics] | GTK2/C+Python | X/Xwayland | MPRIS | | +| [lyricsSeeker] | Python+QML | Plasma | | WIP | [^0]: https://github.com/kangxiaoju/waybar-netease-music-lyrics/blob/f84810fe1628ca38fa36d88506152d88cf0e77e4/song.sh#L41-L59 diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/waylyrics-0.2.2/README.md new/waylyrics-0.2.3/README.md --- old/waylyrics-0.2.2/README.md 2024-02-10 13:24:28.000000000 +0100 +++ new/waylyrics-0.2.3/README.md 2024-02-13 07:31:55.000000000 +0100 @@ -13,6 +13,7 @@ - [ä¾èµ](#ä¾èµ) - [æ¨èçææ¾å¨](#æ¨èçææ¾å¨) - [å¨çº¿](#å¨çº¿) + - [æµè§å¨](#æµè§å¨) - [GTK+](#gtk) - [Qt](#qt) - [Electron](#electron) @@ -48,6 +49,13 @@ #### å¨çº¿ +##### æµè§å¨ + +[plasma integration]: https://addons.mozilla.org/en-US/firefox/addon/plasma-integration/ + +- Chrome +- Firefoxï¼å [æä»¶][plasma integration] + ##### GTK+ - [netease-cloud-music-gtk](https://github.com/gmg137/netease-cloud-music-gtk) @@ -66,13 +74,14 @@ ##### TUI -- [go-musicfox](https://github.com/go-musicfox/go-musicfox) +- [go-musicfox](https://github.com/go-musicfox/go-musicfox), éè¦ [352bd99](https://github.com/go-musicfox/go-musicfox/commit/352bd9903f759eed98b1079fd44dc37a95da85d2) ä¿®æ¹ #### æ¬å° ##### GTK+ - [amberol](https://gitlab.gnome.org/World/amberol) +- [lollypop](https://github.com/hamonikr/lollypop) ##### åç @@ -88,11 +97,10 @@ [youtube-music]: https://github.com/th-ch/youtube-music -| Player | OSD | issue | -| ----------------------- | --- | ------------------ | -| Firefox | X | 䏿便æ¾ä½ç½®è°ç¨ | -| qqmusic | O | ä½ç½®ä¸ç´ä¸º0 | -| [flutter-netease-music] | X | å®å ¨ä¸æ¯æmpris | +| Player | OSD | issue | 夿³¨ | +| ----------------------- | --- | --------------- | ---- | +| qqmusic | O | ä½ç½®ä¸ç´ä¸º0 | | +| [flutter-netease-music] | X | å®å ¨ä¸æ¯æmpris | | ## ç®å½ @@ -114,16 +122,18 @@ [desktop-lyric]: https://github.com/tuberry/desktop-lyric [å¯éæè¯]: https://www.autolyric.com/ [Lyricify]: https://github.com/WXRIW/Lyricify-App +[osdlyrics]: https://github.com/osdlyrics/osdlyrics ### Linux -| åç§° | ææ¯æ | æ¡é¢æ¯æ | ææ¾å¨æ¯æ | 夿³¨ | -| ----------------------------- | ----------- | ---------- | ---------- | ---- | -| [waybar-netease-music-lyrics] | bash | Sway | NCM[^0] | | -| [Sunamu] | Electron/TS | X/Xwayland | MPRIS | | -| [desktop-lyric] | JavaScript | GNOME | MPRIS | | -| [lyricsSeeker] | Python+QML | Plasma | | WIP | -| [caraoke-plasmoid] | QML | Plasma | MPRIS | | +| åç§° | ææ¯æ | æ¡é¢æ¯æ | ææ¾å¨æ¯æ | 夿³¨ | +| ----------------------------- | ------------- | ---------- | ---------- | ---- | +| [waybar-netease-music-lyrics] | bash | Sway | NCM[^0] | | +| [Sunamu] | Electron/TS | X/Xwayland | MPRIS | | +| [desktop-lyric] | JavaScript | GNOME | MPRIS | | +| [caraoke-plasmoid] | QML | Plasma | MPRIS | | +| [osdlyrics] | GTK2/C+Python | X/Xwayland | MPRIS | | +| [lyricsSeeker] | Python+QML | Plasma | | WIP | [^0]: https://github.com/kangxiaoju/waybar-netease-music-lyrics/blob/f84810fe1628ca38fa36d88506152d88cf0e77e4/song.sh#L41-L59 diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/waylyrics-0.2.2/src/config.rs new/waylyrics-0.2.3/src/config.rs --- old/waylyrics-0.2.2/src/config.rs 2024-02-10 13:24:28.000000000 +0100 +++ new/waylyrics-0.2.3/src/config.rs 2024-02-13 07:31:55.000000000 +0100 @@ -19,6 +19,7 @@ pub enum LyricDisplay { #[default] ShowBoth, + ShowBothRev, Origin, PreferTranslation, } @@ -26,22 +27,60 @@ #[derive(Deserialize, Serialize)] #[serde(rename_all = "kebab-case", default)] pub struct Config { + /// the interval waylyrics updates position/metadata from player + /// + /// default: "2s" pub player_sync_interval: String, + /// the way two lyric label align in + /// possible values: center, start, end, fill + /// also check [GTK+ doc](https://docs.gtk.org/gtk4/enum.Align.html#members) + /// + /// default: "center" pub lyric_align: Align, + /// the interval waylyrics refreshes lyric labels + /// + /// default: "20ms" pub lyric_update_interval: String, + /// waylyrics matches lyrics with `weights` + /// if `(length-lyric_len).abs() < length_toleration`, + /// waylyrics set it's weight as zero, + /// so mark it a best choice + /// + /// default: "2s" pub length_toleration: String, + /// whether to cache lyrics /// note: persistenced lyric offset depends on this + /// + /// default: ture pub cache_lyrics: bool, + /// whether to allow mouse-click passthrough + /// + /// default: true pub click_pass_through: bool, + /// whether to set `visable` as `false` when a label is empty + /// + /// default: true pub hide_label_on_empty_text: bool, + /// theme to load (<name>.css) + /// + /// default: "default" pub theme: String, pub enable_filter_regex: bool, + /// hide lyric if it matches any of these regexies /// inspired by LyricX's filter [list](https://github.com/ddddxxx/LyricsX/blob/c16b6a413dda7bc0b793b897522e0c4ee0ffc716/LyricsX/Supporting%20Files/UserDefaults.plist#L31-L62) pub filter_regexies: Vec<String>, + /// shortcuts when focusing on waylyrics + /// for global ones, please install the `.desktop` file pub triggers: Triggers, pub qqmusic_api_base_url: Option<String>, /// avaliable options: ç½æäºé³ä¹, QQé³ä¹ pub lyric_search_source: Vec<String>, + /// lyric display mode + /// avaliable options: + /// - `show_both`: show origin and translated lyric + /// - `show_both_rev`: similiar to `show_both`, but origin text are showed below + /// - `prefer_translation`: show translated lyric if found any, or show origin lyric + /// - `origin`: only to show origin lyric pub lyric_display_mode: LyricDisplay, } @@ -77,7 +116,7 @@ fn default() -> Self { Self { player_sync_interval: "2s".to_owned(), - lyric_update_interval: "10ms".to_owned(), + lyric_update_interval: "20ms".to_owned(), length_toleration: "2s".to_owned(), click_pass_through: true, hide_label_on_empty_text: true, diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/waylyrics-0.2.2/src/lyric_providers/mod.rs new/waylyrics-0.2.3/src/lyric_providers/mod.rs --- old/waylyrics-0.2.2/src/lyric_providers/mod.rs 2024-02-10 13:24:28.000000000 +0100 +++ new/waylyrics-0.2.3/src/lyric_providers/mod.rs 2024-02-13 07:31:55.000000000 +0100 @@ -30,7 +30,7 @@ LineTimestamp(Vec<LyricLineOwned>), } -#[derive(Clone, Debug, Deserialize, Serialize, PartialEq, Eq)] +#[derive(Clone, Debug, Default, Deserialize, Serialize, PartialEq, Eq)] pub struct LyricLineOwned { pub text: String, pub start_time: Duration, @@ -57,6 +57,7 @@ async fn search_song(&self, keyword: &str) -> Result<Vec<SongInfo>>; fn unique_name(&self) -> &'static str; fn init(self, config: &str) -> Result<()>; + fn is_likely_songid(&self, s: &str) -> bool; } pub trait LyricParse { @@ -79,7 +80,7 @@ Lyric::LineTimestamp(lyrics) => LyricOwned::LineTimestamp( lyrics .into_iter() - .map(|l| LyricLine::<'_>::into_owned(l)) + .map(LyricLine::<'_>::into_owned) .collect(), ), } diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/waylyrics-0.2.2/src/lyric_providers/netease/mod.rs new/waylyrics-0.2.3/src/lyric_providers/netease/mod.rs --- old/waylyrics-0.2.2/src/lyric_providers/netease/mod.rs 2024-02-10 13:24:28.000000000 +0100 +++ new/waylyrics-0.2.3/src/lyric_providers/netease/mod.rs 2024-02-13 07:31:55.000000000 +0100 @@ -98,21 +98,25 @@ }) .await? } + + fn is_likely_songid(&self, s: &str) -> bool { + s.parse::<u32>().is_ok() + } } impl super::LyricParse for Netease { fn parse_lyric(&self, store: &LyricStore) -> LyricOwned { let lyric = store.lyric.as_deref(); - match_lyric(lyric).into_owned() + verify_lyric(lyric).into_owned() } fn parse_translated_lyric(&self, store: &LyricStore) -> LyricOwned { let lyric = store.tlyric.as_deref(); - match_lyric(lyric).into_owned() + verify_lyric(lyric).into_owned() } } -fn match_lyric(lyric: Option<&str>) -> Lyric<'_> { +fn verify_lyric(lyric: Option<&str>) -> Lyric<'_> { match lyric { Some("") | None => super::Lyric::None, Some(lyric) => { diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/waylyrics-0.2.2/src/lyric_providers/qqmusic/mod.rs new/waylyrics-0.2.3/src/lyric_providers/qqmusic/mod.rs --- old/waylyrics-0.2.2/src/lyric_providers/qqmusic/mod.rs 2024-02-10 13:24:28.000000000 +0100 +++ new/waylyrics-0.2.3/src/lyric_providers/qqmusic/mod.rs 2024-02-13 07:31:55.000000000 +0100 @@ -26,7 +26,7 @@ let base_url: Url = base_url.parse()?; QQMUSIC_API_CLIENT .set(Some(QQMusicApi::new(base_url))) - .expect("QQMusicApi could only be init once"); + .map_err(|_| Error::ApiClientInited)?; Ok(()) } @@ -50,7 +50,7 @@ let client = Client::builder().user_agent("Waylyrics/0.1").build()?; // might be a little tricky - let songid = if id.parse::<u32>().is_ok() { + let songid = if id.parse::<usize>().is_ok() { SongId::Songid(&id) } else { SongId::Songmid(&id) @@ -123,6 +123,10 @@ }) .await? } + + fn is_likely_songid(&self, s: &str) -> bool { + (s.len() == 14 && s.starts_with('0')) || s.parse::<usize>().is_ok() + } } async fn get_songmid(api: &QQMusicApi, client: &Client, songid: &str) -> Result<String> { @@ -166,10 +170,12 @@ #[derive(thiserror::Error, Debug)] pub enum Error { - #[error("please make sure you configured QQMusicApi base URL")] + #[error("Please make sure you had configured QQMusicApi base URL")] ApiClientNotInit, #[error("Not implemented")] NotImplemented, + #[error("QQMusicApi already initialized")] + ApiClientInited, } pub static QQMUSIC_API_CLIENT: OnceLock<Option<QQMusicApi>> = OnceLock::new(); diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/waylyrics-0.2.2/src/lyric_providers/utils.rs new/waylyrics-0.2.3/src/lyric_providers/utils.rs --- old/waylyrics-0.2.2/src/lyric_providers/utils.rs 2024-02-10 13:24:28.000000000 +0100 +++ new/waylyrics-0.2.3/src/lyric_providers/utils.rs 2024-02-13 07:31:55.000000000 +0100 @@ -11,7 +11,7 @@ pub fn lrc_iter<'a>( lyric_lines: impl Iterator<Item = &'a str>, ) -> Result<Vec<LyricLine<'a>>, LrcParseError> { - let filtered_lines = lyric_lines.filter(|l| l.starts_with("[")); + let filtered_lines = lyric_lines.filter(|l| l.starts_with('[')); let mut lrc_vec: Vec<_> = parse(filtered_lines)? .into_iter() .filter_map(|lrc_item| match lrc_item { diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/waylyrics-0.2.2/src/sync/lyric/cache.rs new/waylyrics-0.2.3/src/sync/lyric/cache.rs --- old/waylyrics-0.2.2/src/sync/lyric/cache.rs 2024-02-10 13:24:28.000000000 +0100 +++ new/waylyrics-0.2.3/src/sync/lyric/cache.rs 2024-02-13 07:31:55.000000000 +0100 @@ -10,7 +10,12 @@ use crate::{app, lyric_providers::LyricOwned, CACHE_DIR}; /// This will not create cache dir for you -- you should create it yourself. +/// /// Note that window.imp().cache_lyrics controls whether to cache lyrics. +/// +/// When `track_meta.title == None`, this returns `None` as well, +/// +/// because we should not cache lyric for an unknown song pub fn get_cache_path(track_meta: &TrackMeta) -> Option<PathBuf> { match track_meta { TrackMeta { @@ -39,13 +44,13 @@ window: &app::Window, ) -> Result<()> { let Some(cache_path) = get_cache_path(track_meta) else { - warn!("cannot cache lyric due to missing metadata"); + warn!("cannot cache lyric due to missing title"); return fetch_lyric(track_meta, window).await; }; info!( "cache_path for {}: {cache_path:?}", - track_meta.title.as_deref().unwrap_or("Unknown Title") + track_meta.title.as_deref().unwrap() ); if !ignore_cache { diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/waylyrics-0.2.2/src/sync/lyric/scroll.rs new/waylyrics-0.2.3/src/sync/lyric/scroll.rs --- old/waylyrics-0.2.2/src/sync/lyric/scroll.rs 2024-02-10 13:24:28.000000000 +0100 +++ new/waylyrics-0.2.3/src/sync/lyric/scroll.rs 2024-02-13 07:31:55.000000000 +0100 @@ -50,16 +50,29 @@ set_lyric(window, origin, "below"); } else { set_lyric(window, origin, "above"); + set_lyric(window, Some(&Default::default()), "below"); + } + } + LyricDisplay::ShowBothRev => { + if translation.is_some() { + set_lyric(window, origin, "above"); + set_lyric(window, translation, "below"); + } else { + set_lyric(window, origin, "above"); + set_lyric(window, Some(&Default::default()), "below"); } } LyricDisplay::Origin => { set_lyric(window, origin, "above"); + set_lyric(window, Some(&Default::default()), "below"); } LyricDisplay::PreferTranslation => { if translation.is_none() { set_lyric(window, origin, "above"); + set_lyric(window, Some(&Default::default()), "below"); } else { set_lyric(window, translation, "above"); + set_lyric(window, Some(&Default::default()), "below"); } } } @@ -90,21 +103,15 @@ LyricOwned::LineTimestamp(origin_lyric), LyricOwned::LineTimestamp(translation_lyric), ) => { - let translation = crate::lyric_providers::utils::find_next_lyric( - &elapsed, - translation_lyric, - ); - let origin = crate::lyric_providers::utils::find_next_lyric( - &elapsed, - origin_lyric, - ); + let translation = + crate::lyric_providers::utils::find_next_lyric(&elapsed, translation_lyric); + let origin = + crate::lyric_providers::utils::find_next_lyric(&elapsed, origin_lyric); set_lyric_with_mode(window, translation, origin); } (LyricOwned::LineTimestamp(origin_lyric), _) => { - let origin = crate::lyric_providers::utils::find_next_lyric( - &elapsed, - origin_lyric, - ); + let origin = + crate::lyric_providers::utils::find_next_lyric(&elapsed, origin_lyric); set_lyric_with_mode(window, None, origin); } _ => (), diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/waylyrics-0.2.2/src/sync/mod.rs new/waylyrics-0.2.3/src/sync/mod.rs --- old/waylyrics-0.2.2/src/sync/mod.rs 2024-02-10 13:24:28.000000000 +0100 +++ new/waylyrics-0.2.3/src/sync/mod.rs 2024-02-13 07:31:55.000000000 +0100 @@ -12,7 +12,7 @@ pub use interop::list_player_names; pub use lyric::scroll::register_lyric_display; -/// A struct from metadata in mpris::TrackID to avoid track_id and title unwrapping +/// metadata from connected player #[derive(Clone, Debug, PartialEq, Eq)] pub struct TrackMeta { pub unique_song_id: Option<String>, diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/waylyrics-0.2.2/src/tests/is_likely_songid.rs new/waylyrics-0.2.3/src/tests/is_likely_songid.rs --- old/waylyrics-0.2.2/src/tests/is_likely_songid.rs 1970-01-01 01:00:00.000000000 +0100 +++ new/waylyrics-0.2.3/src/tests/is_likely_songid.rs 2024-02-13 07:31:55.000000000 +0100 @@ -0,0 +1,23 @@ +use crate::lyric_providers::netease::Netease; +use crate::lyric_providers::qqmusic::QQMusic; +use crate::lyric_providers::LyricProvider; + +#[test] +fn is_qqmusic_songid() { + for songid in ["004Knor205SbZb", "002jGrGi0OXxDJ", "1145141919"] { + assert!(QQMusic.is_likely_songid(songid)); + } + for invalid_songid in ["04Knor205SbZb", "102jGrGi0OXxDJ", "1145.141919", ""] { + assert!(!QQMusic.is_likely_songid(invalid_songid)); + } +} + +#[test] +fn is_netease_songid() { + for songid in ["1145141919"] { + assert!(Netease.is_likely_songid(songid)); + } + for invalid_songid in ["11451.41919", ""] { + assert!(!Netease.is_likely_songid(invalid_songid)); + } +} diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/waylyrics-0.2.2/src/tests/mod.rs new/waylyrics-0.2.3/src/tests/mod.rs --- old/waylyrics-0.2.2/src/tests/mod.rs 2024-02-10 13:24:28.000000000 +0100 +++ new/waylyrics-0.2.3/src/tests/mod.rs 2024-02-13 07:31:55.000000000 +0100 @@ -1,3 +1,5 @@ +mod is_likely_songid; mod lyric_parse; mod lyric_path; mod netease_lyric; +mod qqmusic_init; diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/waylyrics-0.2.2/src/tests/qqmusic_init.rs new/waylyrics-0.2.3/src/tests/qqmusic_init.rs --- old/waylyrics-0.2.2/src/tests/qqmusic_init.rs 1970-01-01 01:00:00.000000000 +0100 +++ new/waylyrics-0.2.3/src/tests/qqmusic_init.rs 2024-02-13 07:31:55.000000000 +0100 @@ -0,0 +1,14 @@ +use crate::lyric_providers::qqmusic::QQMusic; +use crate::lyric_providers::LyricProvider; + +#[test] +fn test_qqmusic_base_url_init() { + // empty URL + assert!(QQMusic.init("").is_err()); + // ill-formed URL + assert!(QQMusic.init("http//127.0.0.1:1000").is_err()); + // legal URL example + assert!(QQMusic.init("https://127.0.0.1:1000").is_ok()); + // prevents to initialize again + assert!(QQMusic.init("http://127.0.0.1:1000").is_err()); +} diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/waylyrics-0.2.2/themes/trans.css new/waylyrics-0.2.3/themes/trans.css --- old/waylyrics-0.2.2/themes/trans.css 1970-01-01 01:00:00.000000000 +0100 +++ new/waylyrics-0.2.3/themes/trans.css 2024-02-13 07:31:55.000000000 +0100 @@ -0,0 +1,33 @@ +window#main-window { + background-color: rgba(0, 0, 0, 0.0); +} + +/* æ 颿 çæ é¢ä¹æ¯ labelï¼å æ¤éè¦ç¹å«æå® above å below */ +label#above, +label#below { + /* åè§ */ + border-radius: 16px; + + font-size: 28px; + padding: 8px; + + color: white; + background: linear-gradient(to right, rgba(91, 206, 250, 0.8), rgba(245, 169, 184, 0.8)); +} + +label#below { + border-radius: 12px; + margin: 5px 0px; + font-size: 24px; + padding: 5px; +} + +/* åå° Gtk CSD çé´å½± */ +window { + box-shadow: 0px 0px 1px 0px; +} + +/* 设置 headerbar 为 50% ä¸éæåº¦ */ +headerbar { + opacity: 0.5; +} \ No newline at end of file ++++++ waylyrics.obsinfo ++++++ --- /var/tmp/diff_new_pack.rRTik8/_old 2024-02-14 23:20:12.647437083 +0100 +++ /var/tmp/diff_new_pack.rRTik8/_new 2024-02-14 23:20:12.659437516 +0100 @@ -1,5 +1,5 @@ name: waylyrics -version: 0.2.2 -mtime: 1707567868 -commit: 81c6155c26573bfc7feee3accdbdb96c41e39a4a +version: 0.2.3 +mtime: 1707805915 +commit: a74cbdad5e2296e842386bb78dbf0eee62b97024
