Giter VIP home page Giter VIP logo

audiotags's Introduction

Hi there πŸ‘‹

Tianyi's github stats

audiotags's People

Contributors

aybruh00 avatar bsteffaniak avatar cdown avatar microtonez avatar pinkforest avatar serial-ata avatar tianyishi2001 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

audiotags's Issues

Request for release

Hello,
Its been a while since #21 has been merged in; along with four more PR's merged in this year adding features.

Would be great to have a new release tagged out with these changes if possible?

Are there any blocker issues preventing a new release I can look at helping with?

Sorry to create more noise πŸ˜…

`wav`/`aiff` file support

Is there a reason wav/aiff files are not supported? Had a poke around in the id3 package and it looks like they are supported over there?

metaflac dependencies index out of range

i'm working on this music player i use audiotags to parse the metadata when the flac files are parsing some flac files parsing panic the program due to issue with the metaflac dependencie

thread 'main' panicked at 'range end index 4 out of range for slice of length 0', /home/user/.cargo/registry/src/github.com-1ecc6299db9ec823/metaflac-0.2.5/src/block.rs:355:26ss

use audiotags::{Tag,Error};

#[derive(Debug)]
pub struct Tags{
    pub title: String,
    pub artist: String,
    pub year: String,
    pub genre: String,
    pub track_number: u16,
    pub duration: f64,
    pub album_cover: Vec<u8>

}

pub fn read_tag(path: &str) -> Result<Tags, Option<Error>> {
    let tag = Tag::new().read_from_path(path)?;
    let title = match tag.title(){
        Some(title) => title.to_string(),
        None => "No Title".to_string(),
    };
    let artist = match tag.artist(){
        Some(artist) => artist.to_string(),
        None => "No artist found".to_string(),
    };
    let year = match tag.year() {
        Some(year) => year.to_string(),
        None => "".to_string(),
    };
    let genre = match tag.genre() {
        Some(genre) => genre.to_string(),
        None => "".to_string(),
    };
    let track_number = match tag.track_number(){
        Some(number) => number,
        None => 0,
    };
    let duration = match tag.duration(){
        Some(duration) => duration,
        None => 0.0,
    };

    let album_cover = match tag.album_cover(){
        Some(picture) => picture.data.to_vec(),
        None => Vec::new(),
    };


    Ok(
        Tags{
            title,
            artist,
            year,
            genre,
            track_number,
            duration,
            album_cover,
        }
    )

}`
```

please find the function i created for parsing tags

Support for custom tags?

Hi,

Would it be possible to add support for custom tags?
By custom tag, I mean a key and value pair.

Cheers,
Alex

`read_from_path` should not panic without extension

currently, extensions are handled like this:

path.as_ref()
    .extension()
    .unwrap()
    .to_string_lossy()
    .to_string()
    .to_lowercase()
    .as_str(),

Which could panic due to the unwrap().
as try_from_ext already handles extensions, maybe we could unwrap_or into an empty OsStr or use ??

Bitrate support

There's currently no way of reading bitrate information for audio files.
Was that simply missed or is there a reason it's not implemented for audiotags (i.e. the underlying metadata crates don't expose that kind of information)?

implement `AnyTag` to allow conversion between different tag types

implementing an AnyTag struct, e,g.

pub struct AnyTag {
    pub title: Option<String>,
    pub artists: Option<Vec<String>>,
    pub year: Option<i32>,
    pub album_title: Option<String>,
    pub album_artists: Option<Vec<String>>,
    pub album_cover: Option<Picture>,
    pub track_number: Option<u16>,
    pub total_tracks: Option<u16>,
    pub disc_number: Option<u16>,
    pub total_discs: Option<u16>,
    ...
}

and corresponding From traits for different specific tag formats will allow conversions between them.

The challenge is: can this be implemented without copying (cloning)? i.e. can the above be implemented as:

pub struct AnyTag1<'a> {
    pub title: Option<&'a str>,
    pub artists: Option<Vec<&'a str>>,
    pub year: Option<i32>,
    pub album_title: Option<&'a str>,
    pub album_artists: Option<Vec<&'a str>>,
    pub album_cover: Option<&'a Picture>,
    pub track_number: Option<u16>,
    pub total_tracks: Option<u16>,
    pub disc_number: Option<u16>,
    pub total_discs: Option<u16>,
}

AudioTag::year() not always valid when it should be

Hi,

I'm new to Rust and started working on a program which iterates through the id3 tags of my iTunes purchased music.

I checked iTunes for the Year tag, which is valid, but the AudioTag value is None. Here's a small example:

use std::path::Path;

let path = Path::new("03 How to Save a Life (New Version).m4a")
let tag = Tag::default().read_from_path(path);

let year = tag.year().unwrap_or(0);
println("Year {}", year)

-- Output
Year: 0

image

I don't have my code up on GitHub yet, although if you need anything further from me, please let me know.

Picture data usage

I am trying yo use this library to parse the data from some files, and everything works perfectly fine expect the cover data. I cannot get to understant what data it is passing to me, as it is neither divisible by 3 nor 4. ΒΏAny idea on how to get the pixels from the array?

(My current objective is to render it in JS using a canvas, which needs an array of RGBA values)

FR: support for X/Y style TRACKNUMBER

I have FLAC files which look like this:

$ metaflac --list Aphex_Twin/Chosen_Lords/02-Reunion_2.flac
METADATA block #0
  type: 0 (STREAMINFO)
  is last: false
  length: 34
  minimum blocksize: 4608 samples
  maximum blocksize: 4608 samples
  minimum framesize: 761 bytes
  maximum framesize: 16014 bytes
  sample_rate: 44100 Hz
  channels: 2
  bits-per-sample: 16
  total samples: 13932660
  MD5 signature: 169d402100e8b2b7f4a34be8f6e69d42
METADATA block #1
  type: 4 (VORBIS_COMMENT)
  is last: false
  length: 262
  vendor string: reference libFLAC 1.2.1 20070917
  comments: 9
    comment[0]: album=Chosen Lords
    comment[1]: discid=820d4b0a
    comment[2]: title=Reunion 2
    comment[3]: artist=Aphex Twin
    comment[4]: albumartist=Aphex Twin
    comment[5]: musicbrainz_discid=38zPtfQswmOKtZtgzc8Q3KV2KNo-
    comment[6]: artistsort=Aphex Twin
    comment[7]: date=2006-04-10
    comment[8]: tracknumber=2/10
METADATA block #2
  type: 1 (PADDING)
  is last: true
  length: 1006

audiotags's call to track_number() returns None in this case. I would prefer if it returnes Some(2).

My understanding is that this use of TRACKNUMBER may be non-standard but it's not uncommon. A number of other tools (easytags, for example) work successfully with files like this.

[Question] Cover Art from .m4a/.mp3 Files

I am unable to read cover art from m4a and mp3 files. These are just songs that I have purchased from there Apple Music Store (iTunes)

For example:

let tag = Tag::new().read_from_path(p.clone()).unwrap();

let album_cover_mime: String = tag.album_cover().map(|cover| cover.mime_type).unwrap_or(MimeType::Tiff).into();
let picture_data = tag.album_cover().map(|cover| cover.data).unwrap_or_default().to_vec();

The album_cover_mime is set to default, and the picture_data vec is empty.

Am I doing something wrong?

goals & no-goals

We probably should set out some goals in the README and direct people who need more lower level access to lofty ?

I think one goal also maybe should be that is should be relatively consistent across all file formats.

cc/ @Serial-ATA

Examples:

Adding composer tag

When trying to tag using this library it can tag the album artist and all other tags but leave the composer tag blank. Fix this, so that composer tag can also be used and copied.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    πŸ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. πŸ“ŠπŸ“ˆπŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❀️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.