Skip to content

Commit

Permalink
Keep UnRead Episodes on Top
Browse files Browse the repository at this point in the history
  • Loading branch information
kimbtech committed Jul 19, 2023
1 parent 1f5cd9c commit d5dbe02
Show file tree
Hide file tree
Showing 4 changed files with 12 additions and 7 deletions.
2 changes: 1 addition & 1 deletion VERSION
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
2.3.9
2.3.10
2.3
2
4 changes: 2 additions & 2 deletions php/classes/Output.php
Original file line number Diff line number Diff line change
Expand Up @@ -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',
Expand All @@ -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;
}

/**
Expand Down
5 changes: 3 additions & 2 deletions php/classes/Router.php
Original file line number Diff line number Diff line change
Expand Up @@ -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');
Expand Down
8 changes: 6 additions & 2 deletions php/classes/UnRead.php
Original file line number Diff line number Diff line change
Expand Up @@ -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) ? '' : '*';
}

/**
Expand Down

0 comments on commit d5dbe02

Please sign in to comment.