Commit 10605f7d authored by Ozbolt Menegatti's avatar Ozbolt Menegatti

removing git_user from config, changing parsing ffmpeg command,

no more run_format!, no more nightly rust, bitrate settable now
parent d00260b5
......@@ -15,7 +15,6 @@ md5 = "0.6"
reqwest = "0.9"
log = "0.4"
env_logger = "0.6"
runtime-fmt = "0.3"
[dependencies.rss]
version = "1"
......
......@@ -2,8 +2,6 @@
extern crate serde_derive;
#[macro_use]
extern crate log;
#[macro_use]
extern crate runtime_fmt;
extern crate serde_json;
extern crate env_logger;
......@@ -42,14 +40,14 @@ fn run_command(cmd_str: &str) -> Result<String, String> {
})
}
fn ffmpeg(cmd: &str, input: &str, output: &str, bitrate: usize, compression: usize) -> Result<String, String> {
rt_format!(
cmd,
fn ffmpeg(input: &str, output: &str, bitrate: usize, ffmpeg_flags: &str) -> String {
format!(
"ffmpeg -i {input} -b:a {bitrate} {ffmpeg_flags} {output}",
ffmpeg_flags = ffmpeg_flags,
input = input,
output = output,
compression = compression,
bitrate = bitrate
).map_err(|e| { format!("bad ffmpeg command formatting: {:#?}", e) })
)
}
const AUDIO_FOLDER: &'static str = "audio";
......@@ -218,7 +216,7 @@ impl SmallItem {
fn transcode(&self) -> Result<(), String> {
let input_file = self.temporary_file();
let output_file = self.transcoded_file();
let command = ffmpeg(&self.conf.ffmpeg_command, &input_file, &output_file, 2usize.pow(15), 7)?;
let command = ffmpeg(&input_file, &output_file, self.conf.bitrate, &self.conf.ffmpeg_flags);
run_command(&command)?;
Ok(())
}
......@@ -425,13 +423,12 @@ struct Conf {
rss_urls: Vec<String>,
max_age: i64,
git_repo_path: String,
git_user: String,
git_email: String,
disable_upload: bool,
ffmpeg_command: String,
ffmpeg_flags: String,
github_username: String,
github_repo: String,
clean_git_days: u64,
bitrate: usize,
base_directory: Option<String>,
}
......@@ -522,7 +519,7 @@ fn main() {
info!("Transcoding: {} -> {}", item.title, item.transcoded_file());
item.transcode().unwrap();
} else {
info!("Already transcoded: {}", item.title);
info!("Already transcoded: {} -> {}", item.title, item.transcoded_file());
}
used_audio_files.push(item.transcoded_file());
......
......@@ -3,11 +3,10 @@ rss_urls = ["https://feeds.megaphone.fm/dailyzeitgeist", "http://feeds.twit.tv/t
max_age = 7 # a week
git_repo_path = "repo"
git_user = "Ozbolt Menegatti"
git_email = "/"
disable_upload = false
ffmpeg_command = "ffmpeg -i {input} -map_metadata -1 -vn -acodec libopus -b:a {bitrate} -vbr on -compression_level {compression} {output}"
bitrate = 24576 # 24kbps, 0b110000000000000
ffmpeg_flags = "-map_metadata -1 -vn -ac 1 -acodec libopus -vbr on -compression_level 10"
github_username = "gareins"
github_repo = "sp3"
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment