protected override void InternalRunWorker(object arg) { var movieEntry = (MovieEntryFacade)arg; _log.Info("Processing: " + movieEntry.Title); try { var url = _tmdb.GetPosterUrl(movieEntry.InternalMovieData.PosterPath, PosterSize.original); var destFolder = new PowerPath(movieEntry.FullPath).GetDirectoryPath(); var destFile = Path.Combine(destFolder, FileName); var isExist = File.Exists(destFile); if (isExist && OverwritePoster) { File.Delete(destFile); } if (!isExist || OverwritePoster) { _wc.DownloadFile(url, destFile); } _log.Info("Processed: " + movieEntry.Title); IncrementWorkDone(); OnProgressChanged(this, new ProgressChangedEventArgs(GetPercentage(), null)); } catch (Exception e) { _log.Error(e, "Error processing: " + movieEntry.Title); } }
public string GetPosterUri(TmdbResult result, string dir, string filename) { var posterPath = Path.Combine(dir, filename); if (!File.Exists(posterPath)) { _log.Debug("Using remote poster."); posterPath = _tmdb.GetPosterUrl(result.PosterPath, PosterSize.w154); } else { _log.Debug("Using local poster file."); } return(posterPath); }