API
- Create an account on rohilla.co.in for testing the Task Manager API
- Send a GET request to /api/auth/token to get the Bearer type access token by sending your email and password as json in request body
- A task has two parameters - name=string and completed=boolean
Base URL : api.rohilla.co.in/task-manager
POST /api - create a task
GET /api/:id - get a task by id
PATCH /api/:id - update a task by id
DELETE /api/:id - delete a task by id
GET /api - get all tasks
DELETE /api - delete all tasks
PATCH /api - mark/unmark all tasks
Usage
Download high quality (320kbps) songs from *****. Songs may have lower qualities if high quality is unavailable.
- Simple Usage
Run music-dl.exe as a normal application or from command prompt either as "music-dl" or as "music-dl query"
e.g. music-dl song-link
- Advanced Usage
music-dl query --arguments
music-dl song-link --dd "2000s Music"
music-dl song-link --redownload +c --pbcs = --pbrs -
How it works ?
- It takes query parameter as a song/playlist/album link or file containing html body of the song search page or artist page.
- It then fetches the info about the link from an API (there are three API, anyone can be used if an API is down).
- The response from API contains the metadata, url to actual media file, album cover and other metadata tags.
- The media file can be downloaded from media url and then saved to local filesystem which can be listened using any media player.
- The downloaded file is just media i.e. it doesn't contain any information about the title, album, artist, etc. and no embedded lyrics and album cover.
- The album cover is downloaded which is applied to downloaded media files later.
- Lyrics is also downloaded which is embedded into the media file.
- aria2 is used in this project to fetch API response and download songs/albums/lyrics by doing system call to aria2c.exe.
- When the media is downloaded, then its time to write the metadata into it.
- kid3-cli is used to write the metadata and embed the album cover and lyrics into downloaded plain media file.
- The filename is assigned as 'album' - 'title' by default.
- Any file naming format can specified in the config file or from command line arguments.
File Based Database
I have made music-dl in such a way that if one song is downloaded, then it should not be downoaded again by default.
All the info about downloaded songs will be saved to local file as pipe-separated-values which is used to remove duplicates.
Renamer
This tool can also be used to rename any local music files based on their metadata. More details in help file.
Info
The app is working but I have stopped it because the streaming platform may not be happy if someone downloads their content. So, all the API links, streaming service related links and some logic have been hidden from the source code. But the app will definitely work when they are placed again.
A lot more information is in the help file
Spotify Playlist To JioSaavn Song Links Converter
Usage : Spotify-to-JioSaavn.exe spotify-playlist-link/uri
How it works ?
- Spotify has a public api which can be used to get all the songs from a playlist link.
- The JSON response contains the information about the title, artist, album, album artist and other metadata tags.
- Above information of a song is used to match the song on JioSaavn by performing a search request to Unofficial JioSaavnAPI.
- If there is a match between metadata tags, then the album covers of the song is downloaded from Spotify and JioSaavn.
- The downloaded album cover images are comapred to each other using OpenCV in C++ or Pillow in Python.
- If the two images matches, then the albums of the song have been matched and we just need to match the song in that album from JioSaavn.
- The Unofficial JioSaavn API only gives five search query results.
- If there is no overall match for the song among these five results, then more results are fetched from JioSaavn by using Selenium Chrome Driver in Python and matching is done in these results.
- Local Flask server is used to compare album covers from Spotify and JioSaavn for similarity and executing Selenium logic to fetch more search results.
- Flask server is started from CPP side by performing a system call and then requests for above tasks are made to this server by using curl.exe
Spotify Playlist To Deezer Song Links Converter
Usage : Spotify-to-Deezer.exe spotify-playlist-link/uri
How it works ?
- Converting a Spotify song link to Deezer song link is very easy because both has public APIs and the API responses provides the ISRC of the song and UPC of album.
- ISRC is a unique code assigned to a recording uniquely and UPC is a unique code assigned for an album when they are released to the world.
- To match a song, app gets the UPC from spotify and it performes a search query for the UPC obtained to Deezer Public API.
- If there is a match for the UPC, it means that curent song's album is also available on Deezer and it's a direct match.
- Now, the matched album on Deezer is queried to get all the songs in that album and ISRC of the these songs are compared to ISRC of the song obtained from Spotify. The ISRC will definitely match if Deezer has the song.
- If there was no search results from Deezer for the UPC of the album, then it means Deezer doesn't have that song on their platform. But still the song may be available on Deezer in some other album because a song can be present in more than one album.
- We query the Deezer API for the ISRC obtained from Spotify and if the results have some song, then the song is matched but the albums from Spotify and Deezer will be different.
Info
You have to provide a Spotify access token or Client ID and Secret as command line argument to use Spotify API otherwise this app will not work.
Create an app on Spotify to get App Client ID and Client Secret or get a Spotify access token somehow.
Note: The access token expires in one hour.
Spotify-to-JioSaavn.exe spy-playlist-link --token your-access-token
Spotify-to-Deezer.exe spy-playlist-link --client your-clientID:your-client-secret
Overview
Fast Downloader is a command line utility that can download a file faster by dividing it into parts/byte-ranges and downloading each part simultaneously.
Usage
Fast-Downloader.exe url output-file-path
Fast-Downloader.exe url output-file-path --parts 5
How it works ?
- Fast Downloader uses libcurl for downloading.
- First, get the size of the file by making a head request to the specified url.
- Divide the size into specified number of parts.
- There are two ways to download these parts.
- First one is, pass the parts to libcurl's function that handles multiple downloads simulataneously and second one is, create a thread for each part and pass them to libcurl's function that handles one download at a time.
- Fast Downloader uses first method but libcurl is not thread safe and synchronisation has to be done whenever we are writing the downloaded content to file or priniting the progress to console.
- Imagine, the download has started, each part will be downloaded by multiple simulataneous downloads handler of libcurl.
- The handler can be configured to call a function whenever the data arrives.
- The data is stored into memory buffer and whenever the current chunk of data contains last bytes or the buffer size become greater than on equal to 1MB, then we acquire a unique lock and seek to the appropriate byte position of the file, then write this buffer into the file and release the lock.
- The critical variables are atomic variables which can be read and updated atomically.