Skip to content

add defaultPath for RST #209

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
May 12, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 7 additions & 6 deletions src-tauri/src/restream.rs
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,8 @@ use crate::{
mpv,
settings::get_settings,
sql,
types::{AppState, Channel, NetworkInfo},
utils::get_bin,
types::{AppState, Channel, CustomChannel, NetworkInfo},
utils::{get_bin, serialize_to_file},
};

const WAN_IP_API: &str = "https://api.ipify.org";
Expand Down Expand Up @@ -177,8 +177,9 @@ pub async fn watch_self(port: u16) -> Result<()> {
}

pub fn share_restream(address: String, channel: Channel, path: String) -> Result<()> {
crate::share::share_custom_channel(
Channel {
let channel = CustomChannel {
headers: sql::get_channel_headers_by_id(channel.id.context("No id on channel?")?)?,
data: Channel {
id: Some(-1),
name: format!("RST | {}", channel.name).to_string(),
url: Some(address),
Expand All @@ -192,8 +193,8 @@ pub fn share_restream(address: String, channel: Channel, path: String) -> Result
stream_id: None,
tv_archive: None,
},
path,
)
};
serialize_to_file(channel, path)
}

pub async fn get_network_info() -> Result<NetworkInfo> {
Expand Down
3 changes: 3 additions & 0 deletions src/app/restream-modal/restream-modal.component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@ import { NetworkInfo } from "../models/networkInfo";
import { NgbActiveModal } from "@ng-bootstrap/ng-bootstrap";
import { UnlistenFn, listen } from "@tauri-apps/api/event";
import { save } from "@tauri-apps/plugin-dialog";
import { sanitizeFileName } from "../utils";
import { CHANNEL_EXTENSION } from "../models/extensions";

@Component({
selector: "app-restream-modal",
Expand Down Expand Up @@ -74,6 +76,7 @@ export class RestreamModalComponent implements OnInit, OnDestroy {
const file = await save({
canCreateDirectories: true,
title: "Select where to export re-stream",
defaultPath: `${sanitizeFileName(this.channel?.name!)}_rst${CHANNEL_EXTENSION}`,
});
if (!file) {
return;
Expand Down
Loading