console-songs


Nameconsole-songs JSON
Version 2024.11.3 PyPI version JSON
download
home_pageNone
SummaryGiven a song and artist, fetches lyrics from Genius, translates them to English using Azure AI Translator, and displays original and translated lyrics side-by-side in the console.
upload_time2024-11-02 19:35:57
maintainerNone
docs_urlNone
authorNone
requires_python>=3.11
licenseMIT License Copyright (c) 2024 Patrick Kubiak Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
keywords console songs genius-lyrics-api azure-translator
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            # console-songs

> Given a song and artist, fetches lyrics from [Genius](https://genius.com), translates them to English using [Azure AI Translator](https://learn.microsoft.com/en-us/azure/ai-services/translator/), and displays original and translated lyrics side-by-side in the console.

[![Python package](https://github.com/patkub/console-songs/actions/workflows/python-app.yml/badge.svg)](https://github.com/patkub/console-songs/actions/workflows/python-app.yml)
![Python 3.11+ Required](https://img.shields.io/badge/python-3.11+-brightgreen.svg)
[![Code style: black](https://img.shields.io/badge/code%20style-black-000000.svg)](https://github.com/psf/black)

### Idea
1. Fetch song lyrics
2. Translate to English
3. Display original and English translated lyrics side-by-side
4. Save already translated songs in database

Enjoy listening to music and learning a new language!

### Install

Requires Python 3.11+ and [pipx](https://pipx.pypa.io/stable/).

Install the `console-songs` script with pipx from [PyPi](https://pypi.org/project/console-songs/).
```
pipx install console-songs==2024.11.03
```

Setup environment variables with your API keys.
```
export "CS_GENIUS_ACCESS_TOKEN=..."
export "CS_MS_TRANSLATOR_KEY=..."
export "CS_MS_TRANSLATOR_REGION=..."
```
Reference documentation to get API keys.
- [Genius API](https://docs.genius.com)
- [Azure Translator Resource](https://learn.microsoft.com/en-us/azure/ai-services/translator/create-translator-resource)


### Usage

Provide the song and optionally the artist's name.
```
console-songs song [artist]
```
<details>

<summary>Full Usage</summary>

```
(console-songs) patka@Patricks-MacBook-Air console-songs % console-songs --help
usage: console-songs [-h] [-r | --refresh | --no-refresh] [--genius-patch | --no-genius-patch] song [song ...]

positional arguments:
  song

options:
  -h, --help            show this help message and exit
  -r, --refresh, --no-refresh
                        Skip database and refresh song (default: False)
  --genius-patch, --no-genius-patch
                        Use patched version of Genius API (default: True)
```

</details>

Example:
```
console-songs "Ma ucide ea" "Mihail"
```

### Sample Output
```
(console-songs) patka@Patricks-MacBook-Air console-songs % console-songs "Ma ucide ea" "Mihail"
Searching for "Ma ucide ea" by Mihail...
Done.

Mă ucide ea by Mihail
https://genius.com/Mihail-ma-ucide-ea-lyrics

Original:                                                        English:                                                                       
=========                                                        ========                                                                       

[Strofa 1]                                                       [Verse 1]
E totul în viteză                                                It's all in speed
Delir cât cerul de înalt                                         Delirium as high as the sky
Suntem în antiteză                                               We are in antithesis
Subiecții unui simplu joc murdar                                 The subjects of a simple dirty game

[Pre-refren]                                                     [Pre-Chorus]
Ochii mei, rușinați, coboară doritor                             My eyes, ashamed, descend willingly
...
```

<details>

<summary>Full Output</summary>

```
(console-songs) patka@Patricks-MacBook-Air console-songs % console-songs "Ma ucide ea" "Mihail"
Searching for "Ma ucide ea" by Mihail...
Done.

Mă ucide ea by Mihail
https://genius.com/Mihail-ma-ucide-ea-lyrics

Original:                                                        English:
=========                                                        ========

[Strofa 1]                                                       [Verse 1]
E totul în viteză                                                It's all in speed
Delir cât cerul de înalt                                         Delirium as high as the sky
Suntem în antiteză                                               We are in antithesis
Subiecții unui simplu joc murdar                                 The subjects of a simple dirty game

[Pre-refren]                                                     [Pre-Chorus]
Ochii mei, rușinați, coboară doritor                             My eyes, ashamed, descend willingly
Dar te respir, în acest urban decor                              But I breathe you, in this urban setting

[Refren]                                                         [Chorus]
Mă ucide ea, mă ucide ea                                         She's killing me, she's killing me
Încet...                                                         Slow...
Îmi vrea inima, îmi vrea inima                                   He wants my heart, he wants my heart
Din piept                                                        From the chest

[Strofa 2]                                                       [Verse 2]
E atât de grațioasă                                              She's so graceful
Printre mulțimi de oameni                                        Among crowds of people
Plictisiți pe drum                                               Bored on the road
Și pare un dans ascuns                                           And it seems like a hidden dance
Supuși, dansează doi necunoscuți                                 Submissive, two strangers dance

[Pre-refren]                                                     [Pre-Chorus]
Ochii mei, rușinați, coboară doritor                             My eyes, ashamed, descend willingly
Dar te respir, în acest urban decor                              But I breathe you, in this urban setting

[Refren]                                                         [Chorus]
Mă ucide ea, mă ucide ea                                         She's killing me, she's killing me
Încet...                                                         Slow...
Îmi vrea inima, îmi vrea inima                                   He wants my heart, he wants my heart
Din piept                                                        From the chest
Mă ucide ea, mă ucide ea                                         She's killing me, she's killing me
Încet...                                                         Slow...
Îmi vrea inima, îmi vrea inima                                   He wants my heart, he wants my heart
Din piept                                                        From the chest

[Punte]                                                          [Tips]
Arde pe asfalt și pulsează foc                                   It burns on the asphalt and pulsates fire
Arde, arde revoltat                                              It burns, it burns in revolt
Arde prea frumos, arde inima                                     It burns too beautifully, it burns the heart
Arde, recunosc!                                                  It's burning, I admit!

[Strofa 3]                                                       [Verse 3]
Mă ucide ea încet, încet                                         She's killing me slowly, slowly
Îmi rupe inima, da, din piept                                    It breaks my heart, yes, out of my chest
Tremură ușor buzele mușcate                                      Bitten lips tremble slightly
Iar gravitația mă atacă                                          And gravity attacks me
Fluturi și vibrații calde pe asfalt                              Butterflies and warm vibrations on asphalt
De parcă ne plimbăm desculți, prin pat                           As if we were walking barefoot, in bed
Sirene de incendiu care nu ne pot opri                           Fire sirens that can't stop us
Iar timpul, un nemernic, numără grăbit                           And time, an, counts in a hurry

[Outro]                                                          [Other]
Mă ucide ea                                                      She's killing me
Mă ucide ea                                                      She's killing me
Mă ucide ea                                                      She's killing me
Mă ucide ea                                                      She's killing me
Da, da...                                                        Yes, yes...
```

</details>


### Development Setup

Requires Python 3.11+ and [pipx](https://pipx.pypa.io/stable/).

Install the `console-songs` script with pipx for developement.
```
pipx install .
```

Create an `.env` file with your API keys.
```
CS_GENIUS_ACCESS_TOKEN=...
CS_MS_TRANSLATOR_KEY=...
CS_MS_TRANSLATOR_REGION=...
```
Reference documentation to get API keys.
- [Genius API](https://docs.genius.com)
- [Azure Translator Resource](https://learn.microsoft.com/en-us/azure/ai-services/translator/create-translator-resource)

Setup a virtual environment:
```
python3 -m venv .
source bin/activate
```

Install dependencies:
```
pip3 install -r requirements.txt
```

You should now be able to run `python3 src/songs.py --help` and see usage.

When making code changes, remember to format code with black:
```
black .
```


### Unit Tests

Run unit tests with [pytest](https://docs.pytest.org/en/stable/) and report coverage.
```
pytest
```


### Publishing

Publish a new version to PyPi.
```
python3 -m build
python3 -m pip install --upgrade twine
python3 -m twine upload --repository pypi dist/*
```

            

Raw data

            {
    "_id": null,
    "home_page": null,
    "name": "console-songs",
    "maintainer": null,
    "docs_url": null,
    "requires_python": ">=3.11",
    "maintainer_email": "Patrick Kubiak <epicpatka@gmail.com>",
    "keywords": "console, songs, genius-lyrics-api, azure-translator",
    "author": null,
    "author_email": "Patrick Kubiak <epicpatka@gmail.com>",
    "download_url": "https://files.pythonhosted.org/packages/68/46/9d733639c2b5ce33aed75b454235ee9acd30b0a6189a839701ebe7e698ed/console_songs-2024.11.3.tar.gz",
    "platform": null,
    "description": "# console-songs\n\n> Given a song and artist, fetches lyrics from [Genius](https://genius.com), translates them to English using [Azure AI Translator](https://learn.microsoft.com/en-us/azure/ai-services/translator/), and displays original and translated lyrics side-by-side in the console.\n\n[![Python package](https://github.com/patkub/console-songs/actions/workflows/python-app.yml/badge.svg)](https://github.com/patkub/console-songs/actions/workflows/python-app.yml)\n![Python 3.11+ Required](https://img.shields.io/badge/python-3.11+-brightgreen.svg)\n[![Code style: black](https://img.shields.io/badge/code%20style-black-000000.svg)](https://github.com/psf/black)\n\n### Idea\n1. Fetch song lyrics\n2. Translate to English\n3. Display original and English translated lyrics side-by-side\n4. Save already translated songs in database\n\nEnjoy listening to music and learning a new language!\n\n### Install\n\nRequires Python 3.11+ and [pipx](https://pipx.pypa.io/stable/).\n\nInstall the `console-songs` script with pipx from [PyPi](https://pypi.org/project/console-songs/).\n```\npipx install console-songs==2024.11.03\n```\n\nSetup environment variables with your API keys.\n```\nexport \"CS_GENIUS_ACCESS_TOKEN=...\"\nexport \"CS_MS_TRANSLATOR_KEY=...\"\nexport \"CS_MS_TRANSLATOR_REGION=...\"\n```\nReference documentation to get API keys.\n- [Genius API](https://docs.genius.com)\n- [Azure Translator Resource](https://learn.microsoft.com/en-us/azure/ai-services/translator/create-translator-resource)\n\n\n### Usage\n\nProvide the song and optionally the artist's name.\n```\nconsole-songs song [artist]\n```\n<details>\n\n<summary>Full Usage</summary>\n\n```\n(console-songs) patka@Patricks-MacBook-Air console-songs % console-songs --help\nusage: console-songs [-h] [-r | --refresh | --no-refresh] [--genius-patch | --no-genius-patch] song [song ...]\n\npositional arguments:\n  song\n\noptions:\n  -h, --help            show this help message and exit\n  -r, --refresh, --no-refresh\n                        Skip database and refresh song (default: False)\n  --genius-patch, --no-genius-patch\n                        Use patched version of Genius API (default: True)\n```\n\n</details>\n\nExample:\n```\nconsole-songs \"Ma ucide ea\" \"Mihail\"\n```\n\n### Sample Output\n```\n(console-songs) patka@Patricks-MacBook-Air console-songs % console-songs \"Ma ucide ea\" \"Mihail\"\nSearching for \"Ma ucide ea\" by Mihail...\nDone.\n\nM\u0103 ucide ea by Mihail\nhttps://genius.com/Mihail-ma-ucide-ea-lyrics\n\nOriginal:                                                        English:                                                                       \n=========                                                        ========                                                                       \n\n[Strofa 1]                                                       [Verse 1]\nE totul \u00een vitez\u0103                                                It's all in speed\nDelir c\u00e2t cerul de \u00eenalt                                         Delirium as high as the sky\nSuntem \u00een antitez\u0103                                               We are in antithesis\nSubiec\u021bii unui simplu joc murdar                                 The subjects of a simple dirty game\n\n[Pre-refren]                                                     [Pre-Chorus]\nOchii mei, ru\u0219ina\u021bi, coboar\u0103 doritor                             My eyes, ashamed, descend willingly\n...\n```\n\n<details>\n\n<summary>Full Output</summary>\n\n```\n(console-songs) patka@Patricks-MacBook-Air console-songs % console-songs \"Ma ucide ea\" \"Mihail\"\nSearching for \"Ma ucide ea\" by Mihail...\nDone.\n\nM\u0103 ucide ea by Mihail\nhttps://genius.com/Mihail-ma-ucide-ea-lyrics\n\nOriginal:                                                        English:\n=========                                                        ========\n\n[Strofa 1]                                                       [Verse 1]\nE totul \u00een vitez\u0103                                                It's all in speed\nDelir c\u00e2t cerul de \u00eenalt                                         Delirium as high as the sky\nSuntem \u00een antitez\u0103                                               We are in antithesis\nSubiec\u021bii unui simplu joc murdar                                 The subjects of a simple dirty game\n\n[Pre-refren]                                                     [Pre-Chorus]\nOchii mei, ru\u0219ina\u021bi, coboar\u0103 doritor                             My eyes, ashamed, descend willingly\nDar te respir, \u00een acest urban decor                              But I breathe you, in this urban setting\n\n[Refren]                                                         [Chorus]\nM\u0103 ucide ea, m\u0103 ucide ea                                         She's killing me, she's killing me\n\u00cencet...                                                         Slow...\n\u00cemi vrea inima, \u00eemi vrea inima                                   He wants my heart, he wants my heart\nDin piept                                                        From the chest\n\n[Strofa 2]                                                       [Verse 2]\nE at\u00e2t de gra\u021bioas\u0103                                              She's so graceful\nPrintre mul\u021bimi de oameni                                        Among crowds of people\nPlictisi\u021bi pe drum                                               Bored on the road\n\u0218i pare un dans ascuns                                           And it seems like a hidden dance\nSupu\u0219i, danseaz\u0103 doi necunoscu\u021bi                                 Submissive, two strangers dance\n\n[Pre-refren]                                                     [Pre-Chorus]\nOchii mei, ru\u0219ina\u021bi, coboar\u0103 doritor                             My eyes, ashamed, descend willingly\nDar te respir, \u00een acest urban decor                              But I breathe you, in this urban setting\n\n[Refren]                                                         [Chorus]\nM\u0103 ucide ea, m\u0103 ucide ea                                         She's killing me, she's killing me\n\u00cencet...                                                         Slow...\n\u00cemi vrea inima, \u00eemi vrea inima                                   He wants my heart, he wants my heart\nDin piept                                                        From the chest\nM\u0103 ucide ea, m\u0103 ucide ea                                         She's killing me, she's killing me\n\u00cencet...                                                         Slow...\n\u00cemi vrea inima, \u00eemi vrea inima                                   He wants my heart, he wants my heart\nDin piept                                                        From the chest\n\n[Punte]                                                          [Tips]\nArde pe asfalt \u0219i pulseaz\u0103 foc                                   It burns on the asphalt and pulsates fire\nArde, arde revoltat                                              It burns, it burns in revolt\nArde prea frumos, arde inima                                     It burns too beautifully, it burns the heart\nArde, recunosc!                                                  It's burning, I admit!\n\n[Strofa 3]                                                       [Verse 3]\nM\u0103 ucide ea \u00eencet, \u00eencet                                         She's killing me slowly, slowly\n\u00cemi rupe inima, da, din piept                                    It breaks my heart, yes, out of my chest\nTremur\u0103 u\u0219or buzele mu\u0219cate                                      Bitten lips tremble slightly\nIar gravita\u021bia m\u0103 atac\u0103                                          And gravity attacks me\nFluturi \u0219i vibra\u021bii calde pe asfalt                              Butterflies and warm vibrations on asphalt\nDe parc\u0103 ne plimb\u0103m descul\u021bi, prin pat                           As if we were walking barefoot, in bed\nSirene de incendiu care nu ne pot opri                           Fire sirens that can't stop us\nIar timpul, un nemernic, num\u0103r\u0103 gr\u0103bit                           And time, an, counts in a hurry\n\n[Outro]                                                          [Other]\nM\u0103 ucide ea                                                      She's killing me\nM\u0103 ucide ea                                                      She's killing me\nM\u0103 ucide ea                                                      She's killing me\nM\u0103 ucide ea                                                      She's killing me\nDa, da...                                                        Yes, yes...\n```\n\n</details>\n\n\n### Development Setup\n\nRequires Python 3.11+ and [pipx](https://pipx.pypa.io/stable/).\n\nInstall the `console-songs` script with pipx for developement.\n```\npipx install .\n```\n\nCreate an `.env` file with your API keys.\n```\nCS_GENIUS_ACCESS_TOKEN=...\nCS_MS_TRANSLATOR_KEY=...\nCS_MS_TRANSLATOR_REGION=...\n```\nReference documentation to get API keys.\n- [Genius API](https://docs.genius.com)\n- [Azure Translator Resource](https://learn.microsoft.com/en-us/azure/ai-services/translator/create-translator-resource)\n\nSetup a virtual environment:\n```\npython3 -m venv .\nsource bin/activate\n```\n\nInstall dependencies:\n```\npip3 install -r requirements.txt\n```\n\nYou should now be able to run `python3 src/songs.py --help` and see usage.\n\nWhen making code changes, remember to format code with black:\n```\nblack .\n```\n\n\n### Unit Tests\n\nRun unit tests with [pytest](https://docs.pytest.org/en/stable/) and report coverage.\n```\npytest\n```\n\n\n### Publishing\n\nPublish a new version to PyPi.\n```\npython3 -m build\npython3 -m pip install --upgrade twine\npython3 -m twine upload --repository pypi dist/*\n```\n",
    "bugtrack_url": null,
    "license": "MIT License  Copyright (c) 2024 Patrick Kubiak  Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the \"Software\"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:  The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.  THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. ",
    "summary": "Given a song and artist, fetches lyrics from Genius, translates them to English using Azure AI Translator, and displays original and translated lyrics side-by-side in the console.",
    "version": "2024.11.3",
    "project_urls": null,
    "split_keywords": [
        "console",
        " songs",
        " genius-lyrics-api",
        " azure-translator"
    ],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "496ec0f9a1ec6358fe89d97dac73262c11c00bba09e2e7632659c05381e84b74",
                "md5": "f3c9690c86dec5d4ad2a023582557136",
                "sha256": "ed079566024a7f34dacd4a1d60e19e7d2bb11d3bb2880ee15d7daeacc3a1af3c"
            },
            "downloads": -1,
            "filename": "console_songs-2024.11.3-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "f3c9690c86dec5d4ad2a023582557136",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": ">=3.11",
            "size": 17776,
            "upload_time": "2024-11-02T19:35:55",
            "upload_time_iso_8601": "2024-11-02T19:35:55.778341Z",
            "url": "https://files.pythonhosted.org/packages/49/6e/c0f9a1ec6358fe89d97dac73262c11c00bba09e2e7632659c05381e84b74/console_songs-2024.11.3-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "68469d733639c2b5ce33aed75b454235ee9acd30b0a6189a839701ebe7e698ed",
                "md5": "1da3068f279dc9cf4ae9ddea6f4d3a77",
                "sha256": "4dc1acfb14e2eda950e00e01161d3eba9dd0d9210e5c79b00699d9c6d11746d0"
            },
            "downloads": -1,
            "filename": "console_songs-2024.11.3.tar.gz",
            "has_sig": false,
            "md5_digest": "1da3068f279dc9cf4ae9ddea6f4d3a77",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=3.11",
            "size": 13346,
            "upload_time": "2024-11-02T19:35:57",
            "upload_time_iso_8601": "2024-11-02T19:35:57.411939Z",
            "url": "https://files.pythonhosted.org/packages/68/46/9d733639c2b5ce33aed75b454235ee9acd30b0a6189a839701ebe7e698ed/console_songs-2024.11.3.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2024-11-02 19:35:57",
    "github": false,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "lcname": "console-songs"
}
        
Elapsed time: 0.56609s