private NicoTitleParseResult ParseNicoPV(IRepositoryContext <PVForSong> ctx, VideoUrlParseResult res) { if (res == null || !res.IsOk) { return(null); } var titleParseResult = NicoHelper.ParseTitle(res.Title, a => GetArtist(a, ctx, AppConfig.PreferredNicoArtistTypes)); if (!string.IsNullOrEmpty(titleParseResult.Title)) { titleParseResult.TitleLanguage = languageDetector.Detect(titleParseResult.Title, ContentLanguageSelection.Unspecified); } if (!string.IsNullOrEmpty(res.AuthorId)) { var authorPage = string.Format("http://www.nicovideo.jp/user/{0}", res.AuthorId); var author = ctx.OfType <ArtistWebLink>().Query() .Where(w => w.Url == authorPage && !w.Artist.Deleted) .Select(w => w.Artist) .FirstOrDefault(); if (author != null) { titleParseResult.Artists.Add(author); } } return(titleParseResult); }
private NicoTitleParseResult ParseNicoPV(IDatabaseContext <PVForSong> ctx, VideoUrlParseResult res) { if (res == null || !res.IsOk) { return(null); } var titleParseResult = NicoHelper.ParseTitle(res.Title, a => GetArtist(a, ctx, AppConfig.PreferredNicoArtistTypes)); if (!string.IsNullOrEmpty(titleParseResult.Title)) { titleParseResult.TitleLanguage = languageDetector.Detect(titleParseResult.Title, ContentLanguageSelection.Unspecified); } if (titleParseResult.SongType == SongType.Unspecified) { titleParseResult.SongType = HasCoverTag(ctx, res) ? SongType.Cover : SongType.Original; } if (!string.IsNullOrEmpty(res.AuthorId)) { var authorPage = NicoHelper.GetUserProfileUrlById(res.AuthorId); var author = ctx.OfType <ArtistWebLink>().Query() .Where(w => w.Url == authorPage && !w.Entry.Deleted) .Select(w => w.Entry) .FirstOrDefault(); if (author != null && !titleParseResult.Artists.Contains(author)) { titleParseResult.Artists.Add(author); } } return(titleParseResult); }
public LanguageDetectorResult Detect(ISourceRepo sourceRepo) { return(_detector.Detect(sourceRepo)); }
public LanguageDetectorResult Detect(RepositoryContext context) { return(_detector?.Detect(context)); }
public LanguageDetectorResult Detect(BuildScriptGeneratorContext context) { return(_detector?.Detect(context)); }