Skip to main content

Download audio from youtube-dl sources and import into beets

Project description

beets ydl

Download audio from youtube-dl sources and import into beets, it will also split tracks from albums:

# 101 Bands -- Short Music for Short People
$ beet ydl "https://www.youtube.com/watch?v=wW6ykueIhX8"

$ beet ls short music for short people

59 Times the Pain - Short Music for Short People - We Want the Kids
7 Seconds - Short Music for Short People - F.O.F.O.D.
88 Fingers Louie - Short Music for Short People - All My Friends Are in Popular Bands
Adrenalin O.D. - Short Music for Short People - Your Kung Fu Is Old... And Now You Must Die!
Aerobitch - Short Music for Short People - Steamroller Blues
[...]

Installation

pip install beets-ydl

And enable ydl plugin on your config.yaml file.

Configuration

Available options on config.yaml:

  • download: will download files from sources after getting information, defaults to True

  • split_files: will try to split album files into separate tracks, defaults to True

  • import: will import files on youtube-dl after downloading and splitting, defaults to True

  • urls: a list of default urls to download when no arguments are provided, you can provide a playlist to get checked every time

  • youtubedl_options is a dictionary of a lot of youtube-dl options available

Example:

plugins: ydl

ydl:
    split_files: true
    urls:
        - url1
        - url2
        - url3
    youtubedl_options:
        postprocessors:
            key': 'SomeOtherExtractor',
            preferredcodec: 'ogg'

Tips

Use a .netrc file

Security discussions apart, you can create a ~/.netrc with credentials for youtube-dl to read.

machine youtube login somelogin@gmail.com password somepassword

Check this entry on youtube-dl docs for more information.

Like this, you can download private playlists or your subscriptions:

beet ydl "https://www.youtube.com/feed/subscriptions"

Download and import later

To download and split files without importing into beets:

beet ydl "<source>" --keep-files --no-import

And later, to import:

beet ydl "<source>" --no-download --no-split-files

Like this, you can download a big playlist and then run the beets import routine, which requires manual intervention.

(possibly) enhance audio quality

beets-ydl uses a proposed 192kbps extractor 'bestaudio' format because it is more likely that it will find separate audio files on sources. Some high quality videos might have better audio quality embedded, so it can also make sense to set a higher quality extractor:

ydl:
    youtubedl_options:
        format: 'best',
        postprocessors:
            key: 'FFmpegExtractAudio'
            preferredcodec: 'mp3'
            preferredquality: '320'
            nopostoverwrites: True

This can, however, end-up with unnecessarily big files that have 320kbps as a merely nominal quality. See this discussion.

Development

To setup a development instance:

virtualenv env
pip install -r requirements.txt
source env/bin/activate

You can also use -v option for printing processing information

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

beets-ydl-0.0.3.tar.gz (8.0 kB view details)

Uploaded Source

Built Distribution

beets_ydl-0.0.3-py3-none-any.whl (8.2 kB view details)

Uploaded Python 3

File details

Details for the file beets-ydl-0.0.3.tar.gz.

File metadata

  • Download URL: beets-ydl-0.0.3.tar.gz
  • Upload date:
  • Size: 8.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.11.0 pkginfo/1.4.2 requests/2.19.1 setuptools/39.2.0 requests-toolbelt/0.8.0 tqdm/4.23.4 CPython/3.6.6

File hashes

Hashes for beets-ydl-0.0.3.tar.gz
Algorithm Hash digest
SHA256 096c88f62f0f2599f644f6877c68174830de86cfdca00683f6835208d14e1b72
MD5 4e8172d437e3340204e2d867cb7f78c1
BLAKE2b-256 e62fd48fa3b187df269cbb48f1d666af867d88463e9f86700e392e4a25384e03

See more details on using hashes here.

File details

Details for the file beets_ydl-0.0.3-py3-none-any.whl.

File metadata

  • Download URL: beets_ydl-0.0.3-py3-none-any.whl
  • Upload date:
  • Size: 8.2 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.11.0 pkginfo/1.4.2 requests/2.19.1 setuptools/39.2.0 requests-toolbelt/0.8.0 tqdm/4.23.4 CPython/3.6.6

File hashes

Hashes for beets_ydl-0.0.3-py3-none-any.whl
Algorithm Hash digest
SHA256 103b90077475096c734fb4453562f3dfc5808b57b0f129358959b6b7bebad545
MD5 c9ca1b8bc34f694083b5dc7a4e80cd3e
BLAKE2b-256 0f6ce8c4dd39caa9fcc3f963dc1ed119c41324321b37ea4805efa8f4924eadbc

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page