mirror of
https://github.com/Serial-ATA/lofty-rs
synced 2024-12-12 21:52:33 +00:00
Cleanup
Signed-off-by: Serial <69764315+Serial-ATA@users.noreply.github.com>
This commit is contained in:
parent
fe1c81b583
commit
9698e3cbc0
10 changed files with 34 additions and 50 deletions
|
@ -1,12 +1,11 @@
|
|||
#![cfg(feature = "format-flac")]
|
||||
|
||||
use crate::{Picture, Result};
|
||||
|
||||
use metaflac::BlockType;
|
||||
use std::borrow::Cow;
|
||||
use std::collections::HashMap;
|
||||
use std::io::{Read, Seek, SeekFrom, Write};
|
||||
|
||||
use metaflac::BlockType;
|
||||
|
||||
pub(crate) fn write_to<T>(
|
||||
mut data: T,
|
||||
vendor: &str,
|
||||
|
|
|
@ -1,3 +1,4 @@
|
|||
use super::{is_metadata, page_from_packet};
|
||||
use crate::{LoftyError, Picture, Result};
|
||||
|
||||
#[cfg(feature = "format-opus")]
|
||||
|
@ -5,15 +6,14 @@ use crate::components::logic::ogg::constants::OPUSTAGS;
|
|||
#[cfg(feature = "format-vorbis")]
|
||||
use crate::components::logic::ogg::constants::{VORBIS_COMMENT_HEAD, VORBIS_SETUP_HEAD};
|
||||
|
||||
use byteorder::{LittleEndian, ReadBytesExt};
|
||||
use std::borrow::Cow;
|
||||
use std::collections::HashMap;
|
||||
|
||||
use crate::components::logic::ogg::{is_metadata, page_from_packet};
|
||||
use ogg_pager::Page;
|
||||
use std::fs::File;
|
||||
use std::io::{Cursor, Read, Seek, SeekFrom, Write};
|
||||
|
||||
use byteorder::{LittleEndian, ReadBytesExt};
|
||||
use ogg_pager::Page;
|
||||
|
||||
pub(crate) fn create_pages(
|
||||
file: &mut File,
|
||||
sig: &[u8],
|
||||
|
|
|
@ -1,14 +1,10 @@
|
|||
use crate::{LoftyError, Result};
|
||||
|
||||
use byteorder::{LittleEndian, ReadBytesExt};
|
||||
use std::collections::HashMap;
|
||||
use std::fs::File;
|
||||
use std::io::{Cursor, Read, Seek, SeekFrom, Write};
|
||||
|
||||
// Used to determine the RIFF metadata format
|
||||
pub const LIST_ID: &[u8] = b"LIST";
|
||||
|
||||
// FourCC
|
||||
use byteorder::{LittleEndian, ReadBytesExt};
|
||||
|
||||
// Standard
|
||||
pub const IART: &[u8] = &[73, 65, 82, 84];
|
||||
|
@ -75,7 +71,7 @@ where
|
|||
let mut chunk_name = [0; 4];
|
||||
data.read_exact(&mut chunk_name)?;
|
||||
|
||||
if chunk_name == LIST_ID {
|
||||
if &chunk_name == b"LIST" {
|
||||
data.seek(SeekFrom::Current(4))?;
|
||||
|
||||
let mut list_type = [0; 4];
|
||||
|
@ -140,7 +136,7 @@ pub fn key_to_fourcc(key: &str) -> Option<&[u8]> {
|
|||
pub(crate) fn write_to(data: &mut File, metadata: HashMap<String, String>) -> Result<()> {
|
||||
let mut packet = Vec::new();
|
||||
|
||||
packet.extend(LIST_ID.iter());
|
||||
packet.extend(b"LIST".iter());
|
||||
packet.extend(b"INFO".iter());
|
||||
|
||||
for (k, v) in metadata {
|
||||
|
|
|
@ -1,18 +1,16 @@
|
|||
#![cfg(feature = "format-ape")]
|
||||
|
||||
use crate::types::picture::APE_PICTYPES;
|
||||
use crate::{
|
||||
Album, AnyTag, AudioTag, AudioTagEdit, AudioTagWrite, Picture, Result, TagType, ToAny, ToAnyTag,
|
||||
};
|
||||
use lofty_attr::impl_tag;
|
||||
|
||||
pub use ape::Tag as ApeInnerTag;
|
||||
|
||||
use crate::types::picture::APE_PICTYPES;
|
||||
use ape::Item;
|
||||
use std::borrow::Cow;
|
||||
use std::fs::File;
|
||||
use std::io::{Read, Seek};
|
||||
|
||||
use ape::Item;
|
||||
pub use ape::Tag as ApeInnerTag;
|
||||
use lofty_attr::impl_tag;
|
||||
|
||||
#[impl_tag(ApeInnerTag, TagType::Ape)]
|
||||
pub struct ApeTag;
|
||||
|
||||
|
|
|
@ -1,20 +1,18 @@
|
|||
#![cfg(feature = "format-id3")]
|
||||
|
||||
use crate::tag::Id3Format;
|
||||
use crate::{
|
||||
Album, AnyTag, AudioTag, AudioTagEdit, AudioTagWrite, LoftyError, MimeType, Picture,
|
||||
PictureType, Result, TagType, ToAny, ToAnyTag,
|
||||
};
|
||||
use lofty_attr::impl_tag;
|
||||
|
||||
pub use id3::Tag as Id3v2InnerTag;
|
||||
|
||||
use filepath::FilePath;
|
||||
use std::borrow::Cow;
|
||||
use std::convert::{TryFrom, TryInto};
|
||||
use std::fs::File;
|
||||
use std::io::{Read, Seek, SeekFrom};
|
||||
|
||||
use filepath::FilePath;
|
||||
pub use id3::Tag as Id3v2InnerTag;
|
||||
use lofty_attr::impl_tag;
|
||||
|
||||
#[impl_tag(Id3v2InnerTag, TagType::Id3v2(Id3Format::Default))]
|
||||
pub struct Id3v2Tag;
|
||||
|
||||
|
|
|
@ -1,17 +1,15 @@
|
|||
#![cfg(feature = "format-mp4")]
|
||||
|
||||
use crate::{
|
||||
Album, AnyTag, AudioTag, AudioTagEdit, AudioTagWrite, LoftyError, MimeType, Picture,
|
||||
PictureType, Result, TagType, ToAny, ToAnyTag,
|
||||
};
|
||||
use lofty_attr::impl_tag;
|
||||
|
||||
pub use mp4ameta::{Fourcc, Tag as Mp4InnerTag};
|
||||
|
||||
use std::borrow::Cow;
|
||||
use std::fs::File;
|
||||
use std::io::{Read, Seek};
|
||||
|
||||
use lofty_attr::impl_tag;
|
||||
pub use mp4ameta::{Fourcc, Tag as Mp4InnerTag};
|
||||
|
||||
#[impl_tag(Mp4InnerTag, TagType::Mp4)]
|
||||
pub struct Mp4Tag {}
|
||||
|
||||
|
|
|
@ -1,9 +1,3 @@
|
|||
#![cfg(any(
|
||||
feature = "format-vorbis",
|
||||
feature = "format-opus",
|
||||
feature = "format-flac"
|
||||
))]
|
||||
|
||||
#[cfg(feature = "format-flac")]
|
||||
use crate::components::logic::flac;
|
||||
#[cfg(any(feature = "format-opus", feature = "format-vorbis"))]
|
||||
|
@ -20,14 +14,14 @@ use crate::{
|
|||
#[cfg(any(feature = "format-opus", feature = "format-vorbis"))]
|
||||
use crate::components::logic::ogg::read::OGGTags;
|
||||
|
||||
use lofty_attr::impl_tag;
|
||||
|
||||
use std::borrow::Cow;
|
||||
use std::collections::HashMap;
|
||||
use std::convert::{TryFrom, TryInto};
|
||||
use std::fs::File;
|
||||
use std::io::{Read, Seek, SeekFrom};
|
||||
|
||||
use lofty_attr::impl_tag;
|
||||
|
||||
struct OggInnerTag {
|
||||
vendor: String,
|
||||
comments: HashMap<String, String>,
|
||||
|
|
|
@ -1,16 +1,15 @@
|
|||
#![cfg(feature = "format-riff")]
|
||||
|
||||
use crate::components::logic::riff;
|
||||
use crate::{
|
||||
Album, AnyTag, AudioTag, AudioTagEdit, AudioTagWrite, Picture, Result, TagType, ToAny, ToAnyTag,
|
||||
};
|
||||
use lofty_attr::impl_tag;
|
||||
|
||||
use std::borrow::Cow;
|
||||
use std::collections::HashMap;
|
||||
use std::fs::File;
|
||||
use std::io::{Read, Seek};
|
||||
|
||||
use lofty_attr::impl_tag;
|
||||
|
||||
struct RiffInnerTag {
|
||||
data: HashMap<String, String>,
|
||||
}
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
#[allow(clippy::wildcard_imports)]
|
||||
use crate::components::tags::*;
|
||||
use crate::{AudioTag, LoftyError, Result};
|
||||
|
||||
use std::io::{Cursor, Read, Seek, SeekFrom};
|
||||
use std::path::Path;
|
||||
|
||||
|
|
|
@ -1,12 +1,5 @@
|
|||
use crate::{LoftyError, Result};
|
||||
|
||||
#[cfg(any(
|
||||
feature = "format-id3",
|
||||
feature = "format-opus",
|
||||
feature = "format-vorbis",
|
||||
feature = "format-flac",
|
||||
))]
|
||||
use byteorder::{BigEndian, ReadBytesExt};
|
||||
use std::borrow::Cow;
|
||||
use std::convert::TryFrom;
|
||||
#[cfg(any(
|
||||
|
@ -18,6 +11,14 @@ use std::convert::TryFrom;
|
|||
))]
|
||||
use std::io::{Cursor, Read};
|
||||
|
||||
#[cfg(any(
|
||||
feature = "format-id3",
|
||||
feature = "format-opus",
|
||||
feature = "format-vorbis",
|
||||
feature = "format-flac",
|
||||
))]
|
||||
use byteorder::{BigEndian, ReadBytesExt};
|
||||
|
||||
#[cfg(feature = "format-ape")]
|
||||
pub const APE_PICTYPES: [&str; 21] = [
|
||||
"Other",
|
||||
|
|
Loading…
Reference in a new issue