Ejemplo n.º 1
0
        private async Task <IActionResult> ProcessJellyPhrase(JellyPhrase phrase, string controllerName)
        {
            phrase.UserId = await _jellyfinService.GetUserId(phrase.User);

            if (string.IsNullOrWhiteSpace(phrase.UserId))
            {
                await _loggingService.LogWarning($"{controllerName} - no user found", $"{phrase.SearchTerm}, or the default user, returned no available user IDs.", phrase);

                return(BadRequest($"No user found! - {phrase.SearchTerm}, or the default user, returned no available user Ids"));
            }

            IEnumerable <QueueItem> items = await _jellyfinService.GetItems(phrase);

            await _loggingService.LogDebug($"{controllerName} - items found.", $"Found {items.Count()} item(s) with the search term {phrase.SearchTerm}.");

            await _loggingService.LogInformation($"{controllerName} - items found.", "Found the following items:", items);

            if (!items.Any())
            {
                await _loggingService.LogWarning($"{controllerName} - no results", $"{phrase.SearchTerm} returned no search results.", phrase);

                return(NotFound($"No user found! - {phrase.SearchTerm}, or the default user, returned no available user IDs."));
            }

            _ = Task.Run(async() => await _castService.StartJellyfinSession(phrase.Device, items));

            return(Ok($"Found {items.Count()} item(s) with the search term {phrase.SearchTerm}."));
        }
Ejemplo n.º 2
0
 public async Task LaunchQueue(string receiverName, string searchTerm) =>
 await _castService.StartJellyfinSession(receiverName, await GetItems(searchTerm));