mirror of
https://github.com/euzu/tuliprox.git
synced 2026-10-09 09:22:18 +02:00
skipping direct_source for xtream
This commit is contained in:
@@ -1,4 +1,10 @@
|
||||
# Changelog
|
||||
# v1.1.3(2023-11-??)
|
||||
* added new target options
|
||||
- `xtream_skip_live_direct_source`
|
||||
- `xtream_skip_video_direct_source`
|
||||
* internal optimization/refactoring to avoid string cloning.
|
||||
|
||||
# v1.1.2(2023-11-03)
|
||||
* Fixed epg for xtream
|
||||
* Fixed some Web-UI Problems
|
||||
|
||||
@@ -193,11 +193,21 @@ sort:
|
||||
### 1.5.2.2 `output`
|
||||
|
||||
Is a list of output format:
|
||||
Each format has 2 properties `type` and `filename`
|
||||
`type` _mandatory_ ```m3u```, ```strm``` and ```xtream```.
|
||||
`filename` _mandatory_ if type `m3u` or `strm`, otherwise ignored
|
||||
Each format has 2 properties
|
||||
- `type`
|
||||
- `filename`
|
||||
|
||||
`strm` output has additional options `underscore_whitespace`, `cleanup` and `kodi_style`.
|
||||
`type` is _mandatory_ for `m3u`, `strm` and `xtream`.
|
||||
`filename` is _mandatory_ if type `m3u` or `strm`, otherwise ignored
|
||||
|
||||
`strm` output has additional options
|
||||
- `underscore_whitespace`
|
||||
- `cleanup`
|
||||
- `kodi_style`.
|
||||
|
||||
`xtream` output has additional options
|
||||
- `xtream_skip_live_direct_source`
|
||||
- `xtream_skip_video_direct_source`
|
||||
|
||||
```yaml
|
||||
output:
|
||||
|
||||
+19
@@ -65,6 +65,25 @@ sources:
|
||||
- Canada
|
||||
watch:
|
||||
- 'FR - Movies'
|
||||
- name: plxtream
|
||||
publish: true
|
||||
filename: playlist_1
|
||||
type: xtream
|
||||
filter: '!ALL_CHAN!'
|
||||
options: { ignore_logo: true, xtream_skip_live_direct_source: true, , xtream_skip_video_direct_source: true, }
|
||||
rename:
|
||||
- { field: group, new_name: 1. DE$1, pattern: ^DE(.*) }
|
||||
sort:
|
||||
groups:
|
||||
order: asc
|
||||
mapping:
|
||||
- France TNT
|
||||
- France Premium
|
||||
- Belgique
|
||||
- Suisse
|
||||
- Canada
|
||||
watch:
|
||||
- 'FR - Movies'
|
||||
- filename: playlist_strm
|
||||
type: strm
|
||||
filter: 'Group ~ "^tv-shows.*"'
|
||||
|
||||
@@ -3,7 +3,7 @@ use std::sync::{Arc, Mutex};
|
||||
use actix_web::web;
|
||||
use serde::{Deserialize, Serialize};
|
||||
use crate::model::api_proxy::{ApiProxyConfig};
|
||||
use crate::model::config::{Config, ConfigOptions, ConfigRename, ConfigSort, InputType, ProcessTargets, TargetOutput, VideoConfig};
|
||||
use crate::model::config::{Config, ConfigTargetOptions, ConfigRename, ConfigSort, InputType, ProcessTargets, TargetOutput, VideoConfig};
|
||||
use crate::model::model_config::{default_as_empty_str, ProcessingOrder};
|
||||
|
||||
pub(crate) struct AppState {
|
||||
@@ -75,7 +75,7 @@ pub(crate) struct ServerTargetConfig {
|
||||
pub id: u16,
|
||||
pub enabled: bool,
|
||||
pub name: String,
|
||||
pub options: Option<ConfigOptions>,
|
||||
pub options: Option<ConfigTargetOptions>,
|
||||
pub sort: Option<ConfigSort>,
|
||||
pub filter: String,
|
||||
#[serde(alias = "type")]
|
||||
|
||||
+6
-2
@@ -143,7 +143,7 @@ impl ConfigRename {
|
||||
}
|
||||
|
||||
#[derive(Debug, Clone, serde::Serialize, serde::Deserialize)]
|
||||
pub(crate) struct ConfigOptions {
|
||||
pub(crate) struct ConfigTargetOptions {
|
||||
#[serde(default = "default_as_false")]
|
||||
pub ignore_logo: bool,
|
||||
#[serde(default = "default_as_false")]
|
||||
@@ -152,6 +152,10 @@ pub(crate) struct ConfigOptions {
|
||||
pub cleanup: bool,
|
||||
#[serde(default = "default_as_false")]
|
||||
pub kodi_style: bool,
|
||||
#[serde(default = "default_as_false")]
|
||||
pub xtream_skip_live_direct_source: bool,
|
||||
#[serde(default = "default_as_false")]
|
||||
pub xtream_skip_video_direct_source: bool,
|
||||
}
|
||||
|
||||
#[derive(Debug, Clone, serde::Serialize, serde::Deserialize)]
|
||||
@@ -171,7 +175,7 @@ pub(crate) struct ConfigTarget {
|
||||
#[serde(default = "default_as_default")]
|
||||
pub name: String,
|
||||
#[serde(skip_serializing_if = "Option::is_none")]
|
||||
pub options: Option<ConfigOptions>,
|
||||
pub options: Option<ConfigTargetOptions>,
|
||||
#[serde(skip_serializing_if = "Option::is_none")]
|
||||
pub sort: Option<ConfigSort>,
|
||||
pub filter: String,
|
||||
|
||||
@@ -4,7 +4,7 @@ use std::rc::Rc;
|
||||
use serde::{Deserialize, Serialize};
|
||||
use serde_json::Value;
|
||||
|
||||
use crate::model::config::{ConfigInput, ConfigOptions};
|
||||
use crate::model::config::{ConfigInput, ConfigTargetOptions};
|
||||
use crate::model::xmltv::TVGuide;
|
||||
|
||||
// https://de.wikipedia.org/wiki/M3U
|
||||
@@ -106,7 +106,7 @@ macro_rules! to_m3u_non_empty_fields {
|
||||
|
||||
|
||||
impl PlaylistItem {
|
||||
pub fn to_m3u(&self, options: &Option<ConfigOptions>) -> String {
|
||||
pub fn to_m3u(&self, options: &Option<ConfigTargetOptions>) -> String {
|
||||
let header = self.header.borrow();
|
||||
let ignore_logo = options.as_ref().map_or(false, |o| o.ignore_logo);
|
||||
let mut line = format!("#EXTINF:-1 tvg-id=\"{}\" tvg-name=\"{}\" group-title=\"{}\"",
|
||||
|
||||
@@ -242,8 +242,10 @@ fn process_streams(xtream_cluster: &XtreamCluster, streams: &Value) -> Result<Ve
|
||||
}
|
||||
}
|
||||
|
||||
pub(crate) fn parse_xtream(cat_id_cnt: &AtomicI32, xtream_cluster: &XtreamCluster,
|
||||
category: &Value, streams: &Value,
|
||||
pub(crate) fn parse_xtream(cat_id_cnt: &AtomicI32,
|
||||
xtream_cluster: &XtreamCluster,
|
||||
category: &Value,
|
||||
streams: &Value,
|
||||
stream_base_url: &String) -> Result<Option<Vec<PlaylistGroup>>, M3uFilterError> {
|
||||
match process_category(category) {
|
||||
Ok(mut categories) => {
|
||||
@@ -270,7 +272,8 @@ pub(crate) fn parse_xtream(cat_id_cnt: &AtomicI32, xtream_cluster: &XtreamCluste
|
||||
audio_track: default_as_empty_rc_str(),
|
||||
time_shift: default_as_empty_rc_str(),
|
||||
rec: default_as_empty_rc_str(),
|
||||
source: default_as_empty_rc_str(), // String::from(&stream.direct_source),
|
||||
// source is meant to hold the original provider data
|
||||
source: default_as_empty_rc_str(),
|
||||
url: if stream.direct_source.is_empty() {
|
||||
Rc::new(format!("{}/{}", stream_base_url, stream.get_stream_id()))
|
||||
} else {
|
||||
|
||||
@@ -69,6 +69,10 @@ pub(crate) fn write_xtream_playlist(target: &ConfigTarget, cfg: &Config, playlis
|
||||
return Err(M3uFilterError::new(M3uFilterErrorKind::Notify, msg));
|
||||
}
|
||||
|
||||
|
||||
let (skip_live_direct_source, skip_video_direct_source) = target.options.as_ref()
|
||||
.map_or((false, false), |o| (o.xtream_skip_live_direct_source, o.xtream_skip_video_direct_source));
|
||||
|
||||
let mut cat_live_col = vec![];
|
||||
let mut cat_series_col = vec![];
|
||||
let mut cat_vod_col = vec![];
|
||||
@@ -106,7 +110,9 @@ pub(crate) fn write_xtream_playlist(target: &ConfigTarget, cfg: &Config, playlis
|
||||
match header.xtream_cluster {
|
||||
XtreamCluster::Live => {
|
||||
document.insert("stream_id".to_string(), stream_id);
|
||||
document.insert("direct_source".to_string(), Value::String(header.url.as_ref().clone()));
|
||||
if !skip_live_direct_source {
|
||||
document.insert("direct_source".to_string(), Value::String(header.url.as_ref().clone()));
|
||||
}
|
||||
document.insert("thumbnail".to_string(), Value::String(header.logo_small.as_ref().clone()));
|
||||
document.insert("custom_sid".to_string(), Value::String("".to_string()));
|
||||
document.insert("epg_channel_id".to_string(), match &header.epg_channel_id {
|
||||
@@ -116,7 +122,9 @@ pub(crate) fn write_xtream_playlist(target: &ConfigTarget, cfg: &Config, playlis
|
||||
}
|
||||
XtreamCluster::Video => {
|
||||
document.insert("stream_id".to_string(), stream_id);
|
||||
document.insert("direct_source".to_string(), Value::String(header.url.as_ref().clone()));
|
||||
if !skip_video_direct_source {
|
||||
document.insert("direct_source".to_string(), Value::String(header.url.as_ref().clone()));
|
||||
}
|
||||
document.insert("custom_sid".to_string(), Value::String("".to_string()));
|
||||
}
|
||||
XtreamCluster::Series => {
|
||||
|
||||
Reference in New Issue
Block a user