private void RefreshTvShowLibrary() { Logger.Instance().Log("Yatse2", "Start Refresh : TvShows"); var res = _remote.VideoLibrary.GetTvShows(); Logger.Instance().Log("Yatse2", "Remote TvShows : " + res.Count); var oldData = _database.GetTvShowFavorites(_remoteInfo.Id); _database.SetBulkInsert(true); _database.BeginTransaction(); _database.DeleteRemoteTvShows(_remoteInfo.Id); foreach (var apiTvShow in res) { long oldFavorite = 0; foreach (var show in oldData) { if (show.IdShow == apiTvShow.IdShow) { oldFavorite = show.IsFavorite; } } var tvShow = new Yatse2TvShow(apiTvShow) { IdRemote = _remoteInfo.Id, IsFavorite = oldFavorite }; _database.InsertTvShow(tvShow); } _database.CommitTransaction(); _database.SetBulkInsert(false); Logger.Instance().Log("Yatse2", "End Refresh : TvShows"); }
private void QuickRefreshTvShowLibrary() { Logger.Instance().Log("FrontView+", "Start Quick Refresh : TvShows"); var res = _remote.VideoLibrary.GetTvShowsRefresh(); Logger.Instance().Log("FrontView+", "Remote Quick Refresh TvShows : " + res.Count); var oldData = _database.GetTvShow(_remoteInfo.Id); _database.SetBulkInsert(true); _database.BeginTransaction(); // _database.DeleteRemoteTvShows(_remoteInfo.Id); var notfound = true; /** * foreach (var apiTvShow in res) * { * Logger.Instance().Log("FrontView+", "res Data:" + apiTvShow.Title); * } * * foreach (var show in oldData) * { * Logger.Instance().Log("FrontView+", "oldData Data:" + show.Title); * } */ foreach (var apiTvShow in res) { notfound = true; foreach (var show in oldData) { // Logger.Instance().Log("FrontView+", "In Loop: oldData ShowName :" + show.Title); if (show.IdShow == apiTvShow.IdShow) { notfound = false; Logger.Instance().Log("FrontView+", "Quick Shows Check Id - Show Exists:" + show.Title + " - show.Idshow ID:" + show.IdShow + " apiTVShow.IdShow:" + apiTvShow.IdShow); break; } } if (notfound == true) { Logger.Instance().Log("FrontView+", "Inserting TV Show :Show Name:" + apiTvShow.Title + ":ShowID:" + apiTvShow.IdShow); var tvShow = new Yatse2TvShow(apiTvShow) { IdRemote = _remoteInfo.Id }; _database.InsertTvShow(tvShow); } } _database.CommitTransaction(); _database.SetBulkInsert(false); Logger.Instance().Log("FrontView+", "End Quick Refresh : TvShows"); }