GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — GitHub - lenartkladnik/Sngfetch: Just play a song and sngfetch will recognize it and give you all the details right in the command line.

BranchesTags
Open more actions menu

Latest commit

 

History

36 Commits
36 Commits

Folders and files

NameName
Last commit message
Last commit date
bin
bin
 
 
build/sngfetch
build/sngfetch
 
 
examples
examples
 
 
src
src
 
 
.gitattributes
.gitattributes
 
 
.gitignore
.gitignore
 
 
LICENSE.txt
LICENSE.txt
 
 
README.md
README.md
 
 
requirements.txt
requirements.txt
 
 
sngfetch.spec
sngfetch.spec
 
 

Repository files navigation

Sngfetch 🎵

A Python application that identifies a song through your microphone and fetches detailed information about it.

Python License

1. About

Sngfetch is a Python app designed to retrieve data about a song by analyzing audio captured through your microphone.
With Sngfetch, you can:

  • Identify a song.
  • Fetch song metadata (e.g., title, artist, album).
  • Optionally retrieve the song lyrics.

2. How It Works

Sngfetch utilizes three APIs:

  1. Shazam API: To identify the song and its metadata.

    Note: The shazam api is accessed trough shazamio.

  2. Deezer API: To provide additional details about the song.
  3. Genius API: (Optional) To fetch song lyrics.

    Note: To use the Genius API, you'll need to create a free account and register an application to get your client access token.


3. Getting Started

Prerequisites

Make sure you have the following:

  • Python 3.7+

    Only if you are running the python file yourself.

  • A microphone-enabled device.

Running

  1. Clone the repository:

    git clone https://github.com/pyth0g/Sngfetch.git
    cd Sngfetch
  2. Here you can either use a packaged python binary from the ./bin folder (windows or linux), or you can run the python file:

    This should work but there are some issues with shazamio that can arise:

    python -m venv .venv
    source .venv/bin/activate
    pip install -r requirements.txt
    cd src
    python sngfetch.py -h

    In case you get an error when installing the packages try:

    python -m venv .venv
    source .venv/bin/activate
    git clone https://github.com/shazamio/shazamio-core.git
    cd shazamio-core
    pip install .
    cd ..
    pip install -r requirements.txt
    cd src
    python sngfetch.py -h

Packaging

If you wish to package the app yourself:

  • Make sure that if you are using a virtual environment your source is in the env, then run:
    pip install pyinstaller
    pyinstaller sngfetch.spec
    This will create a dist folder in which is your executable.

4. Usage

  • Run the file with the instructions from Running.
  • These are all the possible flags:
  -h, --help            show this help message and exit
  -v, --version         show program's version number and exit
  -l, --lyrics          Display the lyrics of the song fetched.
  -ls, --lyrics-setup   Setup the access token for the Genius API.
  -cd, --continuous-until-different [CONTINUOUS_UNTIL_DIFFERENT]
                        Keep searching even after a song is found, you can specify the delay between searches after the flag, stop by keyboard interrupt.
  -c, --continuous [CONTINUOUS]
                        Keep searching even after a song is found, you can specify the delay between searches after the flag, stop by keyboard interrupt.
  -hi, --history [HISTORY]
                        Show the history of fetched songs or a specific song by title.
  -hic, --history-clear
                        Clear all the history of fetched songs.
  -m, --minimalist [MINIMALIST]
                        Display data in a more minimal style the amount of data can be controlled with an integer (0..2) after the flag.
  -r, --remove REMOVE   Remove a song from the history by it's title.
  -d, --duration DURATION
                        The default duration of each audio sample to be taken in seconds.
  -t, --total TOTAL     The total amount of time to listen for in seconds.
  -inc, --increase INCREASE
                        Increase the duration of each audio sample to be taken in seconds.
  -i, --infinite        Keep trying until interrupted.
  -s, --size SIZE       The size of the cover art.
  --debug               Debug mode.
  -ve, --verbosity VERBOSITY
                        Set the verbosity level of debug (will only have affect if debug is on).
  --disable-stdout      Disable stdout and remove it from log.
  --log                 Log all the output in sngfetch_i.log in the current directory (recommended to use in conjunction with disable-stdout).
  --freeze FREEZE       Freeze basic song data to specified json file.

Setting up lyrics

To setup lyrics fetching you will need to:

  • Visit https://genius.com/api-clients and sign up for an account.
  • Click on New API Client, fill out the form (you can put in any data) and click save.
  • Click on Generate Access Token (bellow Client Secret) and copy the token.
  • Run the program with the -ls or --lyrics-setup flag, it will create the file where you can store the token.
  • The program will prompt you to open the file, confirm and paste the token in after Access-Token:

5. Examples

Result

Single Result

Lyrics

Result with lyrics

History

History

Demo Video

Demo Video


6. Contributing

Contributions are welcome! Here's how you can contribute:

  • Fork the repository.
  • Create a new branch (git checkout -b feature/YourFeature).
  • Commit your changes (git commit -m 'Add YourFeature').
  • Push to the branch (git push origin feature/YourFeature).
  • Open a pull request.

7. License

Distributed under the MIT License. See LICENSE.txt for more information.


8. Contact

For any questions or issues, please open an issue on the GitHub repository.
I will try to get back to you as soon as possible.

About

Just play a song and sngfetch will recognize it and give you all the details right in the command line.

Topics

clicommand-linedeezerlyricsmicrophonemusicpythonshazamsong-recognition

Resources

Readme
MIT license
Activity

Stars

2 stars

Watchers

1 watching

Forks

0 forks
Report repository

Releases

Packages

Used by

Contributors

Languages

You are visitor 01402775 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.