本文整理汇总了C#中JMMServer.Repositories.AniDB_AnimeRepository类的典型用法代码示例。如果您正苦于以下问题:C# AniDB_AnimeRepository类的具体用法?C# AniDB_AnimeRepository怎么用?C# AniDB_AnimeRepository使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
AniDB_AnimeRepository类属于JMMServer.Repositories命名空间,在下文中一共展示了AniDB_AnimeRepository类的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()
{
logger.Info("Processing CommandRequest_MALUploadStatusToMAL");
try
{
if (string.IsNullOrEmpty(ServerSettings.MAL_Username) || string.IsNullOrEmpty(ServerSettings.MAL_Password))
return;
// find the latest eps to update
AniDB_AnimeRepository repAnime = new AniDB_AnimeRepository();
List<AniDB_Anime> animes = repAnime.GetAll();
foreach (AniDB_Anime anime in animes)
{
CommandRequest_MALUpdatedWatchedStatus cmd = new CommandRequest_MALUpdatedWatchedStatus(anime.AnimeID);
cmd.Save();
}
}
catch (Exception ex)
{
logger.Error("Error processing CommandRequest_MALUploadStatusToMAL: {0}", ex.ToString());
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: 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;
}
}
示例6: ProcessCommand
public override void ProcessCommand()
{
logger.Info("Processing CommandRequest_GetAnimeHTTP: {0}", AnimeID);
try
{
AniDB_AnimeRepository repAnime = new AniDB_AnimeRepository();
AniDB_Anime anime = JMMService.AnidbProcessor.GetAnimeInfoHTTP(AnimeID, ForceRefresh, DownloadRelations);
// NOTE - related anime are downloaded when the relations are created
// download group status info for this anime
// the group status will also help us determine missing episodes for a series
// download reviews
if (ServerSettings.AniDB_DownloadReviews)
{
CommandRequest_GetReviews cmd = new CommandRequest_GetReviews(AnimeID, ForceRefresh);
cmd.Save();
}
// Request an image download
}
catch (Exception ex)
{
logger.Error("Error processing CommandRequest_GetAnimeHTTP: {0} - {1}", AnimeID, ex.ToString());
return;
}
}
示例7: 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;
}
示例8: 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;
}
示例9: 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;
}
}
示例10: 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;
}
示例11: 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;
}
示例12: 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;
}
}
示例13: 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;
}
}
示例14: 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_TvDB_Get)
{
try
{
CrossRef_AniDB_TraktResult crossRef = XMLService.Get_CrossRef_AniDB_Trakt(AnimeID);
if (crossRef != null)
{
TraktTVShow showInfo = TraktTVHelper.GetShowInfo(crossRef.TraktID);
if (showInfo != null)
{
logger.Trace("Found trakt match on web cache for {0} - id = {1}", AnimeID, showInfo.title);
TraktTVHelper.LinkAniDBTrakt(AnimeID, crossRef.TraktID, crossRef.TraktSeasonNumber, 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 == 1) //TODO this is temporary code, until trakt also allows multiple links
{
TraktTVShow showInfo = TraktTVHelper.GetShowInfo(xrefTvDBs[0].TvDBID);
if (showInfo != null)
{
// make sure the season specified by TvDB also exists on Trakt
Trakt_ShowRepository repShow = new Trakt_ShowRepository();
Trakt_Show traktShow = repShow.GetByTraktID(session, showInfo.TraktID);
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, showInfo.TraktID, traktSeason.Season, true);
return;
}
}
}
}
// if not lets try the tvdb web cache based on the same reasoning
if (ServerSettings.WebCache_TvDB_Get)
{
List<JMMServer.Providers.Azure.CrossRef_AniDB_TvDB> cacheResults = JMMServer.Providers.Azure.AzureWebAPI.Get_CrossRefAniDBTvDB(AnimeID);
if (cacheResults != null && cacheResults.Count > 0)
{
TraktTVShow showInfo = TraktTVHelper.GetShowInfo(cacheResults[0].TvDBID);
if (showInfo != null)
{
// make sure the season specified by TvDB also exists on Trakt
Trakt_ShowRepository repShow = new Trakt_ShowRepository();
Trakt_Show traktShow = repShow.GetByTraktID(session, showInfo.TraktID);
if (traktShow != null)
{
Trakt_SeasonRepository repSeasons = new Trakt_SeasonRepository();
Trakt_Season traktSeason = repSeasons.GetByShowIDAndSeason(session, traktShow.Trakt_ShowID, cacheResults[0].TvDBSeasonNumber);
if (traktSeason != null)
{
logger.Trace("Found trakt match on web cache by using TvDBID {0} - id = {1}", AnimeID, showInfo.title);
TraktTVHelper.LinkAniDBTrakt(AnimeID, showInfo.TraktID, traktSeason.Season, 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<TraktTVShow> results = TraktTVHelper.SearchShow(searchCriteria);
logger.Trace("Found {0} trakt results for {1} ", results.Count, searchCriteria);
if (ProcessSearchResults(session, results, searchCriteria)) return;
if (results.Count == 0)
//.........这里部分代码省略.........
示例15: ProcessFile_AniDB
private void ProcessFile_AniDB(VideoLocal vidLocal)
{
logger.Trace("Checking for AniDB_File record for: {0} --- {1}", vidLocal.Hash, vidLocal.FilePath);
// check if we already have this AniDB_File info in the database
AniDB_FileRepository repAniFile = new AniDB_FileRepository();
AniDB_EpisodeRepository repAniEps = new AniDB_EpisodeRepository();
AniDB_AnimeRepository repAniAnime = new AniDB_AnimeRepository();
AnimeSeriesRepository repSeries = new AnimeSeriesRepository();
VideoLocalRepository repVidLocals = new VideoLocalRepository();
AnimeEpisodeRepository repEps = new AnimeEpisodeRepository();
CrossRef_File_EpisodeRepository repXrefFE = new CrossRef_File_EpisodeRepository();
AniDB_File aniFile = null;
if (!ForceAniDB)
{
aniFile = repAniFile.GetByHashAndFileSize(vidLocal.Hash, vlocal.FileSize);
if (aniFile == null)
logger.Trace("AniDB_File record not found");
}
int animeID = 0;
if (aniFile == null)
{
// get info from AniDB
logger.Debug("Getting AniDB_File record from AniDB....");
Raw_AniDB_File fileInfo = JMMService.AnidbProcessor.GetFileInfo(vidLocal);
if (fileInfo != null)
{
// check if we already have a record
aniFile = repAniFile.GetByHashAndFileSize(vidLocal.Hash, vlocal.FileSize);
if (aniFile == null)
aniFile = new AniDB_File();
aniFile.Populate(fileInfo);
//overwrite with local file name
string localFileName = Path.GetFileName(vidLocal.FilePath);
aniFile.FileName = localFileName;
repAniFile.Save(aniFile, false);
aniFile.CreateLanguages();
aniFile.CreateCrossEpisodes(localFileName);
if (!string.IsNullOrEmpty(fileInfo.OtherEpisodesRAW))
{
string[] epIDs = fileInfo.OtherEpisodesRAW.Split(',');
foreach (string epid in epIDs)
{
int id = 0;
if (int.TryParse(epid, out id))
{
CommandRequest_GetEpisode cmdEp = new CommandRequest_GetEpisode(id);
cmdEp.Save();
}
}
}
animeID = aniFile.AnimeID;
}
}
bool missingEpisodes = false;
// if we still haven't got the AniDB_File Info we try the web cache or local records
if (aniFile == null)
{
// check if we have any records from previous imports
List<CrossRef_File_Episode> crossRefs = repXrefFE.GetByHash(vidLocal.Hash);
if (crossRefs == null || crossRefs.Count == 0)
{
// lets see if we can find the episode/anime info from the web cache
if (ServerSettings.WebCache_XRefFileEpisode_Get)
{
crossRefs = XMLService.Get_CrossRef_File_Episode(vidLocal);
if (crossRefs == null || crossRefs.Count == 0)
{
logger.Debug("Cannot find AniDB_File record or get cross ref from web cache record so exiting: {0}", vidLocal.ED2KHash);
return;
}
else
{
foreach (CrossRef_File_Episode xref in crossRefs)
{
// in this case we need to save the cross refs manually as AniDB did not provide them
repXrefFE.Save(xref);
}
}
}
else
{
logger.Debug("Cannot get AniDB_File record so exiting: {0}", vidLocal.ED2KHash);
return;
}
}
//.........这里部分代码省略.........