Skip to content

Commit

Permalink
Added linux build
Browse files Browse the repository at this point in the history
  • Loading branch information
williamyang98 committed Jul 23, 2024
1 parent 031158f commit 63d56c4
Show file tree
Hide file tree
Showing 5 changed files with 71 additions and 2 deletions.
54 changes: 54 additions & 0 deletions .github/workflows/x86-linux.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
name: x86-linux

on:
workflow_dispatch:
push:
branches: [ "master", "main", "dev" ]

env:
PACKAGE_DIR: package

jobs:
skip_check:
continue-on-error: false
runs-on: ubuntu-22.04
outputs:
should_skip: ${{ steps.skip_check.outputs.should_skip }}
steps:
- id: skip_check
uses: fkirc/skip-duplicate-actions@v5
with:
concurrent_skipping: 'same_content'
cancel_others: 'true'
skip_after_successful_duplicate: 'true'
paths_ignore: '["**/README.md", "**/docs/**", "**/LICENSE"]'
do_not_skip: '["workflow_dispatch", "schedule"]'

build:
needs: skip_check
if: needs.skip_check.outputs.should_skip != 'true'

runs-on: ubuntu-22.04

steps:
- uses: actions/checkout@v3
with:
submodules: recursive

- name: Build
shell: bash
run: cargo build

- name: Copy files
shell: bash
run: ./scripts/create_package.sh ${{env.PACKAGE_DIR}} debug ytdlp_server

- name: Download third party binaries
shell: bash
run: ./scripts/download_ubuntu.sh

- name: Upload files
uses: actions/upload-artifact@v3
with:
name: ytdlp_webui_ubuntu_x86
path: ${{github.workspace}}/${{env.PACKAGE_DIR}}
3 changes: 2 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
# Introduction
[![x86-windows](https://github.com/williamyang98/ytdlp_webui/actions/workflows/x86-windows.yml/badge.svg)](https://github.com/williamyang98/ytdlp_webui/actions/workflows/x86-windows.yml)
[![x86-linux](https://github.com/williamyang98/ytdlp_webui/actions/workflows/x86-linux.yml/badge.svg)](https://github.com/williamyang98/ytdlp_webui/actions/workflows/x86-linux.yml)

Download and convert Youtube videos into audio clips. Has a web UI client that wraps around ```yt-dlp``` and ```ffmpeg``` and caches downloaded and transcoded files locally.

Expand All @@ -16,6 +17,6 @@ Download and convert Youtube videos into audio clips. Has a web UI client that w

## Building
1. Download rust.
2. Download ffmpeg and yt-dlp using ```./scripts/download_win32.sh``` or links for your platform.
2. Download ffmpeg and yt-dlp using ```./scripts/download_*.sh``` for your platform.
3. Build server: ```cargo build -r```
4. Run server: ```cargo run -r```
3 changes: 2 additions & 1 deletion scripts/create_package.sh
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
#!/bin/sh
path=${1:-package}
build_type=${2:-release}
exec_name=${3:-ytdlp_server.exe}
rm -rf $path/
mkdir -p $path/
cp ./target/$build_type/ytdlp_server.exe $path/
cp ./target/$build_type/$exec_name $path/
cp ./README.md $path/
cp ./LICENSE $path/
cp -rf ./static/ $path/
Expand Down
9 changes: 9 additions & 0 deletions scripts/download_ubuntu.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
#!/bin/sh
# Install yt-dlp
mkdir ./bin/
curl -fLo ./bin/yt-dlp https://github.com/yt-dlp/yt-dlp/releases/download/2024.07.16/yt-dlp_linux
set -e
echo a6b840e536014ce7b2c7c40b758080498ed5054aa96979e64fcc369752cdc8d3 ./bin/yt-dlp | sha256sum --check
sudo chmod 777 ./bin/yt-dlp
# Install ffmpeg
sudo apt-get --yes install ffmpeg
4 changes: 4 additions & 0 deletions src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -29,9 +29,13 @@ struct Args {
total_worker_threads: usize,
/// ffmpeg binary for transcoding between formats
#[arg(long)]
#[cfg_attr(windows, arg(default_value = Some("./bin/ffmpeg.exe")))]
#[cfg_attr(unix, arg(default_value = Some("ffmpeg")))]
ffmpeg_binary_path: Option<String>,
/// yt-dlp binary for downloading from Youtube
#[arg(long)]
#[cfg_attr(windows, arg(default_value = Some("./bin/yt-dlp.exe")))]
#[cfg_attr(unix, arg(default_value = Some("./bin/yt-dlp")))]
ytdlp_binary_path: Option<String>,
}

Expand Down

0 comments on commit 63d56c4

Please sign in to comment.