From d5dbe02fc23ad75be8899d4fb80dc046f10f5420 Mon Sep 17 00:00:00 2001 From: KIMB-technologies Date: Wed, 19 Jul 2023 14:27:47 +0200 Subject: [PATCH] Keep UnRead Episodes on Top --- VERSION | 2 +- php/classes/Output.php | 4 ++-- php/classes/Router.php | 5 +++-- php/classes/UnRead.php | 8 ++++++-- 4 files changed, 12 insertions(+), 7 deletions(-) diff --git a/VERSION b/VERSION index fd7f44e..e75f16d 100644 --- a/VERSION +++ b/VERSION @@ -1,3 +1,3 @@ -2.3.9 +2.3.10 2.3 2 diff --git a/php/classes/Output.php b/php/classes/Output.php index fe003a6..85e742f 100644 --- a/php/classes/Output.php +++ b/php/classes/Output.php @@ -87,7 +87,7 @@ public function addPodcast( int $podcastid, string $name, string $url ) : void { * Add a podcast episode */ public function addEpisode( int $podcastid, int $episodeid, string $podcastname, string $episodename, - string $url, string $desc = '', string $logo = '' ) : void { + string $url, string $desc = '', string $logo = '', bool $top = false ) : void { $logo = empty($logo) || substr($logo, 0, 4) != 'http' ? Config::DOMAIN . 'media/default.png' : $logo; $this->items[] = array( 'ItemType' => 'ShowEpisode', @@ -103,7 +103,7 @@ public function addEpisode( int $podcastid, int $episodeid, string $podcastname, 'Country' => 'KIMB', 'ShowMime' => 'MP3' ); - $this->itemsSortKeys[] = 'ep==' . $podcastid . '==' . $episodeid; + $this->itemsSortKeys[] = ($top ? 'epA' : 'epZ' ) . '==' . $podcastid . '==' . $episodeid; } /** diff --git a/php/classes/Router.php b/php/classes/Router.php index 4069f7f..9a2cc57 100644 --- a/php/classes/Router.php +++ b/php/classes/Router.php @@ -132,10 +132,11 @@ private function listPodcast(){ $id, $eid, $pd['title'], - $this->unread->knownItem($id, $e['url']) . $e['title'], + $this->unread->knownItemMark($id, $e['url']) . $e['title'], $proxy ? Config::DOMAIN . 'stream.php?id=' . $id . '&eid=' . $eid . '&mac=' . $this->radioid->getMac() : $e['url'], $e['desc'], - $pd['logo'] + $pd['logo'], + !$this->unread->knownItem($id, $e['url']) ); } $this->out->prevUrl(Config::DOMAIN . 'cat?cid=3'); diff --git a/php/classes/UnRead.php b/php/classes/UnRead.php index 79142b5..3342010 100644 --- a/php/classes/UnRead.php +++ b/php/classes/UnRead.php @@ -45,13 +45,17 @@ public function searchItem(int $id, string $noturl = '') : void { } } + public function knownItem(int $id, string $url) : bool { + return $this->redis->keyExists( $url ); + } + /** * Get the status of one episode (as gui prefix string) * @param id the podcast id * @param url of episode */ - public function knownItem(int $id, string $url) : string { - return $this->redis->keyExists( $url ) ? '' : '*'; + public function knownItemMark(int $id, string $url) : string { + return $this->knownItem($id, $url) ? '' : '*'; } /**