private void UpdateLocalWatchedStatus(TaskListItem taskDetails) { DBMovieInfo matchingMovie = DBMovieInfo.GetByFitId(taskDetails.MovieId); if (matchingMovie == null) return; currentlySyncingMovies.Add(matchingMovie); logger.Info("Importing watched status from follw.it for '{0}'. Watched: {1}", matchingMovie.Title, taskDetails.Watched); if (((bool)taskDetails.Watched) && matchingMovie.ActiveUserSettings.WatchedCount == 0) { matchingMovie.ActiveUserSettings.WatchedCount = 1; matchingMovie.Commit(); } if (!((bool)taskDetails.Watched) && matchingMovie.ActiveUserSettings.WatchedCount > 0) { matchingMovie.ActiveUserSettings.WatchedCount = 0; matchingMovie.Commit(); } matchingMovie.Commit(); currentlySyncingMovies.Remove(matchingMovie); }
private void UpdateLocalMovieId(TaskListItem taskDetails) { DBMovieInfo matchingMovie = DBMovieInfo.GetByFitId(taskDetails.MovieId); if (matchingMovie == null) return; logger.Debug("The follw.it ID for {0} has changed from {1} to {2}.", matchingMovie.Title, taskDetails.MovieId, taskDetails.NewMovieId); matchingMovie.FitId = taskDetails.NewMovieId; matchingMovie.Commit(); }
private void UpdateLocalRating(TaskListItem taskDetails) { DBMovieInfo matchingMovie = DBMovieInfo.GetByFitId(taskDetails.MovieId); if (matchingMovie == null) return; currentlySyncingMovies.Add(matchingMovie); logger.Info("Importing rating of {0} for '{1}' from follw.it.", taskDetails.Rating, matchingMovie.Title); matchingMovie.ActiveUserSettings.UserRating = taskDetails.Rating; matchingMovie.Commit(); currentlySyncingMovies.Remove(matchingMovie); }
public List<TaskListItem> GetUserTaskList(DateTime? startDate, out DateTime serverTime) { List<TaskListItem> result = new List<TaskListItem>(); serverTime = DateTime.MinValue; var tasks = Proxy.GetUserTaskList(startDate); foreach (XmlRpcStruct task in tasks) { TaskListItem tli = new TaskListItem(); switch (task["ItemType"].ToString()) { case "server_time": DateTime.TryParse(task["ServerTime"].ToString(), out serverTime); break; case "cover_request": tli.Task = TaskItemType.CoverRequest; tli.MovieId = (int)task["MovieId"]; result.Add(tli); break; case "new_rating": tli.Task = TaskItemType.NewRating; tli.MovieId = (int)task["MovieId"]; tli.Rating = (int)task["Rating"]; result.Add(tli); break; case "new_watched_status": tli.Task = TaskItemType.NewWatchedStatus; tli.MovieId = (int)task["MovieId"]; tli.Watched = ((string)task["Watched"]) == "1"; result.Add(tli); break; case "updated_movie_id": tli.Task = TaskItemType.UpdatedMovieId; tli.MovieId = (int)task["MovieId"]; tli.NewMovieId = (int)task["NewMovieId"]; result.Add(tli); break; case "new_series_rating": tli.Task = TaskItemType.NewSeriesRating; tli.SeriesId = (int)task["SeriesId"]; tli.TvdbSeriesId = (int)task["TvdbSeriesId"]; tli.Rating = (int)task["Rating"]; result.Add(tli); break; case "new_episode_rating": tli.Task = TaskItemType.NewEpisodeRating; tli.EpisodeId = (int)task["EpisodeId"]; tli.Rating = (int)task["Rating"]; result.Add(tli); break; case "new_episode_watched_status": tli.Task = TaskItemType.NewEpisodeWatchedStatus; tli.EpisodeId = (int)task["EpisodeId"]; tli.Watched = ((string)task["Watched"]) == "1"; result.Add(tli); break; default: break; } } return result; }