An automated music downloading service
Project description
Cranberry
===============================
[![PyPI version](https://badge.fury.io/py/cranberry.svg) ](https://pypi.python.org/pypi/cranberry/1.0.0)[![dls](https://img.shields.io/github/downloads/danielschwabacher/cranberry/total.svg) ](
http://github.com/danielschwabacher/cranberry)[![release](https://img.shields.io/github/release/danielschwabacher/cranberry/all.svg) ](https://github.com/danielschwabacher/cranberry)
Cranberry is a flexible solution for batch downloading music. It sits atop [youtube-dl](https://github.com/rg3/youtube-dl) and accepts plaintext files specifying music to download. Cranberry is user friendly and highly extensible. The ultimate goal of this project is to provide a versatile and customizable music downloading experience through a simple and universal medium (plaintext files).
Overview
--------
Cranberry parses plaintexts files for music. After it finds song names in these files, it searches youtube (or another video service) for the matching video. Cranberry then uploads the relevant URLs to youtube-dl, which downloads and converts the video to an MP3.
Installation
--------------------
Cranberry is distributed via a PyPi. The current PyPi index, along with the tar distros can be found here: https://pypi.python.org/pypi/cranberry/1.0.1
The easier way to install cranberry is with pip. Simply run the folllowing:
```pip install cranberry```
Basic Usage Guide
-------------
Cranberry is a command line interface (CLI) meaning that, once installed, the program can be invoked via a command line by running the command: ```cranberry```. This will print a help menu and then exit.
Cranberry Sessions
-------
A cranberry session requires two arguments to run.
1.) A source file, denoted by ```-s```
* This is a plaintext file containing a list of songs to download.
* If left unspecified, cranberry will look for songs in the file ```~/songsList.txt```
* The format of this song file is detailed in the section **Song Files**.
2.) An output directory, denoted by ```-o```
* This is the directory which cranberry will download the MP3s to
* If left unspecified, cranberry will download the songs to ```~/CranberryMusic```
### Basic usage
The following example shows how to download music contained in the file **songs.txt** to the directory **~/music**:
* ```cranberry -s songs.txt -o ~/music```
### More options
##### Append "audio" <a id="append"></a>
Sometimes, especially on Youtube, appending the text "audio" to your search queries results in more accurate matches. Cranberry has a handy flag to automatically append this to your searches, to run cranberry in append mode, use the ```-a``` flag
* ```cranberry -a -s songs.txt -o ~/music```
##### Delay requests <a id="delay"></a>
Youtube may throttle or deny your requests if you spam the site with a lot of requests in a short period of time. Cranberry has a flag (```-r NUM_SECONDS``` ) to add a delay, in seconds, to your requests to mitigate this issue.
* ```cranberry -r 2 -s songs.txt -o ~/music```
* This will run cranberry with a 2 second delay between Youtube requests
* Note that higher values may significantly increase the time cranberry takes to finish
For more rigorous pattern matching and parsing options, see the section entitled **Sensors**
Song Files
----------
Song files are simply .txt files which may contain individual song names, artists, albums, etc. In cranberry's default mode, each line, delimited by the newline character (return), will be searched on Youtube. The first result of each search will be downloaded as a MP3 file.
For example, suppose you want to download all of Beethoven's first 5 symphonies. To do this, you'd construct a file,
**Beethoven_songs.txt**, containing:
**Beethoven_songs.txt**
| Beethoven Symphony No. 1 |
| Beethoven Symphony No. 2 |
| Beethoven Symphony No. 3 |
| Beethoven Symphony No. 4 |
| Beethoven Symphony No. 5 |
Cranberry works best when your song file contains specific enough queries such that the first Youtube search result is what you're looking for. Again, using the [append](#append) flag can help ensure you download the expected content.
Sensors
---------
Sensors are the backbone of cranberry. They specify parsing and search patterns. Cranberry downloads the first result returned by Youtube's search. Using the right sensor can ensure the first Youtube search result is the most relevant one to your use case.
#### Default sensor
The default sensor simply removes numbers and colons from each search query. For example, if your song file contains timestamps along with song names, only the song names will be uploaded to the Youtube search. The following table may help illustrate:
|Actual Song File Text | Uploaded to Youtube |
|-----------------------|---------------------|
| 10:15 SONG_NAME | SONG_NAME |
| Beethoven No. 1 | Beethoven No. |
The default sensor is not a good choice for downloading songs which contain numbers (like the symphonies), as the numbers won't be reflected in the Youtube search.
#### Other sensors
Currently, cranberry just has the one default sensor. I'll be adding more in the future to handle more use cases.
#### Custom sensors
Sensors can, technically, be anything, from simply regex pattern matches to artificially intelligent systems which best pick out which items to search. Cranberry will support custom, user-defined sensors. The architecture for this system is currently a work in progress.
Troubleshooting
-------------------
The most likely problem you'll experience with cranberry is Youtube blocking your requests for long song files. To help remedy this, specify a reasonable number of seconds between requests using the [delay](#delay) flag.
Contributing
---------
Contributions are very welcome. Feel free to fork this repository and add some features.
A final disclaimer
-----------
There is a lot of non-copyrighted, free, and good music on Youtube. Cranberry was developed to make downloading this music less tedious. Without cranberry, the best option is often to upload individual Youtube URLs to a music downloading service (for example, http://youtubemp3.to/). This takes a long time.
You shouldn't use cranberry to download copyrighted works. And, by using this software, you agree that I will not be held responsible for any implications of you downloading or distributing copyrighted work through cranberry.
===============================
[![PyPI version](https://badge.fury.io/py/cranberry.svg) ](https://pypi.python.org/pypi/cranberry/1.0.0)[![dls](https://img.shields.io/github/downloads/danielschwabacher/cranberry/total.svg) ](
http://github.com/danielschwabacher/cranberry)[![release](https://img.shields.io/github/release/danielschwabacher/cranberry/all.svg) ](https://github.com/danielschwabacher/cranberry)
Cranberry is a flexible solution for batch downloading music. It sits atop [youtube-dl](https://github.com/rg3/youtube-dl) and accepts plaintext files specifying music to download. Cranberry is user friendly and highly extensible. The ultimate goal of this project is to provide a versatile and customizable music downloading experience through a simple and universal medium (plaintext files).
Overview
--------
Cranberry parses plaintexts files for music. After it finds song names in these files, it searches youtube (or another video service) for the matching video. Cranberry then uploads the relevant URLs to youtube-dl, which downloads and converts the video to an MP3.
Installation
--------------------
Cranberry is distributed via a PyPi. The current PyPi index, along with the tar distros can be found here: https://pypi.python.org/pypi/cranberry/1.0.1
The easier way to install cranberry is with pip. Simply run the folllowing:
```pip install cranberry```
Basic Usage Guide
-------------
Cranberry is a command line interface (CLI) meaning that, once installed, the program can be invoked via a command line by running the command: ```cranberry```. This will print a help menu and then exit.
Cranberry Sessions
-------
A cranberry session requires two arguments to run.
1.) A source file, denoted by ```-s```
* This is a plaintext file containing a list of songs to download.
* If left unspecified, cranberry will look for songs in the file ```~/songsList.txt```
* The format of this song file is detailed in the section **Song Files**.
2.) An output directory, denoted by ```-o```
* This is the directory which cranberry will download the MP3s to
* If left unspecified, cranberry will download the songs to ```~/CranberryMusic```
### Basic usage
The following example shows how to download music contained in the file **songs.txt** to the directory **~/music**:
* ```cranberry -s songs.txt -o ~/music```
### More options
##### Append "audio" <a id="append"></a>
Sometimes, especially on Youtube, appending the text "audio" to your search queries results in more accurate matches. Cranberry has a handy flag to automatically append this to your searches, to run cranberry in append mode, use the ```-a``` flag
* ```cranberry -a -s songs.txt -o ~/music```
##### Delay requests <a id="delay"></a>
Youtube may throttle or deny your requests if you spam the site with a lot of requests in a short period of time. Cranberry has a flag (```-r NUM_SECONDS``` ) to add a delay, in seconds, to your requests to mitigate this issue.
* ```cranberry -r 2 -s songs.txt -o ~/music```
* This will run cranberry with a 2 second delay between Youtube requests
* Note that higher values may significantly increase the time cranberry takes to finish
For more rigorous pattern matching and parsing options, see the section entitled **Sensors**
Song Files
----------
Song files are simply .txt files which may contain individual song names, artists, albums, etc. In cranberry's default mode, each line, delimited by the newline character (return), will be searched on Youtube. The first result of each search will be downloaded as a MP3 file.
For example, suppose you want to download all of Beethoven's first 5 symphonies. To do this, you'd construct a file,
**Beethoven_songs.txt**, containing:
**Beethoven_songs.txt**
| Beethoven Symphony No. 1 |
| Beethoven Symphony No. 2 |
| Beethoven Symphony No. 3 |
| Beethoven Symphony No. 4 |
| Beethoven Symphony No. 5 |
Cranberry works best when your song file contains specific enough queries such that the first Youtube search result is what you're looking for. Again, using the [append](#append) flag can help ensure you download the expected content.
Sensors
---------
Sensors are the backbone of cranberry. They specify parsing and search patterns. Cranberry downloads the first result returned by Youtube's search. Using the right sensor can ensure the first Youtube search result is the most relevant one to your use case.
#### Default sensor
The default sensor simply removes numbers and colons from each search query. For example, if your song file contains timestamps along with song names, only the song names will be uploaded to the Youtube search. The following table may help illustrate:
|Actual Song File Text | Uploaded to Youtube |
|-----------------------|---------------------|
| 10:15 SONG_NAME | SONG_NAME |
| Beethoven No. 1 | Beethoven No. |
The default sensor is not a good choice for downloading songs which contain numbers (like the symphonies), as the numbers won't be reflected in the Youtube search.
#### Other sensors
Currently, cranberry just has the one default sensor. I'll be adding more in the future to handle more use cases.
#### Custom sensors
Sensors can, technically, be anything, from simply regex pattern matches to artificially intelligent systems which best pick out which items to search. Cranberry will support custom, user-defined sensors. The architecture for this system is currently a work in progress.
Troubleshooting
-------------------
The most likely problem you'll experience with cranberry is Youtube blocking your requests for long song files. To help remedy this, specify a reasonable number of seconds between requests using the [delay](#delay) flag.
Contributing
---------
Contributions are very welcome. Feel free to fork this repository and add some features.
A final disclaimer
-----------
There is a lot of non-copyrighted, free, and good music on Youtube. Cranberry was developed to make downloading this music less tedious. Without cranberry, the best option is often to upload individual Youtube URLs to a music downloading service (for example, http://youtubemp3.to/). This takes a long time.
You shouldn't use cranberry to download copyrighted works. And, by using this software, you agree that I will not be held responsible for any implications of you downloading or distributing copyrighted work through cranberry.
Project details
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
cranberry-1.0.3.tar.gz
(10.1 kB
view details)
Built Distribution
File details
Details for the file cranberry-1.0.3.tar.gz
.
File metadata
- Download URL: cranberry-1.0.3.tar.gz
- Upload date:
- Size: 10.1 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/1.12.1 pkginfo/1.4.2 requests/2.20.0 setuptools/40.5.0 requests-toolbelt/0.8.0 tqdm/4.28.1 CPython/3.6.4
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 7ff106a40ae7af858fd3708c97e6d244d21256e0ee4063e07a0c189f7ccce0e3 |
|
MD5 | 646354307f366a8c651f38b501d5794d |
|
BLAKE2b-256 | e36cc26c45a0e93c65ea428f6c38837682039d944bee9e7684fb529f3d6bb732 |
File details
Details for the file cranberry-1.0.3-py2.py3-none-any.whl
.
File metadata
- Download URL: cranberry-1.0.3-py2.py3-none-any.whl
- Upload date:
- Size: 16.2 kB
- Tags: Python 2, Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/1.12.1 pkginfo/1.4.2 requests/2.20.0 setuptools/40.5.0 requests-toolbelt/0.8.0 tqdm/4.28.1 CPython/3.6.4
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 062613cb303f91d23e3b23da0dfc33a56499a6acf9b4ff8708dfe8c03218af9e |
|
MD5 | 5a28d7d4d83ddfdde6fefb56cae87008 |
|
BLAKE2b-256 | 6f7757672d32d83dae0bea9e4b016e38e901218c89f34e389429a9124e6459ac |