accept remote source

This commit is contained in:
pybt 2022-05-30 19:42:32 +07:00
parent f6a7a3989d
commit ebcf828536
3 changed files with 6 additions and 8 deletions

View File

@ -10,10 +10,7 @@ use std::{
use serde_json::json;
use simplelog::*;
use crate::utils::{
check_sync, gen_dummy, get_delta, get_sec, is_close, json_serializer::read_json, modified_time,
seek_and_length, GlobalConfig, Media, PlayoutStatus, DUMMY_LEN,
};
use crate::utils::{check_sync, gen_dummy, get_delta, get_sec, is_close, json_serializer::read_json, modified_time, seek_and_length, GlobalConfig, Media, PlayoutStatus, DUMMY_LEN, validate_source};
/// Struct for current playlist.
///
@ -430,7 +427,7 @@ fn timed_source(
/// Generate the source CMD, or when clip not exist, get a dummy.
fn gen_source(config: &GlobalConfig, mut node: Media) -> Media {
if Path::new(&node.source).is_file() {
if validate_source(&node.source) {
node.add_probe();
node.cmd = Some(seek_and_length(
node.source.clone(),

View File

@ -1,5 +1,4 @@
use std::{
path::Path,
sync::{
atomic::{AtomicBool, Ordering},
Arc,
@ -8,7 +7,7 @@ use std::{
use simplelog::*;
use crate::utils::{sec_to_time, GlobalConfig, MediaProbe, Playlist};
use crate::utils::{sec_to_time, GlobalConfig, MediaProbe, Playlist, validate_source};
/// Validate a given playlist, to check if:
///
@ -31,7 +30,7 @@ pub fn validate_playlist(playlist: Playlist, is_terminated: Arc<AtomicBool>, con
return;
}
if Path::new(&item.source).is_file() {
if validate_source(&item.source) {
let probe = MediaProbe::new(item.source.clone());
if probe.format.is_none() {

View File

@ -20,6 +20,7 @@ mod generator;
pub mod json_serializer;
mod json_validate;
mod logging;
mod source;
pub use arg_parse::get_args;
pub use config::GlobalConfig;
@ -28,6 +29,7 @@ pub use generator::generate_playlist;
pub use json_serializer::{read_json, Playlist, DUMMY_LEN};
pub use json_validate::validate_playlist;
pub use logging::{init_logging, send_mail};
pub use source::{validate_source};
use crate::filter::filter_chains;