// // GET: /Artist/Details/5 public ActionResult Details(int id = invalidId) { if (id == invalidId) { return(HttpNotFound()); } WebHelper.VerifyUserAgent(Request); var model = queries.GetDetails(id, GetHostnameForValidHit()); var hasDescription = !model.Description.IsEmpty; var prop = PageProperties; prop.GlobalSearchType = EntryType.Artist; prop.Title = model.Name; prop.Subtitle = string.Format("({0})", Translate.ArtistTypeName(model.ArtistType)); prop.Description = new ArtistDescriptionGenerator().GenerateDescription(model, markdownParser.GetPlainText(model.Description.EnglishOrOriginal), Translate.ArtistTypeNames); prop.CanonicalUrl = UrlMapper.FullAbsolute(Url.Action("Details", new { id })); prop.OpenGraph.Image = Url.ImageThumb(model, Model.Domain.Images.ImageSize.Original, fullUrl: true); prop.OpenGraph.Title = hasDescription ? string.Format("{0} ({1})", model.Name, Translate.ArtistTypeName(model.ArtistType)) : model.Name; prop.OpenGraph.ShowTwitterCard = true; return(View(model)); }
public ActionResult GetSongsPerVoicebankTypeOverTime(DateTime?cutoff, ArtistType[] vocalistTypes = null, int startYear = 2007) { if (vocalistTypes == null) { vocalistTypes = new[] { ArtistType.Vocaloid, ArtistType.UTAU, ArtistType.CeVIO, ArtistType.OtherVoiceSynthesizer } } ; var data = queries.GetSongsPerVoicebankTypeOverTime(cutoff, vocalistTypes, startYear); var dataSeries = data .Select(ser => new Series { Name = Translate.ArtistTypeName(ser.Key), Data = Series.DateData(ser, p => p.Item1, p => p.Item3) }) .ToArray(); return(AreaChart("Songs per vocalist type over time", dataSeries)); }
public ActionResult GetSongsPerVoicebankTypeOverTime(DateTime?cutoff, ArtistType[] vocalistTypes = null, int startYear = 2007) { if (vocalistTypes == null) { vocalistTypes = new[] { ArtistType.Vocaloid, ArtistType.UTAU, ArtistType.CeVIO, ArtistType.OtherVoiceSynthesizer } } ; var data = repository.HandleQuery(ctx => { // Note: the same song may be included multiple times for different artists var points = ctx.Query <ArtistForSong>() .Where(s => !s.Song.Deleted && s.Song.PublishDate.DateTime != null && s.Song.PublishDate.DateTime.Value.Year >= startYear && vocalistTypes.Contains(s.Artist.ArtistType)) .FilterIfNotNull(cutoff, s => s.Song.PublishDate.DateTime > cutoff) .OrderBy(a => a.Song.PublishDate.DateTime.Value.Year) .GroupBy(s => new { s.Song.PublishDate.DateTime.Value.Year, s.Song.PublishDate.DateTime.Value.Month, ArtistType = s.Artist.ArtistType }) .Select(s => new { s.Key.Year, s.Key.Month, s.Key.ArtistType, Count = s.Count() }) .ToArray() .Select(s => new { Date = new DateTime(s.Year, s.Month, 1), s.ArtistType, s.Count }) .GroupBy(s => s.ArtistType) .ToArray(); return(points); }); var dataSeries = data.Select(ser => new Series { Name = Translate.ArtistTypeName(ser.Key), Data = Series.DateData(ser, p => p.Date, p => p.Count) }).ToArray(); return(AreaChart("Songs per vocalist type over time", dataSeries)); }