private void RefreshTvSeasonLibrary() { Logger.Instance().Log("Yatse2", "Start Refresh : TvSeasons"); var res = _remote.VideoLibrary.GetTvSeasons(); Logger.Instance().Log("Yatse2", "Remote TvSeasons : " + res.Count); var oldData = _database.GetTvSeasonFavorites(_remoteInfo.Id); _database.SetBulkInsert(true); _database.BeginTransaction(); _database.DeleteRemoteTvSeasons(_remoteInfo.Id); foreach (var apiTvSeason in res) { long oldFavorite = 0; foreach (var show in oldData) { if (show.IdShow == apiTvSeason.IdShow) { oldFavorite = show.IsFavorite; } } var tvSeason = new Yatse2TvSeason(apiTvSeason) { IdRemote = _remoteInfo.Id, IsFavorite = oldFavorite }; _database.InsertTvSeason(tvSeason); } _database.CommitTransaction(); _database.SetBulkInsert(false); Logger.Instance().Log("Yatse2", "End Refresh : TvSeasons"); }
private void RefreshTvSeasonLibrary() { Logger.Instance().Log("FrontView+", "Start Refresh : TvSeasons"); var res = _remote.VideoLibrary.GetTvSeasons(); Logger.Instance().Log("FrontView+", "Remote TvSeasons : " + res.Count); //Below should be empty as everything deleted before running so what is the point/at least initialises _database.SetBulkInsert(true); _database.BeginTransaction(); _database.DeleteRemoteTvSeasons(_remoteInfo.Id); var oldData = _database.GetTvSeason(_remoteInfo.Id); var notfound = true; foreach (var apiTvSeason in res) { notfound = true; // long oldFavorite = 0; foreach (var show in oldData) { if (show.IdShow == apiTvSeason.IdShow && apiTvSeason.SeasonNumber == show.SeasonNumber) { notfound = false; //Logger.Instance().LogDump("FrontView+", "Refresh: TV Seasons : Season Already Exists: Seasons Id Show.Name: " + show.Show + " show.Idshow ID:" + show.IdShow + " apiTvEpisode.Id:" + apiTvSeason.IdShow + " SeasonNumber:" + apiTvSeason.SeasonNumber + " show.SeasonNumber:" + show.SeasonNumber); } } if (notfound == true) { Logger.Instance().LogDump("FrontView+", "Refresh: TV Seasons :Inserting TV Season :Show Name:" + apiTvSeason.Show + ": ShowID:" + apiTvSeason.IdShow + " Season Number:" + apiTvSeason.SeasonNumber + " Episode Count:" + apiTvSeason.EpisodeCount + " Hash " + apiTvSeason.Hash); var tvSeason = new Yatse2TvSeason(apiTvSeason) { IdRemote = _remoteInfo.Id }; _database.InsertTvSeason(tvSeason); oldData = _database.GetTvSeason(_remoteInfo.Id); } } _database.CommitTransaction(); _database.SetBulkInsert(false); Logger.Instance().Log("FrontView+", "End Refresh : TvSeasons"); }
private void QuickRefreshTvSeasonLibrary() { Logger.Instance().Log("FrontView+", "Start Quick Refresh : TvSeasons"); var res = _remote.VideoLibrary.GetTvSeasonsRefresh(); Logger.Instance().Log("FrontView+", "Remote Quick Refresh TvSeasons : " + res.Count); var oldData = _database.GetTvSeason(_remoteInfo.Id); _database.SetBulkInsert(true); _database.BeginTransaction(); //_database.DeleteRemoteTvSeasons(_remoteInfo.Id); var notfound = true; foreach (var apiTvSeason in res) { notfound = true; foreach (var show in oldData) { if (show.IdShow == apiTvSeason.IdShow && apiTvSeason.SeasonNumber == show.SeasonNumber) { notfound = false; Logger.Instance().Log("FrontView+", "Season Already Exisits: Seasons Id Show.Name: " + show.Show + " show.Idshow ID:" + show.IdShow + " apiTvEpisode.Id:" + apiTvSeason.IdShow + " SeasonNumber:" + apiTvSeason.SeasonNumber + " show.SeasonNumber:" + show.SeasonNumber); } } if (notfound == true) { Logger.Instance().Log("FrontView+", "Inserting TV Season :Show Name:" + apiTvSeason.Show + ": ShowID:" + apiTvSeason.IdShow + " Season Number:" + apiTvSeason.SeasonNumber + " Episode Count:" + apiTvSeason.EpisodeCount + " Hash " + apiTvSeason.Hash); var tvSeason = new Yatse2TvSeason(apiTvSeason) { IdRemote = _remoteInfo.Id }; _database.InsertTvSeason(tvSeason); oldData = _database.GetTvSeason(_remoteInfo.Id); } } _database.CommitTransaction(); _database.SetBulkInsert(false); Logger.Instance().Log("FrontView+", "End Quick Refresh : TvSeasons"); }