private function addTidalFavs(array $collection) { $count = 0; foreach ($collection as $album) { $query = $album['artist'] . ' ' . $album['name']; $found = $this->searchTidal($query); if (empty($found)) { $missing[] = $query; continue; } $id = array_shift($found)['id']; try { $this->addTidalFav($id); } catch (ServerException $e) { if (!$e->hasResponse() || !$this->tidal->isProbablyDuplicate($e->getResponse())) { $missing[] = $query; continue; } } $count++; } return [$count, $missing]; }
private function completeLogin($username, $password) { $session = $this->tidal->login($username, $password); $this->session->set('tidal.session', $session); return $this->payload->withStatus(Payload::OK)->withMessages(['redirect' => '/login']); }