Skip to content

Commit 380aafe

Browse files
authored
Merge pull request #355 from euzu/feature/remove_default_sort
Default sort removed, Removed disabled proessing step logs
2 parents 41a3bb8 + 3a872c8 commit 380aafe

File tree

5 files changed

+36
-19
lines changed

5 files changed

+36
-19
lines changed

CHANGELOG.md

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,11 @@
22
# 3.1.7 (2025-09-xx)
33
- Added Dark / Bright theme switch
44
- Resource proxy retries failed requests up to three times and honors the `Retry-After` header (or waits 100 ms as a fallback) to reduce transient HTTP 400, 408, 425, 429 and all 5xx statuses errors observed by clients.
5-
- Added `accept_unsecure_ssl_certificate` to `config.yml`
5+
- Added `accept_unsecure_ssl_certificate` to `config.yml`. Necessary if pictures are served over https without valid ssl cert.
6+
- Using tmdbid for VOD from get_vod_streams if available, which makes using resolve_vod for STRM generation not necessary.
7+
- File length problem with strm generation fixed.
8+
- Series name empty paren problem fixed.
9+
- Default sort removed
610

711
# 3.1.6 (2025-09-01)
812
- EPG Config View added

backend/src/processing/processor/playlist.rs

Lines changed: 19 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -507,43 +507,49 @@ async fn process_playlist_for_target(app_config: &AppConfig,
507507
info!("Playlist is empty: {}", &target.name);
508508
Ok(())
509509
} else {
510-
511510
// Process Trakt categories
512-
trakt_playlist(&client, target, errors, &mut new_playlist).await;
513-
step.tick("trakt categories");
511+
if trakt_playlist(&client, target, errors, &mut new_playlist).await {
512+
step.tick("trakt categories");
513+
}
514514

515515
let mut flat_new_playlist = flatten_groups(new_playlist);
516516
step.tick("playlist merge");
517517

518-
sort_playlist(target, &mut flat_new_playlist);
519-
step.tick("playlist sort");
518+
if sort_playlist(target, &mut flat_new_playlist) {
519+
step.tick("playlist sort");
520+
}
520521
assign_channel_no_playlist(&mut flat_new_playlist);
521522
step.tick("assigning channel numbers");
522523
map_playlist_counter(target, &mut flat_new_playlist);
523524
step.tick("assigning channel counter");
524525

525526
let config = app_config.config.load();
526-
process_watch(&config, &client, target, &flat_new_playlist);
527-
step.tick("group watches");
527+
if process_watch(&config, &client, target, &flat_new_playlist) {
528+
step.tick("group watches");
529+
}
528530
let result = persist_playlist(app_config, &mut flat_new_playlist, flatten_tvguide(&new_epg).as_ref(), target).await;
529531
step.stop("Persisting playlists");
530532
result
531533
}
532534
}
533535

534-
async fn trakt_playlist(client: &Arc<Client>, target: &ConfigTarget, errors: &mut Vec<TuliproxError>, playlist: &mut Vec<PlaylistGroup>) {
536+
async fn trakt_playlist(client: &Arc<Client>, target: &ConfigTarget, errors: &mut Vec<TuliproxError>, playlist: &mut Vec<PlaylistGroup>) -> bool {
535537
match process_trakt_categories_for_target(Arc::clone(client), playlist, target).await {
536-
Ok(trakt_categories) => {
538+
Ok(Some(trakt_categories)) => {
537539
if !trakt_categories.is_empty() {
538540
info!("Adding {} Trakt categories to playlist", trakt_categories.len());
539541
playlist.extend(trakt_categories);
540542
}
541543
}
544+
Ok(None) => {
545+
return false;
546+
}
542547
Err(trakt_errors) => {
543548
warn!("Trakt processing failed with {} errors", trakt_errors.len());
544549
errors.extend(trakt_errors);
545550
}
546551
}
552+
true
547553
}
548554

549555
fn process_epg(processed_fetched_playlists: &mut Vec<FetchedPlaylist>) -> (Vec<Epg>, Vec<PlaylistGroup>) {
@@ -559,7 +565,7 @@ fn process_epg(processed_fetched_playlists: &mut Vec<FetchedPlaylist>) -> (Vec<E
559565
(new_epg, new_playlist)
560566
}
561567

562-
fn process_watch(cfg: &Config, client: &Arc<reqwest::Client>, target: &ConfigTarget, new_playlist: &Vec<PlaylistGroup>) {
568+
fn process_watch(cfg: &Config, client: &Arc<reqwest::Client>, target: &ConfigTarget, new_playlist: &Vec<PlaylistGroup>) -> bool {
563569
if let Some(watches) = &target.watch {
564570
if default_as_default().eq_ignore_ascii_case(&target.name) {
565571
error!("cant watch a target with no unique name");
@@ -570,6 +576,9 @@ fn process_watch(cfg: &Config, client: &Arc<reqwest::Client>, target: &ConfigTar
570576
}
571577
}
572578
}
579+
true
580+
} else {
581+
false
573582
}
574583
}
575584

backend/src/processing/processor/sort.rs

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -115,7 +115,7 @@ fn playlistitem_comparator(
115115
playlist_comparator(channel_sort.sequence.as_ref(), channel_sort.order, &value_a, &value_b)
116116
}
117117

118-
pub(in crate::processing::processor) fn sort_playlist(target: &ConfigTarget, new_playlist: &mut [PlaylistGroup]) {
118+
pub(in crate::processing::processor) fn sort_playlist(target: &ConfigTarget, new_playlist: &mut [PlaylistGroup]) -> bool {
119119
if let Some(sort) = &target.sort {
120120
let match_as_ascii = sort.match_as_ascii;
121121
if let Some(group_sort) = &sort.groups {
@@ -132,6 +132,9 @@ pub(in crate::processing::processor) fn sort_playlist(target: &ConfigTarget, new
132132
}
133133
}
134134
}
135+
true
136+
} else {
137+
false
135138
}
136139
}
137140

backend/src/processing/processor/trakt.rs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -253,10 +253,10 @@ impl TraktCategoriesProcessor {
253253
playlist: &[PlaylistGroup],
254254
target: &ConfigTarget,
255255
trakt_config: &TraktConfig,
256-
) -> Result<Vec<PlaylistGroup>, Vec<TuliproxError>> {
256+
) -> Result<Option<Vec<PlaylistGroup>>, Vec<TuliproxError>> {
257257
if trakt_config.lists.is_empty() {
258258
debug!("No Trakt lists configured for target {}", target.name);
259-
return Ok(vec![]);
259+
return Ok(None);
260260
}
261261

262262
info!("Processing {} Trakt lists for target {}", trakt_config.lists.len(), target.name);
@@ -288,17 +288,17 @@ impl TraktCategoriesProcessor {
288288
info!("Trakt processing complete: created {} categories with {total_matches} total matches",
289289
new_categories.len());
290290

291-
Ok(new_categories)
291+
Ok(Some(new_categories))
292292
}
293293
}
294294
pub async fn process_trakt_categories_for_target(
295295
http_client: Arc<reqwest::Client>,
296296
playlist: &[PlaylistGroup],
297297
target: &ConfigTarget,
298-
) -> Result<Vec<PlaylistGroup>, Vec<TuliproxError>> {
298+
) -> Result<Option<Vec<PlaylistGroup>>, Vec<TuliproxError>> {
299299
let Some(trakt_config) = target.get_xtream_output().and_then(|output| output.trakt.as_ref()) else {
300300
debug!("No Trakt configuration found for target {}", target.name);
301-
return Ok(vec![]);
301+
return Ok(None);
302302
};
303303

304304
let processor = TraktCategoriesProcessor::new(http_client, trakt_config);

backend/src/utils/network/xtream.rs

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ use shared::error::{str_to_io_error, TuliproxError};
77
use crate::utils::{request};
88
use chrono::{DateTime};
99
use log::{info, warn};
10-
use std::cmp::Ordering;
10+
// use std::cmp::Ordering;
1111
use std::io::Error;
1212
use std::str::FromStr;
1313
use std::sync::Arc;
@@ -240,7 +240,8 @@ pub async fn get_xtream_playlist(cfg: &Config, client: Arc<reqwest::Client>, inp
240240
}
241241
}
242242
}
243-
playlist_groups.sort_by(|a, b| a.title.partial_cmp(&b.title).unwrap_or(Ordering::Greater));
243+
// why we need a sort if there is no sort defined ?
244+
//playlist_groups.sort_by(|a, b| a.title.partial_cmp(&b.title).unwrap_or(Ordering::Greater));
244245

245246
for (grp_id, plg) in (1_u32..).zip(playlist_groups.iter_mut()) {
246247
plg.id = grp_id;

0 commit comments

Comments
 (0)