spoty


Namespoty JSON
Version 0.1.11 PyPI version JSON
download
home_pagehttps://github.com/dy-sh/spoty
SummaryCLI tool for management of Spotify, Deezer and other music services as well as local music files.
upload_time2023-01-03 16:27:04
maintainer
docs_urlNone
authorDmitry Savosh
requires_python>=3.7
licenseMIT
keywords music audio spotify deezer
VCS
bugtrack_url
requirements click deemix deezersdk dynaconf Flask loguru mutagen numpy python-dateutil spotipy toml
Travis-CI No Travis.
coveralls test coverage No coveralls.
            [Readme in Russian](https://github.com/dy-sh/spoty/blob/master/README-rus.md)

# Spoty

This command line utility allows you to manage the library in music services, as well as work with the tags of the local mp3/flac files.

With this tool you can:
- Manage a music service from the command line - create/copy/delete playlists, search for songs, add them to playlists, like it, etc.
- From the recommendations and playlists of other users, always listen only to the music that you have not yet heard (skip tracks you listened to). New tracks (which you definitely haven't heard yet) will be automatically added to your library from the playlists of other users and recommendations to which you are subscribed.
- Transfer music from one service to another (for example, from Spotify to Deezer), or from one account to another.
- Scan your collection of mp3/flac files and transfer it to a music service.
- Make a backup of your entire music collection from the music service to csv files on disk. Later, you can restore your playlists from these files in any music service. Now you will never lose your library, even if you lose access to your account.
- Clean your library from duplicates (both in music services and in local files).
- Transfer tags from the music service to your local files, or do it between duplicate local audio files.
- Create m3u8 playlists by grouping audio files by specified tags (for example, by style and mood).
- And much more...

Currently, two services are supported - Spotify and Deezer. You can make a request to add the service you need.

The program supports plugins. You can connect the functionality you need, written by the community. The list of plugins will be updated below. 


## How to install

- Install [python](https://www.python.org/downloads/) version 3.7 or higher.
- Install Spoty running the following command in the terminal: 

```batch
pip install spoty
```


## Plugins

Just put the plugin in the plugins folder and it will be connected automatically (for example, `spoty\plugins\collector\collector.py`). 
You can find out the location of the plugins folder by running the `spoty config` command.

- [collector](https://github.com/dy-sh/spoty_collector) - Plugin for collecting music in spotify.
- [tag-cleaner](https://github.com/dy-sh/spoty_tag_cleaner) Plugin for cleaning tags in audio files.
- [genre-from-folder](https://github.com/dy-sh/spoty_genre_from_folder) - The plugin updates Genre and Mood tags in audio files by the name of the parent folder.


## How to setup

The program is ready to use immediately after installation.
The only thing you need to set up is access to your music service. 

### Set up for Spotify

- On the Spotify [applications](https://developer.spotify.com/dashboard/applications) page, click `Create new app`, create a new application. 
- Click `Edit Settings`, in `Redirect URIs` enter `http://localhost:8888/callback`.
- Copy `Client ID` and `Client Secret` into the configuration file `spoty\settings\.secrets.toml` (parameters `SPOTIFY_CLIENT_ID` and `SPOTIFY_CLIENT_SECRET`).
- Delete `spoty\settings\.cache` file if exist.
- Run any command for Spotify (for example, `spoty spotify me`) and agree to grant access in the opened browser page.
- Everything is ready. When you run the command `spoty spotify me`, you should see your Spotify username. 

### Set up for Deezer

- Run any command for Deezer (eg `spoty deezer playlist list`), you will be prompted for `ARL`. Open Deezer Web Player in a browser and copy the value of the `arl` cookie, enter it into the console. You can edit this value in the file `spoty\settings\.arl`
- Everything is ready. When you run the command `spoty deezer playlist list`, you should see a list of your playlists. 

## How to use

### Command examples

For any command, you can get detailed help by running the command with the `--help` parameter.
Many commands have huge functionality that can be configured using parameters.
Here are just a few examples, for general introduction to Spoty. 

### Examples with music services

Transfer all playlists from Spotify to Deezer: 

```bash
spoty get --s me import-deezer
```

Transfer all playlists from Deezer to Spotify:

```bash
spoty get --d me import-spotify
```

Move playlists with names starting with "BEST" from Spotify to Deezer (you can use any regex to filter playlists): 

```bash
spoty get --sr me "^BEST" import-deezer
```

Export all playlists of specified Spotify user to csv files on disk: 

```bash
spoty get --s "user-name" export
```

Export specified playlists: 

```bash
spoty get --sp "https://open.spotify.com/playlist/37i9dQZF1DXdEiDkV82etZ" --ps "https://open.spotify.com/playlist/37i9dQZF1DX4uWsCu3SlsH" export
```

Import from csv file to Spotify: 

```bash
spoty get --c "./playlist.csv" import-spotify
```

Remove duplicates in Spotify playlist: 

```bash
spoty get --sp "37i9dQZF1DXdEiDkV82etZ" dup get delete
```

Take all tracks in playlists that contain "my" and delete all tracks that were added before the specified date. 

```bash
spoty get --sr me "my"  --leave-added-before "2022-01-10 08:15:27" delete
```

Take all tracks that were added after the specified date (from all playlists) and copy them into one playlist with the specified name. 

```bash
spoty get --s me --leave-added-after "2022-01-10" import-spotify --grouping-pattern "New tracks"
```

Like all tracks in the playlist: 

```bash
spoty spotify playlist "37i9dQZF1DXdEiDkV82etZ" like-all-tracks
```

Remove all tracks that have a like from the playlist: 

```bash
spoty spotify playlist "37i9dQZF1DXdEiDkV82etZ" remove-liked-tracks
```


Export all liked tracks from Spotify to csv files on disk (you can also import the list): 

```bash
spoty spotify like export
```

Find a track that has the specified title (you can also search by artist, ISRC and other tags): 

```bash
spoty spotify track query "track: breathe"
```


### Examples with local mp3/flac files

Sync local mp3/flac files and Spotify playlists: 

```bash
spoty get --a "./music" sync-spotify
```

Take local files, group them by Genre and Mood, and import these playlists to Spotify:

```bash
spoty get --a "./music" import-spotify --grouping-pattern "%GENRE% %MOOD%"
```

Move duplicates from mp3/flac files to specified folder: 

```bash
spoty get --a "./music" dup get move --p "./duplicates"
```

Take local files from one folder, find their duplicates in another folder, and copy the tags that are missing: 

```bash
spoty get --a "./music1" get --a "./music2" dup add-missing-tags
```

Take local files from one folder, find their duplicates in another folder, and replace the specified tags: 

```bash
spoty get --a "./music1" get --a "./music2" dup replace-tags 'Genre,Mood'
```

Compare audio files in two folders, take only unique files from the first folder and export their list to a csv file: 

```bash
spoty get --a "./music1" get --a "./music2" dup get-unique export 
```

Take audio files, filter out those in which Genre is not specified and make an m3u8 playlist out of them (you can import it into the music player). 

```bash
spoty get --a "./music" filter --leave-no-tags 'Genre' create-m3u8
```

Take playlists from csv files, leave only the necessary tags and export playlists to new csv files.

```bash
spoty get --c "C:\Users\User\Documents\spoty\plugins\collector\cache" export --got 'ARTIST,TITLE'    
````

# Development

- Clone repo
- Execute: 
```bash
pip install --editable .
```

Check spoty location:
```bash
spoty config
```

Check spotify connection:
```bash
spoty spotify me
```



            

Raw data

            {
    "_id": null,
    "home_page": "https://github.com/dy-sh/spoty",
    "name": "spoty",
    "maintainer": "",
    "docs_url": null,
    "requires_python": ">=3.7",
    "maintainer_email": "",
    "keywords": "music,audio,spotify,deezer",
    "author": "Dmitry Savosh",
    "author_email": "d.savosh@gmail.com",
    "download_url": "https://files.pythonhosted.org/packages/09/31/5715b2025855dfe52489bec30b4450a5c8038731302b2b35af46c03d07ee/spoty-0.1.11.tar.gz",
    "platform": null,
    "description": "[Readme in Russian](https://github.com/dy-sh/spoty/blob/master/README-rus.md)\r\n\r\n# Spoty\r\n\r\nThis command line utility allows you to manage the library in music services, as well as work with the tags of the local mp3/flac files.\r\n\r\nWith this tool you can:\r\n- Manage a music service from the command line - create/copy/delete playlists, search for songs, add them to playlists, like it, etc.\r\n- From the recommendations and playlists of other users, always listen only to the music that you have not yet heard (skip tracks you listened to). New tracks (which you definitely haven't heard yet) will be automatically added to your library from the playlists of other users and recommendations to which you are subscribed.\r\n- Transfer music from one service to another (for example, from Spotify to Deezer), or from one account to another.\r\n- Scan your collection of mp3/flac files and transfer it to a music service.\r\n- Make a backup of your entire music collection from the music service to csv files on disk. Later, you can restore your playlists from these files in any music service. Now you will never lose your library, even if you lose access to your account.\r\n- Clean your library from duplicates (both in music services and in local files).\r\n- Transfer tags from the music service to your local files, or do it between duplicate local audio files.\r\n- Create m3u8 playlists by grouping audio files by specified tags (for example, by style and mood).\r\n- And much more...\r\n\r\nCurrently, two services are supported - Spotify and Deezer. You can make a request to add the service you need.\r\n\r\nThe program supports plugins. You can connect the functionality you need, written by the community. The list of plugins will be updated below. \r\n\r\n\r\n## How to install\r\n\r\n- Install [python](https://www.python.org/downloads/) version 3.7 or higher.\r\n- Install Spoty running the following command in the terminal: \r\n\r\n```batch\r\npip install spoty\r\n```\r\n\r\n\r\n## Plugins\r\n\r\nJust put the plugin in the plugins folder and it will be connected automatically (for example, `spoty\\plugins\\collector\\collector.py`). \r\nYou can find out the location of the plugins folder by running the `spoty config` command.\r\n\r\n- [collector](https://github.com/dy-sh/spoty_collector) - Plugin for collecting music in spotify.\r\n- [tag-cleaner](https://github.com/dy-sh/spoty_tag_cleaner) Plugin for cleaning tags in audio files.\r\n- [genre-from-folder](https://github.com/dy-sh/spoty_genre_from_folder) - The plugin updates Genre and Mood tags in audio files by the name of the parent folder.\r\n\r\n\r\n## How to setup\r\n\r\nThe program is ready to use immediately after installation.\r\nThe only thing you need to set up is access to your music service. \r\n\r\n### Set up for Spotify\r\n\r\n- On the Spotify [applications](https://developer.spotify.com/dashboard/applications) page, click `Create new app`, create a new application. \r\n- Click `Edit Settings`, in `Redirect URIs` enter `http://localhost:8888/callback`.\r\n- Copy `Client ID` and `Client Secret` into the configuration file `spoty\\settings\\.secrets.toml` (parameters `SPOTIFY_CLIENT_ID` and `SPOTIFY_CLIENT_SECRET`).\r\n- Delete `spoty\\settings\\.cache` file if exist.\r\n- Run any command for Spotify (for example, `spoty spotify me`) and agree to grant access in the opened browser page.\r\n- Everything is ready. When you run the command `spoty spotify me`, you should see your Spotify username. \r\n\r\n### Set up for Deezer\r\n\r\n- Run any command for Deezer (eg `spoty deezer playlist list`), you will be prompted for `ARL`. Open Deezer Web Player in a browser and copy the value of the `arl` cookie, enter it into the console. You can edit this value in the file `spoty\\settings\\.arl`\r\n- Everything is ready. When you run the command `spoty deezer playlist list`, you should see a list of your playlists. \r\n\r\n## How to use\r\n\r\n### Command examples\r\n\r\nFor any command, you can get detailed help by running the command with the `--help` parameter.\r\nMany commands have huge functionality that can be configured using parameters.\r\nHere are just a few examples, for general introduction to Spoty. \r\n\r\n### Examples with music services\r\n\r\nTransfer all playlists from Spotify to Deezer: \r\n\r\n```bash\r\nspoty get --s me import-deezer\r\n```\r\n\r\nTransfer all playlists from Deezer to Spotify:\r\n\r\n```bash\r\nspoty get --d me import-spotify\r\n```\r\n\r\nMove playlists with names starting with \"BEST\" from Spotify to Deezer (you can use any regex to filter playlists): \r\n\r\n```bash\r\nspoty get --sr me \"^BEST\" import-deezer\r\n```\r\n\r\nExport all playlists of specified Spotify user to csv files on disk: \r\n\r\n```bash\r\nspoty get --s \"user-name\" export\r\n```\r\n\r\nExport specified playlists: \r\n\r\n```bash\r\nspoty get --sp \"https://open.spotify.com/playlist/37i9dQZF1DXdEiDkV82etZ\" --ps \"https://open.spotify.com/playlist/37i9dQZF1DX4uWsCu3SlsH\" export\r\n```\r\n\r\nImport from csv file to Spotify: \r\n\r\n```bash\r\nspoty get --c \"./playlist.csv\" import-spotify\r\n```\r\n\r\nRemove duplicates in Spotify playlist: \r\n\r\n```bash\r\nspoty get --sp \"37i9dQZF1DXdEiDkV82etZ\" dup get delete\r\n```\r\n\r\nTake all tracks in playlists that contain \"my\" and delete all tracks that were added before the specified date. \r\n\r\n```bash\r\nspoty get --sr me \"my\"  --leave-added-before \"2022-01-10 08:15:27\" delete\r\n```\r\n\r\nTake all tracks that were added after the specified date (from all playlists) and copy them into one playlist with the specified name. \r\n\r\n```bash\r\nspoty get --s me --leave-added-after \"2022-01-10\" import-spotify --grouping-pattern \"New tracks\"\r\n```\r\n\r\nLike all tracks in the playlist: \r\n\r\n```bash\r\nspoty spotify playlist \"37i9dQZF1DXdEiDkV82etZ\" like-all-tracks\r\n```\r\n\r\nRemove all tracks that have a like from the playlist: \r\n\r\n```bash\r\nspoty spotify playlist \"37i9dQZF1DXdEiDkV82etZ\" remove-liked-tracks\r\n```\r\n\r\n\r\nExport all liked tracks from Spotify to csv files on disk (you can also import the list): \r\n\r\n```bash\r\nspoty spotify like export\r\n```\r\n\r\nFind a track that has the specified title (you can also search by artist, ISRC and other tags): \r\n\r\n```bash\r\nspoty spotify track query \"track: breathe\"\r\n```\r\n\r\n\r\n### Examples with local mp3/flac files\r\n\r\nSync local mp3/flac files and Spotify playlists: \r\n\r\n```bash\r\nspoty get --a \"./music\" sync-spotify\r\n```\r\n\r\nTake local files, group them by Genre and Mood, and import these playlists to Spotify:\r\n\r\n```bash\r\nspoty get --a \"./music\" import-spotify --grouping-pattern \"%GENRE% %MOOD%\"\r\n```\r\n\r\nMove duplicates from mp3/flac files to specified folder: \r\n\r\n```bash\r\nspoty get --a \"./music\" dup get move --p \"./duplicates\"\r\n```\r\n\r\nTake local files from one folder, find their duplicates in another folder, and copy the tags that are missing: \r\n\r\n```bash\r\nspoty get --a \"./music1\" get --a \"./music2\" dup add-missing-tags\r\n```\r\n\r\nTake local files from one folder, find their duplicates in another folder, and replace the specified tags: \r\n\r\n```bash\r\nspoty get --a \"./music1\" get --a \"./music2\" dup replace-tags 'Genre,Mood'\r\n```\r\n\r\nCompare audio files in two folders, take only unique files from the first folder and export their list to a csv file: \r\n\r\n```bash\r\nspoty get --a \"./music1\" get --a \"./music2\" dup get-unique export \r\n```\r\n\r\nTake audio files, filter out those in which Genre is not specified and make an m3u8 playlist out of them (you can import it into the music player). \r\n\r\n```bash\r\nspoty get --a \"./music\" filter --leave-no-tags 'Genre' create-m3u8\r\n```\r\n\r\nTake playlists from csv files, leave only the necessary tags and export playlists to new csv files.\r\n\r\n```bash\r\nspoty get --c \"C:\\Users\\User\\Documents\\spoty\\plugins\\collector\\cache\" export --got 'ARTIST,TITLE'    \r\n````\r\n\r\n# Development\r\n\r\n- Clone repo\r\n- Execute: \r\n```bash\r\npip install --editable .\r\n```\r\n\r\nCheck spoty location:\r\n```bash\r\nspoty config\r\n```\r\n\r\nCheck spotify connection:\r\n```bash\r\nspoty spotify me\r\n```\r\n\r\n\r\n",
    "bugtrack_url": null,
    "license": "MIT",
    "summary": "CLI tool for management of Spotify, Deezer and other music services as well as local music files.",
    "version": "0.1.11",
    "split_keywords": [
        "music",
        "audio",
        "spotify",
        "deezer"
    ],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "35159fd3515c6d50e44446b7e0f3b1b595e20045c3603066a9ee49f18941ab4f",
                "md5": "a8861c80c73454d9b78287693c42fb07",
                "sha256": "1a242cf9815860027d13acc682dd27f0145b1ce5372767810de0104bf6335791"
            },
            "downloads": -1,
            "filename": "spoty-0.1.11-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "a8861c80c73454d9b78287693c42fb07",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": ">=3.7",
            "size": 79078,
            "upload_time": "2023-01-03T16:27:02",
            "upload_time_iso_8601": "2023-01-03T16:27:02.761659Z",
            "url": "https://files.pythonhosted.org/packages/35/15/9fd3515c6d50e44446b7e0f3b1b595e20045c3603066a9ee49f18941ab4f/spoty-0.1.11-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "09315715b2025855dfe52489bec30b4450a5c8038731302b2b35af46c03d07ee",
                "md5": "b5d799a5010dcfda465a606618e934d7",
                "sha256": "b5691b143a762b08fdaafd8603163a73acb75d0fd67e2dc3392765992c6664c1"
            },
            "downloads": -1,
            "filename": "spoty-0.1.11.tar.gz",
            "has_sig": false,
            "md5_digest": "b5d799a5010dcfda465a606618e934d7",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": ">=3.7",
            "size": 54128,
            "upload_time": "2023-01-03T16:27:04",
            "upload_time_iso_8601": "2023-01-03T16:27:04.509493Z",
            "url": "https://files.pythonhosted.org/packages/09/31/5715b2025855dfe52489bec30b4450a5c8038731302b2b35af46c03d07ee/spoty-0.1.11.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2023-01-03 16:27:04",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "github_user": "dy-sh",
    "github_project": "spoty",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": false,
    "requirements": [
        {
            "name": "click",
            "specs": []
        },
        {
            "name": "deemix",
            "specs": []
        },
        {
            "name": "deezersdk",
            "specs": []
        },
        {
            "name": "dynaconf",
            "specs": []
        },
        {
            "name": "Flask",
            "specs": []
        },
        {
            "name": "loguru",
            "specs": []
        },
        {
            "name": "mutagen",
            "specs": []
        },
        {
            "name": "numpy",
            "specs": []
        },
        {
            "name": "python-dateutil",
            "specs": []
        },
        {
            "name": "spotipy",
            "specs": []
        },
        {
            "name": "toml",
            "specs": []
        }
    ],
    "lcname": "spoty"
}
        
Elapsed time: 0.02520s