예제 #1
0
        // Dependency injection uses this constructor to instantiate MainDialog
        public MainDialog(MovieRecognizer luisRecognizer,
                          SearchDialog searchDialog,
                          RecommendationDialog recommendationDialog,
                          VideoDialog videoDialog,
                          ILogger <MainDialog> logger,
                          TMDBService tmdbService,
                          TransciptionService transciptionService)
            : base(nameof(MainDialog))
        {
            _luisRecognizer       = luisRecognizer;
            _tmdbService          = tmdbService;
            _transcriptionService = transciptionService;
            Logger = logger;

            AddDialog(searchDialog);
            AddDialog(recommendationDialog);
            AddDialog(videoDialog);
            AddDialog(new TextPrompt(nameof(TextPrompt)));
            AddDialog(new WaterfallDialog(nameof(WaterfallDialog), new WaterfallStep[]
            {
                IntroStepAsync,
                ActStepAsync,
                FinalStepAsync,
            }));

            AddDialog(new TextPrompt("AskForText"));

            InitialDialogId = nameof(WaterfallDialog);
        }
예제 #2
0
        async Task LoadInfo()
        {
            Show = await Task.Run(() => TMDBService.GetShow(Id));

            Season = await Task.Run(() => TMDBService.GetSeason(Id, SeasonNumber));

            foreach (var v in Season.credits.cast.OrderBy(x => x.order).ToList().ImagesFirst())
            {
                Cast.Add(v);
            }
            foreach (var v in Season.credits.crew.ImagesFirst())
            {
                if (!Crew.Any(x => x.id == v.id))
                {
                    Crew.Add(v);
                }
                else
                {
                    Crew.Single(x => x.id == v.id).job += $", {v.job}";
                }
            }
            foreach (var v in Season.episodes)
            {
                if (v.still_path != null)
                {
                    Backdrops.Add(new Image()
                    {
                        file_path = v.still_path
                    });
                }
            }
            Console.WriteLine();
        }
        private async Task Search()
        {
            _service = TMDBService.Instance;
            await _service.SearchForMovie(Title);

            Films = _service.Films;
        }
예제 #4
0
        public async Task LoadData()
        {
            LoadedPages++;
            var results = await Task.Run(() => TMDBService.Search(Query["query"], LoadedPages, 1));

            foreach (var v in results.OnlyWithImages())
            {
                Results.Add(v);
                if (v.media_type.Equals("movie"))
                {
                    Movies.Add(v);
                }
                if (v.media_type.Equals("tv"))
                {
                    Shows.Add(v);
                }
                if (v.media_type.Equals("person"))
                {
                    People.Add(v);
                }
            }

            if (results.Count != 0)
            {
                LoadedMore();
            }
            else
            {
                NoMore();
            }
        }
        private async Task Search()
        {
            TMDBService service = TMDBService.Instance;
            await service.SearchForPerson(Name);

            Persons = service.Persons;
        }
예제 #6
0
        async Task LoadInfo()
        {
            Show = await Task.Run(() => TMDBService.GetShow(Id));

            foreach (var v in Show.credits.cast.OrderBy(x => x.order).ToList().ImagesFirst())
            {
                Cast.Add(v);
            }
            foreach (var v in Show.credits.crew.ImagesFirst())
            {
                if (!Crew.Any(x => x.id == v.id))
                {
                    Crew.Add(v);
                }
                else
                {
                    Crew.Single(x => x.id == v.id).job += $", {v.job}";
                }
            }
            foreach (var v in Show.seasons)
            {
                if (v.season_number == 0)
                {
                    Show.seasons.Add(v);
                    Show.seasons.Remove(v);
                    break;
                }
            }
        }
예제 #7
0
        async Task LoadSimilar()
        {
            var similar = await Task.Run(() => TMDBService.GetMovieList($"/movie/{Id}/similar", new Dictionary <string, string>()));

            foreach (var v in similar.ImagesFirst())
            {
                Similar.Add(v);
            }
        }
예제 #8
0
        async Task LoadInfo()
        {
            Collection = await Task.Run(() => TMDBService.GetCollection(Id));

            foreach (var v in Collection.parts.OrderBy(x => x.release_date).ToList())
            {
                Parts.Add(v);
            }
        }
예제 #9
0
        async Task LoadImages()
        {
            Images = await Task.Run(() => TMDBService.GetImages($"/collection/{Id}/images"));

            foreach (var v in Images.backdrops)
            {
                Backdrops.Add(v);
            }
        }
예제 #10
0
        async Task LoadImages()
        {
            var images = await Task.Run(() => TMDBService.GetImages($"/person/{Id}/tagged_images"));

            foreach (var v in images.results)
            {
                Images.Add(v);
            }
        }
예제 #11
0
        async Task LoadPersonList(ObservableCollection <Person> List, string Path, Dictionary <string, string> Query)
        {
            var results = await Task.Run(() => TMDBService.GetPersonList(Path, Query, 1, 1));

            foreach (var v in results)
            {
                List.Add(v);
            }
        }
예제 #12
0
        async Task LoadRecommendations()
        {
            var recommendations = await Task.Run(() => TMDBService.GetMovieList($"/movie/{Id}/recommendations", new Dictionary <string, string>()));

            foreach (var v in recommendations.ImagesFirst())
            {
                Recommendations.Add(v);
            }
        }
예제 #13
0
        public App()
        {
            InitializeComponent();

            TMDBService.Init();
            JackettService.Init();

            // Deferred execution until used. Check https://msdn.microsoft.com/library/dd642331(v=vs.110).aspx for further info on Lazy<T> class.
            _activationService = new Lazy <ActivationService>(CreateActivationService);
        }
예제 #14
0
        public List <Movie> Discover0()
        {
            TMDBService serv = new TMDBService(new DebugConfigurationService());

            var res = serv.Discover().GetAwaiter().GetResult();

            Log("Got data from source");

            return(res.Data.Results);
        }
예제 #15
0
        public VideoDialog(TMDBService service) : base(nameof(VideoDialog))
        {
            _tmdbService = service;
            AddDialog(new TextPrompt(nameof(TextPrompt)));
            AddDialog(new WaterfallDialog(nameof(WaterfallDialog), new WaterfallStep[]
            {
                InitialStepAsync,
                FinalStepAsync,
            }));

            InitialDialogId = nameof(WaterfallDialog);
        }
예제 #16
0
        async Task LoadVideos()
        {
            var videos = await Task.Run(() => TMDBService.GetVideos($"/tv/{Id}/season/{SeasonNumber}"));

            foreach (var v in videos)
            {
                if (v.site.Equals("YouTube"))
                {
                    Videos.Add(v);
                }
            }
        }
예제 #17
0
        async Task LoadVideos()
        {
            var videos = await Task.Run(() => TMDBService.GetVideos($"/movie/{Id}"));

            foreach (var v in videos)
            {
                if (v.site.Equals("YouTube"))
                {
                    Videos.Add(v);
                }
            }
        }
예제 #18
0
        public SearchDialog(TMDBService service) : base(nameof(SearchDialog))
        {
            _tmdbService = service;
            AddDialog(new TextPrompt(nameof(TextPrompt)));
            AddDialog(new ChoicePrompt("Prompt", AdaptiveCardVerifier));
            AddDialog(new WaterfallDialog(nameof(WaterfallDialog), new WaterfallStep[]
            {
                InitialStepAsync,
                FinalStepAsync,
            }));

            InitialDialogId = nameof(WaterfallDialog);
        }
예제 #19
0
        public async Task LoadData()
        {
            LoadedPages++;
            var results = await Task.Run(() => TMDBService.GetShowList(Path, Query, LoadedPages, 1));

            if (results.Count != 0)
            {
                LoadedMore();
            }
            foreach (var v in results)
            {
                Shows.Add(v);
            }
        }
예제 #20
0
        public async Task LoadSearchResultNames(string query)
        {
            var searchresultnames = await Task.Run(() => TMDBService.Search(query));

            SearchResultNames.Clear();

            if (searched)
            {
                return;
            }
            foreach (var v in searchresultnames)
            {
                SearchResultNames.Add(v);
            }
        }
        protected async override void OnNavigatedTo(NavigationEventArgs e)
        {
            base.OnNavigatedTo(e);

            this.SpinAndWait(true);

            TMDBService tmdb = new TMDBService();

            if (App.TMDBConfig == null)
            {
                App.TMDBConfig = await tmdb.GetConfig();
            }

            Person p = await tmdb.GetPersonDetails(castinfo.ID);

            this.LoadPersonDetails(p);

            this.SpinAndWait(false);
        }
예제 #22
0
        async Task LoadInfo()
        {
            Person = await Task.Run(() => TMDBService.GetPerson(Id));

            var movies = Person.movie_credits.cast;

            movies.AddRange(Person.movie_credits.crew);

            var shows = Person.tv_credits.cast;

            shows.AddRange(Person.tv_credits.crew);

            var distinctMovies = movies.GroupBy(x => x.title).Select(y => y.First()).ToList();
            var distinctShows  = shows.GroupBy(x => x.name).Select(y => y.First()).ToList();

            var sortedMovies = distinctMovies.OrderByDescending(v => v.popularity).ToList();
            var sortedShows  = distinctShows.OrderByDescending(v => v.popularity).ToList();

            sortedMovies.ImagesFirst().ForEach(v => Movies.Add(v));
            sortedShows.ImagesFirst().ForEach(v => Shows.Add(v));

            foreach (var v in Person.images.profiles)
            {
                if (v.file_path.Equals(Person.profile_path))
                {
                    Profiles.Add(v);
                    break;
                }
            }
            foreach (var v in Person.images.profiles)
            {
                if (!v.file_path.Equals(Person.profile_path))
                {
                    Profiles.Add(v);
                }
            }
        }
예제 #23
0
        async Task LoadInfo()
        {
            Movie = await Task.Run(() => TMDBService.GetMovie(Id));

            foreach (var v in Movie.credits.cast.OrderBy(x => x.order).ToList().ImagesFirst())
            {
                Cast.Add(v);
            }
            foreach (var v in Movie.credits.crew.ImagesFirst())
            {
                if (!Crew.Any(x => x.id == v.id))
                {
                    Crew.Add(v);
                }
                else
                {
                    Crew.Single(x => x.id == v.id).job += $", {v.job}";
                }
                if (v.job.Equals("Director"))
                {
                    Directors.Add(v);
                }
            }
        }
예제 #24
0
        async Task LoadLanguages()
        {
            var languages = await Task.Run(() => TMDBService.GetLanguages());

            languages.ForEach(x => Languages.Add(x));
        }
예제 #25
0
        async Task LoadCountries()
        {
            var countries = await Task.Run(() => TMDBService.GetCountries());

            countries.ForEach(x => Countries.Add(x));
        }
예제 #26
0
        public async override void ViewDidLoad()
        {
            base.ViewDidLoad();

            this.PersonDetailsSegment.Enabled = false;

            this.BusyIndicator.StartAnimating();

            this.NavigationItem.Title = this.Cast.Name;

            Person person = null;

            try
            {
                TMDBService tmdbService = new TMDBService();

                if (Application.TMDBConfig == null)
                {
                    Application.TMDBConfig = await tmdbService.GetConfig();
                }

                person = await tmdbService.GetPersonDetails(this.Cast.ID);
            }
            catch
            {
                UIAlertView alert = new UIAlertView("Cineworld", "Error downloading data. Please try again later", null, "OK", null);
                alert.Show();

                return;
            }
            finally
            {
                this.BioView.Hidden = false;
                this.BusyIndicator.StopAnimating();
            }

            var height = 0;

            string url   = Cast.ProfilePicture == null ? null : Cast.ProfilePicture.OriginalString;
            var    image = ImageManager.Instance.GetImage(url);

            if (image == null)
            {
                image = UIImage.FromFile("Images/PlaceHolder.png");
            }

            this.Poster.Image = image;
            this.Poster.Image = image;
            this.Poster.Layer.CornerRadius       = 10f;
            this.Poster.Layer.MasksToBounds      = true;
            this.Poster.Layer.RasterizationScale = UIScreen.MainScreen.Scale;
            this.Poster.Layer.Opaque             = true;

            DateTime dtBirthDay;

            if (DateTime.TryParseExact(person.Birthday, "yyyy-MM-dd", CultureInfo.InvariantCulture, DateTimeStyles.None, out dtBirthDay))
            {
                UILabel birthday = new UILabel(new CGRect(0, height, 166, 20));
                birthday.Font = UIFont.FromName("HelveticaNeue", 12f);
                birthday.Text = String.Format("Born: {0}", dtBirthDay.ToString("dd MMM yyyy"));

                this.MiscView.AddSubview(birthday);
                height += 30;
            }

            if (!String.IsNullOrWhiteSpace(person.PlaceOfBirth))
            {
                UILabel birthplace = new UILabel(new CGRect(0, height, 166, 20));
                birthplace.Font = UIFont.FromName("HelveticaNeue", 12f);
                birthplace.Text = person.PlaceOfBirth;

                this.MiscView.AddSubview(birthplace);
                height += 30;
            }

            DateTime dtDeathDay;

            if (DateTime.TryParseExact(person.Deathday, "yyyy-MM-dd", CultureInfo.InvariantCulture, DateTimeStyles.None, out dtDeathDay))
            {
                UILabel deathDay = new UILabel(new CGRect(0, height, 166, 20));
                deathDay.Font = UIFont.FromName("HelveticaNeue", 12f);
                deathDay.Text = String.Format("Died: {0}", dtBirthDay.ToString("dd MMM yyyy"));

                this.MiscView.AddSubview(deathDay);
                height += 30;
            }

            if (!String.IsNullOrWhiteSpace(person.Biography))
            {
                UILabel biography = new UILabel(new CGRect(15, 0, 290, 1));
                biography.Font  = UIFont.FromName("HelveticaNeue", 12f);
                biography.Lines = 0;
                biography.Text  = person.Biography;
                biography.SizeToFit();

                UIScrollView scrollviewer = new UIScrollView(new CGRect(0, 183, 320, 207));
                scrollviewer.ContentSize = biography.Bounds.Size;
                scrollviewer.AddSubview(biography);

                this.BioView.AddSubview(scrollviewer);
            }

            if (person.Credits != null && person.Credits.Cast != null && person.Credits.Cast.Length > 0)
            {
                List <MovieCastInfo> movieRoles = new List <MovieCastInfo>();

                foreach (var movieRole in person.Credits.Cast.OrderByDescending(p => p.ReleaseDate))
                {
                    movieRoles.Add(new MovieCastInfo(Application.TMDBConfig.Images.BaseUrl, "w185", movieRole));
                }

                CastFilmTableSource castFilmSource = new CastFilmTableSource(movieRoles);
                this.FilmsView.Source = castFilmSource;
                this.FilmsView.ReloadData();
            }

            this.PersonDetailsSegment.ValueChanged += (sender, e) =>
            {
                switch (this.PersonDetailsSegment.SelectedSegment)
                {
                case 0:
                    this.BioView.Hidden   = false;
                    this.FilmsView.Hidden = true;
                    break;

                case 1:
                    this.FilmsView.Hidden = false;
                    this.BioView.Hidden   = true;
                    break;
                }
            };

            this.PersonDetailsSegment.Enabled = true;
        }
예제 #27
0
 async Task LoadImages()
 {
     Images = await Task.Run(() => TMDBService.GetImages($"/tv/{Id}/season/{SeasonNumber}/images"));
 }
예제 #28
0
        private void ProcessFilmInfo(Cineworld.Configuration config, Dictionary <int, FilmInfo> currentFilms, Dictionary <int, List <CinemaInfo> > filmCinemas, RegionDef region, bool searchTMDB = true)
        {
            CineworldService cws    = new CineworldService();
            Films            films  = null;
            Task <Films>     tfilms = cws.GetFilms(region, true);

            tfilms.Wait();

            if (!tfilms.IsCanceled && tfilms.Result != null)
            {
                films = tfilms.Result;
            }

            TMDBService tmdb = new TMDBService();

            HashSet <int> newFilmIds = new HashSet <int>();

            CineMobileService mobileService = new CineMobileService();

            //foreach (var film in films.films)
            for (int i = 0; i < films.films.Count; i++)
            {
                //if (i > 0)
                //    break;

                var film = films.films[i];

                newFilmIds.Add(film.edi);

                //if (film.edi != 128529 && film.edi != 139438)
                //    continue;

                Task <Cinemas> tcinemas = cws.GetCinemas(region, false, int.MinValue, film.edi);

                if (!currentFilms.ContainsKey(film.edi) || !currentFilms[film.edi].TMDBDataLoaded)
                {
                    Movie             movieData    = null;
                    Task <FilmImages> tmovieImages = null;

                    FilmInfo filminfo = new FilmInfo()
                    {
                        EDI = film.edi, Classification = !String.IsNullOrWhiteSpace(film.classification) ? film.classification : "TBC", Title = film.ProcessedTitle, TMDBDataLoaded = false
                    };

                    if (movieData == null)
                    {
                        Results res = null;
                        try
                        {
                            DateTime       ukRelease = film.GetReleaseDate();
                            Task <Results> tres      = tmdb.GetSearchResults(film.CleanTitle, ukRelease);
                            tres.Wait();
                            if (!tres.IsFaulted && tres.Result != null)
                            {
                                res = tres.Result;
                            }

                            if (res.SearchResults == null || res.SearchResults.Count == 0 && ukRelease != DateTime.MinValue)
                            {
                                Task <Results> tres2 = tmdb.GetSearchResults(film.CleanTitle, DateTime.MinValue);
                                tres2.Wait();
                                if (!tres2.IsFaulted && tres2.Result != null)
                                {
                                    res = tres2.Result;
                                }
                            }

                            if (res.SearchResults != null && res.SearchResults.Count > 0)
                            {
                                Result movieSearchRes = res.SearchResults.First();

                                Task <Movie> tmovieData = tmdb.GetMovieDetails(movieSearchRes.Id);
                                tmovieData.Wait();

                                tmovieImages = tmdb.GetFilmImages(movieSearchRes.Id);

                                if (!tmovieData.IsFaulted && tmovieData.Result != null)
                                {
                                    movieData = tmovieData.Result;
                                }

                                if (movieData.Trailers != null && movieData.Trailers.Youtube != null && movieData.Trailers.Youtube.Count > 0 && !String.IsNullOrEmpty(movieData.Trailers.Youtube[0].Source))
                                {
                                    if (movieData.Trailers.Youtube[0].Source.IndexOf('=') == -1)
                                    {
                                        string[] trailerparts = movieData.Trailers.Youtube[0].Source.Split('=');
                                        movieData.YouTubeTrailerID = trailerparts[trailerparts.Length - 1];
                                    }
                                    else
                                    {
                                        movieData.YouTubeTrailerID = movieData.Trailers.Youtube[0].Source;
                                    }
                                }
                                else
                                {
                                    Task <string> tyoutube = (new YouTubeService().GetVideoId(film.CleanTitle));
                                    tyoutube.Wait();

                                    if (!tyoutube.IsCanceled && tyoutube.Result != null)
                                    {
                                        movieData.YouTubeTrailerID = tyoutube.Result;
                                    }
                                }

                                if (ukRelease == DateTime.MinValue)
                                {
                                    Country c = movieData.Releases.Countries.FirstOrDefault(country => String.Compare(country.Iso31661, region == RegionDef.GB ? "GB" : "IE", StringComparison.OrdinalIgnoreCase) == 0);
                                    if (c != null)
                                    {
                                        ukRelease = DateTime.ParseExact(c.ReleaseDate, "yyyy-MM-dd", CultureInfo.InvariantCulture);
                                    }
                                    else if (!String.IsNullOrEmpty(movieSearchRes.ReleaseDate))
                                    {
                                        ukRelease = DateTime.ParseExact(movieSearchRes.ReleaseDate, "yyyy-MM-dd", CultureInfo.InvariantCulture);
                                    }
                                }

                                movieData.CineworldReleaseDate = ukRelease;
                            }
                        }
                        catch { }
                    }

                    if (movieData != null)
                    {
                        filminfo.TMDBDataLoaded = true;

                        filminfo.TmdbId   = movieData.Id;
                        filminfo.Overview = movieData.Overview;
                        filminfo.Tagline  = movieData.Tagline;
                        filminfo.Runtime  = movieData.Runtime;
                        filminfo.Genres   = new List <string>();
                        if (movieData.Genres != null)
                        {
                            foreach (var g in movieData.Genres)
                            {
                                filminfo.Genres.Add(g.Name);
                            }
                        }

                        if (tmovieImages != null)
                        {
                            tmovieImages.Wait();

                            if (!tmovieImages.IsFaulted && tmovieImages.Result != null)
                            {
                                if (tmovieImages.Result.Backdrops != null)
                                {
                                    foreach (var backdrop in tmovieImages.Result.Backdrops)
                                    {
                                        string url = string.Format("{0}{1}{2}", config.Images.BaseUrl, ConfigurationManager.AppSettings["mediumposterwidth"], backdrop.FilePath);
                                        filminfo.Backdrops.Add(new Uri(url));
                                    }
                                }

                                if (tmovieImages.Result.Posters != null)
                                {
                                    foreach (var poster in tmovieImages.Result.Posters)
                                    {
                                        string url = string.Format("{0}{1}{2}", config.Images.BaseUrl, ConfigurationManager.AppSettings["mediumposterwidth"], poster.FilePath);
                                        filminfo.Posters.Add(new Uri(url));
                                    }
                                }
                            }
                        }

                        if (!String.IsNullOrEmpty(movieData.PosterPath))
                        {
                            string poster = string.Format("{0}{1}{2}", config.Images.BaseUrl, ConfigurationManager.AppSettings["posterwidth"], movieData.PosterPath);

                            string mediumposter = string.Format("{0}{1}{2}", config.Images.BaseUrl, ConfigurationManager.AppSettings["mediumposterwidth"], movieData.PosterPath);

                            if (!MoviePosters.ContainsKey(filminfo.TmdbId))
                            {
                                MoviePosters.Add(filminfo.TmdbId, mediumposter);
                            }

                            filminfo.PosterUrl       = new Uri(poster);
                            filminfo.MediumPosterUrl = new Uri(mediumposter);
                        }
                        else if (!String.IsNullOrEmpty(film.poster_url))
                        {
                            filminfo.PosterUrl = new Uri(film.poster_url);
                        }

                        if (!String.IsNullOrEmpty(movieData.BackdropPath))
                        {
                            string backdrop = string.Format("{0}{1}{2}", config.Images.BaseUrl, ConfigurationManager.AppSettings["backdropwidth"], movieData.BackdropPath);
                            filminfo.BackdropUrl = new Uri(backdrop);
                        }

                        filminfo.YoutubeTrailer = movieData.YouTubeTrailerID;

                        filminfo.Release = movieData.CineworldReleaseDate;

                        if (movieData.Casts != null && movieData.Casts.Cast != null)
                        {
                            foreach (var cast in movieData.Casts.Cast)
                            {
                                filminfo.FilmCast.Add(new CastInfo()
                                {
                                    ID          = cast.Id,
                                    Name        = cast.Name,
                                    Character   = cast.Character,
                                    ProfilePath = (!String.IsNullOrEmpty(cast.ProfilePath) ? new Uri(string.Format("{0}{1}{2}", config.Images.BaseUrl, ConfigurationManager.AppSettings["posterwidth"], cast.ProfilePath)) : null)
                                });
                            }
                        }
                    }
                    else
                    {
                        if (!String.IsNullOrEmpty(film.poster_url))
                        {
                            filminfo.PosterUrl = new Uri(film.poster_url);
                        }
                    }

                    Task <List <FilmReview> > tReviews = mobileService.GetFilmReviews(filminfo);

                    tReviews.Wait();

                    if (!tReviews.IsFaulted && tReviews.Result != null)
                    {
                        filminfo.Reviews = tReviews.Result;
                    }

                    currentFilms[filminfo.EDI] = filminfo;
                }

                tcinemas.Wait();

                if (!tcinemas.IsFaulted && tcinemas.Result != null)
                {
                    List <CinemaInfo> fCinemas = new List <CinemaInfo>();
                    foreach (var cinema in tcinemas.Result.cinemas)
                    {
                        fCinemas.Add(new CinemaInfo()
                        {
                            ID = cinema.id, Name = cinema.name
                        });
                    }

                    filmCinemas[film.edi] = fCinemas;
                }
            }

            HashSet <int> currentFilmIds = new HashSet <int>(currentFilms.Keys);

            currentFilmIds.ExceptWith(newFilmIds);

            foreach (var id in currentFilmIds)
            {
                currentFilms.Remove(id);
            }
        }
예제 #29
0
        public override void Run()
        {
            // This is a sample worker implementation. Replace with your logic.
            Trace.WriteLine("CineDataWorkerRole entry point called", "Information");

            TMDBService tmdb = new TMDBService();

            dtNextFullRun = DateTime.MinValue;
            DateTime dtLastRun = DateTime.MinValue; //GetLastModified();

            if (dtLastRun.Date < DateTime.UtcNow.Date)
            {
                dtNextFullRun = DateTime.UtcNow;
            }
            else
            {
                dtNextFullRun = DateTime.UtcNow.Date.AddHours(26);
            }

            int tenMinSleepDuration = (int)TimeSpan.FromMinutes(10).TotalMilliseconds;

            LoadLocationData();

            while (true)
            {
                Trace.WriteLine("Working", "Information");

                if (DateTime.UtcNow >= dtNextFullRun)
                {
                    // execute a full run

                    dtNextFullRun = DateTime.UtcNow.Date.AddHours(26);

                    Cineworld.Configuration        conf  = null;
                    Task <Cineworld.Configuration> tConf = tmdb.GetConfig();
                    tConf.Wait();

                    if (!tConf.IsFaulted && tConf.Result != null)
                    {
                        conf = tConf.Result;
                    }
                    else
                    {
                        continue;
                    }

                    dictionaryCinemaFilms.Clear();

                    FilmsUK.Clear();
                    FilmsIE.Clear();

                    CinemasUK.Clear();
                    CinemasIE.Clear();

                    cinemaFilmsUK.Clear();
                    filmCinemasUK.Clear();

                    cinemaFilmsIE.Clear();
                    filmCinemasIE.Clear();

                    bool          processedUKFilms     = false;
                    bool          processedUKCinemas   = false;
                    bool          processedIEFilms     = false;
                    bool          processedIECinemas   = false;
                    bool          cinemafilmSaved      = false;
                    HashSet <int> ukCinemaPerformances = new HashSet <int>();
                    HashSet <int> ieCinemaPerformances = new HashSet <int>();

                    while (true)
                    {
                        try
                        {
                            if (!processedUKFilms)
                            {
                                ProcessFilmInfo(conf, FilmsUK, filmCinemasUK, RegionDef.GB);
                                processedUKFilms = true;
                            }

                            if (!processedUKCinemas)
                            {
                                ProcessCinemaInfo(CinemasUK, cinemaFilmsUK, FilmsUK, RegionDef.GB);
                                processedUKCinemas = true;
                            }

                            if (!processedIEFilms)
                            {
                                ProcessFilmInfo(conf, FilmsIE, filmCinemasIE, RegionDef.IE, true);
                                processedIEFilms = true;
                            }

                            if (!processedIECinemas)
                            {
                                ProcessCinemaInfo(CinemasIE, cinemaFilmsIE, FilmsIE, RegionDef.IE);
                                processedIECinemas = true;
                            }

                            if (!cinemafilmSaved)
                            {
                                ProcessData();
                                cinemafilmSaved = true;
                            }

                            ProcessPerformances(ukCinemaPerformances, ieCinemaPerformances);

                            break;
                        }
                        catch (Exception ex)
                        {
                            LogError(ex, null);
                            Thread.Sleep(tenMinSleepDuration);
                        }
                    }
                }

#if DEBUG
                return;
#else
                Thread.Sleep(tenMinSleepDuration);
#endif
            }
        }