christykmathew / Music-Tagger

Mp3 file tagger.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Open In Collab

Music-Tagger

Table of Contents

Introduction

An Mp3 file tagger for obsessive-compulsive music geeks. Tags like Artwork, Artist, Album, Genre, Lyrics etc. can be added to your audio metadata and can be automated to certain level. Shazam API is used to fetch the list and meta data of the mp3 file. Synced lyrics that are available is fetched from megalobiz. Mutagen library is used at tha core to edit the meta data.

Features

  • List down probable music titles from the Mp3 filename
  • Get accurate metadata about the music like Artist, Album, Genre, Lyrics, Label, Year, Artwork and save these in the Mp3 file.
  • Get synced Lyrics of the music.
  • User-Friendly interface.

TODO

  • Get Synced Lyrics of the music
  • Add SYLT ID3v2.4 frame (Synced Lyrics Tag) to Mp3 files.
  • Stable version for Windows

Dependencies

API key is required to access Shazam database. Get API Key by signing up in this link and paste it in the API_KEY variable

API_KEY = "" #Enter you API Key

Dependencies like mutagen, wget, music-tag etc. are already installed while running the cells.

Usage

Self-explanatory prompts and outputs are generated while running the python cells. music_list, music_search, Meta_Retrieve,Tags_Save, synced_lyric are the main functions that are used in this program. These functions can be used individually as well.

  1. music_list takes two arguments term and API_KEY where term is the term to be searched. The response from the database in json format is returned
def music_search(term, API_KEY):
  '
  '
  return response
  1. music_search takes three arguments file, mode and api where file is the mp3 file or the term to be searched and mode that can be either 0(Auto selects probable options) or 1(mannual selection (preferred)) and api is the API_KEY. A list of probable music titles based on the file/term will be displayed and its music key will be returned which will be used by Meta_Retrieve.
def music_list(file, mode, api):
  '
  '
  return music['tracks']['hits'][int(option)]['track']['key']
  1. Meta_Retrieve takes three arguments key, file, API_KEY where key is the key retrieved from music_search, file is the name of the Mp3 file. The available tags will be displayed in output. Some tags might not be available and prompt to enter those tags manually will be given. All the tags in a dictionary and the image file will be returned by this function.
def Meta_Retrieve(key, file, API_KEY):
 '
 '
 return tag, Image
  1. Tags_Save takes three argument Tags, Image, file_path where Tags are the python dictionary cantaining the tags, Image is the artwork/Image file for Mp3 and file_path is the path location of the image file. This function is used to save the meta tags to the Mp3 file and doesn't return anything.
def Tags_Save(Tags, Image, file_path):
  1. synced_lyric takes two argument file_path which is the path location of Mp3 and term is the filename/term to be searched for synced lyrics. Synced Lyrics will be saved as .lrc file in Lyrics folder in the file_path specified.
def synced_lyric(file_path, term):

About

Mp3 file tagger.


Languages

Language:Jupyter Notebook 100.0%