Skip to content

Commit

Permalink
Deprecate no longer supported formats
Browse files Browse the repository at this point in the history
  • Loading branch information
nukeop committed Mar 6, 2024
1 parent ae45d93 commit c61a4cc
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 27 deletions.
16 changes: 0 additions & 16 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -117,29 +117,13 @@
"ext": "opus",
"mimeType": "audio/ogg"
},
{
"ext": "aac",
"mimeType": "audio/aac"
},
{
"ext": "flac",
"mimeType": "audio/flac"
},
{
"ext": "wav",
"mimeType": "audio/x-wav"
},
{
"ext": "weba",
"mimeType": "audio/weba"
},
{
"ext": "mp4",
"mimeType": "audio/mp4"
},
{
"ext": "webm",
"mimeType": "audio/webm"
}
],
"linux": {
Expand Down
6 changes: 2 additions & 4 deletions packages/scanner/src/metadata.rs
Original file line number Diff line number Diff line change
@@ -1,13 +1,12 @@
use std::{fs::File, io::BufReader};
use std::fs::File;

use derive_builder::Builder;
use id3::TagLike;
use metaflac;
use symphonia::core::{
codecs::DecoderOptions,
formats::FormatOptions,
io::MediaSourceStream,
meta::{MetadataOptions, MetadataRevision, StandardTagKey},
meta::{MetadataOptions, StandardTagKey},
probe::Hint,
};

Expand Down Expand Up @@ -191,7 +190,6 @@ impl MetadataExtractor for OggMetadataExtractor {
if let Some(meta) = probed.format.metadata().current() {
for tag in meta.tags().iter() {
if tag.is_known() {
println!("{:?}", tag.std_key);
match tag.std_key {
Some(StandardTagKey::TrackTitle) => {
metadata.title = Some(tag.value.to_string());
Expand Down
15 changes: 8 additions & 7 deletions packages/scanner/src/scanner.rs
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
use id3::{Error, Tag};
use std::collections::{HashSet, LinkedList};
use std::collections::LinkedList;
use std::ffi::OsStr;
use std::path::Path;
use uuid::Uuid;

use crate::error::{MetadataError, ScannerError};
use crate::local_track::LocalTrack;
use crate::metadata::{
AudioMetadata, AudioMetadataBuilder, FlacMetadataExtractor, MetadataExtractor,
Mp3MetadataExtractor, Mp4MetadataExtractor, OggMetadataExtractor,
AudioMetadata, FlacMetadataExtractor, MetadataExtractor, Mp3MetadataExtractor,
Mp4MetadataExtractor, OggMetadataExtractor,
};

pub trait TagReader {
Expand Down Expand Up @@ -80,6 +80,8 @@ pub fn visit_directory(

#[cfg(test)]
mod tests {
use crate::metadata::AudioMetadataBuilder;

use super::*;

#[derive(Debug, Clone, Default)]
Expand Down Expand Up @@ -112,7 +114,7 @@ mod tests {
.duration(10)
.position(1)
.disc(1)
.year(2020)
.year("2020".to_string())
.thumbnail("http://localhost:8080/thumbnails/0b/0b0b0b0b0b0b0b0b.webp".to_string())
.build()
.unwrap(),
Expand All @@ -122,8 +124,7 @@ mod tests {
#[test]
fn test_visit_file() {
let path = "tests/test.mp3".to_string();
let thumbnails_dir = "tests/thumbnails".to_string();
let mut created_thumbnails_hashset: HashSet<String> = HashSet::new();
let thumbnails_dir: String = "tests/thumbnails".to_string();
let local_track = visit_file(path, test_extractor_from_path, &thumbnails_dir).unwrap();
assert_eq!(local_track.filename, "test.mp3");
assert_eq!(local_track.metadata.artist, Some("Test Artist".to_string()));
Expand All @@ -132,7 +133,7 @@ mod tests {
assert_eq!(local_track.metadata.duration, Some(10));
assert_eq!(local_track.metadata.position, Some(1));
assert_eq!(local_track.metadata.disc, Some(1));
assert_eq!(local_track.metadata.year, Some(2020));
assert_eq!(local_track.metadata.year, Some("2020".to_string()));
assert_eq!(
local_track.metadata.thumbnail,
Some("http://localhost:8080/thumbnails/0b/0b0b0b0b0b0b0b0b.webp".to_string())
Expand Down

0 comments on commit c61a4cc

Please sign in to comment.