From 67f1b147ccbaba63108c122b4759cecfa6543ae0 Mon Sep 17 00:00:00 2001 From: f18326186224 Date: Tue, 18 Jun 2024 04:28:31 +0800 Subject: [PATCH 1/4] fix: Fixed the problem of m4a audio download bit rate being too low --- .dockerignore | 1 + .github/workflows/main.yml | 77 +++++++++++------------------ .github/workflows/update-yt-dlp.yml | 5 +- .gitignore | 1 + 4 files changed, 34 insertions(+), 50 deletions(-) diff --git a/.dockerignore b/.dockerignore index f49e149..98a36ae 100644 --- a/.dockerignore +++ b/.dockerignore @@ -2,3 +2,4 @@ .venv ui/.angular ui/node_modules +/.idea/* diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index f54f4b6..b47e49b 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -6,60 +6,41 @@ on: - 'master' jobs: - dockerhub-build-push: + push_to_registries: + name: Push Docker image to multiple registries runs-on: ubuntu-latest + permissions: + packages: write + contents: read steps: - - - name: Get current date - id: date - run: echo "::set-output name=date::$(date +'%Y-%m-%d')" - - - name: Checkout - uses: actions/checkout@v4 - - - name: Set up QEMU - uses: docker/setup-qemu-action@v3 - - - name: Set up Docker Buildx - uses: docker/setup-buildx-action@v3 - - - name: Login to DockerHub - uses: docker/login-action@v3 - with: - username: ${{ secrets.DOCKERHUB_USERNAME }} - password: ${{ secrets.DOCKERHUB_TOKEN }} - - - name: Login to GitHub Container Registry - uses: docker/login-action@v3 + - name: Check out the repo + uses: actions/checkout@v3 + + - name: Set up QEMU + uses: docker/setup-qemu-action@v2 + + - name: Set up Docker Buildx + uses: docker/setup-buildx-action@v2 + + - name: Log in to the Container registry + uses: docker/login-action@f054a8b539a109f9f41c372932f1ae047eff08c9 with: registry: ghcr.io - username: ${{ github.repository_owner }} + username: ${{ github.actor }} password: ${{ secrets.GITHUB_TOKEN }} - - - name: Build and push - uses: docker/build-push-action@v5 + + - name: Extract metadata (tags, labels) for Docker + id: meta + uses: docker/metadata-action@98669ae865ea3cffbcbaa878cf57c20bbf1c6c38 + with: + images: | + ghcr.io/${{ github.repository }} + + - name: Build and push Docker images + uses: docker/build-push-action@ad44023a93711e3deb337508980b4b5e9bcdc5dc with: context: . platforms: linux/amd64,linux/arm64 push: true - tags: | - ${{ secrets.DOCKERHUB_REPOSITORY }}:latest - ${{ secrets.DOCKERHUB_REPOSITORY }}:${{ steps.date.outputs.date }} - ghcr.io/${{ github.repository }}:latest - ghcr.io/${{ github.repository }}:${{ steps.date.outputs.date }} - - dockerhub-sync-readme: - needs: dockerhub-build-push - runs-on: ubuntu-latest - steps: - - name: Sync README - uses: docker://lsiodev/readme-sync:latest - env: - DOCKERHUB_USERNAME: ${{ secrets.DOCKERHUB_USERNAME }} - DOCKERHUB_PASSWORD: ${{ secrets.DOCKERHUB_PASSWORD }} - GIT_REPOSITORY: ${{ github.repository }} - DOCKER_REPOSITORY: ${{ secrets.DOCKERHUB_REPOSITORY }} - GIT_BRANCH: master - with: - entrypoint: node - args: /opt/docker-readme-sync/sync + tags: ${{ steps.meta.outputs.tags }} + labels: ${{ steps.meta.outputs.labels }} diff --git a/.github/workflows/update-yt-dlp.yml b/.github/workflows/update-yt-dlp.yml index ab8433d..b801015 100644 --- a/.github/workflows/update-yt-dlp.yml +++ b/.github/workflows/update-yt-dlp.yml @@ -1,8 +1,9 @@ name: update-yt-dlp on: - schedule: - - cron: '0 0 * * *' + workflow_dispatch: +# schedule: +# - cron: '0 0 * * *' jobs: update-yt-dlp : diff --git a/.gitignore b/.gitignore index ac87c29..5c9f69d 100644 --- a/.gitignore +++ b/.gitignore @@ -47,3 +47,4 @@ Thumbs.db __pycache__ .venv +/.idea/* From ff86fa8fbd72d5b2ee8702c970b6725674afc460 Mon Sep 17 00:00:00 2001 From: f18326186224 Date: Tue, 18 Jun 2024 04:29:33 +0800 Subject: [PATCH 2/4] fix: Fixed the problem of m4a audio download bit rate being too low --- app/dl_formats.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/app/dl_formats.py b/app/dl_formats.py index 8abd038..55ea0b0 100644 --- a/app/dl_formats.py +++ b/app/dl_formats.py @@ -28,7 +28,7 @@ def get_format(format: str, quality: str) -> str: if format in AUDIO_FORMATS: # Audio quality needs to be set post-download, set in opts - return f"bestaudio[ext={format}]/bestaudio/best" + return f"bestaudio/best" if format in ("mp4", "any"): if quality == "audio": From e946fd9b362924a4c628e999713a15e704d0dbe6 Mon Sep 17 00:00:00 2001 From: f18326186224 Date: Tue, 18 Jun 2024 04:32:12 +0800 Subject: [PATCH 3/4] fix: update yt_dlp using schedule --- .github/workflows/update-yt-dlp.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/update-yt-dlp.yml b/.github/workflows/update-yt-dlp.yml index b801015..17e55c6 100644 --- a/.github/workflows/update-yt-dlp.yml +++ b/.github/workflows/update-yt-dlp.yml @@ -2,8 +2,8 @@ name: update-yt-dlp on: workflow_dispatch: -# schedule: -# - cron: '0 0 * * *' + schedule: + - cron: '0 0 * * *' jobs: update-yt-dlp : From b685c562be83dd56b544a63689d8e3f638b12092 Mon Sep 17 00:00:00 2001 From: f18326186224 Date: Tue, 18 Jun 2024 17:11:54 +0800 Subject: [PATCH 4/4] =?UTF-8?q?feat:=20=E6=9C=AC=E5=9C=B0=E6=B5=8B?= =?UTF-8?q?=E8=AF=95=E9=98=B2=E6=AD=A2=E6=8A=A5=E9=94=99?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .dockerignore | 3 +++ .github/workflows/main.yml | 7 ++++--- .github/workflows/update-yt-dlp.yml | 4 ++-- .gitignore | 3 +++ app/main.py | 18 ++++++++++-------- ui/e2e/src/app.e2e-spec.ts | 6 ++++-- 6 files changed, 26 insertions(+), 15 deletions(-) diff --git a/.dockerignore b/.dockerignore index 98a36ae..926c0f4 100644 --- a/.dockerignore +++ b/.dockerignore @@ -3,3 +3,6 @@ ui/.angular ui/node_modules /.idea/* +*.bak +*.dat +*.dir diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index b47e49b..cab8517 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -1,9 +1,10 @@ name: build on: - push: - branches: - - 'master' + workflow_dispatch: +# push: +# branches: +# - 'master' jobs: push_to_registries: diff --git a/.github/workflows/update-yt-dlp.yml b/.github/workflows/update-yt-dlp.yml index 17e55c6..b801015 100644 --- a/.github/workflows/update-yt-dlp.yml +++ b/.github/workflows/update-yt-dlp.yml @@ -2,8 +2,8 @@ name: update-yt-dlp on: workflow_dispatch: - schedule: - - cron: '0 0 * * *' +# schedule: +# - cron: '0 0 * * *' jobs: update-yt-dlp : diff --git a/.gitignore b/.gitignore index 5c9f69d..21ca361 100644 --- a/.gitignore +++ b/.gitignore @@ -48,3 +48,6 @@ Thumbs.db __pycache__ .venv /.idea/* +*.bak +*.dat +*.dir diff --git a/app/main.py b/app/main.py index 3daed83..96a98e1 100644 --- a/app/main.py +++ b/app/main.py @@ -1,13 +1,12 @@ -#!/usr/bin/env python3 -# pylint: disable=no-member,method-hidden - +import json +import logging import os +import pathlib import sys -from aiohttp import web +import platform + import socketio -import logging -import json -import pathlib +from aiohttp import web from ytdl import DownloadQueueNotifier, DownloadQueue @@ -238,4 +237,7 @@ async def on_prepare(request, response): if __name__ == '__main__': logging.basicConfig(level=logging.DEBUG) log.info(f"Listening on {config.HOST}:{config.PORT}") - web.run_app(app, host=config.HOST, port=int(config.PORT), reuse_port=True) + if platform.system() == 'Windows': + web.run_app(app, host=config.HOST, port=int(config.PORT)) + else: + web.run_app(app, host=config.HOST, port=int(config.PORT), reuse_port=True) diff --git a/ui/e2e/src/app.e2e-spec.ts b/ui/e2e/src/app.e2e-spec.ts index d2c5a2d..1cffecf 100644 --- a/ui/e2e/src/app.e2e-spec.ts +++ b/ui/e2e/src/app.e2e-spec.ts @@ -1,5 +1,7 @@ -import { AppPage } from './app.po'; -import { browser, logging } from 'protractor'; +import {describe, it} from 'node:test'; +import {AppPage} from './app.po'; +// @ts-ignore +import {browser, logging} from 'protractor'; describe('workspace-project App', () => { let page: AppPage;