Songbird's cli.
Project description
songbirdcli 🐦
Music downloading client featuring mp3 or m4a tagging.
Dependencies
Install via Pip
Run
pip install songbirdcli
To run (with minimal features enabled) use:
RUN_LOCAL=true GDRIVE_ENABLED=false ITUNES_ENABLED=false python3 songbirdcli
See Configuration for how to configure the CLI via Environment variables. Without configuration, songbirdcli saves it's data relative to the script's directory.
Install via Docker
To run the app via docker, you will require:
Note: to be gung-ho, add --pull always to any of the
below commands to always receive the latest
and greatest images.
First, initialize your docker volumes
make volumesinit
Note: bash or zsh aliases are provided below,
assuming you clone songbird into your home directory
into ~/proj/cboin1996/.
Itunes and Google Drive Integration
Macos:
alias songbirdgi="docker run -it --env-file "${HOME}"/proj/cboin1996/songbird/songbirdcli/songbirdcli/docker.env \
-v "${HOME}"/proj/cboin1996/songbird/songbirdcli/songbirdcli/data/dump:/app/data/dump \
-v "${HOME}"/proj/cboin1996/songbird/songbirdcli/songbirdcli/data/gdrive:/app/data/gdrive \
-v "${HOME}"/Music/iTunes/iTunes\ Media/Automatically\ Add\ to\ Music.localized:/app/data/itunesauto \
-v "${HOME}"/Music/Itunes/Itunes\ Media/Music:/app/data/ituneslib \
-p 8080:8080 \
--hostname songbird \
--pull always \
cboin/songbird:latest"
Windows:
Install windows sub-system for linux and setup the below alias:
alias songbirdgi="docker run -it --env-file "${HOME}"/proj/cboin1996/songbird/songbirdcli/songbirdcli/docker.env \
-v "${HOME}"/proj/cboin1996/songbird/songbirdcli/songbirdcli/data/dump:/app/data/dump \
-v "${HOME}"/proj/cboin1996/songbird/songbirdcli/songbirdcli/data/gdrive:/app/data/gdrive \
-v /mnt/c/Users/*/Music/iTunes/iTunes\ Media/Automatically\ Add\ to\ Music:/app/data/itunesauto \
-v /mnt/c/Users/*/Music/iTunes/iTunes\ Media/Music:/app/data/ituneslib \
-p 8080:8080 \
--hostname songbird \
--pull always \
cboin/songbird:latest"
Minimal configuration
By default, the app assumes itunes is installed. At minimum,
create a .env file with to run without either.
In addition, you need a folder to store local files in.
This folder will be passed as a volume mount to the
dockerized app, as above in -v "app/data/dump":"app/data/dump", and is initialized automatically when running make volumesinit`.
ITUNES_ENABLED=False
GDRIVE_ENABLED=False
Gdrive Only
Create a .env file at the root of the project containing:
ITUNES_ENABLED=false
GDRIVE_FOLDER_ID=foo
Replace the foo with the folder id of your google drive
folder. This is found
in the url inside the folder when open in googledrive.
E.x: https://drive.google.com/drive/folders/foo
Follow https://developers.google.com/drive/api/quickstart/python,
and place the credentials.json file at the app/data/gdrive
folder at the root of the project.
alias songbirdg="docker run -it --env-file "${HOME}"/proj/cboin1996/songbird/songbirdcli/songbirdcli/docker.env \
-v "${HOME}"/proj/cboin1996/songbird/songbirdcli/songbirdcli/data/dump:/app/data/dump \
-v "${HOME}"/proj/cboin1996/songbird/songbirdcli/songbirdcli/data/gdrive:/app/data/gdrive \
-p 8080:8080 \
--hostname songbird \
--pull always \
cboin/songbird:latest"
Itunes Only
GDRIVE_ENABLED=false
Run
Macos:
alias songbirdi="docker run -it --env-file "${HOME}"/proj/cboin1996/songbird/songbirdcli/songbirdcli/docker.env \
-v "${HOME}"/proj/cboin1996/songbird/songbirdcli/songbirdcli/data/dump:/app/data/dump \
-v "${HOME}"/Music/iTunes/iTunes\ Media/Automatically\ Add\ to\ Music.localized:/app/data/itunesauto \
-v "${HOME}"/Music/Itunes/Itunes\ Media/Music:/app/data/ituneslib \
--pull always \
cboin/songbird:latest"
Windows:
Install windows sub-system for linux and setup the below alias:
alias songbirdi="docker run -it --env-file "${HOME}"/proj/cboin1996/songbird/songbirdcli/songbirdcli/docker.env \
-v "${HOME}"/proj/cboin1996/songbird/songbirdcli/songbirdcli/data/dump:/app/data/dump \
-v /mnt/c/Users/*/Music/iTunes/iTunes\ Media/Automatically\ Add\ to\ Music:/app/data/itunesauto \
-v /mnt/c/Users/*/Music/iTunes/iTunes\ Media/Music:/app/data/ituneslib \
-p 8080:8080 \
--hostname songbird \
--pull always \
cboin/songbird:latest"
Install as Package
To use songbirdcli as a python package, use
pip install songbirdcli
See tests for an example of configuring and running songbirdcli as a package.
For API documentation, view here
Development
To run the application locally, you can use a vscode debugger.
You should also setup a .env file
with the parameter RUN_LOCAL=True.
Requirements
-
Clone songbirdcore adjacent to this project.
-
Next, run
export ENV=dev make setup
-
Follow the outputted instructions from
make setup. -
Next, run:
make requirements
Note: the above command performs an editable install of songbirdcore
This allows you to edit songbirdcore locally,
and have those changes directly
integrated with this application when developing.
To install the official stable version use
pip install songbirdcore
Debug CLI
Vscode debugger can be configured to run the cli.py file
with the following .vscode/launch.json file
{
"configurations": [
{
"name": "Python: Current File",
"type": "python",
"request": "launch",
"program": "./songbirdcli/cli.py",
"console": "integratedTerminal",
"justMyCode": true,
"envFile": "./dev.env"
},
]
}
Alternatively, you can simply run the app directly with
python3 songbirdcli/cli.py
Linting
To lint the app, run
make lint
Configuration
The following table summarizes the configurable parameters for the app,
these can be setup in a .env file at the root of the project,
and passed to docker with --env-file .env.
| Variable | Type | Default | Description |
|---|---|---|---|
| RUN_LOCAL | bool | False | Whether to run the app locally, or configure it for running in a container |
| ROOT_PATH | str | sys.path[0] | The root path to the project folder |
| DATA_PATH | str | "data" | The name of the folder where app data is stored on disk |
| ITUNES_SEARCH_API_BASE_URL | str | "https://itunes.apple.com/search" | The itunes search api root url |
| ITUNES_ENABLED | bool | True | Whether to run with itunes integration enabled |
| ITUNES_FOLDER_PATH | Optional[str] | "itunesauto" | The path to the itunes automatically add folder |
| ITUNES_LIB_PATH | Optional[str] | "ituneslib" | The path to the itunes library folder |
| GDRIVE_ENABLED | bool | True | Whether to run with google drive integration |
| GDRIVE_FOLDER_PATH | Optional[str] | "gdrive" | Local folder for storing files destined for uploading to google drive |
| GDRIVE_FOLDER_ID | Optional[str] | "" | The folder id of a cloud google drive folder |
| GDRIVE_AUTH_PORT | int | 8080 | The port for oauth setup for google drive integration |
| LOCAL_SONG_STORE_STR | str | "dump" | Where songs are stored locally |
| FNAME_DUP_KEY | str | "_dup" | The key for naming duplicate files |
| FNAME_DUP_LIMIT | str | 8 | The limit of duplicate files matching the FNAME_DUP_KEY |
| YOUTUBE_DL_ENABLED | bool | True | Whether to enable the youtube download feature |
| YOUTUBE_RENDER_TIMEOUT | int | 20 | The time before giving up on the render of youtube's search page |
| YOUTUBE_RENDER_WAIT | float | 0.2 | The wait time before starting a render of the youtube search page |
| YOUTUBE_RENDER_SLEEP | int | 1 | The wait time after initial render of youtube |
| YOUTUBE_HOME_URL | str | "https://www.youtube.com" | |
| YOUTUBE_SEARCH_URL | str | "https://www.youtube.com/results" | |
| YOUTUBE_SEARCH_TAG | str | "search_query" | The html tag on youtubes home page linking to the html search form |
| YOUTUBE_SEARCHFORM_PAYLOAD | dict | {youtube_search_tag: ""} | the payload for performing a youtube search |
| YOUTUBE_DL_RETRIES | int | 3 | number of retries for youtube-dlp before giving up on a download |
| FILE_FORMAT | str | "mp3" | This field is overwritten to m4a if itunes is enabled. |
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file songbirdcli-0.3.0.tar.gz.
File metadata
- Download URL: songbirdcli-0.3.0.tar.gz
- Upload date:
- Size: 27.4 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
9a2d52f254aa44281f22a9ed037d0b635dee5f42866cfb43a028ea04b57b2322
|
|
| MD5 |
472ba81e70186c9d10b6ecbc18132876
|
|
| BLAKE2b-256 |
8cffd63d4ed647937412b29b18ee5894aea61680de2805f0690e942b3753a70e
|
Provenance
The following attestation bundles were made for songbirdcli-0.3.0.tar.gz:
Publisher:
pypi-publish.yaml on cboin1996/songbird
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
songbirdcli-0.3.0.tar.gz -
Subject digest:
9a2d52f254aa44281f22a9ed037d0b635dee5f42866cfb43a028ea04b57b2322 - Sigstore transparency entry: 698402486
- Sigstore integration time:
-
Permalink:
cboin1996/songbird@b9b06cbeb57a90eb07a25dd71d0fb8c9ad7597ee -
Branch / Tag:
refs/tags/v0.3.0 - Owner: https://github.com/cboin1996
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
pypi-publish.yaml@b9b06cbeb57a90eb07a25dd71d0fb8c9ad7597ee -
Trigger Event:
push
-
Statement type:
File details
Details for the file songbirdcli-0.3.0-py3-none-any.whl.
File metadata
- Download URL: songbirdcli-0.3.0-py3-none-any.whl
- Upload date:
- Size: 21.6 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
bd8f40bf36493fc19f6835a51589a517750226f8e2c1fa728d0d8582f13a32e6
|
|
| MD5 |
56c9ffc4c3e771ac63d3533048e56494
|
|
| BLAKE2b-256 |
0adfc22cb1796dc15a0839ebcaa8d8527610fe48aa78edd2a99dff86ad5dfc2c
|
Provenance
The following attestation bundles were made for songbirdcli-0.3.0-py3-none-any.whl:
Publisher:
pypi-publish.yaml on cboin1996/songbird
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
songbirdcli-0.3.0-py3-none-any.whl -
Subject digest:
bd8f40bf36493fc19f6835a51589a517750226f8e2c1fa728d0d8582f13a32e6 - Sigstore transparency entry: 698402493
- Sigstore integration time:
-
Permalink:
cboin1996/songbird@b9b06cbeb57a90eb07a25dd71d0fb8c9ad7597ee -
Branch / Tag:
refs/tags/v0.3.0 - Owner: https://github.com/cboin1996
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
pypi-publish.yaml@b9b06cbeb57a90eb07a25dd71d0fb8c9ad7597ee -
Trigger Event:
push
-
Statement type: