musikr: get rid of warnings

This commit is contained in:
Alexander Capehart 2025-02-14 21:15:32 -07:00
parent 7906fcf5af
commit 03d8f70ecd
No known key found for this signature in database
GPG key ID: 37DBE3621FE9AD47
2 changed files with 27 additions and 37 deletions

View file

@ -8,7 +8,6 @@ mod taglib;
mod jstream; mod jstream;
use taglib::file::FileRef; use taglib::file::FileRef;
use jstream::JInputStream; use jstream::JInputStream;
type SharedEnv<'local> = Rc<RefCell<JNIEnv<'local>>>; type SharedEnv<'local> = Rc<RefCell<JNIEnv<'local>>>;
@ -23,40 +22,34 @@ pub extern "C" fn Java_org_oxycblt_musikr_metadata_MetadataJNI_openFile<'local>(
let shared_env = Rc::new(RefCell::new(env)); let shared_env = Rc::new(RefCell::new(env));
let mut stream = JInputStream::new(shared_env.clone(), input); let mut stream = JInputStream::new(shared_env.clone(), input);
let file_ref = FileRef::new(stream); let file_ref = FileRef::new(stream);
// file_ref.file().and_then(|file| { let title = file_ref.file().and_then(|file| {
// let audio_properties = file.audio_properties().map(|props| AudioProperties { let audio_properties = file.audio_properties();
// length_in_milliseconds: props.length_in_milliseconds(),
// bitrate_in_kilobits_per_second: props.bitrate(),
// sample_rate_in_hz: props.sample_rate(),
// number_of_channels: props.channels(),
// });
// if let Some(vorbis_file) = file.as_vorbis() { if let Some(vorbis_file) = file.as_vorbis() {
// let xiph_comments = vorbis_file vorbis_file
// .xiph_comments() .xiph_comments()
// .map(|comments| comments.field_list_map().to_hashmap()); .map(|comments| comments.field_list_map().to_hashmap())
.and_then(|comments| comments.get("TITLE").cloned())
// } else if let Some(opus_file) = file.as_opus() { .and_then(|title| title.first().cloned())
// let xiph_comments = opus_file .map(|s| s.to_string())
// .xiph_comments() } else if let Some(opus_file) = file.as_opus() {
// .map(|comments| comments.field_list_map().to_hashmap()); opus_file
.xiph_comments()
// Some(File::Opus { .map(|comments| comments.field_list_map().to_hashmap())
// audio_properties, .and_then(|comments| comments.get("TITLE").cloned())
// xiph_comments, .and_then(|title| title.first().cloned())
// }) .map(|s| s.to_string())
// } else if let Some(flac_file) = file.as_flac() { } else if let Some(flac_file) = file.as_flac() {
// let xiph_comments = flac_file flac_file
// .xiph_comments() .xiph_comments()
// .map(|comments| comments.field_list_map().to_hashmap()); .map(|comments| comments.field_list_map().to_hashmap())
// Some(File::FLAC { .and_then(|comments| comments.get("TITLE").cloned())
// audio_properties, .and_then(|title| title.first().cloned())
// xiph_comments, .map(|s| s.to_string())
// }) } else {
// } else { None
// Some(File::Unknown { audio_properties }) }
// } });
// });
// Return the title // Return the title
let output = shared_env.borrow_mut().new_string("title").expect("Couldn't create string!"); let output = shared_env.borrow_mut().new_string("title").expect("Couldn't create string!");

View file

@ -44,9 +44,6 @@ impl<'a> Drop for BridgedIOStream<'a> {
pub(super) struct DynIOStream<'a>(Box<dyn IOStream + 'a>); pub(super) struct DynIOStream<'a>(Box<dyn IOStream + 'a>);
impl<'a> DynIOStream<'a> { impl<'a> DynIOStream<'a> {
pub fn new<T: IOStream + 'a>(stream: T) -> Self {
DynIOStream(Box::new(stream))
}
// Implement the exposed functions for cxx bridge // Implement the exposed functions for cxx bridge
pub fn name(&mut self) -> String { pub fn name(&mut self) -> String {