本文整理汇总了C#中JMMServer.Repositories.AniDB_AnimeRepository.GetByAnimeID方法的典型用法代码示例。如果您正苦于以下问题:C# AniDB_AnimeRepository.GetByAnimeID方法的具体用法?C# AniDB_AnimeRepository.GetByAnimeID怎么用?C# AniDB_AnimeRepository.GetByAnimeID使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类JMMServer.Repositories.AniDB_AnimeRepository
的用法示例。
在下文中一共展示了AniDB_AnimeRepository.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()
{
try
{
bool process = (ServerSettings.AniDB_Username.Equals("jonbaby", StringComparison.InvariantCultureIgnoreCase) ||
ServerSettings.AniDB_Username.Equals("jmediamanager", StringComparison.InvariantCultureIgnoreCase) ||
ServerSettings.AniDB_Username.Equals("jmmtesting", StringComparison.InvariantCultureIgnoreCase));
if (!process) return;
AniDB_AnimeRepository rep = new AniDB_AnimeRepository();
AniDB_Anime anime = rep.GetByAnimeID(AnimeID);
if (anime == null) return;
if (anime.AllTags.ToUpper().Contains("18 RESTRICTED")) return;
AzureWebAPI.Send_AnimeFull(anime);
}
catch (Exception ex)
{
logger.Error("Error processing CommandRequest_Azure_SendAnimeFull: {0} - {1}", AnimeID, ex.ToString());
return;
}
}
示例3: ProcessCommand
public override void ProcessCommand()
{
try
{
CrossRef_AniDB_TraktV2Repository repCrossRef = new CrossRef_AniDB_TraktV2Repository();
CrossRef_AniDB_TraktV2 xref = repCrossRef.GetByID(CrossRef_AniDB_TraktID);
if (xref == null) return;
Trakt_ShowRepository repShow = new Trakt_ShowRepository();
Trakt_Show tvShow = repShow.GetByTraktSlug(xref.TraktID);
if (tvShow == null) return;
AniDB_AnimeRepository repAnime = new AniDB_AnimeRepository();
AniDB_Anime anime = repAnime.GetByAnimeID(xref.AnimeID);
if (anime == null) return;
string showName = "";
if (tvShow != null) showName = tvShow.Title;
AzureWebAPI.Send_CrossRefAniDBTrakt(xref, anime.MainTitle);
}
catch (Exception ex)
{
logger.ErrorException("Error processing CommandRequest_WebCacheSendXRefAniDBTrakt: {0}" + ex.ToString(), ex);
return;
}
}
示例4: ProcessCommand
public override void ProcessCommand()
{
logger.Info("Processing CommandRequest_GetReviews: {0}", AnimeID);
try
{
return;
// we will always assume that an anime was downloaded via http first
AniDB_AnimeRepository repAnime = new AniDB_AnimeRepository();
AniDB_Anime anime = repAnime.GetByAnimeID(AnimeID);
if (anime != null)
{
// reviews count will be 0 when the anime is only downloaded via HTTP
if (ForceRefresh || anime.AnimeReviews.Count == 0)
anime = JMMService.AnidbProcessor.GetAnimeInfoUDP(AnimeID, true);
foreach (AniDB_Anime_Review animeRev in anime.AnimeReviews)
{
JMMService.AnidbProcessor.GetReviewUDP(animeRev.ReviewID);
}
}
}
catch (Exception ex)
{
logger.Error("Error processing CommandRequest_GetReviews: {0} - {1}", AnimeID, ex.ToString());
return;
}
}
示例5: GetCommunityLinks
public MetroContract_CommunityLinks GetCommunityLinks(int animeID)
{
MetroContract_CommunityLinks contract = new MetroContract_CommunityLinks();
try
{
using (var session = JMMService.SessionFactory.OpenSession())
{
AniDB_AnimeRepository repAnime = new AniDB_AnimeRepository();
AniDB_Anime anime = repAnime.GetByAnimeID(session, animeID);
if (anime == null) return null;
//AniDB
contract.AniDB_ID = animeID;
contract.AniDB_URL = string.Format(Constants.URLS.AniDB_Series, animeID);
contract.AniDB_DiscussURL = string.Format(Constants.URLS.AniDB_SeriesDiscussion, animeID);
// MAL
List<CrossRef_AniDB_MAL> malRef = anime.GetCrossRefMAL(session);
if (malRef != null && malRef.Count > 0)
{
contract.MAL_ID = malRef[0].MALID.ToString();
contract.MAL_URL = string.Format(Constants.URLS.MAL_Series, malRef[0].MALID);
//contract.MAL_DiscussURL = string.Format(Constants.URLS.MAL_SeriesDiscussion, malRef[0].MALID, malRef[0].MALTitle);
contract.MAL_DiscussURL = string.Format(Constants.URLS.MAL_Series, malRef[0].MALID);
}
// TvDB
List<CrossRef_AniDB_TvDBV2> tvdbRef = anime.GetCrossRefTvDBV2(session);
if (tvdbRef != null && tvdbRef.Count > 0)
{
contract.TvDB_ID = tvdbRef[0].TvDBID.ToString();
contract.TvDB_URL = string.Format(Constants.URLS.TvDB_Series, tvdbRef[0].TvDBID);
}
// Trakt
List<CrossRef_AniDB_TraktV2> traktRef = anime.GetCrossRefTraktV2(session);
if (traktRef != null && traktRef.Count > 0)
{
contract.Trakt_ID = traktRef[0].TraktID;
contract.Trakt_URL = string.Format(Constants.URLS.Trakt_Series, traktRef[0].TraktID);
}
}
}
catch (Exception ex)
{
logger.ErrorException(ex.ToString(), ex);
}
return contract;
}
示例6: ToContract
public Contract_IgnoreAnime ToContract()
{
Contract_IgnoreAnime contract = new Contract_IgnoreAnime();
contract.IgnoreAnimeID = this.IgnoreAnimeID;
contract.JMMUserID = this.JMMUserID;
contract.AnimeID = this.AnimeID;
contract.IgnoreType = this.IgnoreType;
AniDB_AnimeRepository repAnime = new AniDB_AnimeRepository();
AniDB_Anime anime = repAnime.GetByAnimeID(AnimeID);
if (anime != null) contract.Anime = anime.ToContract();
return contract;
}
示例7: ProcessCommand
public override void ProcessCommand()
{
try
{
bool process = (ServerSettings.AniDB_Username.Equals("jonbaby", StringComparison.InvariantCultureIgnoreCase) ||
ServerSettings.AniDB_Username.Equals("jmediamanager", StringComparison.InvariantCultureIgnoreCase));
if (!process) return;
AniDB_AnimeRepository rep = new AniDB_AnimeRepository();
AniDB_Anime anime = rep.GetByAnimeID(AnimeID);
if (anime == null) return;
string appPath = System.IO.Path.GetDirectoryName(System.Reflection.Assembly.GetExecutingAssembly().Location);
string filePath = Path.Combine(appPath, "Anime_HTTP");
if (!Directory.Exists(filePath))
Directory.CreateDirectory(filePath);
string fileName = string.Format("AnimeDoc_{0}.xml", AnimeID);
string fileNameWithPath = Path.Combine(filePath, fileName);
string rawXML = "";
if (File.Exists(fileNameWithPath))
{
StreamReader re = File.OpenText(fileNameWithPath);
rawXML = re.ReadToEnd();
re.Close();
}
AnimeXML xml = new AnimeXML();
xml.AnimeID = AnimeID;
xml.AnimeName = anime.MainTitle;
xml.DateDownloaded = 0;
xml.Username = ServerSettings.AniDB_Username;
xml.XMLContent = rawXML;
AzureWebAPI.Send_AnimeXML(xml);
}
catch (Exception ex)
{
logger.Error("Error processing CommandRequest_Azure_SendAnimeXML: {0} - {1}", AnimeID, ex.ToString());
return;
}
}
示例8: ToContract
public Contract_BookmarkedAnime ToContract()
{
Contract_BookmarkedAnime contract = new Contract_BookmarkedAnime();
contract.BookmarkedAnimeID = BookmarkedAnimeID;
contract.AnimeID = AnimeID;
contract.Priority = Priority;
contract.Notes = Notes;
contract.Downloading = Downloading;
contract.Anime = null;
AniDB_AnimeRepository repAnime = new AniDB_AnimeRepository();
AniDB_Anime an = repAnime.GetByAnimeID(AnimeID);
if (an != null)
contract.Anime = an.ToContract(true, null);
return contract;
}
示例9: HasTraktLink
public bool HasTraktLink(int animeID)
{
try
{
AniDB_AnimeRepository repAnime = new AniDB_AnimeRepository();
AniDB_Anime anime = repAnime.GetByAnimeID(animeID);
if (anime == null) return false;
return anime.GetCrossRefTrakt() != null;
}
catch (Exception ex)
{
logger.ErrorException(ex.ToString(), ex);
}
return false;
}
示例10: ProcessCommand
public override void ProcessCommand()
{
logger.Info("Processing CommandRequest_GetCharactersCreators: {0}", AnimeID);
try
{
AniDB_AnimeRepository repAnime = new AniDB_AnimeRepository();
AniDB_Character_CreatorRepository repCharCreators = new AniDB_Character_CreatorRepository();
AniDB_Anime anime = null;
if (ForceRefresh)
{
// redownload anime details from http ap so we can get an update character list
anime = JMMService.AnidbProcessor.GetAnimeInfoHTTP(AnimeID, false, false);
}
else
anime = repAnime.GetByAnimeID(AnimeID);
if (anime == null) return;
foreach (AniDB_Anime_Character animeChar in anime.AnimeCharacters)
{
//MainWindow.anidbProcessor.UpdateCharacterInfo(charref.CharID, false);
//logger.Trace("Downloading char info: {0}", animeChar.CharID);
CommandRequest_GetCharacter cmdChar = new CommandRequest_GetCharacter(animeChar.CharID, ForceRefresh);
cmdChar.Save();
// for each of the creators for this character
foreach (AniDB_Character_Seiyuu aac in repCharCreators.GetByCharID(animeChar.CharID))
{
CommandRequest_GetCreator cmdCreators = new CommandRequest_GetCreator(aac.SeiyuuID, ForceRefresh);
cmdCreators.Save();
}
}
}
catch (Exception ex)
{
logger.Error("Error processing CommandRequest_GetCharactersCreators: {0} - {1}", AnimeID, ex.ToString());
return;
}
}
示例11: ProcessCommand
public override void ProcessCommand()
{
try
{
//if (string.IsNullOrEmpty(ServerSettings.WebCacheAuthKey)) return;
CrossRef_AniDB_TvDBV2Repository repCrossRef = new CrossRef_AniDB_TvDBV2Repository();
CrossRef_AniDB_TvDBV2 xref = repCrossRef.GetByID(CrossRef_AniDB_TvDBID);
if (xref == null) return;
AniDB_AnimeRepository repAnime = new AniDB_AnimeRepository();
AniDB_Anime anime = repAnime.GetByAnimeID(xref.AnimeID);
if (anime == null) return;
AzureWebAPI.Send_CrossRefAniDBTvDB(xref, anime.MainTitle);
}
catch (Exception ex)
{
logger.ErrorException("Error processing CommandRequest_WebCacheSendXRefAniDBTvDB: {0}" + ex.ToString(), ex);
return;
}
}
示例12: ProcessCommand
public override void ProcessCommand()
{
logger.Info("Processing CommandRequest_TraktSearchAnime: {0}", AnimeID);
try
{
using (var session = JMMService.SessionFactory.OpenSession())
{
// first check if the user wants to use the web cache
if (ServerSettings.WebCache_Trakt_Get)
{
try
{
List<Contract_Azure_CrossRef_AniDB_Trakt> contracts = new List<Contract_Azure_CrossRef_AniDB_Trakt>();
List<JMMServer.Providers.Azure.CrossRef_AniDB_Trakt> resultsCache = JMMServer.Providers.Azure.AzureWebAPI.Get_CrossRefAniDBTrakt(AnimeID);
if (resultsCache != null && resultsCache.Count > 0)
{
foreach (JMMServer.Providers.Azure.CrossRef_AniDB_Trakt xref in resultsCache)
{
TraktV2ShowExtended showInfo = TraktTVHelper.GetShowInfoV2(xref.TraktID);
if (showInfo != null)
{
logger.Trace("Found trakt match on web cache for {0} - id = {1}", AnimeID, showInfo.title);
TraktTVHelper.LinkAniDBTrakt(AnimeID, (enEpisodeType)xref.AniDBStartEpisodeType, xref.AniDBStartEpisodeNumber,
xref.TraktID, xref.TraktSeasonNumber, xref.TraktStartEpisodeNumber, true);
return;
}
}
}
}
catch (Exception ex)
{
logger.ErrorException(ex.ToString(), ex);
}
}
// lets try to see locally if we have a tvDB link for this anime
// Trakt allows the use of TvDB ID's or their own Trakt ID's
CrossRef_AniDB_TvDBV2Repository repCrossRefTvDB = new CrossRef_AniDB_TvDBV2Repository();
List<CrossRef_AniDB_TvDBV2> xrefTvDBs = repCrossRefTvDB.GetByAnimeID(session, AnimeID);
if (xrefTvDBs != null && xrefTvDBs.Count > 0)
{
foreach (CrossRef_AniDB_TvDBV2 tvXRef in xrefTvDBs)
{
// first search for this show by the TvDB ID
List<TraktV2SearchTvDBIDShowResult> searchResults = TraktTVHelper.SearchShowByIDV2(TraktSearchIDType.tvdb, tvXRef.TvDBID.ToString());
if (searchResults != null && searchResults.Count > 0)
{
// since we are searching by ID, there will only be one 'show' result
TraktV2Show resShow = null;
foreach (TraktV2SearchTvDBIDShowResult res in searchResults)
{
if (res.ResultType == SearchIDType.Show)
{
resShow = res.show;
break;
}
}
if (resShow != null)
{
TraktV2ShowExtended showInfo = TraktTVHelper.GetShowInfoV2(resShow.ids.slug);
if (showInfo != null && showInfo.ids != null)
{
// make sure the season specified by TvDB also exists on Trakt
Trakt_ShowRepository repShow = new Trakt_ShowRepository();
Trakt_Show traktShow = repShow.GetByTraktSlug(session, showInfo.ids.slug);
if (traktShow != null)
{
Trakt_SeasonRepository repSeasons = new Trakt_SeasonRepository();
Trakt_Season traktSeason = repSeasons.GetByShowIDAndSeason(session, traktShow.Trakt_ShowID, xrefTvDBs[0].TvDBSeasonNumber);
if (traktSeason != null)
{
logger.Trace("Found trakt match using TvDBID locally {0} - id = {1}", AnimeID, showInfo.title);
TraktTVHelper.LinkAniDBTrakt(AnimeID, (AniDBAPI.enEpisodeType)tvXRef.AniDBStartEpisodeType,
tvXRef.AniDBStartEpisodeNumber, showInfo.ids.slug, tvXRef.TvDBSeasonNumber, tvXRef.TvDBStartEpisodeNumber, true);
return;
}
}
}
}
}
}
}
// finally lets try searching Trakt directly
string searchCriteria = "";
AniDB_AnimeRepository repAnime = new AniDB_AnimeRepository();
AniDB_Anime anime = repAnime.GetByAnimeID(session, AnimeID);
if (anime == null) return;
searchCriteria = anime.MainTitle;
// if not wanting to use web cache, or no match found on the web cache go to TvDB directly
List<TraktV2SearchShowResult> results = TraktTVHelper.SearchShowV2(searchCriteria);
logger.Trace("Found {0} trakt results for {1} ", results.Count, searchCriteria);
//.........这里部分代码省略.........
示例13: 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;
}
}
示例14: UseMyTvDBLinksWebCache
/// <summary>
/// Sends the current user's TvDB links to the web cache, and then admin approves them
/// </summary>
/// <returns></returns>
public string UseMyTvDBLinksWebCache(int animeID)
{
try
{
// Get all the links for this user and anime
CrossRef_AniDB_TvDBV2Repository repCrossRef = new CrossRef_AniDB_TvDBV2Repository();
List<CrossRef_AniDB_TvDBV2> xrefs = repCrossRef.GetByAnimeID(animeID);
if (xrefs == null) return "No Links found to use";
AniDB_AnimeRepository repAnime = new AniDB_AnimeRepository();
AniDB_Anime anime = repAnime.GetByAnimeID(animeID);
if (anime == null) return "Anime not found";
// make sure the user doesn't alreday have links
List<JMMServer.Providers.Azure.CrossRef_AniDB_TvDB> results = JMMServer.Providers.Azure.AzureWebAPI.Admin_Get_CrossRefAniDBTvDB(animeID);
bool foundLinks = false;
if (results != null)
{
foreach (JMMServer.Providers.Azure.CrossRef_AniDB_TvDB xref in results)
{
if (xref.Username.Equals(ServerSettings.AniDB_Username, StringComparison.InvariantCultureIgnoreCase))
{
foundLinks = true;
break;
}
}
}
if (foundLinks) return "Links already exist, please approve them instead";
// send the links to the web cache
foreach (CrossRef_AniDB_TvDBV2 xref in xrefs)
{
Providers.Azure.AzureWebAPI.Send_CrossRefAniDBTvDB(xref, anime.MainTitle);
}
// now get the links back from the cache and approve them
results = JMMServer.Providers.Azure.AzureWebAPI.Admin_Get_CrossRefAniDBTvDB(animeID);
if (results != null)
{
List<JMMServer.Providers.Azure.CrossRef_AniDB_TvDB> linksToApprove = new List<Providers.Azure.CrossRef_AniDB_TvDB>();
foreach (JMMServer.Providers.Azure.CrossRef_AniDB_TvDB xref in results)
{
if (xref.Username.Equals(ServerSettings.AniDB_Username, StringComparison.InvariantCultureIgnoreCase))
linksToApprove.Add(xref);
}
foreach (JMMServer.Providers.Azure.CrossRef_AniDB_TvDB xref in linksToApprove)
{
JMMServer.Providers.Azure.AzureWebAPI.Admin_Approve_CrossRefAniDBTvDB(xref.CrossRef_AniDB_TvDBId.Value);
}
return "Success";
}
else
return "Failure to send links to web cache";
}
catch (Exception ex)
{
logger.ErrorException(ex.ToString(), ex);
return ex.Message;
}
}
示例15: ProcessCommand
public override void ProcessCommand()
{
logger.Info("Processing CommandRequest_MovieDBSearchAnime: {0}", AnimeID);
try
{
using (var session = JMMService.SessionFactory.OpenSession())
{
// first check if the user wants to use the web cache
if (ServerSettings.WebCache_TvDB_Get)
{
try
{
MovieDB_MovieRepository repMovies = new MovieDB_MovieRepository();
JMMServer.Providers.Azure.CrossRef_AniDB_Other crossRef = JMMServer.Providers.Azure.AzureWebAPI.Get_CrossRefAniDBOther(AnimeID, CrossRefType.MovieDB);
if (crossRef != null)
{
int movieID = int.Parse(crossRef.CrossRefID);
MovieDB_Movie movie = repMovies.GetByOnlineID(session, movieID);
if (movie == null)
{
// update the info from online
MovieDBHelper.UpdateMovieInfo(session, movieID, true);
movie = repMovies.GetByOnlineID(movieID);
}
if (movie != null)
{
// since we are using the web cache result, let's save it
MovieDBHelper.LinkAniDBMovieDB(AnimeID, movieID, true);
return;
}
}
}
catch (Exception)
{
}
}
string searchCriteria = "";
AniDB_AnimeRepository repAnime = new AniDB_AnimeRepository();
AniDB_Anime anime = repAnime.GetByAnimeID(session, AnimeID);
if (anime == null) return;
searchCriteria = anime.MainTitle;
// if not wanting to use web cache, or no match found on the web cache go to TvDB directly
List<MovieDB_Movie_Result> results = MovieDBHelper.Search(searchCriteria);
logger.Trace("Found {0} moviedb results for {1} on TheTvDB", results.Count, searchCriteria);
if (ProcessSearchResults(session, results, searchCriteria)) return;
if (results.Count == 0)
{
foreach (AniDB_Anime_Title title in anime.GetTitles(session))
{
if (title.TitleType.ToUpper() != Constants.AnimeTitleType.Official.ToUpper()) continue;
if (searchCriteria.ToUpper() == title.Title.ToUpper()) continue;
results = MovieDBHelper.Search(title.Title);
logger.Trace("Found {0} moviedb results for search on {1}", results.Count, title.Title);
if (ProcessSearchResults(session, results, title.Title)) return;
}
}
}
}
catch (Exception ex)
{
logger.Error("Error processing CommandRequest_TvDBSearchAnime: {0} - {1}", AnimeID, ex.ToString());
return;
}
}