forked from Ethanscharlie/Happy-Ripper
Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
83c2593ff4 | ||
|
|
170914539d | ||
|
|
4060cb672f |
@@ -1,25 +0,0 @@
|
|||||||
#!/bin/bash
|
|
||||||
|
|
||||||
DOCKERHUB_USERNAME="${1}"
|
|
||||||
DOCKERHUB_PASSWORD="${2}"
|
|
||||||
GITEA_OWNER_REPO="${3}"
|
|
||||||
GITEA_API_KEY="${4}"
|
|
||||||
gitea_username=$(echo "${GITEA_OWNER_REPO}" | sed 's/\/.*//')
|
|
||||||
repo_name=$(echo "${GITEA_OWNER_REPO}" | sed 's/^.*\///')
|
|
||||||
|
|
||||||
NEW_DOCKERHUB_TOKEN=$(curl -s -X POST "https://hub.docker.com/v2/auth/token" \
|
|
||||||
-H "Content-Type: application/json" \
|
|
||||||
-d "{\"identifier\": \"${DOCKERHUB_USERNAME}\", \"secret\": \"${DOCKERHUB_PASSWORD}\"}" \
|
|
||||||
| jq -r .access_token)
|
|
||||||
|
|
||||||
curl -X 'PUT' \
|
|
||||||
"https://gitea.happylizard.me/api/v1/repos/${gitea_username}/${repo_name}/actions/secrets/DOCKERHUB_TOKEN" \
|
|
||||||
-H 'accept: application/json' \
|
|
||||||
-H "Authorization: token ${GITEA_API_KEY}" \
|
|
||||||
-H 'Content-Type: application/json' \
|
|
||||||
-d "{
|
|
||||||
\"data\": \"${NEW_DOCKERHUB_TOKEN}\",
|
|
||||||
\"description\": \"\"
|
|
||||||
}"
|
|
||||||
|
|
||||||
|
|
||||||
@@ -1,53 +0,0 @@
|
|||||||
name: Build and Push Docker Image
|
|
||||||
|
|
||||||
on:
|
|
||||||
push:
|
|
||||||
branches:
|
|
||||||
- docker_upload
|
|
||||||
|
|
||||||
jobs:
|
|
||||||
docker:
|
|
||||||
runs-on: ubuntu-latest
|
|
||||||
|
|
||||||
steps:
|
|
||||||
- id: get-repo-name
|
|
||||||
name: Grab formatted repo name
|
|
||||||
run: |
|
|
||||||
repository_name=$(echo ${{ gitea.repository }} | sed 's/^.*\///')
|
|
||||||
dockerhub_repo_name=$(echo ${repository_name} | tr '[:upper:]' '[:lower:]')
|
|
||||||
echo "repository-name=$repository_name" >> "$GITEA_OUTPUT"
|
|
||||||
echo "dockerhub-repo-name=$dockerhub_repo_name" >> "$GITEA_OUTPUT"
|
|
||||||
- name: Print repo name (for testing)
|
|
||||||
run: |
|
|
||||||
echo "Repository name: ${{ steps.get-repo-name.outputs.repository-name }}"
|
|
||||||
echo "Dockerhub formatted repo name: ${{ steps.get-repo-name.outputs.dockerhub-repo-name }}"
|
|
||||||
|
|
||||||
- name: Checkout repository
|
|
||||||
uses: actions/checkout@v4
|
|
||||||
|
|
||||||
- run: |
|
|
||||||
./bin/update_dockerhub_api \
|
|
||||||
${{ secrets.DOCKERHUB_USERNAME }} \
|
|
||||||
${{ secrets.DOCKERHUB_PASSWORD }} \
|
|
||||||
${{ gitea.repository }} \
|
|
||||||
${{ secrets.API_KEY }}
|
|
||||||
|
|
||||||
- name: Log in to Docker Hub
|
|
||||||
uses: docker/login-action@v3
|
|
||||||
with:
|
|
||||||
registry: docker.io
|
|
||||||
username: ${{ secrets.DOCKERHUB_USERNAME }}
|
|
||||||
password: ${{ secrets.DOCKERHUB_TOKEN }}
|
|
||||||
|
|
||||||
- name: Set up Docker Buildx
|
|
||||||
uses: docker/setup-buildx-action@v3
|
|
||||||
|
|
||||||
- name: Build and push Docker image
|
|
||||||
uses: docker/build-push-action@v6
|
|
||||||
with:
|
|
||||||
context: .
|
|
||||||
push: true
|
|
||||||
tags: |
|
|
||||||
docker.io/${{ secrets.DOCKERHUB_USERNAME }}/${{ steps.get-repo-name.outputs.dockerhub-repo-name }}:latest
|
|
||||||
docker.io/${{ secrets.DOCKERHUB_USERNAME }}/${{ steps.get-repo-name.outputs.dockerhub-repo-name }}:${{ gitea.sha }}
|
|
||||||
|
|
||||||
-19
@@ -1,19 +0,0 @@
|
|||||||
FROM python:3-alpine3.15
|
|
||||||
WORKDIR /app
|
|
||||||
|
|
||||||
# Install the application dependencies
|
|
||||||
# COPY . ./
|
|
||||||
COPY happy_ripper.py ./
|
|
||||||
COPY requirements.txt ./
|
|
||||||
COPY templates ./templates
|
|
||||||
|
|
||||||
RUN pip install --no-cache-dir -r requirements.txt
|
|
||||||
RUN apk add --no-cache ffmpeg
|
|
||||||
|
|
||||||
EXPOSE 5000
|
|
||||||
|
|
||||||
## Setup an app user so the container doesn't run as the root user
|
|
||||||
#RUN useradd app
|
|
||||||
#USER app
|
|
||||||
|
|
||||||
CMD ["python3", "./happy_ripper.py"]
|
|
||||||
@@ -0,0 +1,21 @@
|
|||||||
|
# Running with Docker
|
||||||
|
TBD
|
||||||
|
|
||||||
|
# Dependences
|
||||||
|
This section is only for people who do not want to use docker.
|
||||||
|
|
||||||
|
## Python Dependences
|
||||||
|
```
|
||||||
|
pip install -r requirements.txt
|
||||||
|
```
|
||||||
|
|
||||||
|
## Deno (JavaScript runtime for ytdlp)
|
||||||
|
For Linux
|
||||||
|
```
|
||||||
|
curl -fsSL https://deno.land/install.sh | sh
|
||||||
|
```
|
||||||
|
|
||||||
|
For Windows
|
||||||
|
```
|
||||||
|
irm https://deno.land/install.ps1 | iex
|
||||||
|
```
|
||||||
@@ -1,10 +0,0 @@
|
|||||||
#!/bin/bash
|
|
||||||
# Will return your dockerhub token (tokens may be temporary)
|
|
||||||
|
|
||||||
read -p "Dockerhub username: " DOCKERHUB_USERNAME
|
|
||||||
read -p "Dockerhub PASSWORD: " DOCKERHUB_PASSWORD
|
|
||||||
|
|
||||||
curl -s -X POST "https://hub.docker.com/v2/auth/token" \
|
|
||||||
-H "Content-Type: application/json" \
|
|
||||||
-d "{\"identifier\": \"${DOCKERHUB_USERNAME}\", \"secret\": \"${DOCKERHUB_PASSWORD}\"}" \
|
|
||||||
| jq -r .access_token
|
|
||||||
@@ -1 +0,0 @@
|
|||||||
These are mainly only needed for managing the git repository, not to be used with happy-ripper
|
|
||||||
@@ -1,30 +0,0 @@
|
|||||||
#!/bin/bash
|
|
||||||
|
|
||||||
if [[ -z "${1}" ]]; then
|
|
||||||
echo "This is for the gitea actions only, as it requires the repository's secrets to pass the needed variables"
|
|
||||||
exit 1
|
|
||||||
fi
|
|
||||||
|
|
||||||
DOCKERHUB_USERNAME="${1}"
|
|
||||||
DOCKERHUB_PASSWORD="${2}"
|
|
||||||
GITEA_OWNER_REPO="${3}"
|
|
||||||
GITEA_API_KEY="${4}"
|
|
||||||
gitea_username=$(echo "${GITEA_OWNER_REPO}" | sed 's/\/.*//')
|
|
||||||
repo_name=$(echo "${GITEA_OWNER_REPO}" | sed 's/^.*\///')
|
|
||||||
|
|
||||||
NEW_DOCKERHUB_TOKEN=$(curl -s -X POST "https://hub.docker.com/v2/auth/token" \
|
|
||||||
-H "Content-Type: application/json" \
|
|
||||||
-d "{\"identifier\": \"${DOCKERHUB_USERNAME}\", \"secret\": \"${DOCKERHUB_PASSWORD}\"}" \
|
|
||||||
| jq -r .access_token)
|
|
||||||
|
|
||||||
curl -X 'PUT' \
|
|
||||||
"https://gitea.happylizard.me/api/v1/repos/${gitea_username}/${repo_name}/actions/secrets/DOCKERHUB_TOKEN" \
|
|
||||||
-H 'accept: application/json' \
|
|
||||||
-H "Authorization: token ${GITEA_API_KEY}" \
|
|
||||||
-H 'Content-Type: application/json' \
|
|
||||||
-d "{
|
|
||||||
\"data\": \"${NEW_DOCKERHUB_TOKEN}\",
|
|
||||||
\"description\": \"\"
|
|
||||||
}"
|
|
||||||
|
|
||||||
|
|
||||||
+7
-3
@@ -19,9 +19,12 @@ from mutagen.id3 import ID3, APIC
|
|||||||
from flask import Flask, render_template, request, jsonify
|
from flask import Flask, render_template, request, jsonify
|
||||||
from ytmusicapi import YTMusic
|
from ytmusicapi import YTMusic
|
||||||
|
|
||||||
MUSIC_FOLDER = os.environ.get("HAPPY_RIPPER_MUSIC_DIR", "Music")
|
MUSIC_FOLDER: str = os.environ.get("HAPPY_RIPPER_MUSIC_DIR", "Music")
|
||||||
ACCESS_URL = os.environ.get("HAPPY_RIPPER_ACCESS_URL", "https://test.test.test")
|
ACCESS_URL: str = os.environ.get("HAPPY_RIPPER_ACCESS_URL", "https://test.test.test")
|
||||||
PORT = int(os.environ.get("HAPPY_RIPPER_MUSIC_PORT", 5000))
|
PORT = int(os.environ.get("HAPPY_RIPPER_MUSIC_PORT", 5000))
|
||||||
|
DENO_PATH: str = os.environ.get("HAPPY_RIPPER_DENO_PATH", str(pathlib.Path.home() / ".deno/bin/deno"))
|
||||||
|
|
||||||
|
JS_RUNTIME_KEYS = {"deno": {"path": DENO_PATH}}
|
||||||
|
|
||||||
|
|
||||||
@dataclass
|
@dataclass
|
||||||
@@ -101,7 +104,7 @@ def create_or_wipe_folder(path: str) -> None:
|
|||||||
|
|
||||||
|
|
||||||
def get_content_json(url: str):
|
def get_content_json(url: str):
|
||||||
with YoutubeDL({"playlist_items": "1"}) as ydl:
|
with YoutubeDL({"js_runtimes": JS_RUNTIME_KEYS, "playlist_items": "1"}) as ydl:
|
||||||
return ydl.extract_info(url, download=False)
|
return ydl.extract_info(url, download=False)
|
||||||
|
|
||||||
|
|
||||||
@@ -109,6 +112,7 @@ def download_content(path: str, url: str, post_processor: PostProcessor) -> None
|
|||||||
try:
|
try:
|
||||||
with YoutubeDL(
|
with YoutubeDL(
|
||||||
{
|
{
|
||||||
|
"js_runtimes": JS_RUNTIME_KEYS,
|
||||||
"format": "bestaudio/best",
|
"format": "bestaudio/best",
|
||||||
"ignoreerrors": True,
|
"ignoreerrors": True,
|
||||||
"restrictfilenames": True,
|
"restrictfilenames": True,
|
||||||
|
|||||||
+1
-1
@@ -1,4 +1,4 @@
|
|||||||
Flask==3.1.3
|
Flask==3.1.3
|
||||||
mutagen==1.47.0
|
mutagen==1.47.0
|
||||||
yt_dlp==2026.8.19
|
yt_dlp==2026.8.19
|
||||||
ytmusicapi==1.12.3
|
ytmusicapi==1.12.1
|
||||||
|
|||||||
Reference in New Issue
Block a user