Giter VIP home page Giter VIP logo

gtagger's Introduction

gTagger

A CLI for automatically meta-tagging music files using Genius' API.

Features

  • Infers song title from filename and uses it to match with Genius' database
  • Batch-mode for operating on multiple files and folders
  • Can also take a custom Genius' URL
  • Can also take a custom query for matching
  • Works in CLI and can be imported into Python

Installation

  • Install using pip install --upgrade git+https://github.com/Haroon96/gTagger
  • Signup on Genius to get an API token
  • Run the program and enter the token when prompted

CLI usage

gtagger [-h] [--query QUERY] [--genius-url GENIUS_URL]
           sources [sources ...]

positional arguments:
sources               source file(s) or folder(s)

optional arguments:
-h, --help            show this help message and exit
--query QUERY         Query suffix (use if filename alone isn't sufficient
                    for inferring song title)
--genius-url GENIUS_URL
                    Genius.com URL to use for tagging (use if program
                    fails to find it itself)

Examples

  • To tag all files in your music directory
    • gtagger ~/Music
  • To tag a file with a specific Genius URL
    • gtagger song.mp3 --genius-url https://genius.com/...
  • To improve matching if the filename is vague, use the query parameter to attach a a more specific identifier
    • Attach artist name so the matching becomes more specific
      • gtagger "Face to Face.mp3" --query "Daft Punk"
    • Attach album name when working on that album's folder
      • gtagger "~/Music/Daft Punk" --query "Random Access Memories"
  • Batch-mode
    • gtagger ~/Music song1.mp3 song2.mp3

Python module usage

Example

import os
from gtagger import gTagger

# your Genius API token
token = '...'

# path containing music
source = '~/Music'

# instantiate the tagger by providing
# token and an optional logger
gt = gTagger(token, print)

for filename in os.listdir(source):
    path = os.path.join(source, filename)

    # tag the file by providing
    # a query (filename) for matching
    # and the path to the file
    gt.tag(filename, path)
    
    # additionally the tag method also takes a genius_url
    # parameter for directly tagging instead of inferring from filename

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.