Skip to content

Commit

Permalink
Added manifest for third party binaries
Browse files Browse the repository at this point in the history
  • Loading branch information
williamyang98 committed Jul 23, 2024
1 parent dddb11c commit 4ac34e7
Show file tree
Hide file tree
Showing 6 changed files with 41 additions and 4 deletions.
4 changes: 4 additions & 0 deletions .github/workflows/x86-windows.yml
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,10 @@ jobs:
shell: bash
run: ./scripts/create_package.sh ${{env.PACKAGE_DIR}} debug

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

- name: Upload files
uses: actions/upload-artifact@v3
with:
Expand Down
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -2,3 +2,4 @@
/target/
/data/
/package/
/bin/
5 changes: 3 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,5 +16,6 @@ Download and convert Youtube videos into audio clips. Has a web UI client that w

## Building
1. Download rust.
2. Build server: ```cargo build -r```
3. Run server: ```cargo run -r```
2. Download ffmpeg and yt-dlp using ```./scripts/download_win32.sh``` or links for your platform.
3. Build server: ```cargo build -r```
4. Run server: ```cargo run -r```
5 changes: 5 additions & 0 deletions bin/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
# Source for binaries
| Name | Location | MD5 Hash |
| --- | --- | --- |
| ffmpeg | [Link](https://www.gyan.dev/ffmpeg/builds/packages/ffmpeg-2024-07-18-git-fa5a605542-essentials_build.7z) | 7c35458246ef08c70b76f11b2a12c41c83d72508eefaf9b75e572089c1c1b1c8 |
| yt-dlp | [Link](https://github.com/yt-dlp/yt-dlp/releases/download/2024.07.16/yt-dlp.exe) | e96f6348244306ac999501b1e8e2b096b8a57f098c3b2b9ffe64b2107039e0ae |
17 changes: 17 additions & 0 deletions scripts/download_win32.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
#!/bin/sh
# Download files
mkdir ./bin/
cd ./bin
curl -fLo ./yt-dlp.exe https://github.com/yt-dlp/yt-dlp/releases/download/2024.07.16/yt-dlp.exe &
curl -fLo ./ffmpeg.7z https://github.com/GyanD/codexffmpeg/releases/download/7.0.1/ffmpeg-7.0.1-essentials_build.7z &
wait
# Unzip
7z x ./ffmpeg.7z -offmpeg -y
cp ./ffmpeg/ffmpeg-7.0.1-essentials_build/bin/ffmpeg.exe ./ffmpeg.exe
# Verify hash
set -e
echo d7b51e782c79f564d6e33907b17b010f01634c00e3c42559975cbc7a82982f8f ffmpeg.exe | sha256sum --check
echo e96f6348244306ac999501b1e8e2b096b8a57f098c3b2b9ffe64b2107039e0ae yt-dlp.exe | sha256sum --check
# Cleanup
rm ./ffmpeg.7z
rm -rf ./ffmpeg
13 changes: 11 additions & 2 deletions src/main.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
use std::sync::{Arc, Mutex};
use std::path::PathBuf;
use actix_web::{middleware, web, App, HttpServer};
use clap::Parser;
use dashmap::DashMap;
Expand All @@ -15,7 +16,7 @@ use ytdlp_server::{
#[command(version, about, long_about = None)]
struct Args {
/// Url of server
#[arg(long, default_value = "127.0.0.1")]
#[arg(long, default_value = "0.0.0.0")]
url: String,
/// Port of server
#[arg(long, default_value_t = 8080)]
Expand All @@ -26,6 +27,12 @@ struct Args {
/// Maximum number of worker threads
#[arg(long, default_value_t = 0)]
total_worker_threads: usize,
/// ffmpeg binary for transcoding between formats
#[arg(long)]
ffmpeg_binary_path: Option<String>,
/// yt-dlp binary for downloading from Youtube
#[arg(long)]
ytdlp_binary_path: Option<String>,
}

#[actix_web::main]
Expand All @@ -41,7 +48,9 @@ async fn main() -> Result<(), Box<dyn std::error::Error>> {
0 => std::thread::available_parallelism().map(|v| v.get()).unwrap_or(1),
x => x,
};
let app_config = AppConfig::default();
let mut app_config = AppConfig::default();
if let Some(path) = args.ytdlp_binary_path { app_config.ytdlp_binary = PathBuf::from(path); }
if let Some(path) = args.ffmpeg_binary_path { app_config.ffmpeg_binary = PathBuf::from(path); }
app_config.seed_directories()?;
let db_manager = r2d2_sqlite::SqliteConnectionManager::file(app_config.root.join("index.db"));
let db_pool = DatabasePool::new(db_manager)?;
Expand Down

0 comments on commit 4ac34e7

Please sign in to comment.