本文整理汇总了C#中JMMServer.Repositories.AnimeSeriesRepository.GetByAnimeID方法的典型用法代码示例。如果您正苦于以下问题:C# AnimeSeriesRepository.GetByAnimeID方法的具体用法?C# AnimeSeriesRepository.GetByAnimeID怎么用?C# AnimeSeriesRepository.GetByAnimeID使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类JMMServer.Repositories.AnimeSeriesRepository
的用法示例。
在下文中一共展示了AnimeSeriesRepository.GetByAnimeID方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: 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;
}
}
示例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("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;
}
}
示例4: OnlineAnimeTitleSearch
public List<Contract_AnimeSearch> OnlineAnimeTitleSearch(string titleQuery)
{
List<Contract_AnimeSearch> retTitles = new List<Contract_AnimeSearch>();
try
{
AnimeSeriesRepository repSeries = new AnimeSeriesRepository();
List<JMMServer.Providers.Azure.AnimeIDTitle> titles = JMMServer.Providers.Azure.AzureWebAPI.Get_AnimeTitle(titleQuery);
using (var session = JMMService.SessionFactory.OpenSession())
{
foreach (JMMServer.Providers.Azure.AnimeIDTitle tit in titles)
{
Contract_AnimeSearch res = new Contract_AnimeSearch();
res.AnimeID = tit.AnimeID;
res.MainTitle = tit.MainTitle;
res.Titles = tit.Titles;
// check for existing series and group details
AnimeSeries ser = repSeries.GetByAnimeID(tit.AnimeID);
if (ser != null)
{
res.SeriesExists = true;
res.AnimeSeriesID = ser.AnimeSeriesID;
res.AnimeSeriesName = ser.GetAnime(session).GetFormattedTitle(session);
}
else
{
res.SeriesExists = false;
}
retTitles.Add(res);
}
}
}
catch (Exception ex)
{
logger.ErrorException(ex.ToString(), ex);
}
return retTitles;
}
示例5: ProcessFile_AniDB
//.........这里部分代码省略.........
animeID = xref.AnimeID;
AniDB_Episode ep = repAniEps.GetByEpisodeID(xref.EpisodeID);
if (ep == null) missingEpisodes = true;
}
}
else
{
// check if we have the episode info
// if we don't, we will need to re-download the anime info (which also has episode info)
if (aniFile.EpisodeCrossRefs.Count == 0)
{
animeID = aniFile.AnimeID;
// if we have the anidb file, but no cross refs it means something has been broken
logger.Debug("Could not find any cross ref records for: {0}", vidLocal.ED2KHash);
missingEpisodes = true;
}
else
{
foreach (CrossRef_File_Episode xref in aniFile.EpisodeCrossRefs)
{
AniDB_Episode ep = repAniEps.GetByEpisodeID(xref.EpisodeID);
if (ep == null)
missingEpisodes = true;
animeID = xref.AnimeID;
}
}
}
// get from DB
AniDB_Anime anime = repAniAnime.GetByAnimeID(animeID);
bool animeRecentlyUpdated = false;
if (anime != null)
{
TimeSpan ts = DateTime.Now - anime.DateTimeUpdated;
if (ts.TotalHours < 4) animeRecentlyUpdated = true;
}
// even if we are missing episode info, don't get data more than once every 4 hours
// this is to prevent banning
if (missingEpisodes && !animeRecentlyUpdated)
{
logger.Debug("Getting Anime record from AniDB....");
// try using the cache first
using (var session = JMMService.SessionFactory.OpenSession())
{
anime = JMMService.AnidbProcessor.GetAnimeInfoHTTPFromCache(session, animeID, ServerSettings.AutoGroupSeries);
}
// if not in cache try from AniDB
if (anime == null)
anime = JMMService.AnidbProcessor.GetAnimeInfoHTTP(animeID, true, ServerSettings.AutoGroupSeries);
}
// create the group/series/episode records if needed
AnimeSeries ser = null;
if (anime != null)
{
logger.Debug("Creating groups, series and episodes....");
// check if there is an AnimeSeries Record associated with this AnimeID
ser = repSeries.GetByAnimeID(animeID);
示例6: ProcessCommand
public override void ProcessCommand()
{
logger.Info("Processing CommandRequest_GetUpdated");
try
{
List<int> animeIDsToUpdate = new List<int>();
ScheduledUpdateRepository repSched = new ScheduledUpdateRepository();
AnimeSeriesRepository repSeries = new AnimeSeriesRepository();
AniDB_AnimeRepository repAnime = new AniDB_AnimeRepository();
// check the automated update table to see when the last time we ran this command
ScheduledUpdate sched = repSched.GetByUpdateType((int)ScheduledUpdateType.AniDBUpdates);
if (sched != null)
{
int freqHours = Utils.GetScheduledHours(ServerSettings.AniDB_Anime_UpdateFrequency);
// if we have run this in the last 12 hours and are not forcing it, then exit
TimeSpan tsLastRun = DateTime.Now - sched.LastUpdate;
if (tsLastRun.TotalHours < freqHours)
{
if (!ForceRefresh) return;
}
}
long webUpdateTime = 0;
long webUpdateTimeNew = 0;
if (sched == null)
{
// if this is the first time, lets ask for last 3 days
DateTime localTime = DateTime.Now.AddDays(-3);
DateTime utcTime = localTime.ToUniversalTime();
webUpdateTime = long.Parse(Utils.AniDBDate(utcTime));
webUpdateTimeNew = long.Parse(Utils.AniDBDate(DateTime.Now.ToUniversalTime()));
sched = new ScheduledUpdate();
sched.UpdateType = (int)ScheduledUpdateType.AniDBUpdates;
}
else
{
logger.Trace("Last anidb info update was : {0}", sched.UpdateDetails);
webUpdateTime = long.Parse(sched.UpdateDetails);
webUpdateTimeNew = long.Parse(Utils.AniDBDate(DateTime.Now.ToUniversalTime()));
DateTime timeNow = DateTime.Now.ToUniversalTime();
logger.Info(string.Format("{0} since last UPDATED command",
Utils.FormatSecondsToDisplayTime(int.Parse((webUpdateTimeNew - webUpdateTime).ToString()))));
}
// get a list of updates from AniDB
// startTime will contain the date/time from which the updates apply to
JMMService.AnidbProcessor.GetUpdated(ref animeIDsToUpdate, ref webUpdateTime);
// now save the update time from AniDB
// we will use this next time as a starting point when querying the web cache
sched.LastUpdate = DateTime.Now;
sched.UpdateDetails = webUpdateTimeNew.ToString();
repSched.Save(sched);
if (animeIDsToUpdate.Count == 0)
{
logger.Info("No anime to be updated");
return;
}
int countAnime = 0;
int countSeries = 0;
foreach (int animeID in animeIDsToUpdate)
{
// update the anime from HTTP
AniDB_Anime anime = repAnime.GetByAnimeID(animeID);
if (anime == null)
{
logger.Trace("No local record found for Anime ID: {0}, so skipping...", animeID);
continue;
}
logger.Info("Updating CommandRequest_GetUpdated: {0} ", animeID);
// but only if it hasn't been recently updated
TimeSpan ts = DateTime.Now - anime.DateTimeUpdated;
if (ts.TotalHours > 4)
{
CommandRequest_GetAnimeHTTP cmdAnime = new CommandRequest_GetAnimeHTTP(animeID, true, false);
cmdAnime.Save();
countAnime++;
}
// update the group status
// this will allow us to determine which anime has missing episodes
// so we wonly get by an amime where we also have an associated series
AnimeSeries ser = repSeries.GetByAnimeID(animeID);
if (ser != null)
{
CommandRequest_GetReleaseGroupStatus cmdStatus = new CommandRequest_GetReleaseGroupStatus(animeID, true);
cmdStatus.Save();
countSeries++;
}
}
//.........这里部分代码省略.........
示例7: RemoveLinkAniDBTvDBForAnime
/// <summary>
/// Removes all tvdb links for one anime
/// </summary>
/// <param name="animeID"></param>
/// <returns></returns>
public string RemoveLinkAniDBTvDBForAnime(int animeID)
{
try
{
AnimeSeriesRepository repSeries = new AnimeSeriesRepository();
AnimeSeries ser = repSeries.GetByAnimeID(animeID);
if (ser == null) return "Could not find Series for Anime!";
CrossRef_AniDB_TvDBV2Repository repCrossRef= new CrossRef_AniDB_TvDBV2Repository();
List<CrossRef_AniDB_TvDBV2> xrefs = repCrossRef.GetByAnimeID(animeID);
if (xrefs == null) return "";
AniDB_Anime_DefaultImageRepository repDefaults = new AniDB_Anime_DefaultImageRepository();
foreach (CrossRef_AniDB_TvDBV2 xref in xrefs)
{
// check if there are default images used associated
List<AniDB_Anime_DefaultImage> images = repDefaults.GetByAnimeID(animeID);
foreach (AniDB_Anime_DefaultImage image in images)
{
if (image.ImageParentType == (int)JMMImageType.TvDB_Banner ||
image.ImageParentType == (int)JMMImageType.TvDB_Cover ||
image.ImageParentType == (int)JMMImageType.TvDB_FanArt)
{
if (image.ImageParentID == xref.TvDBID)
repDefaults.Delete(image.AniDB_Anime_DefaultImageID);
}
}
TvDBHelper.RemoveLinkAniDBTvDB(xref.AnimeID, (enEpisodeType)xref.AniDBStartEpisodeType, xref.AniDBStartEpisodeNumber,
xref.TvDBID, xref.TvDBSeasonNumber, xref.TvDBStartEpisodeNumber);
}
return "";
}
catch (Exception ex)
{
logger.ErrorException(ex.ToString(), ex);
return ex.Message;
}
}
示例8: RemoveLinkAniDBTraktForAnime
public string RemoveLinkAniDBTraktForAnime(int animeID)
{
try
{
AnimeSeriesRepository repSeries = new AnimeSeriesRepository();
AnimeSeries ser = repSeries.GetByAnimeID(animeID);
if (ser == null) return "Could not find Series for Anime!";
// check if there are default images used associated
AniDB_Anime_DefaultImageRepository repDefaults = new AniDB_Anime_DefaultImageRepository();
List<AniDB_Anime_DefaultImage> images = repDefaults.GetByAnimeID(animeID);
foreach (AniDB_Anime_DefaultImage image in images)
{
if (image.ImageParentType == (int)JMMImageType.Trakt_Fanart ||
image.ImageParentType == (int)JMMImageType.Trakt_Poster)
{
repDefaults.Delete(image.AniDB_Anime_DefaultImageID);
}
}
CrossRef_AniDB_TraktV2Repository repXrefTrakt = new CrossRef_AniDB_TraktV2Repository();
foreach (CrossRef_AniDB_TraktV2 xref in repXrefTrakt.GetByAnimeID(animeID))
{
TraktTVHelper.RemoveLinkAniDBTrakt(animeID, (enEpisodeType)xref.AniDBStartEpisodeType, xref.AniDBStartEpisodeNumber,
xref.TraktID, xref.TraktSeasonNumber, xref.TraktStartEpisodeNumber);
}
return "";
}
catch (Exception ex)
{
logger.ErrorException(ex.ToString(), ex);
return ex.Message;
}
}
示例9: 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;
}
}
示例10: SearchAnime
public List<MetroContract_Anime_Summary> SearchAnime(int jmmuserID, string queryText, int maxRecords)
{
List<MetroContract_Anime_Summary> retAnime = new List<MetroContract_Anime_Summary>();
try
{
using (var session = JMMService.SessionFactory.OpenSession())
{
AniDB_AnimeRepository repAnime = new AniDB_AnimeRepository();
JMMUserRepository repUsers = new JMMUserRepository();
AnimeSeriesRepository repSeries = new AnimeSeriesRepository();
JMMUser user = repUsers.GetByID(session, jmmuserID);
if (user == null) return retAnime;
List<AniDB_Anime> animes = repAnime.SearchByName(session, queryText);
foreach (AniDB_Anime anidb_anime in animes)
{
if (!user.AllowedAnime(anidb_anime)) continue;
AnimeSeries ser = repSeries.GetByAnimeID(anidb_anime.AnimeID);
MetroContract_Anime_Summary summ = new MetroContract_Anime_Summary();
summ.AirDateAsSeconds = anidb_anime.AirDateAsSeconds;
summ.AnimeID = anidb_anime.AnimeID;
if (ser != null)
{
summ.AnimeName = ser.GetSeriesName(session);
summ.AnimeSeriesID = ser.AnimeSeriesID;
}
else
{
summ.AnimeName = anidb_anime.MainTitle;
summ.AnimeSeriesID = 0;
}
summ.BeginYear = anidb_anime.BeginYear;
summ.EndYear = anidb_anime.EndYear;
summ.PosterName = anidb_anime.GetDefaultPosterPathNoBlanks(session);
ImageDetails imgDet = anidb_anime.GetDefaultPosterDetailsNoBlanks(session);
summ.ImageType = (int)imgDet.ImageType;
summ.ImageID = imgDet.ImageID;
retAnime.Add(summ);
if (retAnime.Count == maxRecords) break;
}
}
}
catch (Exception ex)
{
logger.ErrorException(ex.ToString(), ex);
}
return retAnime;
}
示例11: GetSimilarAnimeForAnime
public List<MetroContract_Anime_Summary> GetSimilarAnimeForAnime(int animeID, int maxRecords, int jmmuserID)
{
List<Contract_AniDB_Anime_Similar> links = new List<Contract_AniDB_Anime_Similar>();
List<MetroContract_Anime_Summary> retAnime = new List<MetroContract_Anime_Summary>();
try
{
using (var session = JMMService.SessionFactory.OpenSession())
{
AniDB_AnimeRepository repAnime = new AniDB_AnimeRepository();
AniDB_Anime anime = repAnime.GetByAnimeID(session, animeID);
if (anime == null) return retAnime;
JMMUserRepository repUsers = new JMMUserRepository();
JMMUser juser = repUsers.GetByID(session, jmmuserID);
if (juser == null) return retAnime;
AnimeSeriesRepository repSeries = new AnimeSeriesRepository();
// first get the related anime
foreach (AniDB_Anime_Relation link in anime.GetRelatedAnime())
{
AniDB_Anime animeLink = repAnime.GetByAnimeID(link.RelatedAnimeID);
if (animeLink == null)
{
// try getting it from anidb now
animeLink = JMMService.AnidbProcessor.GetAnimeInfoHTTP(session, link.RelatedAnimeID, false, false);
}
if (animeLink == null) continue;
if (!juser.AllowedAnime(animeLink)) continue;
// check if this anime has a series
AnimeSeries ser = repSeries.GetByAnimeID(link.RelatedAnimeID);
MetroContract_Anime_Summary summ = new MetroContract_Anime_Summary();
summ.AnimeID = animeLink.AnimeID;
summ.AnimeName = animeLink.MainTitle;
summ.AnimeSeriesID = 0;
summ.BeginYear = animeLink.BeginYear;
summ.EndYear = animeLink.EndYear;
//summ.PosterName = animeLink.GetDefaultPosterPathNoBlanks(session);
summ.RelationshipType = link.RelationType;
ImageDetails imgDet = animeLink.GetDefaultPosterDetailsNoBlanks(session);
summ.ImageType = (int)imgDet.ImageType;
summ.ImageID = imgDet.ImageID;
if (ser != null)
{
summ.AnimeName = ser.GetSeriesName(session);
summ.AnimeSeriesID = ser.AnimeSeriesID;
}
retAnime.Add(summ);
}
// now get similar anime
foreach (AniDB_Anime_Similar link in anime.GetSimilarAnime(session))
{
AniDB_Anime animeLink = repAnime.GetByAnimeID(session, link.SimilarAnimeID);
if (animeLink == null)
{
// try getting it from anidb now
animeLink = JMMService.AnidbProcessor.GetAnimeInfoHTTP(session, link.SimilarAnimeID, false, false);
}
if (animeLink == null) continue;
if (!juser.AllowedAnime(animeLink)) continue;
// check if this anime has a series
AnimeSeries ser = repSeries.GetByAnimeID(session, link.SimilarAnimeID);
MetroContract_Anime_Summary summ = new MetroContract_Anime_Summary();
summ.AnimeID = animeLink.AnimeID;
summ.AnimeName = animeLink.MainTitle;
summ.AnimeSeriesID = 0;
summ.BeginYear = animeLink.BeginYear;
summ.EndYear = animeLink.EndYear;
//summ.PosterName = animeLink.GetDefaultPosterPathNoBlanks(session);
summ.RelationshipType = "Recommendation";
ImageDetails imgDet = animeLink.GetDefaultPosterDetailsNoBlanks(session);
summ.ImageType = (int)imgDet.ImageType;
summ.ImageID = imgDet.ImageID;
if (ser != null)
{
summ.AnimeName = ser.GetSeriesName(session);
summ.AnimeSeriesID = ser.AnimeSeriesID;
}
retAnime.Add(summ);
if (retAnime.Count == maxRecords) break;
//.........这里部分代码省略.........
示例12: MoveFileIfRequired
public void MoveFileIfRequired()
{
// check if this file is in the drop folder
// otherwise we don't need to move it
if (this.ImportFolder.IsDropSource == 0) return;
if (!File.Exists(this.FullServerPath)) return;
// find the default destination
ImportFolder destFolder = null;
ImportFolderRepository repFolders = new ImportFolderRepository();
foreach (ImportFolder fldr in repFolders.GetAll())
{
if (fldr.IsDropDestination == 1)
{
destFolder = fldr;
break;
}
}
if (destFolder == null) return;
if (!Directory.Exists(destFolder.ImportFolderLocation)) return;
// we can only move the file if it has an anime associated with it
List<CrossRef_File_Episode> xrefs = this.EpisodeCrossRefs;
if (xrefs.Count == 0) return;
CrossRef_File_Episode xref = xrefs[0];
// find the series associated with this episode
AnimeSeriesRepository repSeries = new AnimeSeriesRepository();
AnimeSeries series = repSeries.GetByAnimeID(xref.AnimeID);
if (series == null) return;
// find where the other files are stored for this series
// if there are no other files except for this one, it means we need to create a new location
bool foundLocation = false;
string newFullPath = "";
// sort the episodes by air date, so that we will move the file to the location of the latest episode
List<AnimeEpisode> allEps = series.GetAnimeEpisodes();
List<SortPropOrFieldAndDirection> sortCriteria = new List<SortPropOrFieldAndDirection>();
sortCriteria.Add(new SortPropOrFieldAndDirection("AniDB_EpisodeID", true, SortType.eInteger));
allEps = Sorting.MultiSort<AnimeEpisode>(allEps, sortCriteria);
foreach (AnimeEpisode ep in allEps)
{
foreach (VideoLocal vid in ep.GetVideoLocals())
{
if (vid.VideoLocalID != this.VideoLocalID)
{
// make sure this folder is not the drop source
if (vid.ImportFolder.IsDropSource == 1) continue;
string thisFileName = vid.FullServerPath;
string folderName = Path.GetDirectoryName(thisFileName);
if (Directory.Exists(folderName))
{
newFullPath = folderName;
foundLocation = true;
break;
}
}
}
if (foundLocation) break;
}
if (!foundLocation)
{
// we need to create a new folder
string newFolderName = Utils.RemoveInvalidFolderNameCharacters(series.GetAnime().MainTitle);
newFullPath = Path.Combine(destFolder.ImportFolderLocation, newFolderName);
if (!Directory.Exists(newFullPath))
Directory.CreateDirectory(newFullPath);
}
int newFolderID = 0;
string newPartialPath = "";
string newFullServerPath = Path.Combine(newFullPath, Path.GetFileName(this.FullServerPath));
DataAccessHelper.GetShareAndPath(newFullServerPath, repFolders.GetAll(), ref newFolderID, ref newPartialPath);
logger.Info("Moving file from {0} to {1}", this.FullServerPath, newFullServerPath);
if (File.Exists(newFullServerPath))
{
// if the file already exists, we can just delete the source file instead
// this is safer than deleting and moving
File.Delete(this.FullServerPath);
this.ImportFolderID = newFolderID;
this.FilePath = newPartialPath;
VideoLocalRepository repVids = new VideoLocalRepository();
repVids.Save(this);
}
else
//.........这里部分代码省略.........
示例13: GetRelatedGroupsFromAnimeID
public static List<AnimeGroup> GetRelatedGroupsFromAnimeID(ISession session, int animeid)
{
// TODO we need to recusrive list at all relations and not just the first one
AniDB_AnimeRepository repAniAnime = new AniDB_AnimeRepository();
AnimeSeriesRepository repSeries = new AnimeSeriesRepository();
AnimeGroupRepository repGroups = new AnimeGroupRepository();
List<AnimeGroup> grps = new List<AnimeGroup>();
AniDB_Anime anime = repAniAnime.GetByAnimeID(session, animeid);
if (anime == null) return grps;
// first check for groups which are directly related
List<AniDB_Anime_Relation> relations = anime.GetRelatedAnime(session);
foreach (AniDB_Anime_Relation rel in relations)
{
string relationtype = rel.RelationType.ToLower();
if ((relationtype == "same setting") || (relationtype == "alternative setting") ||
(relationtype == "character") || (relationtype == "other"))
{
//Filter these relations these will fix messes, like Gundam , Clamp, etc.
continue;
}
// we actually need to get the series, because it might have been added to another group already
AnimeSeries ser = repSeries.GetByAnimeID(session, rel.RelatedAnimeID);
if (ser != null)
{
AnimeGroup grp = repGroups.GetByID(session, ser.AnimeGroupID);
if (grp != null) grps.Add(grp);
}
}
if (grps.Count > 0) return grps;
// if nothing found check by all related anime
List<AniDB_Anime> relatedAnime = anime.GetAllRelatedAnime(session);
foreach (AniDB_Anime rel in relatedAnime)
{
// we actually need to get the series, because it might have been added to another group already
AnimeSeries ser = repSeries.GetByAnimeID(session, rel.AnimeID);
if (ser != null)
{
AnimeGroup grp = repGroups.GetByID(session, ser.AnimeGroupID);
if (grp != null) grps.Add(grp);
}
}
return grps;
}
示例14: UpdateUsingAnime
public void UpdateUsingAnime(ISession session, int animeID)
{
try
{
AniDB_AnimeRepository repAnime = new AniDB_AnimeRepository();
AniDB_Anime anime = repAnime.GetByAnimeID(session, animeID);
if (anime == null) return;
AnimeSeriesRepository repSeries = new AnimeSeriesRepository();
AnimeSeries ser = repSeries.GetByAnimeID(session, animeID);
if (ser == null) return;
UpdateUsingSeries(session, ser.AnimeSeriesID);
}
catch (Exception ex)
{
logger.ErrorException(ex.ToString(), ex);
}
}
示例15: GetSeriesExistingForAnime
public bool GetSeriesExistingForAnime(int animeID)
{
AnimeSeriesRepository repAnimeSer = new AnimeSeriesRepository();
try
{
AnimeSeries series = repAnimeSer.GetByAnimeID(animeID);
if (series == null)
return false;
return true;
}
catch (Exception ex)
{
logger.ErrorException(ex.ToString(), ex);
}
return true;
}