fix clippy, create in memory db for tests, fix tests
This commit is contained in:
parent
f64c22131e
commit
6dc24e830a
@ -684,7 +684,7 @@ impl PlayoutConfig {
|
||||
|
||||
for item in cmd.iter_mut() {
|
||||
if item.ends_with(".ts") || (item.ends_with(".m3u8") && item != "master.m3u8") {
|
||||
if let Ok((hls_path, _, _)) = norm_abs_path(&global.hls_path, &item) {
|
||||
if let Ok((hls_path, _, _)) = norm_abs_path(&global.hls_path, item) {
|
||||
let parent = hls_path.parent().expect("HLS parent path");
|
||||
|
||||
if !parent.is_dir() {
|
||||
|
2
frontend
2
frontend
@ -1 +1 @@
|
||||
Subproject commit e8fd6f65bf255c55c1ca509f9fe59c2c7875c394
|
||||
Subproject commit 761e2816f94a98dd8d400320555c84b99813e1ce
|
@ -1,9 +1,9 @@
|
||||
use std::fs;
|
||||
|
||||
use sqlx::{Pool, Sqlite};
|
||||
use sqlx::{sqlite::SqlitePoolOptions, Pool, Sqlite};
|
||||
use tokio::runtime::Runtime;
|
||||
|
||||
use ffplayout::db::{db_pool, handles};
|
||||
use ffplayout::db::handles;
|
||||
use ffplayout::player::{
|
||||
controller::{ChannelManager, ProcessUnit::*},
|
||||
input::playlist::gen_source,
|
||||
@ -13,8 +13,29 @@ use ffplayout::player::{
|
||||
use ffplayout::utils::config::{OutputMode::*, PlayoutConfig};
|
||||
use ffplayout::vec_strings;
|
||||
|
||||
async fn memory_db() -> Pool<Sqlite> {
|
||||
let pool = SqlitePoolOptions::new()
|
||||
.connect("sqlite::memory:")
|
||||
.await
|
||||
.unwrap();
|
||||
handles::db_migrate(&pool).await.unwrap();
|
||||
|
||||
sqlx::query(
|
||||
r#"
|
||||
UPDATE global SET hls_path = "assets/hls", logging_path = "assets/log",
|
||||
playlist_path = "assets/playlists", storage_path = "assets/storage";
|
||||
UPDATE configurations SET processing_width = 1024, processing_height = 576;
|
||||
"#,
|
||||
)
|
||||
.execute(&pool)
|
||||
.await
|
||||
.unwrap();
|
||||
|
||||
pool
|
||||
}
|
||||
|
||||
fn get_pool() -> Pool<Sqlite> {
|
||||
Runtime::new().unwrap().block_on(db_pool()).unwrap()
|
||||
Runtime::new().unwrap().block_on(memory_db())
|
||||
}
|
||||
|
||||
#[test]
|
||||
|
@ -4,10 +4,10 @@ use std::{
|
||||
};
|
||||
|
||||
use chrono::NaiveTime;
|
||||
use sqlx::{Pool, Sqlite};
|
||||
use sqlx::{sqlite::SqlitePoolOptions, Pool, Sqlite};
|
||||
use tokio::runtime::Runtime;
|
||||
|
||||
use ffplayout::db::{db_pool, handles};
|
||||
use ffplayout::db::handles;
|
||||
use ffplayout::player::{controller::ChannelManager, utils::*};
|
||||
use ffplayout::utils::config::ProcessMode::Playlist;
|
||||
use ffplayout::utils::playlist::generate_playlist;
|
||||
@ -16,8 +16,29 @@ use ffplayout::utils::{
|
||||
generator::*,
|
||||
};
|
||||
|
||||
async fn memory_db() -> Pool<Sqlite> {
|
||||
let pool = SqlitePoolOptions::new()
|
||||
.connect("sqlite::memory:")
|
||||
.await
|
||||
.unwrap();
|
||||
handles::db_migrate(&pool).await.unwrap();
|
||||
|
||||
sqlx::query(
|
||||
r#"
|
||||
UPDATE global SET hls_path = "assets/hls", logging_path = "assets/log",
|
||||
playlist_path = "assets/playlists", storage_path = "assets/storage";
|
||||
UPDATE configurations SET processing_width = 1024, processing_height = 576;
|
||||
"#,
|
||||
)
|
||||
.execute(&pool)
|
||||
.await
|
||||
.unwrap();
|
||||
|
||||
pool
|
||||
}
|
||||
|
||||
fn get_pool() -> Pool<Sqlite> {
|
||||
Runtime::new().unwrap().block_on(db_pool()).unwrap()
|
||||
Runtime::new().unwrap().block_on(memory_db())
|
||||
}
|
||||
|
||||
#[test]
|
||||
|
@ -4,10 +4,10 @@ use std::{
|
||||
};
|
||||
|
||||
use serial_test::serial;
|
||||
use sqlx::{Pool, Sqlite};
|
||||
use sqlx::{sqlite::SqlitePoolOptions, Pool, Sqlite};
|
||||
use tokio::runtime::Runtime;
|
||||
|
||||
use ffplayout::db::{db_pool, handles};
|
||||
use ffplayout::db::handles;
|
||||
use ffplayout::player::output::player;
|
||||
use ffplayout::player::utils::*;
|
||||
use ffplayout::player::{controller::ChannelManager, input::playlist::gen_source, utils::Media};
|
||||
@ -15,8 +15,29 @@ use ffplayout::utils::config::OutputMode::Null;
|
||||
use ffplayout::utils::config::{PlayoutConfig, ProcessMode::Playlist};
|
||||
use ffplayout::vec_strings;
|
||||
|
||||
async fn memory_db() -> Pool<Sqlite> {
|
||||
let pool = SqlitePoolOptions::new()
|
||||
.connect("sqlite::memory:")
|
||||
.await
|
||||
.unwrap();
|
||||
handles::db_migrate(&pool).await.unwrap();
|
||||
|
||||
sqlx::query(
|
||||
r#"
|
||||
UPDATE global SET hls_path = "assets/hls", logging_path = "assets/log",
|
||||
playlist_path = "assets/playlists", storage_path = "assets/storage";
|
||||
UPDATE configurations SET processing_width = 1024, processing_height = 576;
|
||||
"#,
|
||||
)
|
||||
.execute(&pool)
|
||||
.await
|
||||
.unwrap();
|
||||
|
||||
pool
|
||||
}
|
||||
|
||||
fn get_pool() -> Pool<Sqlite> {
|
||||
Runtime::new().unwrap().block_on(db_pool()).unwrap()
|
||||
Runtime::new().unwrap().block_on(memory_db())
|
||||
}
|
||||
|
||||
fn timed_stop(sec: u64, manager: ChannelManager) {
|
||||
|
@ -1,17 +1,38 @@
|
||||
use sqlx::{Pool, Sqlite};
|
||||
use sqlx::{sqlite::SqlitePoolOptions, Pool, Sqlite};
|
||||
use tokio::runtime::Runtime;
|
||||
|
||||
#[cfg(test)]
|
||||
use chrono::prelude::*;
|
||||
|
||||
use ffplayout::db::db_pool;
|
||||
#[cfg(test)]
|
||||
use ffplayout::db::handles;
|
||||
use ffplayout::player::utils::*;
|
||||
use ffplayout::utils::config::PlayoutConfig;
|
||||
use ffplayout::utils::config::ProcessMode::Playlist;
|
||||
|
||||
async fn memory_db() -> Pool<Sqlite> {
|
||||
let pool = SqlitePoolOptions::new()
|
||||
.connect("sqlite::memory:")
|
||||
.await
|
||||
.unwrap();
|
||||
handles::db_migrate(&pool).await.unwrap();
|
||||
|
||||
sqlx::query(
|
||||
r#"
|
||||
UPDATE global SET hls_path = "assets/hls", logging_path = "assets/log",
|
||||
playlist_path = "assets/playlists", storage_path = "assets/storage";
|
||||
UPDATE configurations SET processing_width = 1024, processing_height = 576;
|
||||
"#,
|
||||
)
|
||||
.execute(&pool)
|
||||
.await
|
||||
.unwrap();
|
||||
|
||||
pool
|
||||
}
|
||||
|
||||
fn get_pool() -> Pool<Sqlite> {
|
||||
Runtime::new().unwrap().block_on(db_pool()).unwrap()
|
||||
Runtime::new().unwrap().block_on(memory_db())
|
||||
}
|
||||
|
||||
#[test]
|
||||
|
Loading…
Reference in New Issue
Block a user