Exemplo n.º 1
0
        public async Task Imdb([Remainder] string query = null)
        {
            if (!(await ValidateQuery(Context.Channel, query).ConfigureAwait(false)))
            {
                return;
            }
            await Context.Channel.TriggerTypingAsync().ConfigureAwait(false);

            var movie = await OmdbProvider.FindMovie(query, _google);

            if (movie == null)
            {
                await ReplyErrorLocalized("imdb_fail").ConfigureAwait(false);

                return;
            }
            await Context.Channel.EmbedAsync(movie.GetEmbed()).ConfigureAwait(false);
        }
Exemplo n.º 2
0
        public async Task Imdb([Remainder] string query = null)
        {
            if (!(await ValidateQuery(Context.Channel, query).ConfigureAwait(false)))
            {
                return;
            }
            await Context.Channel.TriggerTypingAsync().ConfigureAwait(false);

            var movie = await OmdbProvider.FindMovie(query);

            if (movie == null)
            {
                await Context.Channel.SendErrorAsync("Failed to find that movie.").ConfigureAwait(false);

                return;
            }
            await Context.Channel.EmbedAsync(movie.GetEmbed()).ConfigureAwait(false);
        }
Exemplo n.º 3
0
        public async Task Imdb(IUserMessage umsg, [Remainder] string query = null)
        {
            var channel = (ITextChannel)umsg.Channel;

            if (!(await ValidateQuery(channel, query).ConfigureAwait(false)))
            {
                return;
            }
            await umsg.Channel.TriggerTypingAsync().ConfigureAwait(false);

            var movie = await OmdbProvider.FindMovie(query);

            if (movie == null)
            {
                await channel.SendMessageAsync("Failed to find that movie.").ConfigureAwait(false);

                return;
            }
            await channel.SendMessageAsync(movie.ToString()).ConfigureAwait(false);
        }
Exemplo n.º 4
0
        public async Task <MetadataResult <Episode> > GetMetadata(EpisodeInfo info, CancellationToken cancellationToken)
        {
            var result = new MetadataResult <Episode>()
            {
                Item = new Episode()
            };

            // Allowing this will dramatically increase scan times
            if (info.IsMissingEpisode || info.IsVirtualUnaired)
            {
                return(result);
            }

            if (OmdbProvider.IsValidSeries(info.SeriesProviderIds) && info.IndexNumber.HasValue && info.ParentIndexNumber.HasValue)
            {
                var seriesImdbId = info.SeriesProviderIds[MetadataProviders.Imdb.ToString()];

                result.HasMetadata = await new OmdbProvider(_jsonSerializer, _httpClient, _fileSystem, _configurationManager).FetchEpisodeData(result, info.IndexNumber.Value, info.ParentIndexNumber.Value, seriesImdbId, info.MetadataLanguage, info.MetadataCountryCode, cancellationToken).ConfigureAwait(false);
            }

            return(result);
        }