本文整理汇总了C#中JMMServer.Repositories.VideoLocalRepository.GetByAniDBAnimeID方法的典型用法代码示例。如果您正苦于以下问题:C# VideoLocalRepository.GetByAniDBAnimeID方法的具体用法?C# VideoLocalRepository.GetByAniDBAnimeID怎么用?C# VideoLocalRepository.GetByAniDBAnimeID使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类JMMServer.Repositories.VideoLocalRepository
的用法示例。
在下文中一共展示了VideoLocalRepository.GetByAniDBAnimeID方法的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: GetVideoLocalsForAnime
public List<Contract_VideoLocal> GetVideoLocalsForAnime(int animeID, int userID)
{
List<Contract_VideoLocal> contracts = new List<Contract_VideoLocal>();
try
{
VideoLocalRepository repVids = new VideoLocalRepository();
foreach (VideoLocal vid in repVids.GetByAniDBAnimeID(animeID))
{
contracts.Add(vid.ToContract(userID));
}
}
catch (Exception ex)
{
logger.ErrorException(ex.ToString(), ex);
}
return contracts;
}
示例2: UpdateAnimeData
public string UpdateAnimeData(int animeID)
{
try
{
using (var session = JMMService.SessionFactory.OpenSession())
{
JMMService.AnidbProcessor.GetAnimeInfoHTTP(session, animeID, true, false);
// also find any files for this anime which don't have proper media info data
// we can usually tell this if the Resolution == '0x0'
VideoLocalRepository repVids = new VideoLocalRepository();
AniDB_FileRepository repFiles = new AniDB_FileRepository();
foreach (VideoLocal vid in repVids.GetByAniDBAnimeID(session, animeID))
{
AniDB_File aniFile = vid.GetAniDBFile(session);
if (aniFile == null) continue;
if (aniFile.File_VideoResolution.Equals("0x0", StringComparison.InvariantCultureIgnoreCase))
{
CommandRequest_GetFile cmd = new CommandRequest_GetFile(vid.VideoLocalID, true);
cmd.Save(session);
}
}
// update group status information
CommandRequest_GetReleaseGroupStatus cmdStatus = new CommandRequest_GetReleaseGroupStatus(animeID, true);
cmdStatus.Save(session);
}
}
catch (Exception ex)
{
logger.ErrorException(ex.ToString(), ex);
}
return "";
}
示例3: GetGroupVideoQualitySummary
public List<Contract_GroupVideoQuality> GetGroupVideoQualitySummary(int animeID)
{
List<Contract_GroupVideoQuality> vidQuals = new List<Contract_GroupVideoQuality>();
AniDB_AnimeRepository repAnime = new AniDB_AnimeRepository();
AnimeSeriesRepository repSeries = new AnimeSeriesRepository();
VideoLocalRepository repVids = new VideoLocalRepository();
AniDB_FileRepository repAniFile = new AniDB_FileRepository();
try
{
DateTime start = DateTime.Now;
TimeSpan ts = DateTime.Now - start;
double totalTiming = 0;
double timingAnime = 0;
double timingVids = 0;
double timingEps = 0;
double timingAniEps = 0;
double timingAniFile = 0;
double timingVidInfo = 0;
double timingContracts = 0;
DateTime oStart = DateTime.Now;
start = DateTime.Now;
AniDB_Anime anime = repAnime.GetByAnimeID(animeID);
ts = DateTime.Now - start;
timingAnime += ts.TotalMilliseconds;
if (anime == null) return vidQuals;
start = DateTime.Now;
List<VideoLocal> vids = repVids.GetByAniDBAnimeID(animeID);
ts = DateTime.Now - start;
timingVids += ts.TotalMilliseconds;
foreach (VideoLocal vid in vids)
{
start = DateTime.Now;
List<AnimeEpisode> eps = vid.GetAnimeEpisodes();
ts = DateTime.Now - start;
timingEps += ts.TotalMilliseconds;
if (eps.Count == 0) continue;
foreach (AnimeEpisode animeEp in eps)
{
//AnimeEpisode animeEp = eps[0];
if (animeEp.EpisodeTypeEnum == enEpisodeType.Episode || animeEp.EpisodeTypeEnum == enEpisodeType.Special)
{
start = DateTime.Now;
AniDB_Episode anidbEp = animeEp.AniDB_Episode;
ts = DateTime.Now - start;
timingAniEps += ts.TotalMilliseconds;
// get the anibd file info
start = DateTime.Now;
AniDB_File aniFile = vid.GetAniDBFile();
ts = DateTime.Now - start;
timingAniFile += ts.TotalMilliseconds;
if (aniFile != null)
{
start = DateTime.Now;
VideoInfo vinfo = vid.VideoInfo;
ts = DateTime.Now - start;
timingVidInfo += ts.TotalMilliseconds;
int bitDepth = 8;
if (vinfo != null)
{
if (!int.TryParse(vinfo.VideoBitDepth, out bitDepth))
bitDepth = 8;
}
string vidResAniFile = Utils.GetStandardisedVideoResolution(aniFile.File_VideoResolution);
// match based on group / video sorce / video res
bool foundSummaryRecord = false;
foreach (Contract_GroupVideoQuality contract in vidQuals)
{
string contractSource = SimplifyVideoSource(contract.VideoSource);
string fileSource = SimplifyVideoSource(aniFile.File_Source);
string vidResContract = Utils.GetStandardisedVideoResolution(contract.Resolution);
if (contract.GroupName.Equals(aniFile.Anime_GroupName, StringComparison.InvariantCultureIgnoreCase) &&
contractSource.Equals(fileSource, StringComparison.InvariantCultureIgnoreCase) &&
vidResContract.Equals(vidResAniFile, StringComparison.InvariantCultureIgnoreCase) &&
contract.VideoBitDepth == bitDepth)
{
foundSummaryRecord = true;
if (animeEp.EpisodeTypeEnum == enEpisodeType.Episode) contract.FileCountNormal++;
if (animeEp.EpisodeTypeEnum == enEpisodeType.Special) contract.FileCountSpecials++;
contract.TotalFileSize += vid.FileSize;
contract.TotalRunningTime += aniFile.File_LengthSeconds;
if (animeEp.EpisodeTypeEnum == enEpisodeType.Episode)
{
if (!contract.NormalEpisodeNumbers.Contains(anidbEp.EpisodeNumber))
contract.NormalEpisodeNumbers.Add(anidbEp.EpisodeNumber);
}
//.........这里部分代码省略.........
示例4: GetSeriesWithoutAnyFiles
public List<Contract_AnimeSeries> GetSeriesWithoutAnyFiles(int userID)
{
List<Contract_AnimeSeries> contracts = new List<Contract_AnimeSeries>();
VideoLocalRepository repVids = new VideoLocalRepository();
AnimeSeriesRepository repSeries = new AnimeSeriesRepository();
try
{
foreach (AnimeSeries ser in repSeries.GetAll())
{
if (repVids.GetByAniDBAnimeID(ser.AniDB_ID).Count == 0)
{
contracts.Add(ser.ToContract(ser.GetUserRecord(userID)));
}
}
}
catch (Exception ex)
{
logger.ErrorException(ex.ToString(), ex);
}
return contracts;
}
示例5: GetGroupFileSummary
public List<Contract_GroupFileSummary> GetGroupFileSummary(int animeID)
{
List<Contract_GroupFileSummary> vidQuals = new List<Contract_GroupFileSummary>();
AniDB_AnimeRepository repAnime = new AniDB_AnimeRepository();
AnimeSeriesRepository repSeries = new AnimeSeriesRepository();
VideoLocalRepository repVids = new VideoLocalRepository();
AniDB_FileRepository repAniFile = new AniDB_FileRepository();
try
{
AniDB_Anime anime = repAnime.GetByAnimeID(animeID);
if (anime == null) return vidQuals;
List<VideoLocal> vids = repVids.GetByAniDBAnimeID(animeID);
foreach (VideoLocal vid in vids)
{
if (vid.FilePath.Contains(@"[DB]_Naruto_Shippuuden_078-079_[0DFB6FE0]"))
Debug.Write("Test");
List<AnimeEpisode> eps = vid.GetAnimeEpisodes();
if (eps.Count == 0) continue;
foreach (AnimeEpisode animeEp in eps)
{
//AnimeEpisode animeEp = eps[0];
if (animeEp.EpisodeTypeEnum == enEpisodeType.Episode || animeEp.EpisodeTypeEnum == enEpisodeType.Special)
{
AniDB_Episode anidbEp = animeEp.AniDB_Episode;
// get the anibd file info
AniDB_File aniFile = vid.GetAniDBFile();
if (aniFile != null)
{
// match based on group / video sorce / video res
bool foundSummaryRecord = false;
foreach (Contract_GroupFileSummary contract in vidQuals)
{
if (contract.GroupName.Equals(aniFile.Anime_GroupName, StringComparison.InvariantCultureIgnoreCase))
{
foundSummaryRecord = true;
if (animeEp.EpisodeTypeEnum == enEpisodeType.Episode) contract.FileCountNormal++;
if (animeEp.EpisodeTypeEnum == enEpisodeType.Special) contract.FileCountSpecials++;
contract.TotalFileSize += aniFile.FileSize;
contract.TotalRunningTime += aniFile.File_LengthSeconds;
if (animeEp.EpisodeTypeEnum == enEpisodeType.Episode)
{
if (!contract.NormalEpisodeNumbers.Contains(anidbEp.EpisodeNumber))
contract.NormalEpisodeNumbers.Add(anidbEp.EpisodeNumber);
}
}
}
if (!foundSummaryRecord)
{
Contract_GroupFileSummary contract = new Contract_GroupFileSummary();
contract.FileCountNormal = 0;
contract.FileCountSpecials = 0;
contract.TotalFileSize = 0;
contract.TotalRunningTime = 0;
if (animeEp.EpisodeTypeEnum == enEpisodeType.Episode) contract.FileCountNormal++;
if (animeEp.EpisodeTypeEnum == enEpisodeType.Special) contract.FileCountSpecials++;
contract.TotalFileSize += aniFile.FileSize;
contract.TotalRunningTime += aniFile.File_LengthSeconds;
contract.GroupName = aniFile.Anime_GroupName;
contract.GroupNameShort = aniFile.Anime_GroupNameShort;
contract.NormalEpisodeNumbers = new List<int>();
if (animeEp.EpisodeTypeEnum == enEpisodeType.Episode)
{
if (!contract.NormalEpisodeNumbers.Contains(anidbEp.EpisodeNumber))
contract.NormalEpisodeNumbers.Add(anidbEp.EpisodeNumber);
}
vidQuals.Add(contract);
}
}
else
{
// look at the Video Info record
VideoInfo vinfo = vid.VideoInfo;
if (vinfo != null)
{
bool foundSummaryRecord = false;
foreach (Contract_GroupFileSummary contract in vidQuals)
{
if (contract.GroupName.Equals("NO GROUP INFO", StringComparison.InvariantCultureIgnoreCase))
{
foundSummaryRecord = true;
if (animeEp.EpisodeTypeEnum == enEpisodeType.Episode) contract.FileCountNormal++;
if (animeEp.EpisodeTypeEnum == enEpisodeType.Special) contract.FileCountSpecials++;
contract.TotalFileSize += vinfo.FileSize;
contract.TotalRunningTime += vinfo.Duration;
if (animeEp.EpisodeTypeEnum == enEpisodeType.Episode)
{
//.........这里部分代码省略.........
示例6: GetFilesByGroupAndResolution
public List<Contract_VideoDetailed> GetFilesByGroupAndResolution(int animeID, string relGroupName, string resolution, string videoSource, int videoBitDepth, int userID)
{
List<Contract_VideoDetailed> vids = new List<Contract_VideoDetailed>();
List<Contract_GroupVideoQuality> vidQuals = new List<Contract_GroupVideoQuality>();
AniDB_AnimeRepository repAnime = new AniDB_AnimeRepository();
AnimeSeriesRepository repSeries = new AnimeSeriesRepository();
VideoLocalRepository repVids = new VideoLocalRepository();
AniDB_FileRepository repAniFile = new AniDB_FileRepository();
try
{
AniDB_Anime anime = repAnime.GetByAnimeID(animeID);
if (anime == null) return vids;
foreach (VideoLocal vid in repVids.GetByAniDBAnimeID(animeID))
{
int thisBitDepth = 8;
VideoInfo vidInfo = vid.VideoInfo;
if (vidInfo != null)
{
int bitDepth = 0;
if (int.TryParse(vidInfo.VideoBitDepth, out bitDepth))
thisBitDepth = bitDepth;
}
List<AnimeEpisode> eps = vid.GetAnimeEpisodes();
if (eps.Count == 0) continue;
AnimeEpisode animeEp = eps[0];
if (animeEp.EpisodeTypeEnum == enEpisodeType.Episode || animeEp.EpisodeTypeEnum == enEpisodeType.Special)
{
// get the anibd file info
AniDB_File aniFile = vid.GetAniDBFile();
if (aniFile != null)
{
videoSource = SimplifyVideoSource(videoSource);
string fileSource = SimplifyVideoSource(aniFile.File_Source);
string vidResAniFile = Utils.GetStandardisedVideoResolution(aniFile.File_VideoResolution);
// match based on group / video sorce / video res
if (relGroupName.Equals(aniFile.Anime_GroupName, StringComparison.InvariantCultureIgnoreCase) &&
videoSource.Equals(fileSource, StringComparison.InvariantCultureIgnoreCase) &&
resolution.Equals(vidResAniFile, StringComparison.InvariantCultureIgnoreCase) &&
thisBitDepth == videoBitDepth)
{
vids.Add(vid.ToContractDetailed(userID));
}
}
else
{
string vidResInfo = Utils.GetStandardisedVideoResolution(vidInfo.VideoResolution);
// match based on group / video sorce / video res
if (relGroupName.Equals(Constants.NO_GROUP_INFO, StringComparison.InvariantCultureIgnoreCase) &&
videoSource.Equals(Constants.NO_SOURCE_INFO, StringComparison.InvariantCultureIgnoreCase) &&
resolution.Equals(vidResInfo, StringComparison.InvariantCultureIgnoreCase) &&
thisBitDepth == videoBitDepth)
{
vids.Add(vid.ToContractDetailed(userID));
}
}
}
}
return vids;
}
catch (Exception ex)
{
logger.ErrorException(ex.ToString(), ex);
return vids;
}
}
示例7: GetFilesByGroup
public List<Contract_VideoDetailed> GetFilesByGroup(int animeID, string relGroupName, int userID)
{
List<Contract_VideoDetailed> vids = new List<Contract_VideoDetailed>();
List<Contract_GroupVideoQuality> vidQuals = new List<Contract_GroupVideoQuality>();
AniDB_AnimeRepository repAnime = new AniDB_AnimeRepository();
VideoLocalRepository repVids = new VideoLocalRepository();
try
{
AniDB_Anime anime = repAnime.GetByAnimeID(animeID);
if (anime == null) return vids;
foreach (VideoLocal vid in repVids.GetByAniDBAnimeID(animeID))
{
List<AnimeEpisode> eps = vid.GetAnimeEpisodes();
if (eps.Count == 0) continue;
AnimeEpisode animeEp = eps[0];
if (animeEp.EpisodeTypeEnum == enEpisodeType.Episode || animeEp.EpisodeTypeEnum == enEpisodeType.Special)
{
// get the anibd file info
AniDB_File aniFile = vid.GetAniDBFile();
if (aniFile != null)
{
// match based on group / video sorce / video res
if (relGroupName.Equals(aniFile.Anime_GroupName, StringComparison.InvariantCultureIgnoreCase))
{
vids.Add(vid.ToContractDetailed(userID));
}
}
else
{
if (relGroupName.Equals(Constants.NO_GROUP_INFO, StringComparison.InvariantCultureIgnoreCase))
{
vids.Add(vid.ToContractDetailed(userID));
}
}
}
}
return vids;
}
catch (Exception ex)
{
logger.ErrorException(ex.ToString(), ex);
return vids;
}
}
示例8: GetEpisodesForSeries
public List<Contract_AnimeEpisode> GetEpisodesForSeries(int animeSeriesID, int userID)
{
List<Contract_AnimeEpisode> eps = new List<Contract_AnimeEpisode>();
try
{
DateTime start = DateTime.Now;
AnimeEpisodeRepository repEps = new AnimeEpisodeRepository();
AnimeEpisode_UserRepository repEpUsers = new AnimeEpisode_UserRepository();
AnimeSeriesRepository repAnimeSer = new AnimeSeriesRepository();
VideoLocalRepository repVids = new VideoLocalRepository();
CrossRef_File_EpisodeRepository repCrossRefs = new CrossRef_File_EpisodeRepository();
// get all the data first
// we do this to reduce the amount of database calls, which makes it a lot faster
AnimeSeries series = repAnimeSer.GetByID(animeSeriesID);
if (series == null) return eps;
List<AnimeEpisode> epList = repEps.GetBySeriesID(animeSeriesID);
List<AnimeEpisode_User> userRecordList = repEpUsers.GetByUserIDAndSeriesID(userID, animeSeriesID);
Dictionary<int, AnimeEpisode_User> dictUserRecords = new Dictionary<int, AnimeEpisode_User>();
foreach (AnimeEpisode_User epuser in userRecordList)
dictUserRecords[epuser.AnimeEpisodeID] = epuser;
AniDB_EpisodeRepository repAniEps = new AniDB_EpisodeRepository();
List<AniDB_Episode> aniEpList = repAniEps.GetByAnimeID(series.AniDB_ID);
Dictionary<int, AniDB_Episode> dictAniEps = new Dictionary<int, AniDB_Episode>();
foreach (AniDB_Episode aniep in aniEpList)
dictAniEps[aniep.EpisodeID] = aniep;
// get all the video local records and cross refs
List<VideoLocal> vids = repVids.GetByAniDBAnimeID(series.AniDB_ID);
List<CrossRef_File_Episode> crossRefs = repCrossRefs.GetByAnimeID(series.AniDB_ID);
TimeSpan ts = DateTime.Now - start;
logger.Info("GetEpisodesForSeries: {0} (Database) in {1} ms", series.GetAnime().MainTitle, ts.TotalMilliseconds);
start = DateTime.Now;
foreach (AnimeEpisode ep in epList)
{
if (dictAniEps.ContainsKey(ep.AniDB_EpisodeID))
{
List<VideoLocal> epVids = new List<VideoLocal>();
foreach (CrossRef_File_Episode xref in crossRefs)
{
if (xref.EpisodeID == dictAniEps[ep.AniDB_EpisodeID].EpisodeID)
{
// don't add the same file twice, this will occur when
// one file appears over more than one episodes
Dictionary<string, string> addedFiles = new Dictionary<string, string>();
foreach (VideoLocal vl in vids)
{
if (string.Equals(xref.Hash, vl.Hash, StringComparison.InvariantCultureIgnoreCase))
{
if (!addedFiles.ContainsKey(xref.Hash.Trim().ToUpper()))
{
addedFiles[xref.Hash.Trim().ToUpper()] = xref.Hash.Trim().ToUpper();
epVids.Add(vl);
}
}
}
}
}
AnimeEpisode_User epuser = null;
if (dictUserRecords.ContainsKey(ep.AnimeEpisodeID))
epuser = dictUserRecords[ep.AnimeEpisodeID];
eps.Add(ep.ToContract(dictAniEps[ep.AniDB_EpisodeID], epVids, epuser, null));
}
}
ts = DateTime.Now - start;
logger.Info("GetEpisodesForSeries: {0} (Contracts) in {1} ms", series.GetAnime().MainTitle, ts.TotalMilliseconds);
}
catch (Exception ex)
{
logger.ErrorException(ex.ToString(), ex);
}
return eps;
}
示例9: UpdateUsingGroup
public void UpdateUsingGroup(ISession session, int animeGroupID)
{
try
{
DateTime start = DateTime.Now;
AnimeGroupRepository repGroups = new AnimeGroupRepository();
AnimeGroup thisgrp = repGroups.GetByID(session, animeGroupID);
if (thisgrp == null) return;
AdhocRepository repAdHoc = new AdhocRepository();
// get a list of all the groups including this one and everthing above it the heirarchy
List<AnimeGroup> allgroups = new List<AnimeGroup>();
allgroups.Add(thisgrp);
int? groupID = thisgrp.AnimeGroupParentID;
while (groupID.HasValue)
{
AnimeGroup grpTemp = repGroups.GetByID(session, groupID.Value);
if (grpTemp != null)
{
allgroups.Add(grpTemp);
groupID = grpTemp.AnimeGroupParentID;
}
else
groupID = null;
}
TimeSpan ts = DateTime.Now - start;
logger.Trace("Updating cached stats for GROUP - STEP 1 ({0}) in {1} ms", thisgrp.GroupName, ts.TotalMilliseconds);
start = DateTime.Now;
VideoLocalRepository repVids = new VideoLocalRepository();
CrossRef_File_EpisodeRepository repXrefs = new CrossRef_File_EpisodeRepository();
foreach (AnimeGroup grp in allgroups)
{
StatGroupCategories[grp.AnimeGroupID] = grp.CategoriesString;
StatGroupTitles[grp.AnimeGroupID] = grp.TitlesString;
StatGroupVideoQuality[grp.AnimeGroupID] = grp.VideoQualityString;
ts = DateTime.Now - start;
logger.Trace("Updating cached stats for GROUP - STEP 2 ({0}) in {1} ms", grp.GroupName, ts.TotalMilliseconds);
start = DateTime.Now;
DateTime? airDate_Min = null;
DateTime? airDate_Max = null;
DateTime? endDate = new DateTime(1980, 1, 1);
DateTime? seriesCreatedDate = null;
bool isComplete = false;
bool hasFinishedAiring = false;
bool isCurrentlyAiring = false;
string videoQualityEpisodes = "";
List<string> audioLanguages = new List<string>();
List<string> subtitleLanguages = new List<string>();
bool hasTvDB = true;
bool hasMAL = true;
bool hasMovieDB = true;
bool hasMovieDBOrTvDB = true;
int seriesCount = 0;
int epCount = 0;
foreach (AnimeSeries series in grp.GetAllSeries(session))
{
seriesCount++;
List<VideoLocal> vidsTemp = repVids.GetByAniDBAnimeID(session, series.AniDB_ID);
List<CrossRef_File_Episode> crossRefs = repXrefs.GetByAnimeID(session, series.AniDB_ID);
Dictionary<int, List<CrossRef_File_Episode>> dictCrossRefs = new Dictionary<int, List<CrossRef_File_Episode>>();
foreach (CrossRef_File_Episode xref in crossRefs)
{
if (!dictCrossRefs.ContainsKey(xref.EpisodeID))
dictCrossRefs[xref.EpisodeID] = new List<CrossRef_File_Episode>();
dictCrossRefs[xref.EpisodeID].Add(xref);
}
Dictionary<string, VideoLocal> dictVids = new Dictionary<string, VideoLocal>();
foreach (VideoLocal vid in vidsTemp)
dictVids[vid.Hash] = vid;
// All Video Quality Episodes
// Try to determine if this anime has all the episodes available at a certain video quality
// e.g. the series has all episodes in blu-ray
// Also look at languages
Dictionary<string, int> vidQualEpCounts = new Dictionary<string,int>(); // video quality, count of episodes
foreach (AnimeEpisode ep in series.GetAnimeEpisodes(session))
{
if (ep.EpisodeTypeEnum != AniDBAPI.enEpisodeType.Episode) continue;
List<VideoLocal> epVids = new List<VideoLocal>();
if (dictCrossRefs.ContainsKey(ep.AniDB_EpisodeID))
//.........这里部分代码省略.........