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 031158f
Show file tree
Hide file tree
Showing 5 changed files with 36 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```
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 f01b37ca4f3e934208a5439d1ec8ae49a18f2be9f68fec5e3cfed08cc38b3275 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 031158f

Please sign in to comment.