SongRec icon indicating copy to clipboard operation
SongRec copied to clipboard

getting ID3 tag

Open alfredjophy opened this issue 3 years ago • 5 comments

is there a way to get ID3 tag as a json from either the shazam api used or as a function in songrec it would really help a lot of people using songrec in scripts to recongize songs , rename and add metadata

thanks

alfredjophy avatar Aug 22 '21 05:08 alfredjophy

Hello,

Does something like this not fit the need?

json_data="$(songrec audio-file-to-recognized-song "${MY_SONG_FILE_PATH}.mp3")"
echo "${json_data}" | jq ".track.genres"
echo "${json_data}" | jq ".track.sections[0]"

If not, what is missing? Is there a standard JSON representation for ID3 I don't know about? Or would you want to recognize audio from the microphone through the command line or something like that?

Regards,

marin-m avatar Aug 24 '21 01:08 marin-m

im not sure if there is standard json for ID3 , its just that the way metadata is in the JSON that songrec(i.e shazam gives) is too obscure to get info like artist name , cover art , release year , etc.

Iytmdl's metadata funtions for spotify seems like a easy way to get a more complete metadata output(i will try that later)

alfredjophy avatar Aug 24 '21 10:08 alfredjophy

its just that the way metadata is in the JSON that songrec(i.e shazam gives) is too obscure to get info like artist name , cover art , release year , etc.

Here is the output of the command that I pasted above for a random song:

$ json_data="$(songrec audio-file-to-recognized-song "/home/marin/Jorrdee - Intégrale (2011-2017) [Rap] .mp3/La Nuit Avant le Jour (2015)/15 - Éternel.mp3" )"

$ echo "${json_data}" | jq ".track.genres"
{
  "primary": "Hip-Hop/Rap"
}

$ echo "${json_data}" | jq ".track.sections[0]"
{
  "metadata": [
    {
      "text": "La Nuit Avant Le Jour",
      "title": "Album"
    },
    {
      "text": "DANNY",
      "title": "Label"
    },
    {
      "text": "2019",
      "title": "Released"
    }
  ],
  "metapages": [
    {
      "caption": "Jorrdee",
      "image": "https://is1-ssl.mzstatic.com/image/thumb/Features115/v4/95/82/d2/9582d242-883c-32ee-a8ca-8f91861c73a8/mzl.usxralaf.jpg/800x800cc.jpg"
    },
    {
      "caption": "Eternel",
      "image": "https://is3-ssl.mzstatic.com/image/thumb/Music114/v4/80/a1/43/80a14348-9d68-f813-7d9b-76045f974d45/artwork.jpg/400x400cc.jpg"
    }
  ],
  "tabname": "Song",
  "type": "SONG"
}

Is this really hard to understand? You obtain almost all the basic ID3 tags you can expect for the song, including cover art, genre, artist name, album name, track name, release year, excluding the track number (and Spotify/Deezer/Apple Music URLs are present for fetching any extra metadata if absolutely needed).

Iytmdl's metadata funtions for spotify seems like a easy way to get a more complete metadata output

"Iytmdl spotify" yields no Google results, maybe a typo?

Regards,

marin-m avatar Aug 24 '21 14:08 marin-m

sorry , its ytmdl , thats on github it uses spotify for getting metadata

alfredjophy avatar Aug 25 '21 00:08 alfredjophy

Or would you want to recognize audio from the microphone through the command line or something like that?

Is this possible ?

Can we launch songrec from the cli and get metadata of recognized audio from the microphone as json ? Can we get json using cli version of songrec?

OR:

Just output to stdout or write(or append as a stack) to a file ? So we could, for example, output filename to a file as Artist - Title of the track

> songrec --listen --output ~/recognised_songs.txt

uunnxx avatar Oct 01 '21 23:10 uunnxx