示例#1
0
        private static void TvSearchHandler(string queryTerm)
        {
            TVMazeClient tvMaze = new TVMazeClient();
            var          result = tvMaze.Serach(queryTerm);

            if (result.Found)
            {
                TvMazeShow    show   = result.Show;
                TvMazeEpisode lastEp = show.PrevEpisode;
                TvMazeEpisode nextEp = show.NextEpisode;
                string        line1  = $" 14{show.name} 15-- {Common.GenerateCommaList(show.schedule?.days)} {show.schedule?.time}  8(14{show.status}8) (14{show.network?.name}8)";
                Write(line1);
                string line2 = $"{CTRLK}14{CTRLB}Prev Episode {CTRLB}{CTRLK}15-- {lastEp?.airdate} {CTRLK}08({CTRLK}14{lastEp?.season}{CTRLK}08x{CTRLK}14{lastEp?.number}{CTRLK}08){CTRLK}14 - {lastEp?.name}";
                Write(line2);
                DateTime airing = Convert.ToDateTime(nextEp?.airstamp);
                TimeSpan span   = airing.Subtract(DateTime.UtcNow);
                if (nextEp != null && nextEp.HasAirDate)
                {
                    string line3 = $"{CTRLK}14{CTRLB}Next Episode {CTRLB}{CTRLK}15-- {nextEp.airdate} {CTRLK}08({CTRLK}14{nextEp.season}{CTRLK}08x{CTRLK}14{nextEp.number}{CTRLK}08){CTRLK}14 - {nextEp.name} - Airing in: {CTRLK}08{span.Days}{CTRLK}14 days {CTRLK}08{span.Hours}{CTRLK}14 hours {CTRLK}08{span.Minutes}{CTRLK}14 minutes {CTRLK}08{span.Seconds}{CTRLK}14 seconds";
                    Write(line3);
                }
            }
            else
            {
                Write(result.Message);
            }
        }
        public static async Task Run([TimerTrigger("0 */10 * * * *")] TimerInfo myTimer, TraceWriter log)
        {
            using (var httpClient = new HttpClient())
            {
                var client = new TVMazeClient(httpClient);

                var connectionString = Environment.GetEnvironmentVariable("ConnectionStrings:TVMazeDatabase", EnvironmentVariableTarget.Process);

                var contextFactory = new TVMazeContextFactory(connectionString);
                var dataStorage    = new DataStorage(contextFactory);

                var scraper = new Application.Scraper(client, dataStorage);

                await scraper.RunAsync();
            }
        }
示例#3
0
 public GetSeriesCastHandler(IOptions <ApiKeys> apiKeys, IOptions <ServicePath> servicePath, TVMazeClient tvMazeClient)
 {
     _apiKeys      = apiKeys.Value;
     _servicePath  = servicePath.Value;
     _tvMazeClient = tvMazeClient;
 }
 public TVMazeClientIntegrationTests()
 {
     _tVMazeClient = new TVMazeClient(HttpClient);
 }
示例#5
0
 public GetActorWithCreditsHandler(IOptions <ApiKeys> apiKeys, IOptions <ServicePath> servicePath, TVMazeClient tvMazeClient)
 {
     _tvMazeClient = tvMazeClient;
 }
示例#6
0
 public GetActorHandler(TVMazeClient tvMazeClient)
 {
     _tvMazeClient = tvMazeClient;
 }