kikusan 0.2.0__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,80 @@
1
+ name: Publish project
2
+
3
+ on:
4
+ release:
5
+ types: [published]
6
+ workflow_dispatch:
7
+ push:
8
+ tags:
9
+ - "v*"
10
+
11
+ jobs:
12
+ build:
13
+ runs-on: ubuntu-latest
14
+ steps:
15
+ - uses: actions/checkout@v4
16
+
17
+ - name: Set up Python
18
+ uses: actions/setup-python@v5
19
+ with:
20
+ python-version: "3.12"
21
+
22
+ - name: Install build dependencies
23
+ run: pip install build
24
+
25
+ - name: Build package
26
+ run: python -m build
27
+
28
+ - name: Upload build artifacts
29
+ uses: actions/upload-artifact@v4
30
+ with:
31
+ name: dist
32
+ path: dist/
33
+
34
+ publish:
35
+ needs: build
36
+ runs-on: ubuntu-latest
37
+ environment: pypi
38
+ permissions:
39
+ id-token: write
40
+ steps:
41
+ - name: Download build artifacts
42
+ uses: actions/download-artifact@v4
43
+ with:
44
+ name: dist
45
+ path: dist/
46
+
47
+ - name: Publish to PyPI
48
+ uses: pypa/gh-action-pypi-publish@release/v1
49
+ build-and-push-image:
50
+ runs-on: ubuntu-latest
51
+ permissions:
52
+ packages: write
53
+ steps:
54
+ - name: Checkout code
55
+ uses: actions/checkout@v4
56
+
57
+ - name: Login to Docker Hub
58
+ uses: docker/login-action@v3
59
+ with:
60
+ registry: ghcr.io
61
+ username: ${{ github.actor }}
62
+ password: ${{ secrets.GITHUB_TOKEN }}
63
+
64
+ - name: Set up QEMU
65
+ uses: docker/setup-qemu-action@v3
66
+
67
+ - name: Set up Docker Buildx
68
+ uses: docker/setup-buildx-action@v3
69
+
70
+ - name: Extract tag name
71
+ id: vars
72
+ run: echo "tag=${GITHUB_REF_NAME}" >> $GITHUB_OUTPUT
73
+
74
+ - name: Build and push
75
+ uses: docker/build-push-action@v6
76
+ with:
77
+ push: true
78
+ tags: |
79
+ ghcr.io/dadav/kikusan:${{ steps.vars.outputs.tag }}
80
+ ghcr.io/dadav/kikusan:latest
@@ -0,0 +1,13 @@
1
+ # Python-generated files
2
+ __pycache__/
3
+ *.py[oc]
4
+ build/
5
+ dist/
6
+ wheels/
7
+ *.egg-info
8
+
9
+ # Virtual environments
10
+ .venv
11
+
12
+ # Downloads
13
+ downloads/
@@ -0,0 +1 @@
1
+ 3.12
@@ -0,0 +1,3 @@
1
+ # Project description
2
+
3
+ Kikusan is a tool to search and download music from youtube music. It must use yt-dlp in the background. It must be usable through CLI and also have a web app (subcommand "web"). The web app should be really simple, but must support search functionality. It should be deployable with docker and have an example docker-compose file. It must add lyrics via lrc files to the downloaded files (via https://lrclib.net/).
@@ -0,0 +1,29 @@
1
+ FROM python:3.12-slim
2
+
3
+ # Install ffmpeg for audio processing
4
+ RUN apt-get update && \
5
+ apt-get install -y --no-install-recommends ffmpeg && \
6
+ rm -rf /var/lib/apt/lists/*
7
+
8
+ # Install uv for fast package management
9
+ COPY --from=ghcr.io/astral-sh/uv:latest /uv /usr/local/bin/uv
10
+
11
+ WORKDIR /app
12
+
13
+ # Copy project files
14
+ COPY README.md pyproject.toml uv.lock ./
15
+ COPY kikusan/ ./kikusan/
16
+
17
+ # Install dependencies
18
+ RUN uv sync --frozen
19
+
20
+ # Create downloads directory
21
+ RUN mkdir -p /downloads
22
+
23
+ ENV KIKUSAN_DOWNLOAD_DIR=/downloads
24
+ ENV KIKUSAN_WEB_PORT=8000
25
+
26
+ EXPOSE 8000
27
+
28
+ # Run the web server
29
+ CMD ["uv", "run", "kikusan", "web", "--host", "0.0.0.0"]
kikusan-0.2.0/PKG-INFO ADDED
@@ -0,0 +1,93 @@
1
+ Metadata-Version: 2.4
2
+ Name: kikusan
3
+ Version: 0.2.0
4
+ Summary: Search and download music from YouTube Music with lyrics
5
+ Requires-Python: >=3.12
6
+ Requires-Dist: apscheduler>=3.10.4
7
+ Requires-Dist: click>=8.0.0
8
+ Requires-Dist: croniter>=1.3.0
9
+ Requires-Dist: fastapi[standard]>=0.115.0
10
+ Requires-Dist: httpx>=0.27.0
11
+ Requires-Dist: mutagen>=1.47.0
12
+ Requires-Dist: pyyaml>=6.0.1
13
+ Requires-Dist: spotipy>=2.24.0
14
+ Requires-Dist: yt-dlp>=2025.12.8
15
+ Requires-Dist: ytmusicapi>=1.8.0
16
+ Description-Content-Type: text/markdown
17
+
18
+ # Kikusan
19
+
20
+ Search and download music from YouTube Music with lyrics.
21
+
22
+ ## Features
23
+
24
+ - Search YouTube Music
25
+ - Download audio in OPUS/MP3/FLAC format
26
+ - Playlist support (download entire playlists)
27
+ - Quick download (search and download first match)
28
+ - Automatic lyrics fetching from lrclib.net (LRC format)
29
+ - CLI and web interface
30
+ - Docker support
31
+
32
+ ## Installation
33
+
34
+ ```bash
35
+ uv sync
36
+ ```
37
+
38
+ ## Usage
39
+
40
+ ### CLI
41
+
42
+ ```bash
43
+ # Search for music
44
+ kikusan search "Bohemian Rhapsody"
45
+
46
+ # Download by video ID
47
+ kikusan download bSnlKl_PoQU
48
+
49
+ # Download by URL
50
+ kikusan download --url "https://music.youtube.com/watch?v=bSnlKl_PoQU"
51
+
52
+ # Search and download first match
53
+ kikusan download --query "Bohemian Rhapsody Queen"
54
+
55
+ # Download entire playlist
56
+ kikusan download --url "https://music.youtube.com/playlist?list=..."
57
+
58
+ # Custom filename format
59
+ kikusan download bSnlKl_PoQU --filename "%(title)s"
60
+
61
+ # Options
62
+ kikusan download bSnlKl_PoQU --output ~/Music --format mp3
63
+ ```
64
+
65
+ ### Web Interface
66
+
67
+ ```bash
68
+ kikusan web
69
+ # Open http://localhost:8000
70
+ ```
71
+
72
+ ### Docker
73
+
74
+ ```bash
75
+ docker compose up -d
76
+ # Open http://localhost:8000
77
+ ```
78
+
79
+ ## Configuration
80
+
81
+ Environment variables:
82
+
83
+ | Variable | Default | Description |
84
+ |----------|---------|-------------|
85
+ | `KIKUSAN_DOWNLOAD_DIR` | `./downloads` | Download directory |
86
+ | `KIKUSAN_AUDIO_FORMAT` | `opus` | Audio format (opus, mp3, flac) |
87
+ | `KIKUSAN_FILENAME_TEMPLATE` | `%(artist,uploader)s - %(title)s` | Filename template (yt-dlp format) |
88
+ | `KIKUSAN_WEB_PORT` | `8000` | Web server port |
89
+
90
+ ## Requirements
91
+
92
+ - Python 3.12+
93
+ - ffmpeg (for audio processing)
@@ -0,0 +1,76 @@
1
+ # Kikusan
2
+
3
+ Search and download music from YouTube Music with lyrics.
4
+
5
+ ## Features
6
+
7
+ - Search YouTube Music
8
+ - Download audio in OPUS/MP3/FLAC format
9
+ - Playlist support (download entire playlists)
10
+ - Quick download (search and download first match)
11
+ - Automatic lyrics fetching from lrclib.net (LRC format)
12
+ - CLI and web interface
13
+ - Docker support
14
+
15
+ ## Installation
16
+
17
+ ```bash
18
+ uv sync
19
+ ```
20
+
21
+ ## Usage
22
+
23
+ ### CLI
24
+
25
+ ```bash
26
+ # Search for music
27
+ kikusan search "Bohemian Rhapsody"
28
+
29
+ # Download by video ID
30
+ kikusan download bSnlKl_PoQU
31
+
32
+ # Download by URL
33
+ kikusan download --url "https://music.youtube.com/watch?v=bSnlKl_PoQU"
34
+
35
+ # Search and download first match
36
+ kikusan download --query "Bohemian Rhapsody Queen"
37
+
38
+ # Download entire playlist
39
+ kikusan download --url "https://music.youtube.com/playlist?list=..."
40
+
41
+ # Custom filename format
42
+ kikusan download bSnlKl_PoQU --filename "%(title)s"
43
+
44
+ # Options
45
+ kikusan download bSnlKl_PoQU --output ~/Music --format mp3
46
+ ```
47
+
48
+ ### Web Interface
49
+
50
+ ```bash
51
+ kikusan web
52
+ # Open http://localhost:8000
53
+ ```
54
+
55
+ ### Docker
56
+
57
+ ```bash
58
+ docker compose up -d
59
+ # Open http://localhost:8000
60
+ ```
61
+
62
+ ## Configuration
63
+
64
+ Environment variables:
65
+
66
+ | Variable | Default | Description |
67
+ |----------|---------|-------------|
68
+ | `KIKUSAN_DOWNLOAD_DIR` | `./downloads` | Download directory |
69
+ | `KIKUSAN_AUDIO_FORMAT` | `opus` | Audio format (opus, mp3, flac) |
70
+ | `KIKUSAN_FILENAME_TEMPLATE` | `%(artist,uploader)s - %(title)s` | Filename template (yt-dlp format) |
71
+ | `KIKUSAN_WEB_PORT` | `8000` | Web server port |
72
+
73
+ ## Requirements
74
+
75
+ - Python 3.12+
76
+ - ffmpeg (for audio processing)
@@ -0,0 +1,49 @@
1
+ # Kikusan Cron Configuration Example
2
+ #
3
+ # This file defines playlists to be monitored and synchronized automatically
4
+ # according to cron schedules.
5
+
6
+ playlists:
7
+ # Playlist name - used for state tracking and M3U playlist file
8
+ favorites:
9
+ # YouTube, YouTube Music, or Spotify playlist URL
10
+ url: https://open.spotify.com/playlist/4X7NjgnVWsjOLNmZtUfFUK?si=93678213885d4c05
11
+
12
+ # Sync behavior:
13
+ # - false: Keep local files even if removed from playlist
14
+ # - true: Delete local files when removed from playlist
15
+ sync: false
16
+
17
+ # Cron schedule expression (standard cron format)
18
+ # Format: minute hour day month weekday
19
+ # Examples:
20
+ # "5 4 * * *" - Daily at 04:05
21
+ # "0 */2 * * *" - Every 2 hours
22
+ # "0 0 * * 0" - Weekly on Sunday at midnight
23
+ # "*/30 * * * *" - Every 30 minutes
24
+ schedule: "5 4 * * *"
25
+
26
+ # Another playlist example with sync enabled
27
+ mixed:
28
+ url: https://open.spotify.com/playlist/1fA6WesRnRQoQl5Nj4sk7S?si=6acbec5276ed4f13
29
+
30
+ # This playlist will delete local files when tracks are removed
31
+ sync: true
32
+
33
+ # Run at minute 23 past every 2nd hour from 0 through 20
34
+ schedule: "23 0-20/2 * * *"
35
+
36
+ # YouTube Music playlist example
37
+ # workout:
38
+ # url: https://music.youtube.com/playlist?list=PLrAXtmErZgOeiKm4sgNOknGvNjby9efdf
39
+ # sync: false
40
+ # schedule: "0 6 * * *" # Daily at 06:00
41
+
42
+ # Usage:
43
+ # kikusan cron # Run continuously
44
+ # kikusan cron --config cron.yaml # Specify config file
45
+ # kikusan cron --once # Sync all playlists once and exit
46
+ # kikusan cron --output /custom/path # Override download directory
47
+ #
48
+ # State files are stored in: {download_dir}/.kikusan/state/
49
+ # M3U playlists are stored in: {download_dir}/{playlist_name}.m3u
@@ -0,0 +1,77 @@
1
+ # Docker Compose configuration for Kikusan Cron
2
+ #
3
+ # This docker-compose file runs the Kikusan cron service for automatic
4
+ # playlist synchronization based on schedules defined in cron.yaml.
5
+
6
+ services:
7
+ # Kikusan cron service - monitors and syncs playlists
8
+ kikusan-cron:
9
+ build: .
10
+ container_name: kikusan-cron
11
+ command: ["uv", "run", "kikusan", "cron", "--config", "/config/cron.yaml"]
12
+
13
+ volumes:
14
+ # Mount downloads directory (contains audio files and state)
15
+ - ./downloads:/downloads
16
+
17
+ # Mount cron configuration file (read-only)
18
+ - ./cron.yaml:/config/cron.yaml:ro
19
+
20
+ environment:
21
+ # Download directory inside container
22
+ - KIKUSAN_DOWNLOAD_DIR=/downloads
23
+
24
+ # Audio format (opus, mp3, or flac)
25
+ - KIKUSAN_AUDIO_FORMAT=opus
26
+
27
+ # Spotify credentials (required for Spotify playlists)
28
+ # Create an app at https://developer.spotify.com/dashboard
29
+ - SPOTIFY_CLIENT_ID=${SPOTIFY_CLIENT_ID}
30
+ - SPOTIFY_CLIENT_SECRET=${SPOTIFY_CLIENT_SECRET}
31
+
32
+ # Optional: Filename template
33
+ # - KIKUSAN_FILENAME_TEMPLATE=%(artist,uploader)s - %(title)s
34
+
35
+ restart: unless-stopped
36
+
37
+ # Optional: Health check
38
+ # healthcheck:
39
+ # test: ["CMD", "test", "-d", "/downloads/.kikusan/state"]
40
+ # interval: 5m
41
+ # timeout: 10s
42
+ # retries: 3
43
+
44
+ # Optional: Run web UI alongside cron service
45
+ # Uncomment the section below to enable the web interface
46
+
47
+ # kikusan-web:
48
+ # build: .
49
+ # container_name: kikusan-web
50
+ # command: ["uv", "run", "kikusan", "web", "--host", "0.0.0.0", "--port", "8000"]
51
+ #
52
+ # ports:
53
+ # - "8000:8000"
54
+ #
55
+ # volumes:
56
+ # - ./downloads:/downloads
57
+ #
58
+ # environment:
59
+ # - KIKUSAN_DOWNLOAD_DIR=/downloads
60
+ # - KIKUSAN_AUDIO_FORMAT=opus
61
+ # - KIKUSAN_WEB_PORT=8000
62
+ #
63
+ # restart: unless-stopped
64
+
65
+ # Usage:
66
+ # 1. Create cron.yaml with your playlist configurations
67
+ # 2. Set SPOTIFY_CLIENT_ID and SPOTIFY_CLIENT_SECRET in .env file
68
+ # 3. Run: docker-compose -f docker-compose.cron.yml up -d
69
+ # 4. View logs: docker-compose -f docker-compose.cron.yml logs -f kikusan-cron
70
+ # 5. Stop: docker-compose -f docker-compose.cron.yml down
71
+ #
72
+ # Files structure:
73
+ # ./downloads/ - Downloaded audio files
74
+ # ./downloads/.kikusan/state/ - State files (playlist tracking)
75
+ # ./downloads/{playlist}.m3u - Generated M3U playlists
76
+ # ./cron.yaml - Cron configuration
77
+ # ./.env - Environment variables (optional)
@@ -0,0 +1,12 @@
1
+ services:
2
+ kikusan:
3
+ build: .
4
+ ports:
5
+ - "8000:8000"
6
+ volumes:
7
+ - ./downloads:/downloads
8
+ environment:
9
+ - KIKUSAN_DOWNLOAD_DIR=/downloads
10
+ - KIKUSAN_AUDIO_FORMAT=opus
11
+ - KIKUSAN_WEB_PORT=8000
12
+ restart: unless-stopped
@@ -0,0 +1,3 @@
1
+ """Kikusan - Search and download music from YouTube Music with lyrics."""
2
+
3
+ __version__ = "0.1.0"