amahi / amahi-anywhere-fs

Amahi Anywhere file server
GNU General Public License v3.0
12 stars 10 forks source link

Metadata API #28

Open vishwasmittal opened 5 years ago

vishwasmittal commented 5 years ago

Added API to fetch metadata for the media files. Following data can be retrieved from a file:

        Format   string `json:"format"`
    FileType string `json:"file_type"`

    Title       string `json:"title"`
    Album       string `json:"album"`
    Artist      string `json:"artist"`
    AlbumArtist string `json:"album_artist"`
    Composer    string `json:"composer"`
    Genre       string `json:"genre"`
    Year        int    `json:"year"`

    Picture *tag.Picture // `json:"picture"` // Artwork
    Lyrics  string `json:"lyrics"`
    Comment string `json:"comment"

Some of it may be null subject to the data present in the file.

vishwasmittal commented 5 years ago

fixes #26

csoni111 commented 5 years ago

I tested the pr, it works fine. Just one small issue that I noticed, it returns the complete cover image data in the JSON response, something like this:

"Picture":{"Ext":"jpg","MIMEType":"image/jpeg","Type":"Cover (front)","Description":"","Data":"/9j/4AAQSkZJRgABAQEASABIAAD/....."}

How to use this image data on the client-side? The purpose behind building this API was to serve chromecast with the URL of the cover image. So it would make sense if we cache this image data in a jpeg file in .fscache directory and return the URL of the file accessible via /cache.

csoni111 commented 5 years ago

Please also include the docs for this API in amahi-anywhere-specs

vishwasmittal commented 5 years ago

Yeah, caching the image in .fscache makes sense. Will update the PR.

cpg commented 5 years ago

Can we get the docs for the API at the same time as the code, so we can deploy it?

Thanks