本文整理汇总了C#中JMMServer.Repositories.AniDB_AnimeRepository.SearchByName方法的典型用法代码示例。如果您正苦于以下问题:C# AniDB_AnimeRepository.SearchByName方法的具体用法?C# AniDB_AnimeRepository.SearchByName怎么用?C# AniDB_AnimeRepository.SearchByName使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类JMMServer.Repositories.AniDB_AnimeRepository
的用法示例。
在下文中一共展示了AniDB_AnimeRepository.SearchByName方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Search
public System.IO.Stream Search(string UserId, string limit, string query, bool searchTag)
{
KodiObject ret =new KodiObject(KodiHelper.NewMediaContainer("Search",false));
ret.MediaContainer.Title2 = "Search Results for '" + query + "'...";
AniDB_AnimeRepository repAnime = new AniDB_AnimeRepository();
AnimeSeriesRepository repSeries = new AnimeSeriesRepository();
int lim;
if (!int.TryParse(limit, out lim))
lim = 100;
JMMUser user = KodiHelper.GetUser(UserId);
if (user == null) return new MemoryStream();
List<Video> ls=new List<Video>();
int cnt = 0;
List<AniDB_Anime> animes;
if (searchTag)
{
animes = repAnime.SearchByTag(query);
}
else
{
animes = repAnime.SearchByName(query);
}
foreach (AniDB_Anime anidb_anime in animes)
{
if (!user.AllowedAnime(anidb_anime)) continue;
AnimeSeries ser = repSeries.GetByAnimeID(anidb_anime.AnimeID);
if (ser != null)
{
Contract_AnimeSeries cserie = ser.ToContract(ser.GetUserRecord(user.JMMUserID), true);
Video v = KodiHelper.FromSerieWithPossibleReplacement(cserie, ser, user.JMMUserID);
//proper naming
v.OriginalTitle = "";
foreach (AniDB_Anime_Title title in anidb_anime.GetTitles())
{
if (title.TitleType == "official" || title.TitleType == "main")
{
v.OriginalTitle += "{" + title.TitleType + ":" + title.Language + "}" + title.Title + "|";
}
}
v.OriginalTitle = v.OriginalTitle.Substring(0, v.OriginalTitle.Length - 1);
//proper naming end
//experiment
Characters c = new Characters();
c.CharactersList = new List<Character>();
c.CharactersList = GetCharactersFromAniDB(anidb_anime);
v.CharactersList = new List<Characters>();
v.CharactersList.Add(c);
//experiment END
switch (anidb_anime.AnimeTypeEnum)
{
case enAnimeType.Movie:
v.SourceTitle = "Anime Movies";
break;
case enAnimeType.OVA:
v.SourceTitle = "Anime Ovas";
break;
case enAnimeType.Other:
v.SourceTitle = "Anime Others";
break;
case enAnimeType.TVSeries:
v.SourceTitle = "Anime Series";
break;
case enAnimeType.TVSpecial:
v.SourceTitle = "Anime Specials";
break;
case enAnimeType.Web:
v.SourceTitle = "Anime Web Clips";
break;
}
ls.Add(v);
cnt++;
if (cnt == lim)
break;
}
}
ret.MediaContainer.Childrens= ls;
return ret.GetStream();
}
示例2: 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;
}