Skip to content

Commit a5c9c35

Browse files
committed
feat: look slightly harder for lyric files
1 parent 6360324 commit a5c9c35

1 file changed

Lines changed: 10 additions & 4 deletions

File tree

‎player/src/transmit.rs‎

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ use std::collections::VecDeque;
22
use std::error::Error;
33
use std::fs::File;
44
use std::io::{Cursor, Read};
5-
use std::path::PathBuf;
5+
use std::path::{Path, PathBuf};
66

77
use image::imageops::FilterType;
88
use opus::Encoder;
@@ -150,9 +150,15 @@ impl AudioInfoReader {
150150
}
151151

152152
// lyrics
153-
// lazily search for lrc file assuming it's the same
154-
// (we're gonna glob it or something eventually)
155-
let lyrics_path = self.path.with_extension("lrc");
153+
// lazily search for lrc file assuming it's the same name and stuff
154+
let cwd = self.path.parent().unwrap();
155+
let lyrics_path = if cwd.join("lyrics").is_dir() {
156+
cwd.join("lyrics")
157+
.join(self.path.file_name().unwrap())
158+
.with_extension("lrc")
159+
} else {
160+
self.path.with_extension("lrc")
161+
};
156162
if lyrics_path.exists() {
157163
// epic
158164
println!("has lyrics!");

0 commit comments

Comments
 (0)