1 | <?php |
||
22 | class AlbumBusinessLayer extends BusinessLayer { |
||
23 | |||
24 | private $logger; |
||
25 | |||
26 | public function __construct(AlbumMapper $albumMapper, Logger $logger){ |
||
30 | |||
31 | /** |
||
32 | * Return an album |
||
33 | * @param string $albumId the id of the album |
||
34 | * @param string $userId the name of the user |
||
35 | * @return Album album |
||
36 | */ |
||
37 | public function find($albumId, $userId){ |
||
43 | |||
44 | /** |
||
45 | * Returns all albums |
||
46 | * @param string $userId the name of the user |
||
47 | * @return Album[] albums |
||
48 | */ |
||
49 | public function findAll($userId){ |
||
53 | |||
54 | /** |
||
55 | * Returns all albums filtered by artist |
||
56 | * @param string $artistId the id of the artist |
||
57 | * @return Album[] albums |
||
58 | */ |
||
59 | public function findAllByArtist($artistId, $userId){ |
||
63 | |||
64 | private function injectArtists($albums){ |
||
78 | |||
79 | public function findAlbumOwner($albumId){ |
||
89 | |||
90 | /** |
||
91 | * Adds an album if it does not exist already or updates an existing album |
||
92 | * @param string $name the name of the album |
||
93 | * @param string $year the year of the release |
||
94 | * @param string $discnumber the disk number of this album's disk |
||
95 | * @param integer $albumArtistId |
||
96 | * @param string $userId |
||
97 | * @return Album The added/updated album |
||
98 | */ |
||
99 | public function addOrUpdateAlbum($name, $year, $discnumber, $albumArtistId, $userId){ |
||
115 | |||
116 | /** |
||
117 | * Check if given file is used as cover for the given album |
||
118 | * @param int $albumId |
||
119 | * @param int[] $fileIds |
||
120 | * @return boolean |
||
121 | */ |
||
122 | public function albumCoverIsOneOfFiles($albumId, $fileIds) { |
||
126 | |||
127 | /** |
||
128 | * updates the cover for albums in the specified folder without cover |
||
129 | * @param integer $coverFileId the file id of the cover image |
||
130 | * @param integer $folderId the file id of the folder where the albums are looked from |
||
131 | * @return true if one or more albums were influenced |
||
132 | */ |
||
133 | public function updateFolderCover($coverFileId, $folderId){ |
||
136 | |||
137 | /** |
||
138 | * set cover file for a specified album |
||
139 | * @param integer $coverFileId the file id of the cover image |
||
140 | * @param integer $albumId the id of the album to be modified |
||
141 | */ |
||
142 | public function setCover($coverFileId, $albumId){ |
||
145 | |||
146 | /** |
||
147 | * removes the cover art from albums, replacement covers will be searched in a background task |
||
148 | * @param integer[] $coverFileIds the file IDs of the cover images |
||
149 | * @param string|null $userId the user whose music library is targeted; all users are targeted if omitted |
||
150 | * @return string[] user IDs of the affected users; empty array if no album was modified |
||
151 | */ |
||
152 | public function removeCovers($coverFileIds, $userId=null){ |
||
155 | |||
156 | /** |
||
157 | * try to find cover arts for albums without covers |
||
158 | * @return array of users whose collections got modified |
||
159 | */ |
||
160 | public function findCovers(){ |
||
170 | } |
||
171 |