本文整理汇总了C#中JMMServer.Repositories.AniDB_AnimeRepository.GetAll方法的典型用法代码示例。如果您正苦于以下问题:C# AniDB_AnimeRepository.GetAll方法的具体用法?C# AniDB_AnimeRepository.GetAll怎么用?C# AniDB_AnimeRepository.GetAll使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类JMMServer.Repositories.AniDB_AnimeRepository
的用法示例。
在下文中一共展示了AniDB_AnimeRepository.GetAll方法的14个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: 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;
}
}
示例2: btnUploadAzureCache_Click
void btnUploadAzureCache_Click(object sender, RoutedEventArgs e)
{
AniDB_AnimeRepository repAnime = new AniDB_AnimeRepository();
List<AniDB_Anime> allAnime = repAnime.GetAll();
int cnt = 0;
foreach (AniDB_Anime anime in allAnime)
{
cnt++;
logger.Info(string.Format("Uploading anime {0} of {1} - {2}", cnt, allAnime.Count, anime.MainTitle));
try
{
CommandRequest_Azure_SendAnimeFull cmdAzure = new CommandRequest_Azure_SendAnimeFull(anime.AnimeID);
cmdAzure.Save();
}
catch { }
}
}
示例3: SendToAzureXML
private void SendToAzureXML()
{
DateTime dt = DateTime.Now.AddYears(-2);
AniDB_AnimeRepository rep = new AniDB_AnimeRepository();
List<AniDB_Anime> allAnime = rep.GetAll();
int sentAnime = 0;
foreach (AniDB_Anime anime in rep.GetAll())
{
if (!anime.EndDate.HasValue) continue;
if (anime.EndDate.Value > dt) continue;
sentAnime++;
CommandRequest_Azure_SendAnimeXML cmd = new CommandRequest_Azure_SendAnimeXML(anime.AnimeID);
cmd.Save();
}
logger.Info(string.Format("Sent Anime XML to Cache: {0} out of {1}", sentAnime, allAnime.Count));
}
示例4: GenerateAzureList
private void GenerateAzureList()
{
// get a lst of anime's that we already have
AniDB_AnimeRepository repAnime = new AniDB_AnimeRepository();
List<AniDB_Anime> allAnime = repAnime.GetAll();
Dictionary<int, int> localAnimeIDs = new Dictionary<int, int>();
foreach (AniDB_Anime anime in allAnime)
{
localAnimeIDs[anime.AnimeID] = anime.AnimeID;
}
// loop through the list of valid anime id's and add the ones we don't have yet
Dictionary<int, int> validAnimeIDs = new Dictionary<int, int>();
string line;
System.IO.StreamReader file =
new System.IO.StreamReader(@"e:\animetitles.txt");
while ((line = file.ReadLine()) != null)
{
string[] titlesArray = line.Split('|');
try
{
int aid = int.Parse(titlesArray[0]);
if (!localAnimeIDs.ContainsKey(aid))
validAnimeIDs[aid] = aid;
}
catch { }
}
file.Close();
string aids = "";
var shuffledList = validAnimeIDs.Values.OrderBy(a => Guid.NewGuid());
int i = 0;
foreach (int animeID in shuffledList)
{
i++;
if (!string.IsNullOrEmpty(aids)) aids += ",";
aids += animeID;
if (i == 250)
{
logger.Info(aids);
aids = "";
i = 0;
}
}
logger.Info(aids);
}
示例5: GetSeriesWithMissingEpisodes
public List<Contract_AnimeSeries> GetSeriesWithMissingEpisodes(int maxRecords, int jmmuserID)
{
DateTime start = DateTime.Now;
AnimeSeriesRepository repSeries = new AnimeSeriesRepository();
AniDB_AnimeRepository repAnime = new AniDB_AnimeRepository();
JMMUserRepository repUsers = new JMMUserRepository();
// get all the series
List<Contract_AnimeSeries> seriesContractList = new List<Contract_AnimeSeries>();
try
{
JMMUser user = repUsers.GetByID(jmmuserID);
if (user == null) return seriesContractList;
List<AnimeSeries> series = repSeries.GetWithMissingEpisodes();
List<AniDB_Anime> animes = repAnime.GetAll();
Dictionary<int, AniDB_Anime> dictAnimes = new Dictionary<int, AniDB_Anime>();
foreach (AniDB_Anime anime in animes)
dictAnimes[anime.AnimeID] = anime;
// tvdb
CrossRef_AniDB_TvDBV2Repository repCrossRef = new CrossRef_AniDB_TvDBV2Repository();
List<CrossRef_AniDB_TvDBV2> allCrossRefs = repCrossRef.GetAll();
Dictionary<int, List<CrossRef_AniDB_TvDBV2>> dictCrossRefsV2 = new Dictionary<int, List<CrossRef_AniDB_TvDBV2>>();
foreach (CrossRef_AniDB_TvDBV2 xref in allCrossRefs)
{
if (!dictCrossRefsV2.ContainsKey(xref.AnimeID))
dictCrossRefsV2[xref.AnimeID] = new List<CrossRef_AniDB_TvDBV2>();
dictCrossRefsV2[xref.AnimeID].Add(xref);
}
// moviedb
CrossRef_AniDB_OtherRepository repOtherCrossRef = new CrossRef_AniDB_OtherRepository();
List<CrossRef_AniDB_Other> allOtherCrossRefs = repOtherCrossRef.GetAll();
Dictionary<int, CrossRef_AniDB_Other> dictMovieCrossRefs = new Dictionary<int, CrossRef_AniDB_Other>();
foreach (CrossRef_AniDB_Other xref in allOtherCrossRefs)
{
if (xref.CrossRefType == (int)CrossRefType.MovieDB)
dictMovieCrossRefs[xref.AnimeID] = xref;
}
// MAL
CrossRef_AniDB_MALRepository repMALCrossRef = new CrossRef_AniDB_MALRepository();
List<CrossRef_AniDB_MAL> allMALCrossRefs = repMALCrossRef.GetAll();
Dictionary<int, List<CrossRef_AniDB_MAL>> dictMALCrossRefs = new Dictionary<int, List<CrossRef_AniDB_MAL>>();
foreach (CrossRef_AniDB_MAL xref in allMALCrossRefs)
{
if (!dictMALCrossRefs.ContainsKey(xref.AnimeID))
dictMALCrossRefs[xref.AnimeID] = new List<CrossRef_AniDB_MAL>();
dictMALCrossRefs[xref.AnimeID].Add(xref);
}
// user records
AnimeSeries_UserRepository repSeriesUser = new AnimeSeries_UserRepository();
List<AnimeSeries_User> userRecordList = repSeriesUser.GetByUserID(jmmuserID);
Dictionary<int, AnimeSeries_User> dictUserRecords = new Dictionary<int, AnimeSeries_User>();
foreach (AnimeSeries_User serUser in userRecordList)
dictUserRecords[serUser.AnimeSeriesID] = serUser;
int i = 1;
foreach (AnimeSeries aser in series)
{
if (!dictAnimes.ContainsKey(aser.AniDB_ID)) continue;
AniDB_Anime anime = dictAnimes[aser.AniDB_ID];
if (!user.AllowedAnime(anime)) continue;
List<CrossRef_AniDB_TvDBV2> xrefs = new List<CrossRef_AniDB_TvDBV2>();
if (dictCrossRefsV2.ContainsKey(aser.AniDB_ID)) xrefs = dictCrossRefsV2[aser.AniDB_ID];
CrossRef_AniDB_Other xrefMovie = null;
if (dictMovieCrossRefs.ContainsKey(aser.AniDB_ID)) xrefMovie = dictMovieCrossRefs[aser.AniDB_ID];
AnimeSeries_User userRec = null;
if (dictUserRecords.ContainsKey(aser.AnimeSeriesID))
userRec = dictUserRecords[aser.AnimeSeriesID];
List<CrossRef_AniDB_MAL> xrefMAL = null;
if (dictMALCrossRefs.ContainsKey(aser.AniDB_ID))
xrefMAL = dictMALCrossRefs[aser.AniDB_ID];
List<TvDB_Series> sers = new List<TvDB_Series>();
foreach (CrossRef_AniDB_TvDBV2 xref in xrefs)
sers.Add(xref.GetTvDBSeries());
MovieDB_Movie movie = null;
if (xrefMovie != null)
movie = xrefMovie.GetMovieDB_Movie();
seriesContractList.Add(aser.ToContract(dictAnimes[aser.AniDB_ID], xrefs, xrefMovie, userRec,
sers, xrefMAL, false, null, null, null, null,movie));
if (i == maxRecords) break;
i++;
}
TimeSpan ts = DateTime.Now - start;
logger.Info("GetSeriesWithMissingEpisodes in {0} ms", ts.TotalMilliseconds);
}
//.........这里部分代码省略.........
示例6: GetAnimeRatings
public List<Contract_AnimeRating> GetAnimeRatings(int collectionState, int watchedState, int ratingVotedState, int userID)
{
List<Contract_AnimeRating> contracts = new List<Contract_AnimeRating>();
try
{
AnimeSeriesRepository repSeries = new AnimeSeriesRepository();
List<AnimeSeries> series = repSeries.GetAll();
Dictionary<int, AnimeSeries> dictSeries = new Dictionary<int, AnimeSeries>();
foreach (AnimeSeries ser in series)
dictSeries[ser.AniDB_ID] = ser;
RatingCollectionState _collectionState = (RatingCollectionState)collectionState;
RatingWatchedState _watchedState = (RatingWatchedState)watchedState;
RatingVotedState _ratingVotedState = (RatingVotedState)ratingVotedState;
DateTime start = DateTime.Now;
AniDB_AnimeRepository repAnime = new AniDB_AnimeRepository();
/*
// build a dictionary of categories
AniDB_CategoryRepository repCats = new AniDB_CategoryRepository();
AniDB_Anime_CategoryRepository repAnimeCat = new AniDB_Anime_CategoryRepository();
List<AniDB_Category> allCatgeories = repCats.GetAll();
Dictionary<int, AniDB_Category> allCatgeoriesDict = new Dictionary<int, AniDB_Category>();
foreach (AniDB_Category cat in allCatgeories)
allCatgeoriesDict[cat.CategoryID] = cat;
List<AniDB_Anime_Category> allAnimeCatgeories = repAnimeCat.GetAll();
Dictionary<int, List<AniDB_Anime_Category>> allAnimeCatgeoriesDict = new Dictionary<int, List<AniDB_Anime_Category>>(); //
foreach (AniDB_Anime_Category aniCat in allAnimeCatgeories)
{
if (!allAnimeCatgeoriesDict.ContainsKey(aniCat.AnimeID))
allAnimeCatgeoriesDict[aniCat.AnimeID] = new List<AniDB_Anime_Category>();
allAnimeCatgeoriesDict[aniCat.AnimeID].Add(aniCat);
}
// build a dictionary of titles
AniDB_Anime_TitleRepository repTitles = new AniDB_Anime_TitleRepository();
List<AniDB_Anime_Title> allTitles = repTitles.GetAll();
Dictionary<int, List<AniDB_Anime_Title>> allTitlesDict = new Dictionary<int, List<AniDB_Anime_Title>>();
foreach (AniDB_Anime_Title title in allTitles)
{
if (!allTitlesDict.ContainsKey(title.AnimeID))
allTitlesDict[title.AnimeID] = new List<AniDB_Anime_Title>();
allTitlesDict[title.AnimeID].Add(title);
}
// build a dictionary of tags
AniDB_TagRepository repTags = new AniDB_TagRepository();
AniDB_Anime_TagRepository repAnimeTag = new AniDB_Anime_TagRepository();
List<AniDB_Tag> allTags = repTags.GetAll();
Dictionary<int, AniDB_Tag> allTagsDict = new Dictionary<int, AniDB_Tag>();
foreach (AniDB_Tag tag in allTags)
allTagsDict[tag.TagID] = tag;
List<AniDB_Anime_Tag> allAnimeTags = repAnimeTag.GetAll();
Dictionary<int, List<AniDB_Anime_Tag>> allAnimeTagsDict = new Dictionary<int, List<AniDB_Anime_Tag>>(); //
foreach (AniDB_Anime_Tag aniTag in allAnimeTags)
{
if (!allAnimeTagsDict.ContainsKey(aniTag.AnimeID))
allAnimeTagsDict[aniTag.AnimeID] = new List<AniDB_Anime_Tag>();
allAnimeTagsDict[aniTag.AnimeID].Add(aniTag);
}
// build a dictionary of languages
AdhocRepository rep = new AdhocRepository();
Dictionary<int, LanguageStat> dictAudioStats = rep.GetAudioLanguageStatsForAnime();
Dictionary<int, LanguageStat> dictSubtitleStats = rep.GetSubtitleLanguageStatsForAnime();
Dictionary<int, string> dictAnimeVideoQualStats = rep.GetAllVideoQualityByAnime();
Dictionary<int, AnimeVideoQualityStat> dictAnimeEpisodeVideoQualStats = rep.GetEpisodeVideoQualityStatsByAnime();
* */
List<AniDB_Anime> animes = repAnime.GetAll();
// user votes
AniDB_VoteRepository repVotes = new AniDB_VoteRepository();
List<AniDB_Vote> allVotes = repVotes.GetAll();
JMMUserRepository repUsers = new JMMUserRepository();
JMMUser user = repUsers.GetByID(userID);
if (user == null) return contracts;
int i = 0;
foreach (AniDB_Anime anime in animes)
{
i++;
// evaluate collection states
if (_collectionState == RatingCollectionState.AllEpisodesInMyCollection)
{
//.........这里部分代码省略.........
示例7: GetAllSeries
public List<Contract_AnimeSeries> GetAllSeries(int userID)
{
AnimeSeriesRepository repSeries = new AnimeSeriesRepository();
AniDB_AnimeRepository repAnime = new AniDB_AnimeRepository();
AniDB_Anime_TitleRepository repTitles = new AniDB_Anime_TitleRepository();
//TODO: Custom Tags: Do I need to add custom tags for searches
// get all the series
List<Contract_AnimeSeries> seriesContractList = new List<Contract_AnimeSeries>();
try
{
DateTime start = DateTime.Now;
DateTime start2 = DateTime.Now;
List<AnimeSeries> series = repSeries.GetAll();
List<AniDB_Anime> animes = repAnime.GetAll();
Dictionary<int, AniDB_Anime> dictAnimes = new Dictionary<int, AniDB_Anime>();
foreach (AniDB_Anime anime in animes)
dictAnimes[anime.AnimeID] = anime;
TimeSpan ts2 = DateTime.Now - start2; logger.Info("GetAllSeries:Anime:RawData in {0} ms", ts2.TotalMilliseconds); start2 = DateTime.Now;
// tvdb - cross refs
CrossRef_AniDB_TvDBV2Repository repCrossRef = new CrossRef_AniDB_TvDBV2Repository();
List<CrossRef_AniDB_TvDBV2> allCrossRefs = repCrossRef.GetAll();
Dictionary<int, List<CrossRef_AniDB_TvDBV2>> dictCrossRefsV2 = new Dictionary<int, List<CrossRef_AniDB_TvDBV2>>();
foreach (CrossRef_AniDB_TvDBV2 xref in allCrossRefs)
{
if (!dictCrossRefsV2.ContainsKey(xref.AnimeID))
dictCrossRefsV2[xref.AnimeID] = new List<CrossRef_AniDB_TvDBV2>();
dictCrossRefsV2[xref.AnimeID].Add(xref);
}
ts2 = DateTime.Now - start2; logger.Info("GetAllSeries:TvDB CrossRefs:RawData in {0} ms", ts2.TotalMilliseconds); start2 = DateTime.Now;
// tvdb - series info
TvDB_SeriesRepository repTvSeries = new TvDB_SeriesRepository();
List<TvDB_Series> allTvSeries = repTvSeries.GetAll();
Dictionary<int, TvDB_Series> dictTvSeries = new Dictionary<int, TvDB_Series>();
foreach (TvDB_Series tvs in allTvSeries)
dictTvSeries[tvs.SeriesID] = tvs;
ts2 = DateTime.Now - start2; logger.Info("GetAllSeries:TvDB:RawData in {0} ms", ts2.TotalMilliseconds); start2 = DateTime.Now;
// moviedb
CrossRef_AniDB_OtherRepository repOtherCrossRef = new CrossRef_AniDB_OtherRepository();
List<CrossRef_AniDB_Other> allOtherCrossRefs = repOtherCrossRef.GetAll();
Dictionary<int, CrossRef_AniDB_Other> dictMovieCrossRefs = new Dictionary<int, CrossRef_AniDB_Other>();
foreach (CrossRef_AniDB_Other xref in allOtherCrossRefs)
{
if (xref.CrossRefType == (int)CrossRefType.MovieDB)
dictMovieCrossRefs[xref.AnimeID] = xref;
}
ts2 = DateTime.Now - start2; logger.Info("GetAllSeries:MovieDB:RawData in {0} ms", ts2.TotalMilliseconds); start2 = DateTime.Now;
// MAL
CrossRef_AniDB_MALRepository repMALCrossRef = new CrossRef_AniDB_MALRepository();
List<CrossRef_AniDB_MAL> allMALCrossRefs = repMALCrossRef.GetAll();
Dictionary<int, List<CrossRef_AniDB_MAL>> dictMALCrossRefs = new Dictionary<int, List<CrossRef_AniDB_MAL>>();
foreach (CrossRef_AniDB_MAL xref in allMALCrossRefs)
{
if (!dictMALCrossRefs.ContainsKey(xref.AnimeID))
dictMALCrossRefs[xref.AnimeID] = new List<CrossRef_AniDB_MAL>();
dictMALCrossRefs[xref.AnimeID].Add(xref);
}
ts2 = DateTime.Now - start2; logger.Info("GetAllSeries:MAL:RawData in {0} ms", ts2.TotalMilliseconds); start2 = DateTime.Now;
// user records
AnimeSeries_UserRepository repSeriesUser = new AnimeSeries_UserRepository();
List<AnimeSeries_User> userRecordList = repSeriesUser.GetByUserID(userID);
Dictionary<int, AnimeSeries_User> dictUserRecords = new Dictionary<int, AnimeSeries_User>();
foreach (AnimeSeries_User serUser in userRecordList)
dictUserRecords[serUser.AnimeSeriesID] = serUser;
ts2 = DateTime.Now - start2; logger.Info("GetAllSeries:UserRecs:RawData in {0} ms", ts2.TotalMilliseconds); start2 = DateTime.Now;
// default images
AniDB_Anime_DefaultImageRepository repDefImages = new AniDB_Anime_DefaultImageRepository();
List<AniDB_Anime_DefaultImage> allDefaultImages = repDefImages.GetAll();
ts2 = DateTime.Now - start2; logger.Info("GetAllSeries:DefaultImages:RawData in {0} ms", ts2.TotalMilliseconds); start2 = DateTime.Now;
// titles
List<AniDB_Anime_Title> allTitles = repTitles.GetAllForLocalSeries();
Dictionary<int, List<AniDB_Anime_Title>> dictTitles = new Dictionary<int, List<AniDB_Anime_Title>>();
foreach (AniDB_Anime_Title atit in allTitles)
{
if (!dictTitles.ContainsKey(atit.AnimeID))
dictTitles[atit.AnimeID] = new List<AniDB_Anime_Title>();
dictTitles[atit.AnimeID].Add(atit);
}
ts2 = DateTime.Now - start2; logger.Info("GetAllSeries:Titles:RawData in {0} ms", ts2.TotalMilliseconds); start2 = DateTime.Now;
TimeSpan ts = DateTime.Now - start;
//.........这里部分代码省略.........
示例8: GetAllEpisodesWithMultipleFiles
public List<Contract_AnimeEpisode> GetAllEpisodesWithMultipleFiles(int userID, bool onlyFinishedSeries, bool ignoreVariations)
{
List<Contract_AnimeEpisode> eps = new List<Contract_AnimeEpisode>();
try
{
AnimeEpisodeRepository repEps = new AnimeEpisodeRepository();
AnimeSeriesRepository repSeries = new AnimeSeriesRepository();
AniDB_AnimeRepository repAnime = new AniDB_AnimeRepository();
Dictionary<int, int> dictSeriesAnime = new Dictionary<int, int>();
Dictionary<int, bool> dictAnimeFinishedAiring = new Dictionary<int, bool>();
Dictionary<int, bool> dictSeriesFinishedAiring = new Dictionary<int, bool>();
if (onlyFinishedSeries)
{
List<AnimeSeries> allSeries = repSeries.GetAll();
foreach (AnimeSeries ser in allSeries)
dictSeriesAnime[ser.AnimeSeriesID] = ser.AniDB_ID;
List<AniDB_Anime> allAnime = repAnime.GetAll();
foreach (AniDB_Anime anime in allAnime)
dictAnimeFinishedAiring[anime.AnimeID] = anime.FinishedAiring;
foreach (KeyValuePair<int, int> kvp in dictSeriesAnime)
{
if (dictAnimeFinishedAiring.ContainsKey(kvp.Value))
dictSeriesFinishedAiring[kvp.Key] = dictAnimeFinishedAiring[kvp.Value];
}
}
foreach (AnimeEpisode ep in repEps.GetEpisodesWithMultipleFiles(ignoreVariations))
{
if (onlyFinishedSeries)
{
bool finishedAiring = false;
if (dictSeriesFinishedAiring.ContainsKey(ep.AnimeSeriesID))
finishedAiring = dictSeriesFinishedAiring[ep.AnimeSeriesID];
if (!finishedAiring) continue;
}
eps.Add(ep.ToContract(true, userID, null));
}
return eps;
}
catch (Exception ex)
{
logger.ErrorException(ex.ToString(), ex);
return eps;
}
}
示例9: GetAllAnimeDetailed
public List<Contract_AniDB_AnimeDetailed> GetAllAnimeDetailed()
{
List<Contract_AniDB_AnimeDetailed> contracts = new List<Contract_AniDB_AnimeDetailed>();
int countElements = 0;
try
{
DateTime start = DateTime.Now;
AniDB_AnimeRepository repAnime = new AniDB_AnimeRepository();
// build a dictionary of titles
AniDB_Anime_TitleRepository repTitles = new AniDB_Anime_TitleRepository();
List<AniDB_Anime_Title> allTitles = repTitles.GetAll();
Dictionary<int, List<AniDB_Anime_Title>> allTitlesDict = new Dictionary<int, List<AniDB_Anime_Title>>();
foreach (AniDB_Anime_Title title in allTitles)
{
if (!allTitlesDict.ContainsKey(title.AnimeID))
allTitlesDict[title.AnimeID] = new List<AniDB_Anime_Title>();
allTitlesDict[title.AnimeID].Add(title);
}
// build a dictionary of tags
AniDB_TagRepository repTags = new AniDB_TagRepository();
AniDB_Anime_TagRepository repAnimeTag = new AniDB_Anime_TagRepository();
List<AniDB_Tag> allTags = repTags.GetAll();
Dictionary<int, AniDB_Tag> allTagsDict = new Dictionary<int, AniDB_Tag>();
foreach (AniDB_Tag tag in allTags)
allTagsDict[tag.TagID] = tag;
List<AniDB_Anime_Tag> allAnimeTags = repAnimeTag.GetAll();
Dictionary<int, List<AniDB_Anime_Tag>> allAnimeTagsDict = new Dictionary<int, List<AniDB_Anime_Tag>>(); //
foreach (AniDB_Anime_Tag aniTag in allAnimeTags)
{
if (!allAnimeTagsDict.ContainsKey(aniTag.AnimeID))
allAnimeTagsDict[aniTag.AnimeID] = new List<AniDB_Anime_Tag>();
allAnimeTagsDict[aniTag.AnimeID].Add(aniTag);
}
// build a dictionary of custom tags
CustomTagRepository repCustomTags = new CustomTagRepository();
CrossRef_CustomTagRepository repXRefCustomTags = new CrossRef_CustomTagRepository();
List<CustomTag> allCustomTags = repCustomTags.GetAll();
Dictionary<int, CustomTag> allCustomTagsDict = new Dictionary<int, CustomTag>();
foreach (CustomTag tag in allCustomTags)
allCustomTagsDict[tag.CustomTagID] = tag;
List<CrossRef_CustomTag> allCustomTagsXRefs = repXRefCustomTags.GetAll();
Dictionary<int, List<CrossRef_CustomTag>> allCustomTagsXRefDict = new Dictionary<int, List<CrossRef_CustomTag>>(); //
foreach (CrossRef_CustomTag aniTag in allCustomTagsXRefs)
{
if (!allCustomTagsXRefDict.ContainsKey(aniTag.CrossRefID))
allCustomTagsXRefDict[aniTag.CrossRefID] = new List<CrossRef_CustomTag>();
allCustomTagsXRefDict[aniTag.CrossRefID].Add(aniTag);
}
// build a dictionary of languages
AdhocRepository rep = new AdhocRepository();
Dictionary<int, LanguageStat> dictAudioStats = rep.GetAudioLanguageStatsForAnime();
Dictionary<int, LanguageStat> dictSubtitleStats = rep.GetSubtitleLanguageStatsForAnime();
Dictionary<int, string> dictAnimeVideoQualStats = rep.GetAllVideoQualityByAnime();
Dictionary<int, AnimeVideoQualityStat> dictAnimeEpisodeVideoQualStats = rep.GetEpisodeVideoQualityStatsByAnime();
List<AniDB_Anime> animes = repAnime.GetAll();
// user votes
AniDB_VoteRepository repVotes = new AniDB_VoteRepository();
List<AniDB_Vote> allVotes = repVotes.GetAll();
int i = 0;
foreach (AniDB_Anime anime in animes)
{
i++;
//if (i >= 10) continue;
countElements++;
Contract_AniDB_AnimeDetailed contract = new Contract_AniDB_AnimeDetailed();
contract.AnimeTitles = new List<Contract_AnimeTitle>();
contract.Tags = new List<Contract_AnimeTag>();
contract.CustomTags = new List<Contract_CustomTag>();
contract.UserVote = null;
contract.AniDBAnime = anime.ToContract();
if (dictAnimeVideoQualStats.ContainsKey(anime.AnimeID))
contract.Stat_AllVideoQuality = dictAnimeVideoQualStats[anime.AnimeID];
else contract.Stat_AllVideoQuality = "";
contract.Stat_AllVideoQuality_Episodes = "";
// All Video Quality Episodes
//.........这里部分代码省略.........
示例10: GetAllAnime
public List<Contract_AniDBAnime> GetAllAnime()
{
List<Contract_AniDBAnime> contracts = new List<Contract_AniDBAnime>();
try
{
using (var session = JMMService.SessionFactory.OpenSession())
{
DateTime start = DateTime.Now;
AniDB_AnimeRepository repAnime = new AniDB_AnimeRepository();
List<AniDB_Anime> animes = repAnime.GetAll(session);
AniDB_Anime_DefaultImageRepository repDefaults = new AniDB_Anime_DefaultImageRepository();
List<AniDB_Anime_DefaultImage> allDefaultImages = repDefaults.GetAll(session);
Dictionary<int, AniDB_Anime_DefaultImage> dictDefaultsPosters = new Dictionary<int, AniDB_Anime_DefaultImage>();
Dictionary<int, AniDB_Anime_DefaultImage> dictDefaultsFanart = new Dictionary<int, AniDB_Anime_DefaultImage>();
Dictionary<int, AniDB_Anime_DefaultImage> dictDefaultsWideBanner = new Dictionary<int, AniDB_Anime_DefaultImage>();
foreach (AniDB_Anime_DefaultImage defaultImage in allDefaultImages)
{
ImageSizeType sizeType = (ImageSizeType)defaultImage.ImageType;
if (sizeType == ImageSizeType.Fanart)
dictDefaultsFanart[defaultImage.AnimeID] = defaultImage;
if (sizeType == ImageSizeType.Poster)
dictDefaultsPosters[defaultImage.AnimeID] = defaultImage;
if (sizeType == ImageSizeType.WideBanner)
dictDefaultsWideBanner[defaultImage.AnimeID] = defaultImage;
}
foreach (AniDB_Anime anime in animes)
{
Contract_AniDBAnime contract = anime.ToContract();
if (dictDefaultsFanart.ContainsKey(anime.AnimeID))
contract.DefaultImageFanart = dictDefaultsFanart[anime.AnimeID].ToContract();
else contract.DefaultImageFanart = null;
if (dictDefaultsPosters.ContainsKey(anime.AnimeID))
contract.DefaultImagePoster = dictDefaultsPosters[anime.AnimeID].ToContract();
else contract.DefaultImagePoster = null;
if (dictDefaultsWideBanner.ContainsKey(anime.AnimeID))
contract.DefaultImageWideBanner = dictDefaultsWideBanner[anime.AnimeID].ToContract();
else contract.DefaultImageWideBanner = null;
contracts.Add(contract);
//anime.ToContractDetailed();
}
TimeSpan ts = DateTime.Now - start;
logger.Info("GetAllAnimein {0} ms", ts.TotalMilliseconds);
}
}
catch (Exception ex)
{
logger.ErrorException(ex.ToString(), ex);
}
return contracts;
}
示例11: InitStats
public void InitStats()
{
try
{
DateTime start = DateTime.Now;
ClearAllData();
#region Get the data
AnimeGroupRepository repGroups = new AnimeGroupRepository();
AniDB_AnimeRepository repAnime = new AniDB_AnimeRepository();
AnimeSeriesRepository repSeries = new AnimeSeriesRepository();
AniDB_CategoryRepository repCats = new AniDB_CategoryRepository();
AniDB_Anime_CategoryRepository repAnimeCat = new AniDB_Anime_CategoryRepository();
AniDB_Anime_TitleRepository repTitles = new AniDB_Anime_TitleRepository();
List<AnimeGroup> allGrps = repGroups.GetAll();
Dictionary<int, AnimeGroup> allGroupsDict = new Dictionary<int, AnimeGroup>();
foreach (AnimeGroup agrp in allGrps)
allGroupsDict[agrp.AnimeGroupID] = agrp;
TimeSpan ts = DateTime.Now - start;
logger.Info("Get All GROUPS (Database) in {0} ms", ts.TotalMilliseconds);
// anime
start = DateTime.Now;
List<AniDB_Anime> allAnime = repAnime.GetAll();
Dictionary<int, AniDB_Anime> allAnimeDict = new Dictionary<int, AniDB_Anime>();
foreach (AniDB_Anime anime in allAnime)
allAnimeDict[anime.AnimeID] = anime;
ts = DateTime.Now - start;
logger.Info("Get All ANIME (Database) in {0} ms", ts.TotalMilliseconds);
// categories
start = DateTime.Now;
List<AniDB_Category> allCatgeories = repCats.GetAll();
Dictionary<int, AniDB_Category> allCatgeoriesDict = new Dictionary<int, AniDB_Category>();
foreach (AniDB_Category cat in allCatgeories)
allCatgeoriesDict[cat.CategoryID] = cat;
List<AniDB_Anime_Category> allAnimeCatgeories = repAnimeCat.GetAll();
Dictionary<int, List<int>> allAnimeCatgeoriesDict = new Dictionary<int, List<int>>(); // animeid / list of category id's
foreach (AniDB_Anime_Category aniCat in allAnimeCatgeories)
{
if (!allAnimeCatgeoriesDict.ContainsKey(aniCat.AnimeID))
allAnimeCatgeoriesDict[aniCat.AnimeID] = new List<int>();
allAnimeCatgeoriesDict[aniCat.AnimeID].Add(aniCat.CategoryID);
}
ts = DateTime.Now - start;
logger.Info("Get All CATEGORIES (Database) in {0} ms", ts.TotalMilliseconds);
// titles
start = DateTime.Now;
List<AniDB_Anime_Title> allTitles = repTitles.GetAll();
Dictionary<int, List<AniDB_Anime_Title>> allTitlesDict = new Dictionary<int, List<AniDB_Anime_Title>>(); // animeid / list of titles
foreach (AniDB_Anime_Title aniTitle in allTitles)
{
if (!allTitlesDict.ContainsKey(aniTitle.AnimeID))
allTitlesDict[aniTitle.AnimeID] = new List<AniDB_Anime_Title>();
allTitlesDict[aniTitle.AnimeID].Add(aniTitle);
}
ts = DateTime.Now - start;
logger.Info("Get All TITLES (Database) in {0} ms", ts.TotalMilliseconds);
// user votes
start = DateTime.Now;
AniDB_VoteRepository repVotes = new AniDB_VoteRepository();
List<AniDB_Vote> allVotes = repVotes.GetAll();
ts = DateTime.Now - start;
logger.Info("Get All VOTES (Database) in {0} ms", ts.TotalMilliseconds);
// video quality
start = DateTime.Now;
AdhocRepository rep = new AdhocRepository();
Dictionary<int, string> allVidQuality = rep.GetAllVideoQualityByGroup();
ts = DateTime.Now - start;
logger.Info("Get VIDEO QUALITY STATS (Database) in {0} ms", ts.TotalMilliseconds);
// video quality episode stats
start = DateTime.Now;
Dictionary<int, AnimeVideoQualityStat> dictStats = rep.GetEpisodeVideoQualityStatsByAnime();
ts = DateTime.Now - start;
logger.Info("Get VIDEO QUALITY EPISODE STATS (Database) in {0} ms", ts.TotalMilliseconds);
// audio and subtitle language stats
start = DateTime.Now;
Dictionary<int, LanguageStat> dictAudioStats = rep.GetAudioLanguageStatsForAnime();
Dictionary<int, LanguageStat> dictSubtitleStats = rep.GetSubtitleLanguageStatsForAnime();
ts = DateTime.Now - start;
logger.Info("Get LANGUAGE STATS (Database) in {0} ms", ts.TotalMilliseconds);
start = DateTime.Now;
List<AnimeSeries> allSeries = repSeries.GetAll();
//.........这里部分代码省略.........
示例12: GetAnimeRatings
public List<Contract_AnimeRating> GetAnimeRatings(int collectionState, int watchedState, int ratingVotedState, int userID)
{
List<Contract_AnimeRating> contracts = new List<Contract_AnimeRating>();
try
{
AnimeSeriesRepository repSeries = new AnimeSeriesRepository();
List<AnimeSeries> series = repSeries.GetAll();
Dictionary<int, AnimeSeries> dictSeries = new Dictionary<int, AnimeSeries>();
foreach (AnimeSeries ser in series)
dictSeries[ser.AniDB_ID] = ser;
RatingCollectionState _collectionState = (RatingCollectionState)collectionState;
RatingWatchedState _watchedState = (RatingWatchedState)watchedState;
RatingVotedState _ratingVotedState = (RatingVotedState)ratingVotedState;
DateTime start = DateTime.Now;
AniDB_AnimeRepository repAnime = new AniDB_AnimeRepository();
/*
// build a dictionary of categories
AniDB_CategoryRepository repCats = new AniDB_CategoryRepository();
AniDB_Anime_CategoryRepository repAnimeCat = new AniDB_Anime_CategoryRepository();
List<AniDB_Category> allCatgeories = repCats.GetAll();
Dictionary<int, AniDB_Category> allCatgeoriesDict = new Dictionary<int, AniDB_Category>();
foreach (AniDB_Category cat in allCatgeories)
allCatgeoriesDict[cat.CategoryID] = cat;
List<AniDB_Anime_Category> allAnimeCatgeories = repAnimeCat.GetAll();
Dictionary<int, List<AniDB_Anime_Category>> allAnimeCatgeoriesDict = new Dictionary<int, List<AniDB_Anime_Category>>(); //
foreach (AniDB_Anime_Category aniCat in allAnimeCatgeories)
{
if (!allAnimeCatgeoriesDict.ContainsKey(aniCat.AnimeID))
allAnimeCatgeoriesDict[aniCat.AnimeID] = new List<AniDB_Anime_Category>();
allAnimeCatgeoriesDict[aniCat.AnimeID].Add(aniCat);
}
// build a dictionary of titles
AniDB_Anime_TitleRepository repTitles = new AniDB_Anime_TitleRepository();
List<AniDB_Anime_Title> allTitles = repTitles.GetAll();
Dictionary<int, List<AniDB_Anime_Title>> allTitlesDict = new Dictionary<int, List<AniDB_Anime_Title>>();
foreach (AniDB_Anime_Title title in allTitles)
{
if (!allTitlesDict.ContainsKey(title.AnimeID))
allTitlesDict[title.AnimeID] = new List<AniDB_Anime_Title>();
allTitlesDict[title.AnimeID].Add(title);
}
// build a dictionary of tags
AniDB_TagRepository repTags = new AniDB_TagRepository();
AniDB_Anime_TagRepository repAnimeTag = new AniDB_Anime_TagRepository();
List<AniDB_Tag> allTags = repTags.GetAll();
Dictionary<int, AniDB_Tag> allTagsDict = new Dictionary<int, AniDB_Tag>();
foreach (AniDB_Tag tag in allTags)
allTagsDict[tag.TagID] = tag;
List<AniDB_Anime_Tag> allAnimeTags = repAnimeTag.GetAll();
Dictionary<int, List<AniDB_Anime_Tag>> allAnimeTagsDict = new Dictionary<int, List<AniDB_Anime_Tag>>(); //
foreach (AniDB_Anime_Tag aniTag in allAnimeTags)
{
if (!allAnimeTagsDict.ContainsKey(aniTag.AnimeID))
allAnimeTagsDict[aniTag.AnimeID] = new List<AniDB_Anime_Tag>();
allAnimeTagsDict[aniTag.AnimeID].Add(aniTag);
}
// build a dictionary of languages
AdhocRepository rep = new AdhocRepository();
Dictionary<int, LanguageStat> dictAudioStats = rep.GetAudioLanguageStatsForAnime();
Dictionary<int, LanguageStat> dictSubtitleStats = rep.GetSubtitleLanguageStatsForAnime();
Dictionary<int, string> dictAnimeVideoQualStats = rep.GetAllVideoQualityByAnime();
Dictionary<int, AnimeVideoQualityStat> dictAnimeEpisodeVideoQualStats = rep.GetEpisodeVideoQualityStatsByAnime();
* */
List<AniDB_Anime> animes = repAnime.GetAll();
// user votes
AniDB_VoteRepository repVotes = new AniDB_VoteRepository();
List<AniDB_Vote> allVotes = repVotes.GetAll();
JMMUserRepository repUsers = new JMMUserRepository();
JMMUser user = repUsers.GetByID(userID);
if (user == null) return contracts;
int i = 0;
foreach (AniDB_Anime anime in animes)
//.........这里部分代码省略.........
示例13: RunImport_UpdateAllAniDB
public static void RunImport_UpdateAllAniDB()
{
AniDB_AnimeRepository repAnime = new AniDB_AnimeRepository();
foreach (AniDB_Anime anime in repAnime.GetAll())
{
CommandRequest_GetAnimeHTTP cmd = new CommandRequest_GetAnimeHTTP(anime.AnimeID, true, false);
cmd.Save();
}
}
示例14: RunImport_GetImages
public static void RunImport_GetImages()
{
// AniDB posters
AniDB_AnimeRepository repAnime = new AniDB_AnimeRepository();
foreach (AniDB_Anime anime in repAnime.GetAll())
{
if (anime.AnimeID == 8580)
Console.Write("");
if (string.IsNullOrEmpty(anime.PosterPath)) continue;
bool fileExists = File.Exists(anime.PosterPath);
if (!fileExists)
{
CommandRequest_DownloadImage cmd = new CommandRequest_DownloadImage(anime.AniDB_AnimeID, JMMImageType.AniDB_Cover, false);
cmd.Save();
}
}
// TvDB Posters
if (ServerSettings.TvDB_AutoPosters)
{
TvDB_ImagePosterRepository repTvPosters = new TvDB_ImagePosterRepository();
Dictionary<int, int> postersCount = new Dictionary<int, int>();
// build a dictionary of series and how many images exist
List<TvDB_ImagePoster> allPosters = repTvPosters.GetAll();
foreach (TvDB_ImagePoster tvPoster in allPosters)
{
if (string.IsNullOrEmpty(tvPoster.FullImagePath)) continue;
bool fileExists = File.Exists(tvPoster.FullImagePath);
if (fileExists)
{
if (postersCount.ContainsKey(tvPoster.SeriesID))
postersCount[tvPoster.SeriesID] = postersCount[tvPoster.SeriesID] + 1;
else
postersCount[tvPoster.SeriesID] = 1;
}
}
foreach (TvDB_ImagePoster tvPoster in allPosters)
{
if (string.IsNullOrEmpty(tvPoster.FullImagePath)) continue;
bool fileExists = File.Exists(tvPoster.FullImagePath);
int postersAvailable = 0;
if (postersCount.ContainsKey(tvPoster.SeriesID))
postersAvailable = postersCount[tvPoster.SeriesID];
if (!fileExists && postersAvailable < ServerSettings.TvDB_AutoPostersAmount)
{
CommandRequest_DownloadImage cmd = new CommandRequest_DownloadImage(tvPoster.TvDB_ImagePosterID, JMMImageType.TvDB_Cover, false);
cmd.Save();
}
}
}
// TvDB Fanart
if (ServerSettings.TvDB_AutoFanart)
{
Dictionary<int, int> fanartCount = new Dictionary<int, int>();
TvDB_ImageFanartRepository repTvFanart = new TvDB_ImageFanartRepository();
List<TvDB_ImageFanart> allFanart = repTvFanart.GetAll();
foreach (TvDB_ImageFanart tvFanart in allFanart)
{
// build a dictionary of series and how many images exist
if (string.IsNullOrEmpty(tvFanart.FullImagePath)) continue;
bool fileExists = File.Exists(tvFanart.FullImagePath);
if (fileExists)
{
if (fanartCount.ContainsKey(tvFanart.SeriesID))
fanartCount[tvFanart.SeriesID] = fanartCount[tvFanart.SeriesID] + 1;
else
fanartCount[tvFanart.SeriesID] = 1;
}
}
foreach (TvDB_ImageFanart tvFanart in allFanart)
{
if (string.IsNullOrEmpty(tvFanart.FullImagePath)) continue;
bool fileExists = File.Exists(tvFanart.FullImagePath);
int fanartAvailable = 0;
if (fanartCount.ContainsKey(tvFanart.SeriesID))
fanartAvailable = fanartCount[tvFanart.SeriesID];
if (!fileExists && fanartAvailable < ServerSettings.TvDB_AutoFanartAmount)
{
CommandRequest_DownloadImage cmd = new CommandRequest_DownloadImage(tvFanart.TvDB_ImageFanartID, JMMImageType.TvDB_FanArt, false);
cmd.Save();
fanartCount[tvFanart.SeriesID] = fanartAvailable + 1;
}
}
}
// TvDB Wide Banners
if (ServerSettings.TvDB_AutoWideBanners)
//.........这里部分代码省略.........