1 | <?php |
||
33 | class TrackBusinessLayer extends BusinessLayer { |
||
34 | |||
35 | private $logger; |
||
36 | |||
37 | public function __construct(TrackMapper $trackMapper, Logger $logger){ |
||
41 | |||
42 | /** |
||
43 | * Returns all tracks filtered by artist |
||
44 | * @param string $artistId the id of the artist |
||
45 | * @param string $userId the name of the user |
||
46 | * @return array of tracks |
||
47 | */ |
||
48 | public function findAllByArtist($artistId, $userId){ |
||
51 | |||
52 | /** |
||
53 | * Returns all tracks filtered by album |
||
54 | * @param string $albumId the id of the track |
||
55 | * @param string $userId the name of the user |
||
56 | * @return \OCA\Music\Db\Track[] tracks |
||
57 | */ |
||
58 | public function findAllByAlbum($albumId, $userId, $artistId = null){ |
||
61 | |||
62 | /** |
||
63 | * Returns the track for a file id |
||
64 | * @param string $fileId the file id of the track |
||
65 | * @param string $userId the name of the user |
||
66 | * @return \OCA\Music\Db\Track track |
||
67 | */ |
||
68 | public function findByFileId($fileId, $userId){ |
||
71 | |||
72 | /** |
||
73 | * Returns file IDs of all indexed tracks of the user |
||
74 | * @param string $userId |
||
75 | * @return int[] |
||
76 | */ |
||
77 | public function findAllFileIds($userId){ |
||
80 | |||
81 | /** |
||
82 | * Adds a track if it does not exist already or updates an existing track |
||
83 | * @param string $title the title of the track |
||
84 | * @param string $number the number of the track |
||
85 | * @param string $artistId the artist id of the track |
||
86 | * @param string $albumId the album id of the track |
||
87 | * @param string $fileId the file id of the track |
||
88 | * @param string $mimetype the mimetype of the track |
||
89 | * @param string $userId the name of the user |
||
90 | * @param int $length track length in seconds |
||
91 | * @param int $bitrate track bitrate in bits (not kbits) |
||
92 | * @return \OCA\Music\Db\Track The added/updated track |
||
93 | */ |
||
94 | public function addOrUpdateTrack( |
||
109 | |||
110 | /** |
||
111 | * Deletes a track |
||
112 | * @param int|int[] $fileIds one or multiple tracks |
||
113 | * @param string|null $userId the name of the user; if omitted, the tracks matching the |
||
114 | * $fileId are deleted from all users |
||
115 | * @return False if no such track was found; otherwise array of six arrays |
||
116 | * (named 'deletedTracks', 'remainingAlbums', 'remainingArtists', 'obsoleteAlbums', |
||
117 | * 'obsoleteArtists', and 'affectedUsers'). These contain the track, album, artist, and |
||
118 | * user IDs of the deleted tracks. The 'obsolete' entities are such which no longer |
||
119 | * have any tracks while 'remaining' entities have some left. |
||
120 | */ |
||
121 | public function deleteTracks($fileIds, $userId = null){ |
||
187 | |||
188 | /** |
||
189 | * Returns all tracks filtered by name (of track/album/artist) |
||
190 | * @param string $name the name of the track/album/artist |
||
191 | * @param string $userId the name of the user |
||
192 | * @return \OCA\Music\Db\Track[] tracks |
||
193 | */ |
||
194 | public function findAllByNameRecursive($name, $userId){ |
||
197 | } |
||
198 |