本文整理汇总了C#中JMMServer.Repositories.AnimeSeriesRepository类的典型用法代码示例。如果您正苦于以下问题:C# AnimeSeriesRepository类的具体用法?C# AnimeSeriesRepository怎么用?C# AnimeSeriesRepository使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
AnimeSeriesRepository类属于JMMServer.Repositories命名空间,在下文中一共展示了AnimeSeriesRepository类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: GetPosterFilenames
private List<string> GetPosterFilenames(ISession session)
{
List<string> allPosters = new List<string>();
// check if user has specied a fanart to always be used
if (DefaultAnimeSeriesID.HasValue)
{
AnimeSeriesRepository repSeries = new AnimeSeriesRepository();
AnimeSeries defaultSeries = repSeries.GetByID(session, DefaultAnimeSeriesID.Value);
if (defaultSeries != null)
{
AniDB_Anime anime = defaultSeries.GetAnime(session);
string defPosterPathNoBlanks = anime.GetDefaultPosterPathNoBlanks(session);
if (!string.IsNullOrEmpty(defPosterPathNoBlanks) && File.Exists(defPosterPathNoBlanks))
{
allPosters.Add(defPosterPathNoBlanks);
return allPosters;
}
}
}
foreach (AnimeSeries ser in GetAllSeries(session))
{
AniDB_Anime anime = ser.GetAnime(session);
string defPosterPathNoBlanks = anime.GetDefaultPosterPathNoBlanks(session);
if (!string.IsNullOrEmpty(defPosterPathNoBlanks) && File.Exists(defPosterPathNoBlanks))
allPosters.Add(defPosterPathNoBlanks);
}
return allPosters;
}
示例2: ProcessCommand
public override void ProcessCommand()
{
AnimeSeriesRepository repSeries = new AnimeSeriesRepository();
AnimeSeries ser = repSeries.GetByAnimeID(AnimeID);
if (ser!=null)
ser.UpdateStats(true, true, true);
}
示例3: ProcessCommand
public override void ProcessCommand()
{
logger.Info("Processing CommandRequest_MALUpdatedWatchedStatus: {0}", AnimeID);
try
{
// find the latest eps to update
AniDB_AnimeRepository repAnime = new AniDB_AnimeRepository();
AniDB_Anime anime = repAnime.GetByAnimeID(AnimeID);
if (anime == null) return;
List<CrossRef_AniDB_MAL> crossRefs = anime.GetCrossRefMAL();
if (crossRefs == null || crossRefs.Count == 0)
return;
AnimeSeriesRepository repSeries = new AnimeSeriesRepository();
AnimeSeries ser = repSeries.GetByAnimeID(AnimeID);
if (ser == null) return;
MALHelper.UpdateMALSeries(ser);
}
catch (Exception ex)
{
logger.Error("Error processing CommandRequest_MALUpdatedWatchedStatus: {0} - {1}", AnimeID, ex.ToString());
return;
}
}
示例4: ProcessCommand
public override void ProcessCommand()
{
logger.Info("Get AniDB episode info: {0}", EpisodeID);
try
{
// we don't use this command to update episode info
// we actually use it to update the cross ref info instead
// and we only use it for the "Other Episodes" section of the FILE command
// because that field doesn't tell you what anime it belongs to
CrossRef_File_EpisodeRepository repCrossRefs = new CrossRef_File_EpisodeRepository();
List<CrossRef_File_Episode> xrefs = repCrossRefs.GetByEpisodeID(EpisodeID);
if (xrefs.Count == 0) return;
Raw_AniDB_Episode epInfo = JMMService.AnidbProcessor.GetEpisodeInfo(EpisodeID);
if (epInfo != null)
{
AnimeSeriesRepository repSeries = new AnimeSeriesRepository();
foreach (CrossRef_File_Episode xref in xrefs)
{
int oldAnimeID = xref.AnimeID;
xref.AnimeID = epInfo.AnimeID;
repCrossRefs.Save(xref);
AnimeSeries ser = repSeries.GetByAnimeID(oldAnimeID);
if (ser != null)
ser.UpdateStats(true, true, true);
StatsCache.Instance.UpdateUsingAnime(oldAnimeID);
ser = repSeries.GetByAnimeID(epInfo.AnimeID);
if (ser != null)
ser.UpdateStats(true, true, true);
StatsCache.Instance.UpdateUsingAnime(epInfo.AnimeID);
}
}
}
catch (Exception ex)
{
logger.Error("Error processing CommandRequest_GetEpisode: {0} - {1}", EpisodeID, ex.ToString());
return;
}
}
示例5: ProcessCommand
public override void ProcessCommand()
{
logger.Info("Processing CommandRequest_TraktSyncCollectionSeries");
try
{
AnimeSeriesRepository repSeries = new AnimeSeriesRepository();
AnimeSeries series = repSeries.GetByID(AnimeSeriesID);
if (series == null)
{
logger.Error("Could not find anime series: {0}", AnimeSeriesID);
return;
}
TraktTVHelper.SyncCollectionToTrakt_Series(series);
}
catch (Exception ex)
{
logger.Error("Error processing CommandRequest_TraktSyncCollectionSeries: {0}", ex.ToString());
return;
}
}
示例6: SyncCollectionToTrakt
public static void SyncCollectionToTrakt()
{
try
{
if (!ServerSettings.Trakt_IsEnabled || string.IsNullOrEmpty(ServerSettings.Trakt_AuthToken)) return;
// check that we have at least one user nominated for Trakt
JMMUserRepository repUsers = new JMMUserRepository();
List<JMMUser> traktUsers = repUsers.GetTraktUsers();
if (traktUsers.Count == 0) return;
AnimeSeriesRepository repSeries = new AnimeSeriesRepository();
List<AnimeSeries> allSeries = repSeries.GetAll();
// now get the full users collection from Trakt
List<TraktV2ShowCollectedResult> collected = new List<TraktV2ShowCollectedResult>();
List<TraktV2ShowWatchedResult> watched = new List<TraktV2ShowWatchedResult>();
if (!GetTraktCollectionInfo(ref collected, ref watched)) return;
TraktV2SyncCollectionEpisodesByNumber syncCollectionAdd = new TraktV2SyncCollectionEpisodesByNumber();
TraktV2SyncCollectionEpisodesByNumber syncCollectionRemove = new TraktV2SyncCollectionEpisodesByNumber();
TraktV2SyncWatchedEpisodesByNumber syncHistoryAdd = new TraktV2SyncWatchedEpisodesByNumber();
TraktV2SyncWatchedEpisodesByNumber syncHistoryRemove = new TraktV2SyncWatchedEpisodesByNumber();
#region Local Collection Sync
///////////////////////////////////////////////////////////////////////////////////////
// First take a look at our local collection and update on Trakt
///////////////////////////////////////////////////////////////////////////////////////
AniDB_AnimeRepository repAnime = new AniDB_AnimeRepository();
int counter = 0;
foreach (AnimeSeries series in allSeries)
{
counter++;
logger.Trace("Syncing check - local collection: {0} / {1} - {2}", counter, allSeries.Count, series.GetSeriesName());
AniDB_Anime anime = repAnime.GetByAnimeID(series.AniDB_ID);
if (anime == null) continue;
//if (anime.AnimeID != 3427) continue;
TraktSummaryContainer traktSummary = new TraktSummaryContainer();
traktSummary.Populate(series.AniDB_ID);
if (traktSummary.CrossRefTraktV2 == null || traktSummary.CrossRefTraktV2.Count == 0) continue;
// get the current watched records for this series on Trakt
foreach (AnimeEpisode ep in series.GetAnimeEpisodes())
{
if (ep.EpisodeTypeEnum == enEpisodeType.Episode || ep.EpisodeTypeEnum == enEpisodeType.Special)
{
EpisodeSyncDetails epsync = ReconSyncTraktEpisode(series, ep, traktSummary, traktUsers, collected, watched, false);
if (epsync != null)
{
switch (epsync.SyncType)
{
case TraktSyncType.CollectionAdd:
syncCollectionAdd.AddEpisode(epsync.Slug, epsync.Season, epsync.EpNumber, epsync.EpDate); break;
case TraktSyncType.CollectionRemove:
syncCollectionRemove.AddEpisode(epsync.Slug, epsync.Season, epsync.EpNumber, epsync.EpDate); break;
case TraktSyncType.HistoryAdd:
syncHistoryAdd.AddEpisode(epsync.Slug, epsync.Season, epsync.EpNumber, epsync.EpDate); break;
case TraktSyncType.HistoryRemove:
syncHistoryRemove.AddEpisode(epsync.Slug, epsync.Season, epsync.EpNumber, epsync.EpDate); break;
}
}
}
}
}
#endregion
// refresh online info, just in case it was chnaged by the last operations
if (!GetTraktCollectionInfo(ref collected, ref watched)) return;
#region Online Collection Sync
///////////////////////////////////////////////////////////////////////////////////////
// Now look at the collection according to Trakt, and remove it if we don't have it locally
///////////////////////////////////////////////////////////////////////////////////////
CrossRef_AniDB_TraktV2Repository repCrossRef = new CrossRef_AniDB_TraktV2Repository();
counter = 0;
foreach (TraktV2ShowCollectedResult col in collected)
{
counter++;
logger.Trace("Syncing check - Online collection: {0} / {1} - {2}", counter, collected.Count, col.show.Title);
//continue;
// check if we have this series locally
List<CrossRef_AniDB_TraktV2> xrefs = repCrossRef.GetByTraktID(col.show.ids.slug);
if (xrefs.Count > 0)
{
foreach (CrossRef_AniDB_TraktV2 xref in xrefs)
{
AnimeSeries locSeries = repSeries.GetByAnimeID(xref.AnimeID);
if (locSeries == null) continue;
//.........这里部分代码省略.........
示例7: IncrementalTvDBUpdate
/// <summary>
/// Used to get a list of TvDB Series ID's that require updating
/// </summary>
/// <param name="tvDBIDs">The list Of Series ID's that need to be updated. Pass in an empty list</param>
/// <returns>The current server time before the update started</returns>
public string IncrementalTvDBUpdate(ref List<int> tvDBIDs, ref bool tvDBOnline)
{
// check if we have record of doing an automated update for the TvDB previously
// if we have then we have kept a record of the server time and can do a delta update
// otherwise we need to do a full update and keep a record of the time
List<int> allTvDBIDs = new List<int>();
tvDBIDs = new List<int>();
tvDBOnline = true;
try
{
CrossRef_AniDB_TvDBRepository repCrossRef = new CrossRef_AniDB_TvDBRepository();
AnimeSeriesRepository repSeries = new AnimeSeriesRepository();
// record the tvdb server time when we started
// we record the time now instead of after we finish, to include any possible misses
string currentTvDBServerTime = CurrentServerTime;
if (currentTvDBServerTime.Length == 0)
{
tvDBOnline = false;
return currentTvDBServerTime;
}
foreach (AnimeSeries ser in repSeries.GetAll())
{
List<CrossRef_AniDB_TvDBV2> xrefs = ser.GetCrossRefTvDBV2();
if (xrefs == null) continue;
foreach (CrossRef_AniDB_TvDBV2 xref in xrefs)
{
if (!allTvDBIDs.Contains(xref.TvDBID)) allTvDBIDs.Add(xref.TvDBID);
}
}
// get the time we last did a TvDB update
// if this is the first time it will be null
// update the anidb info ever 24 hours
ScheduledUpdateRepository repSched = new ScheduledUpdateRepository();
ScheduledUpdate sched = repSched.GetByUpdateType((int)ScheduledUpdateType.TvDBInfo);
string lastServerTime = "";
if (sched != null)
{
TimeSpan ts = DateTime.Now - sched.LastUpdate;
logger.Trace("Last tvdb info update was {0} hours ago", ts.TotalHours.ToString());
if (!string.IsNullOrEmpty(sched.UpdateDetails))
lastServerTime = sched.UpdateDetails;
// the UpdateDetails field for this type will actually contain the last server time from
// TheTvDB that a full update was performed
}
// get a list of updates from TvDB since that time
if (lastServerTime.Length > 0)
{
List<int> seriesList = GetUpdatedSeriesList(lastServerTime);
logger.Trace("{0} series have been updated since last download", seriesList.Count.ToString());
logger.Trace("{0} TvDB series locally", allTvDBIDs.Count.ToString());
foreach (int id in seriesList)
{
if (allTvDBIDs.Contains(id)) tvDBIDs.Add(id);
}
logger.Trace("{0} TvDB local series have been updated since last download", tvDBIDs.Count.ToString());
}
else
{
// use the full list
tvDBIDs = allTvDBIDs;
}
return currentTvDBServerTime;
}
catch (Exception ex)
{
logger.ErrorException("IncrementalTvDBUpdate: "+ ex.ToString(), ex);
return "";
}
}
示例8: workerMyAnime2_DoWork
void workerMyAnime2_DoWork(object sender, DoWorkEventArgs e)
{
MA2Progress ma2Progress = new MA2Progress();
ma2Progress.CurrentFile = 0;
ma2Progress.ErrorMessage = "";
ma2Progress.MigratedFiles = 0;
ma2Progress.TotalFiles = 0;
try
{
string databasePath = e.Argument as string;
string connString = string.Format(@"data source={0};useutf16encoding=True", databasePath);
SQLiteConnection myConn = new SQLiteConnection(connString);
myConn.Open();
// get a list of unlinked files
VideoLocalRepository repVids = new VideoLocalRepository();
AniDB_EpisodeRepository repAniEps = new AniDB_EpisodeRepository();
AniDB_AnimeRepository repAniAnime = new AniDB_AnimeRepository();
AnimeSeriesRepository repSeries = new AnimeSeriesRepository();
AnimeEpisodeRepository repEps = new AnimeEpisodeRepository();
List<VideoLocal> vids = repVids.GetVideosWithoutEpisode();
ma2Progress.TotalFiles = vids.Count;
foreach (VideoLocal vid in vids)
{
ma2Progress.CurrentFile = ma2Progress.CurrentFile + 1;
workerMyAnime2.ReportProgress(0, ma2Progress);
// search for this file in the XrossRef table in MA2
string sql = string.Format("SELECT AniDB_EpisodeID from CrossRef_Episode_FileHash WHERE Hash = '{0}' AND FileSize = {1}", vid.ED2KHash, vid.FileSize);
SQLiteCommand sqCommand = new SQLiteCommand(sql);
sqCommand.Connection = myConn;
SQLiteDataReader myReader = sqCommand.ExecuteReader();
while (myReader.Read())
{
int episodeID = 0;
if (!int.TryParse(myReader.GetValue(0).ToString(), out episodeID)) continue;
if (episodeID <= 0) continue;
sql = string.Format("SELECT AnimeID from AniDB_Episode WHERE EpisodeID = {0}", episodeID);
sqCommand = new SQLiteCommand(sql);
sqCommand.Connection = myConn;
SQLiteDataReader myReader2 = sqCommand.ExecuteReader();
while (myReader2.Read())
{
int animeID = myReader2.GetInt32(0);
// so now we have all the needed details we can link the file to the episode
// as long as wehave the details in JMM
AniDB_Anime anime = null;
AniDB_Episode ep = repAniEps.GetByEpisodeID(episodeID);
if (ep == null)
{
logger.Debug("Getting Anime record from AniDB....");
anime = JMMService.AnidbProcessor.GetAnimeInfoHTTP(animeID, true, ServerSettings.AutoGroupSeries);
}
else
anime = repAniAnime.GetByAnimeID(animeID);
// create the group/series/episode records if needed
AnimeSeries ser = null;
if (anime == null) continue;
logger.Debug("Creating groups, series and episodes....");
// check if there is an AnimeSeries Record associated with this AnimeID
ser = repSeries.GetByAnimeID(animeID);
if (ser == null)
{
// create a new AnimeSeries record
ser = anime.CreateAnimeSeriesAndGroup();
}
ser.CreateAnimeEpisodes();
// check if we have any group status data for this associated anime
// if not we will download it now
AniDB_GroupStatusRepository repStatus = new AniDB_GroupStatusRepository();
if (repStatus.GetByAnimeID(anime.AnimeID).Count == 0)
{
CommandRequest_GetReleaseGroupStatus cmdStatus = new CommandRequest_GetReleaseGroupStatus(anime.AnimeID, false);
cmdStatus.Save();
}
// update stats
ser.EpisodeAddedDate = DateTime.Now;
repSeries.Save(ser);
AnimeGroupRepository repGroups = new AnimeGroupRepository();
foreach (AnimeGroup grp in ser.AllGroupsAbove)
{
grp.EpisodeAddedDate = DateTime.Now;
repGroups.Save(grp);
}
//.........这里部分代码省略.........
示例9: ProcessCommand
public override void ProcessCommand()
{
logger.Info("Processing CommandRequest_GetReleaseGroupStatus: {0}", AnimeID);
try
{
// only get group status if we have an associated series
AnimeSeriesRepository repSeries = new AnimeSeriesRepository();
AnimeSeries series = repSeries.GetByAnimeID(AnimeID);
if (series == null) return;
AniDB_AnimeRepository repAnime = new AniDB_AnimeRepository();
AniDB_Anime anime = repAnime.GetByAnimeID(AnimeID);
if (anime == null) return;
// don't get group status if the anime has already ended more than 50 days ago
bool skip = false;
if (!ForceRefresh)
{
if (anime.EndDate.HasValue)
{
if (anime.EndDate.Value < DateTime.Now)
{
TimeSpan ts = DateTime.Now - anime.EndDate.Value;
if (ts.TotalDays > 50)
{
// don't skip if we have never downloaded this info before
AniDB_GroupStatusRepository repGrpStatus = new AniDB_GroupStatusRepository();
List<AniDB_GroupStatus> grpStatuses = repGrpStatus.GetByAnimeID(AnimeID);
if (grpStatuses != null && grpStatuses.Count > 0)
{
skip = true;
}
}
}
}
}
if (skip)
{
logger.Info("Skipping group status command because anime has already ended: {0}", anime.ToString());
return;
}
GroupStatusCollection grpCol = JMMService.AnidbProcessor.GetReleaseGroupStatusUDP(AnimeID);
if (ServerSettings.AniDB_DownloadReleaseGroups)
{
// save in bulk to improve performance
using (var session = JMMService.SessionFactory.OpenSession())
{
using (var transaction = session.BeginTransaction())
{
foreach (Raw_AniDB_GroupStatus grpStatus in grpCol.Groups)
{
CommandRequest_GetReleaseGroup cmdRelgrp = new CommandRequest_GetReleaseGroup(grpStatus.GroupID, false);
session.SaveOrUpdate(cmdRelgrp);
}
transaction.Commit();
}
}
}
//}
}
catch (Exception ex)
{
logger.Error("Error processing CommandRequest_GetReleaseGroupStatus: {0} - {1}", AnimeID, ex.ToString());
return;
}
}
示例10: SetDefaultSeriesForGroup
public void SetDefaultSeriesForGroup(int animeGroupID, int animeSeriesID)
{
try
{
AnimeGroupRepository repGroups = new AnimeGroupRepository();
AnimeSeriesRepository repSeries = new AnimeSeriesRepository();
AnimeGroup grp = repGroups.GetByID(animeGroupID);
if (grp == null) return;
AnimeSeries ser = repSeries.GetByID(animeSeriesID);
if (ser == null) return;
grp.DefaultAnimeSeriesID = animeSeriesID;
repGroups.Save(grp);
}
catch (Exception ex)
{
logger.ErrorException(ex.ToString(), ex);
}
}
示例11: DeleteAnimeSeries
/// <summary>
/// Delete a series, and everything underneath it (episodes, files)
/// </summary>
/// <param name="animeSeriesID"></param>
/// <param name="deleteFiles">also delete the physical files</param>
/// <returns></returns>
public string DeleteAnimeSeries(int animeSeriesID, bool deleteFiles, bool deleteParentGroup)
{
try
{
AnimeEpisodeRepository repEps = new AnimeEpisodeRepository();
AnimeSeriesRepository repAnimeSer = new AnimeSeriesRepository();
VideoLocalRepository repVids = new VideoLocalRepository();
AnimeGroupRepository repGroups = new AnimeGroupRepository();
AnimeSeries ser = repAnimeSer.GetByID(animeSeriesID);
if (ser == null) return "Series does not exist";
int animeGroupID = ser.AnimeGroupID;
foreach (AnimeEpisode ep in ser.GetAnimeEpisodes())
{
foreach (VideoLocal vid in ep.GetVideoLocals())
{
if (deleteFiles)
{
logger.Info("Deleting video local record and file: {0}", vid.FullServerPath);
if (!File.Exists(vid.FullServerPath)) return "File could not be found";
File.Delete(vid.FullServerPath);
}
CommandRequest_DeleteFileFromMyList cmdDel = new CommandRequest_DeleteFileFromMyList(vid.Hash, vid.FileSize);
cmdDel.Save();
repVids.Delete(vid.VideoLocalID);
}
repEps.Delete(ep.AnimeEpisodeID);
}
repAnimeSer.Delete(ser.AnimeSeriesID);
// finally update stats
AnimeGroup grp = repGroups.GetByID(animeGroupID);
if (grp != null)
{
if (grp.GetAllSeries().Count == 0)
{
DeleteAnimeGroup(grp.AnimeGroupID, false);
}
else
{
grp.TopLevelAnimeGroup.UpdateStatsFromTopLevel(true, true, true);
StatsCache.Instance.UpdateUsingGroup(grp.TopLevelAnimeGroup.AnimeGroupID);
}
}
return "";
}
catch (Exception ex)
{
logger.ErrorException(ex.ToString(), ex);
return ex.Message;
}
}
示例12: GetTopLevelGroupForSeries
public Contract_AnimeGroup GetTopLevelGroupForSeries(int animeSeriesID, int userID)
{
try
{
AnimeGroupRepository repGroups = new AnimeGroupRepository();
AnimeSeriesRepository repSeries = new AnimeSeriesRepository();
AnimeSeries ser = repSeries.GetByID(animeSeriesID);
if (ser == null) return null;
AnimeGroup grp = ser.TopLevelAnimeGroup;
if (grp == null) return null;
return grp.ToContract(grp.GetUserRecord(userID));
}
catch (Exception ex)
{
logger.ErrorException(ex.ToString(), ex);
}
return null;
}
示例13: GetSimilarAnimeLinks
public List<Contract_AniDB_Anime_Similar> GetSimilarAnimeLinks(int animeID, int userID)
{
List<Contract_AniDB_Anime_Similar> links = new List<Contract_AniDB_Anime_Similar>();
try
{
AniDB_AnimeRepository repAnime = new AniDB_AnimeRepository();
AniDB_Anime anime = repAnime.GetByAnimeID(animeID);
if (anime == null) return links;
JMMUserRepository repUsers = new JMMUserRepository();
JMMUser juser = repUsers.GetByID(userID);
if (juser == null) return links;
AnimeSeriesRepository repSeries = new AnimeSeriesRepository();
foreach (AniDB_Anime_Similar link in anime.GetSimilarAnime())
{
AniDB_Anime animeLink = repAnime.GetByAnimeID(link.SimilarAnimeID);
if (animeLink != null)
{
if (!juser.AllowedAnime(animeLink)) continue;
}
// check if this anime has a series
AnimeSeries ser = repSeries.GetByAnimeID(link.SimilarAnimeID);
links.Add(link.ToContract(animeLink, ser, userID));
}
return links;
}
catch (Exception ex)
{
logger.ErrorException(ex.ToString(), ex);
return links;
}
}
示例14: GetSeriesWithoutAnyFiles
public List<Contract_AnimeSeries> GetSeriesWithoutAnyFiles(int userID)
{
List<Contract_AnimeSeries> contracts = new List<Contract_AnimeSeries>();
VideoLocalRepository repVids = new VideoLocalRepository();
AnimeSeriesRepository repSeries = new AnimeSeriesRepository();
try
{
foreach (AnimeSeries ser in repSeries.GetAll())
{
if (repVids.GetByAniDBAnimeID(ser.AniDB_ID).Count == 0)
{
contracts.Add(ser.ToContract(ser.GetUserRecord(userID)));
}
}
}
catch (Exception ex)
{
logger.ErrorException(ex.ToString(), ex);
}
return contracts;
}
示例15: DeleteAnimeGroup
public string DeleteAnimeGroup(int animeGroupID, bool deleteFiles)
{
try
{
AnimeSeriesRepository repAnimeSer = new AnimeSeriesRepository();
AnimeGroupRepository repGroups = new AnimeGroupRepository();
AnimeGroup grp = repGroups.GetByID(animeGroupID);
if (grp == null) return "Group does not exist";
int? parentGroupID = grp.AnimeGroupParentID;
foreach (AnimeSeries ser in grp.GetAllSeries())
{
DeleteAnimeSeries(ser.AnimeSeriesID, deleteFiles, false);
}
// delete all sub groups
foreach (AnimeGroup subGroup in grp.GetAllChildGroups())
{
DeleteAnimeGroup(subGroup.AnimeGroupID, deleteFiles);
}
GroupFilterConditionRepository repConditions = new GroupFilterConditionRepository();
// delete any group filter conditions which reference these groups
foreach (GroupFilterCondition gfc in repConditions.GetByConditionType(GroupFilterConditionType.AnimeGroup))
{
int thisGrpID = 0;
int.TryParse(gfc.ConditionParameter, out thisGrpID);
if (thisGrpID == animeGroupID)
repConditions.Delete(gfc.GroupFilterConditionID);
}
repGroups.Delete(grp.AnimeGroupID);
// finally update stats
if (parentGroupID.HasValue)
{
AnimeGroup grpParent = repGroups.GetByID(parentGroupID.Value);
if (grpParent != null)
{
grpParent.TopLevelAnimeGroup.UpdateStatsFromTopLevel(true, true, true);
StatsCache.Instance.UpdateUsingGroup(grpParent.TopLevelAnimeGroup.AnimeGroupID);
}
}
return "";
}
catch (Exception ex)
{
logger.ErrorException(ex.ToString(), ex);
return ex.Message;
}
}