Exemplo n.º 1
0
        /// <summary>
        /// Processes the episode file passed into storage.
        /// </summary>
        public async Task ProcessAsync(string path, eMediaType mediaType)
        {
            if (mediaType == eMediaType.Movie)
            {
                throw new ArgumentException("Media Type is not an episode");
            }

            string episodeFileName      = Path.GetFileName(path);
            EpisodeSearchResult episode = await _mediaInfoRepository.EpisodeSearch(episodeFileName);

            if (episode?.Id > 0)
            {
                await ProcessFoundEpisodeAsync(path, episode, mediaType);

                _broker.Publish(mediaType.ToString(), episode.Id, "StorageProcessed");
            }
            else
            {
                _logger.LogWarning($"Did not process '{episodeFileName}' as it was not found by the media information service. Show Id: {episode?.ShowId.ToString() ?? "0 (SHOW NOT FOUND)"} / Full path: {path}");
                throw new EpisodeNotFoundException();
            }
        }
Exemplo n.º 2
0
 public void NotifyProcessedFile(eMediaType mediaType, string fileName)
 {
     _broker.Publish(mediaType.ToString(), fileName, "ConvertedMedia");
 }