|
1
|
|
|
<?php declare(strict_types=1); |
|
2
|
|
|
|
|
3
|
|
|
/** |
|
4
|
|
|
* ownCloud - Music app |
|
5
|
|
|
* |
|
6
|
|
|
* This file is licensed under the Affero General Public License version 3 or |
|
7
|
|
|
* later. See the COPYING file. |
|
8
|
|
|
* |
|
9
|
|
|
* @author Pauli Järvinen <[email protected]> |
|
10
|
|
|
* @copyright Pauli Järvinen 2021 |
|
11
|
|
|
*/ |
|
12
|
|
|
|
|
13
|
|
|
namespace OCA\Music\Db; |
|
14
|
|
|
|
|
15
|
|
|
use \OCP\AppFramework\Db\Entity; |
|
16
|
|
|
use \OCA\Music\Utility\Util; |
|
17
|
|
|
|
|
18
|
|
|
/** |
|
19
|
|
|
* @method string getUserId() |
|
20
|
|
|
* @method void setUserId(string $userId) |
|
21
|
|
|
* @method string getRssUrl() |
|
22
|
|
|
* @method void setRssUrl(string $url) |
|
23
|
|
|
* @method string getRssHash() |
|
24
|
|
|
* @method void setRssHash(string $hash) |
|
25
|
|
|
* @method string getContentHash() |
|
26
|
|
|
* @method void setContentHash(string $hash) |
|
27
|
|
|
* @method string getUpdateChecked() |
|
28
|
|
|
* @method void setUpdateChecked(string $timestamp) |
|
29
|
|
|
* @method string getSourceUpdated() |
|
30
|
|
|
* @method void setSourceUpdated(string $timestamp) |
|
31
|
|
|
* @method string getTitle() |
|
32
|
|
|
* @method void setTitle(string $title) |
|
33
|
|
|
* @method string getLinkUrl() |
|
34
|
|
|
* @method void setLinkUrl(string $url) |
|
35
|
|
|
* @method string getLanguage() |
|
36
|
|
|
* @method void setLanguage(string $language) |
|
37
|
|
|
* @method string getCopyright() |
|
38
|
|
|
* @method void setCopyright(string $copyright) |
|
39
|
|
|
* @method string getAuthor() |
|
40
|
|
|
* @method void setAuthor(string $author) |
|
41
|
|
|
* @method string getDescription() |
|
42
|
|
|
* @method void setDescription(string $description) |
|
43
|
|
|
* @method string getImageUrl() |
|
44
|
|
|
* @method void setImageUrl(string $url) |
|
45
|
|
|
* @method string getCategory() |
|
46
|
|
|
* @method void setCategory(string $category) |
|
47
|
|
|
* @method string getCreated() |
|
48
|
|
|
* @method void setCreated(string $timestamp) |
|
49
|
|
|
* @method string getUpdated() |
|
50
|
|
|
* @method void setUpdated(string $timestamp) |
|
51
|
|
|
* @method PodcastEpisode[] getEpisodes() |
|
52
|
|
|
* @method void setEpisodes(PodcastEpisode[] $episodes) |
|
53
|
|
|
*/ |
|
54
|
|
|
class PodcastChannel extends Entity { |
|
55
|
|
|
public $userId; |
|
56
|
|
|
public $rssUrl; |
|
57
|
|
|
public $rssHash; |
|
58
|
|
|
public $contentHash; |
|
59
|
|
|
public $updateChecked; |
|
60
|
|
|
public $sourceUpdated; |
|
61
|
|
|
public $title; |
|
62
|
|
|
public $linkUrl; |
|
63
|
|
|
public $language; |
|
64
|
|
|
public $copyright; |
|
65
|
|
|
public $author; |
|
66
|
|
|
public $description; |
|
67
|
|
|
public $imageUrl; |
|
68
|
|
|
public $category; |
|
69
|
|
|
public $created; |
|
70
|
|
|
public $updated; |
|
71
|
|
|
|
|
72
|
|
|
// not part of the default content, may be injected separately |
|
73
|
|
|
public $episodes; |
|
74
|
|
|
|
|
75
|
|
|
public function toApi() : array { |
|
76
|
|
|
$result = [ |
|
77
|
|
|
'id' => $this->getId(), |
|
78
|
|
|
'title' => $this->getTitle(), |
|
79
|
|
|
'image' => $this->getImageUrl(), |
|
80
|
|
|
'hash' => $this->getContentHash() |
|
81
|
|
|
]; |
|
82
|
|
|
|
|
83
|
|
|
if ($this->episodes !== null) { |
|
84
|
|
|
$result['episodes'] = Util::arrayMapMethod($this->episodes, 'toApi'); |
|
85
|
|
|
} |
|
86
|
|
|
|
|
87
|
|
|
return $result; |
|
88
|
|
|
} |
|
89
|
|
|
} |
|
90
|
|
|
|