Coder Social home page Coder Social logo

akashrchandran / syrics Goto Github PK

View Code? Open in Web Editor NEW
148.0 4.0 11.0 85 KB

A command line tool to fetch lyrics from spotify and save it to lrc file. It can fetch both synced and unsynced lyrics from spotify.

License: GNU General Public License v3.0

Python 100.00%
lyrics spotify spotify-lyrics musixmatch spotify-web-api spotipy musixmatch-lyrics music python python3

syrics's Introduction

syrics logo

A command line tool to fetch lyrics from spotify and save it to lrc file. It can fetch both synced and unsynced lyrics from spotify. You can find API version at akashrchandran/spotify-lyrics-api.

Getting started

You will need a spotify account, free also works for some limited songs but it's nice to have premium.

Install with pip

pip3 install syrics

Upgrade with pip

pip3 install syrics --upgrade

To get more detailed installation guide please check wiki's installation page

Finding sp_dc

Syrics sp_dc cookie to authenticate against Spotify in order to have access to the required services.

The methods are explained in the wiki.

Config

When you run the program for the first time, it will directly create config and open editing.

To edit config

syrics --config

To reset config to default values

syrics --config reset

To open config in notepad or nano text editors

syrics --config open

After finding sp_dc you should edit config file and set sp_dc to the value you found.

Default values of config

{
    "sp_dc": "",
    "download_path": "downloads",
    "create_folder": true,
    "album_folder_name": "{name} - {artists}",
    "play_folder_name": "{name} - {owner}",
    "file_name": "{track_number}. {name}",
    "synced_lyrics": true,
    "force_download": false,
    "force_synced": false
}

See wiki for more details about the format tag detailts in config keys.

Usage

Make sure you have set the congig before starting

1. Direct

syrics
Enter link: https://open.spotify.com/track/2eAvDnpXP5W0cVtiI0PUxV

It will ask for the link

2. Passing link as commandline argument

syrics https://open.spotify.com/track/2eAvDnpXP5W0cVtiI0PUxV

changing download folder command

syrics --directory ~/Music/songs/ https://open.spotify.com/track/2eAvDnpXP5W0cVtiI0PUxV

download current playing song on authorized account

syrics --user current-playing

downloading from user playlist

syrics --user playlist

To see available commands

syrics -h

3. Passing Folder path with music files (Experimental)

syrics /home/public_user/Music/songs

Use as a module

from syrics.api import Spotify
sp = Spotify("SP_DC here!")
sp.get_lyrics("28RQx5pH9T9LZXY02IheWc")

syrics's People

Contributors

abh1-ram avatar abijithka02 avatar akashrchandran avatar riptide-11 avatar ronoren avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

syrics's Issues

downloading transcript for a podcast

I checked requests from open.spotify.com and your code, adding this func, based on get_lyrics, to Spotify class is enough to make it work

import syrics.api
class Spotify(syrics.api.Spotify):
    def get_transcripts(self, episode_id: str):
        params = 'format=json'

        req = self.session.get(f'https://spclient.wg.spotify.com/transcript-read-along/v2/episode/{episode_id}', params=params)
        return req.json() if req.status_code == 200 else None

Error: 'NoneType' object is not subscriptable

I tried to run the script and got this error:

Traceback (most recent call last):
File "C:\Users\Ron Oren\syrics\syrics.py", line 31, in
cmd_url = parse_cmd(config, client)
File "C:\Users\Ron Oren\syrics\cli.py", line 29, in parse_cmd
args.URL = client.get_current_song(
TypeError: 'NoneType' object is not subscriptable
PS C:\Users\Ron Oren\syrics>

I did everything right, renamed the config file and got the sp_dc but for some reason I can't even get the script started.
Love to get help on this.
Thanks!

New Update Give Errors

Congrats on the new update!
It looks promising, but it does have few bugs:

I installed the new program with pip install and run a "syrics --config" commend.
Here's who it turned out:

image

ID Tags

Could it be possible to add ID Tags? Example:

[ar:Chubby Checker oppure  Beatles, The]
[al:Hits Of The 60's - Vol. 2 – Oldies]
[ti:Let's Twist Again]
[au:Written by Kal Mann / Dave Appell, 1961]
[length: 2:23]

[00:12.00]Naku Penda Piya-Naku Taka Piya-Mpenziwe
[00:15.30]Some more lyrics ..

Thank you for this tool!

Error at Passing Folder path with music files

60%|███████████████████▏ | 87/145 [00:51<00:34, 1.68it/s]
Traceback (most recent call last):
File "/data/data/com.termux/files/usr/bin/syrics", line 8, in
sys.exit(main())
^^^^^^
File "/data/data/com.termux/files/usr/lib/python3.11/site-packages/syrics/core.py", line 164, in main
unable = fetch_files(link)
^^^^^^^^^^^^^^^^^
File "/data/data/com.termux/files/usr/lib/python3.11/site-packages/syrics/core.py", line 135, in fetch_files
save_lyrics(format_lrc(lyrics_json), path=file_name)
^^^^^^^^^^^^^^^^^^^^^^^
File "/data/data/com.termux/files/usr/lib/python3.11/site-packages/syrics/core.py", line 58, in format_lrc
if (lyrics_json['lyrics']['syncType'] == 'UNSYNCED' and not config['force_synced']) or not config['synced_lyrics']:
~~~~~~^^^^^^^^^^^^^^^^
KeyError: 'force_synced'
IMG_20221102_162126

Idea

I think i would be cool if you could get the lyrics of the song you are currently listening to automatically downloaded. (I have seen that this function exist but it is not used anywhere) 👍

The problem with Synced Lyrics (Suggestion)

The problem with synced lyrics is that more than often some songs are missing on one streaming service and on the other they are. And even if they are apparent some lines can be missing and even if everything is right and time syncing itself can be wrong.

This can lead some of us (who've got tens of thoundsends of tracks and albums) on a journy with 10 different programs to try and figure out which streaming service got the perfect (or at least coreect) synced lyrics for our songs and try to get those lyrics off of the streaming services.

So to combat this problem, here's an idea:
Do a program like this for Deezer and perhaps for Tidal too? (Maybe even Musixmatch!)
And combine all of them to one program.

That way we could combine all the massive databases of each streaming service into one and massivly increase our chances of getting a good quality synced Lyrics!

Installation failed on latest python (termux)

This used to work really well on termux before but today i reinstalled termux and it's not even installing,
seems like it tries to update pip through it's installation script which is causing the issue.. Other packages work fine that's why I'm opening this issue here.

Screenshot_20230227-052753

Passing Folder path with music files

I tried 2 different playlists (I know for 100% that for most of the tracks there's synced lyrics in spotify.

One couldn't find any lyrics:

Screenshot_20220923-112316_Termux.png

The other stopped at 80 tracks and spat this error:

Screenshot_20220923-113040_Termux.jpg

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.