private string GetNicoMimiUrl(SongDetailsContract contract) { // Don't show nicomimi link for free songs. if (contract.Tags.Any(t => t.TagName.Equals(Model.Domain.Tags.Tag.CommonTag_Free, StringComparison.InvariantCultureIgnoreCase) || t.TagName.Equals(Model.Domain.Tags.Tag.CommonTag_Nicovideo_downloadmusic, StringComparison.InvariantCultureIgnoreCase))) { return(string.Empty); } var nicoId = contract.Song.NicoId; var nicoPvId = PVHelper.GetNicoId(contract.PVs, nicoId); if (!string.IsNullOrEmpty(nicoPvId)) { return(string.Format("http://www.nicomimi.net/play/{0}", nicoPvId)); } else { return(string.Empty); } }
public SongDetails(SongDetailsContract contract) { ParamIs.NotNull(() => contract); AdditionalNames = contract.AdditionalNames; Albums = contract.Albums; AlternateVersions = contract.AlternateVersions.Where(a => a.SongType != SongType.Original).ToArray(); ArtistString = contract.ArtistString; CanEdit = EntryPermissionManager.CanEdit(MvcApplication.LoginManager, contract.Song); CommentCount = contract.CommentCount; CreateDate = contract.CreateDate; Deleted = contract.Deleted; Draft = contract.Song.Status == EntryStatus.Draft; FavoritedTimes = contract.Song.FavoritedTimes; Hits = contract.Hits; Id = contract.Song.Id; IsFavorited = contract.UserRating != SongVoteRating.Nothing; LatestComments = contract.LatestComments; LikedTimes = contract.LikeCount; Lyrics = contract.LyricsFromParents; Name = contract.Song.Name; NicoId = contract.Song.NicoId; Notes = contract.Notes; OriginalVersion = (contract.Song.SongType != SongType.Original ? contract.OriginalVersion : null); Pools = contract.Pools; RatingScore = contract.Song.RatingScore; SongType = contract.Song.SongType; Status = contract.Song.Status; Tags = contract.Tags; UserRating = contract.UserRating; WebLinks = contract.WebLinks.ToList(); Animators = contract.Artists.Where(a => a.Categories.HasFlag(ArtistCategories.Animator)).ToArray(); Performers = contract.Artists.Where(a => a.Categories.HasFlag(ArtistCategories.Vocalist)).ToArray(); Producers = contract.Artists.Where(a => a.Categories.HasFlag(ArtistCategories.Producer)).ToArray(); OtherArtists = contract.Artists.Where(a => a.Categories.HasFlag(ArtistCategories.Circle) || a.Categories.HasFlag(ArtistCategories.Label) || a.Categories.HasFlag(ArtistCategories.Other)).ToArray(); var pvs = contract.PVs; OriginalPVs = pvs.Where(p => p.PVType == PVType.Original).ToArray(); OtherPVs = pvs.Where(p => p.PVType != PVType.Original).ToArray(); PrimaryPV = PVHelper.PrimaryPV(pvs); if (PrimaryPV == null && !string.IsNullOrEmpty(NicoId)) { PrimaryPV = new PVContract { PVId = NicoId, Service = PVService.NicoNicoDouga } } ; var nicoPvId = PVHelper.GetNicoId(pvs, NicoId); if (!string.IsNullOrEmpty(nicoPvId)) { WebLinks.Add(new WebLinkContract(VideoServiceUrlFactory.NicoSound.CreateUrl(nicoPvId), ViewRes.Song.DetailsStrings.CheckNicoSound, WebLinkCategory.Other)); } if (pvs.All(p => p.Service != PVService.Youtube)) { var nicoPV = VideoServiceHelper.PrimaryPV(pvs, PVService.NicoNicoDouga); var query = (nicoPV != null && !string.IsNullOrEmpty(nicoPV.Name)) ? nicoPV.Name : string.Format("{0} {1}", ArtistString, Name); WebLinks.Add(new WebLinkContract(string.Format("http://www.youtube.com/results?search_query={0}", query), ViewRes.Song.DetailsStrings.SearchYoutube, WebLinkCategory.Other)); } }