fix assets copy, load correct storage for media page

This commit is contained in:
Jonathan Baecker 2024-10-18 14:03:56 +02:00
parent a842c78d99
commit 9042e92f96
6 changed files with 17 additions and 23 deletions

View File

@ -13,9 +13,6 @@ COPY <<-EOT /run.sh
if [ ! -f /db/ffplayout.db ]; then if [ ! -f /db/ffplayout.db ]; then
ffplayout -i -u admin -p admin -m contact@example.com --storage "/tv-media" --playlists "/playlists" --public "/public" --logs "/logging" --mail-smtp "mail.example.org" --mail-user "admin@example.org" --mail-password "abcd" --mail-starttls ffplayout -i -u admin -p admin -m contact@example.com --storage "/tv-media" --playlists "/playlists" --public "/public" --logs "/logging" --mail-smtp "mail.example.org" --mail-user "admin@example.org" --mail-password "abcd" --mail-starttls
mkdir /tv-media/1
cp -r /00-assets /tv-media/1/
fi fi
/usr/bin/ffplayout -l "0.0.0.0:8787" /usr/bin/ffplayout -l "0.0.0.0:8787"
@ -31,8 +28,8 @@ RUN [[ -f "/tmp/ffplayout-v${FFPLAYOUT_VERSION}_x86_64-unknown-linux-musl.tar.gz
cd /tmp && \ cd /tmp && \
tar xf "ffplayout-v${FFPLAYOUT_VERSION}_x86_64-unknown-linux-musl.tar.gz" && \ tar xf "ffplayout-v${FFPLAYOUT_VERSION}_x86_64-unknown-linux-musl.tar.gz" && \
cp ffplayout /usr/bin/ && \ cp ffplayout /usr/bin/ && \
mkdir /00-assets && \ mkdir -p /usr/share/ffplayout/ && \
cp assets/dummy.vtt assets/logo.png assets/DejaVuSans.ttf assets/FONT_LICENSE.txt /00-assets/ && \ cp assets/dummy.vtt assets/logo.png assets/DejaVuSans.ttf assets/FONT_LICENSE.txt /usr/share/ffplayout/ && \
rm -rf /tmp/* && \ rm -rf /tmp/* && \
mkdir ${DB} mkdir ${DB}

View File

@ -15,9 +15,6 @@ COPY <<-EOT /run.sh
if [ ! -f /db/ffplayout.db ]; then if [ ! -f /db/ffplayout.db ]; then
ffplayout -i -u admin -p admin -m contact@example.com --storage "/tv-media" --playlists "/playlists" --public "/public" --logs "/logging" --mail-smtp "mail.example.org" --mail-user "admin@example.org" --mail-password "abcd" --mail-starttls ffplayout -i -u admin -p admin -m contact@example.com --storage "/tv-media" --playlists "/playlists" --public "/public" --logs "/logging" --mail-smtp "mail.example.org" --mail-user "admin@example.org" --mail-password "abcd" --mail-starttls
mkdir /tv-media/1
cp -r /00-assets /tv-media/1/
fi fi
/usr/bin/ffplayout -l "0.0.0.0:8787" /usr/bin/ffplayout -l "0.0.0.0:8787"
@ -33,8 +30,8 @@ RUN [[ -f "/tmp/ffplayout-v${FFPLAYOUT_VERSION}_x86_64-unknown-linux-musl.tar.gz
cd /tmp && \ cd /tmp && \
tar xf "ffplayout-v${FFPLAYOUT_VERSION}_x86_64-unknown-linux-musl.tar.gz" && \ tar xf "ffplayout-v${FFPLAYOUT_VERSION}_x86_64-unknown-linux-musl.tar.gz" && \
cp ffplayout /usr/bin/ && \ cp ffplayout /usr/bin/ && \
mkdir /00-assets && \ mkdir -p /usr/share/ffplayout/ && \
cp assets/dummy.vtt assets/logo.png assets/DejaVuSans.ttf assets/FONT_LICENSE.txt /00-assets/ && \ cp assets/dummy.vtt assets/logo.png assets/DejaVuSans.ttf assets/FONT_LICENSE.txt /usr/share/ffplayout/ && \
rm -rf /tmp/* && \ rm -rf /tmp/* && \
mkdir ${DB} mkdir ${DB}

View File

@ -205,9 +205,6 @@ COPY <<-EOT /run.sh
if [ ! -f /db/ffplayout.db ]; then if [ ! -f /db/ffplayout.db ]; then
ffplayout -i -u admin -p admin -m contact@example.com --storage "/tv-media" --playlists "/playlists" --public "/public" --logs "/logging" --mail-smtp "mail.example.org" --mail-user "admin@example.org" --mail-password "abcd" --mail-starttls ffplayout -i -u admin -p admin -m contact@example.com --storage "/tv-media" --playlists "/playlists" --public "/public" --logs "/logging" --mail-smtp "mail.example.org" --mail-user "admin@example.org" --mail-password "abcd" --mail-starttls
mkdir /tv-media/1
cp -r /00-assets /tv-media/1/
fi fi
/usr/bin/ffplayout -l "0.0.0.0:8787" /usr/bin/ffplayout -l "0.0.0.0:8787"
@ -220,8 +217,8 @@ RUN [[ -f "/tmp/ffplayout-v${FFPLAYOUT_VERSION}_x86_64-unknown-linux-musl.tar.gz
cd /tmp && \ cd /tmp && \
tar xf "ffplayout-v${FFPLAYOUT_VERSION}_x86_64-unknown-linux-musl.tar.gz" && \ tar xf "ffplayout-v${FFPLAYOUT_VERSION}_x86_64-unknown-linux-musl.tar.gz" && \
cp ffplayout /usr/bin/ && \ cp ffplayout /usr/bin/ && \
mkdir /00-assets && \ mmkdir -p /usr/share/ffplayout/ && \
cp assets/dummy.vtt assets/logo.png assets/DejaVuSans.ttf assets/FONT_LICENSE.txt /00-assets/ && \ cp assets/dummy.vtt assets/logo.png assets/DejaVuSans.ttf assets/FONT_LICENSE.txt /usr/share/ffplayout/ && \
rm -rf /tmp/* && \ rm -rf /tmp/* && \
mkdir ${DB} mkdir ${DB}

View File

@ -35,14 +35,8 @@ pub async fn create_channel(
target_channel: Channel, target_channel: Channel,
) -> Result<Channel, ServiceError> { ) -> Result<Channel, ServiceError> {
let channel = handles::insert_channel(conn, target_channel).await?; let channel = handles::insert_channel(conn, target_channel).await?;
let storage_path = PathBuf::from(channel.storage.clone());
handles::new_channel_presets(conn, channel.id).await?; handles::new_channel_presets(conn, channel.id).await?;
if let Err(e) = copy_assets(&storage_path).await {
error!("{e}");
};
handles::update_channel(conn, channel.id, channel.clone()).await?; handles::update_channel(conn, channel.id, channel.clone()).await?;
let output_param = "-c:v libx264 -crf 23 -x264-params keyint=50:min-keyint=25:scenecut=-1 -maxrate 1300k -bufsize 2600k -preset faster -tune zerolatency -profile:v Main -level 3.1 -c:a aac -ar 44100 -b:a 128k -flags +cgop -f hls -hls_time 6 -hls_list_size 600 -hls_flags append_list+delete_segments+omit_endlist -hls_segment_filename live/stream-%d.ts live/stream.m3u8".to_string(); let output_param = "-c:v libx264 -crf 23 -x264-params keyint=50:min-keyint=25:scenecut=-1 -maxrate 1300k -bufsize 2600k -preset faster -tune zerolatency -profile:v Main -level 3.1 -c:a aac -ar 44100 -b:a 128k -flags +cgop -f hls -hls_time 6 -hls_list_size 600 -hls_flags append_list+delete_segments+omit_endlist -hls_segment_filename live/stream-%d.ts live/stream.m3u8".to_string();
@ -52,7 +46,11 @@ pub async fn create_channel(
let config = get_config(conn, channel.id).await?; let config = get_config(conn, channel.id).await?;
let m_queue = Arc::new(Mutex::new(MailQueue::new(channel.id, config.mail.clone()))); let m_queue = Arc::new(Mutex::new(MailQueue::new(channel.id, config.mail.clone())));
let manager = ChannelManager::new(Some(conn.clone()), channel.clone(), config); let manager = ChannelManager::new(Some(conn.clone()), channel.clone(), config.clone());
if let Err(e) = copy_assets(&PathBuf::from(&config.storage.path)).await {
error!("{e}");
};
controllers controllers
.lock() .lock()

View File

@ -336,7 +336,7 @@ pub async fn copy_assets(storage_path: &Path) -> Result<(), std::io::Error> {
let font_target = target.join("DejaVuSans.ttf"); let font_target = target.join("DejaVuSans.ttf");
let logo_target = target.join("logo.png"); let logo_target = target.join("logo.png");
fs::create_dir(&target).await?; fs::create_dir_all(&target).await?;
fs::copy(&dummy_source, &dummy_target).await?; fs::copy(&dummy_source, &dummy_target).await?;
fs::copy(&font_source, &font_target).await?; fs::copy(&font_source, &font_target).await?;
fs::copy(&logo_source, &logo_target).await?; fs::copy(&logo_source, &logo_target).await?;
@ -365,6 +365,8 @@ pub async fn copy_assets(storage_path: &Path) -> Result<(), std::io::Error> {
} }
} }
} }
} else {
error!("Storage path {storage_path:?} not exists!");
} }
Ok(()) Ok(())

View File

@ -116,6 +116,7 @@ const { t } = useI18n()
const authStore = useAuth() const authStore = useAuth()
const configStore = useConfig() const configStore = useConfig()
const mediaStore = useMedia()
const indexStore = useIndex() const indexStore = useIndex()
const { i } = storeToRefs(useConfig()) const { i } = storeToRefs(useConfig())
@ -220,6 +221,7 @@ async function addUpdateChannel() {
await configStore.getAdvancedConfig() await configStore.getAdvancedConfig()
await configStore.getPlayoutConfig() await configStore.getPlayoutConfig()
await configStore.getUserConfig() await configStore.getUserConfig()
await mediaStore.getTree('')
} }
} }
@ -244,6 +246,7 @@ async function deleteChannel() {
await configStore.getAdvancedConfig() await configStore.getAdvancedConfig()
await configStore.getPlayoutConfig() await configStore.getPlayoutConfig()
await configStore.getUserConfig() await configStore.getUserConfig()
await mediaStore.getTree('')
if (response.status === 200) { if (response.status === 200) {
indexStore.msgAlert('success', t('config.errorChannelDelete'), 2) indexStore.msgAlert('success', t('config.errorChannelDelete'), 2)