Metadata-Version: 2.4
Name: lidarr-youtube-downloader
Version: 0.3.35
Summary: 
License-File: LICENSE
Author: David O Neill
Author-email: dmz.oneill@gmail.com
Requires-Python: >=3.10,<4.0
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.10
Classifier: Programming Language :: Python :: 3.11
Classifier: Programming Language :: Python :: 3.12
Classifier: Programming Language :: Python :: 3.13
Classifier: Programming Language :: Python :: 3.14
Requires-Dist: eyed3
Requires-Dist: requests
Requires-Dist: typer
Requires-Dist: youtube-search-python
Requires-Dist: yt-dlp
Project-URL: Repository, https://github.com/dmzoneill/lidarr-youtube-downloader
Description-Content-Type: text/markdown

# lidarr-youtube-downloader

Look for missing tracks in your Lidarr library and download them from YouTube.

## Docker Usage

### docker run

The docker build needs the `.git` directory, so be sure to clone the repository.

```bash
git clone https://github.com/dmzoneill/lidarr-youtube-downloader.git
docker build -t lyd .
# you need to be careful that the path matches the path that lidarr knows
docker run \
   -v /path/to/music:/path/to/music \
   -v /path/to/db/file:/path/to/db/file \
   -e LIDARR_URL="http://HOST_IP:8686" \
   -e LIDARR_API_KEY="your-api-key" \
   -e LIDARR_DB="/path/to/lidarr/lidarr.db" \
   -e LIDARR_MUSIC_PATH="/music" \
   --name lyd lyd
```

## Local Usage

### Requirements

```bash
dnf/apt install ffmpeg
pip3 install eyed3 youtube-search-python yt-dlp typer
```

### Install

```bash
pip3 install lidarr-youtube-downloader
```

### Config

```bash
export LIDARR_URL="http://127.0.0.4:8686"
export LIDARR_API_KEY="your-api-key"
export LIDARR_DB="/path/to/lidarr/lidarr.db"
export LIDARR_MUSIC_PATH="/music"

# Optional settings
export YT_COOKIES_FILE="/path/to/cookies.txt"    # YouTube cookies for auth
export MATCH_THRESHOLD="0.8"                      # Fuzzy match threshold (0.0-1.0)
export BLACKLIST_KEYWORDS="live,karaoke,cover"    # Skip YouTube results with these words
```

### Usage

```bash
lyd
```

## Sample output

```text
Album: 34/545   Track: 71/226
================================================================================

    Path           : /music/The Beatles
    Artist         : The Beatles
    Album          : The Beatles
    Track          : Norwegian Wood (This Bird Has Flown)
    Genre          : Acoustic Rock
    Date           : 1988
    CD Count       : 16
    CD No          : 6
    Track No       : 2/12

    YouTube search
    ========================================

        Best title: The Beatles - Norwegian Wood (This Bird Has Flown)
        Best match: 1.0

        Selected https://www.youtube.com/watch?v=W15_1kE08Gc

    yt-dlp
    ========================================

        yt-dlp
            --no-progress
            -x
            --audio-format mp3 "https://www.youtube.com/watch?v=W15_1kE08Gc"
            -o
            "/music/The Beatles/The Beatles/The Beatles - The Beatles - Norwegian Wood (This Bird Has Flown).mp3"


        Downloaded successfully

        [youtube] W15_1kE08Gc: Downloading webpage
        [youtube] W15_1kE08Gc: Downloading MPD manifest
        [download] Destination: /music/The Beatles/The Beatles/The Beatles - The Beatles - Norwegian Wood (This Bird Has Flown).mp3
        [download] Download completed
        [ffmpeg] Correcting container in "/music/The Beatles/The Beatles/The Beatles - The Beatles - Norwegian Wood (This Bird Has Flown).mp3"
        [ffmpeg] Post-process file /music/The Beatles/The Beatles/The Beatles - The Beatles - Norwegian Wood (This Bird Has Flown).mp3 exists, skipping

    Ffmpeg
    ========================================

        ffmpeg -i "/music/The Beatles/The Beatles/The Beatles - The Beatles - Norwegian Wood (This Bird Has Flown).mp3"
            -metadata artist="The Beatles"
            -metadata year="1988"
            -metadata title="Norwegian Wood (This Bird Has Flown)"
            -metadata album="The Beatles"
            -metadata track="2"
            -metadata genre="Acoustic Rock"
            -hide_banner
            -loglevel error
            "/music/The Beatles/The Beatles/The Beatles - The Beatles - Norwegian Wood (This Bird Has Flown).mp3"

        ffmpeg added mp3 tag
```

