public string GenerateDescription(SongContract song, TranslateableEnum <SongType> songTypeNames)
        {
            var sb = new StringBuilder();

            AddBasicDescription(sb, song, songTypeNames);

            return(sb.ToString());
        }
Esempio n. 2
0
 public WVRListEntryResult(string nicoId, int order, string name, string url, SongContract song)
 {
     NicoId = nicoId;
     Order  = order;
     Name   = name;
     Url    = url;
     Song   = song;
 }
        public FavoriteSongForUserContract(FavoriteSongForUser favoriteSongForUser, ContentLanguagePreference languagePreference)
        {
            ParamIs.NotNull(() => favoriteSongForUser);

            Id     = favoriteSongForUser.Id;
            Rating = favoriteSongForUser.Rating;
            Song   = new SongContract(favoriteSongForUser.Song, languagePreference);
            User   = new UserWithEmailContract(favoriteSongForUser.User);
        }
Esempio n. 4
0
        public SongEditViewModel(SongContract song, IUserPermissionContext permissionContext,
                                 SongForEditContract editedSong = null)
            : this()
        {
            ParamIs.NotNull(() => song);

            Song = song;
            AllowedEntryStatuses = EntryPermissionManager.AllowedEntryStatuses(permissionContext);
            EditedSong           = editedSong;
        }
Esempio n. 5
0
        public SongEdit()
        {
            ArtistLinks     = new List <ArtistForSongContract>();
            Lyrics          = new List <LyricsForSongModel>();
            Names           = new NameManagerEditContract();
            OriginalVersion = new SongContract();
            PVs             = new List <PVContract>();
            WebLinks        = new List <WebLinkDisplay>();

            AllPVTypes       = EnumVal <PVType> .Values;
            AllVideoServices = EnumVal <PVService> .Values;
        }
Esempio n. 6
0
        private async Task <SyndicationItem> CreateFeedItemAsync(SongContract song, Func <SongContract, Task <string> > contentFac, Func <SongContract, string> urlFac)
        {
            var item = new SyndicationItem(song.Name, new TextSyndicationContent(await contentFac(song), TextSyndicationContentKind.Html),
                                           VocaUriBuilder.CreateAbsolute(urlFac(song)), song.Id.ToString(), song.CreateDate);

            item.Summary = new TextSyndicationContent(await contentFac(song), TextSyndicationContentKind.Html);
            if (!string.IsNullOrEmpty(song.ThumbUrl))
            {
                item.ElementExtensions.Add(new XElement(s_mediaNs + "thumbnail", new XAttribute("url", song.ThumbUrl)));
            }

            return(item);
        }
Esempio n. 7
0
        public SongEditViewModel(SongContract song, IUserPermissionContext permissionContext,
                                 bool canDelete,
                                 SongForEditContract editedSong = null, int?albumId = null)
            : this()
        {
            ParamIs.NotNull(() => song);

            Song = song;
            AllowedEntryStatuses = EntryPermissionManager.AllowedEntryStatuses(permissionContext).ToArray();
            CanDelete            = canDelete;
            EditedSong           = editedSong;
            AlbumId = albumId;
        }
Esempio n. 8
0
        public SongOEmbedResponse(SongContract song, int width, int height, string html)
        {
            ParamIs.NotNull(() => song);
            ParamIs.NotNullOrEmpty(() => html);

            author_name   = song.ArtistString;
            thumbnail_url = song.ThumbUrl;
            title         = song.Name;

            this.height = height;
            this.html   = html;
            this.width  = width;
        }
Esempio n. 9
0
        public PartialViewResult CreateSongLink(int?songId)
        {
            SongContract song;

            if (songId == null)
            {
                song = new SongContract();
            }
            else
            {
                song = Service.GetSong(songId.Value);
            }

            return(PartialView("SongLink", song));
        }
Esempio n. 10
0
        private void AddBasicDescription(StringBuilder sb, SongContract song, TranslateableEnum <SongType> songTypeNames)
        {
            var typeName = songTypeNames.GetName(song.SongType, CultureInfo.InvariantCulture);

            sb.Append(typeName);

            if (!string.IsNullOrEmpty(song.ArtistString))
            {
                sb.AppendFormat(" by {0}", song.ArtistString);
            }

            if (song.PublishDate.HasValue)
            {
                sb.AppendFormat(", published {0}", song.PublishDate.Value.ToShortDateString());
            }
        }
Esempio n. 11
0
 public ArtistDetailsContract(Artist artist, ContentLanguagePreference languagePreference)
     : base(artist, languagePreference)
 {
     AllNames       = string.Join(", ", artist.AllNames.Where(n => n != Name));
     CreateDate     = artist.CreateDate;
     Description    = artist.Description;
     Draft          = artist.Status == EntryStatus.Draft;
     FollowCount    = artist.Users.Count;
     Groups         = artist.Groups.Select(g => new GroupForArtistContract(g, languagePreference)).OrderBy(g => g.Group.Name).ToArray();
     TranslatedName = new TranslatedStringContract(artist.TranslatedName);
     LatestAlbums   = new AlbumContract[] {};
     LatestSongs    = new SongContract[] {};
     Members        = artist.Members.Select(m => new GroupForArtistContract(m, languagePreference)).OrderBy(a => a.Member.Name).ToArray();
     OwnerUsers     = artist.OwnerUsers.Select(u => new UserContract(u.User)).ToArray();
     Pictures       = artist.Pictures.Select(p => new EntryPictureFileContract(p)).ToArray();
     Tags           = artist.Tags.Usages.Select(u => new TagUsageContract(u)).OrderByDescending(t => t.Count).ToArray();
     TopAlbums      = new AlbumContract[] {};
     TopSongs       = new SongContract[] {};
     WebLinks       = artist.WebLinks.Select(w => new WebLinkContract(w)).OrderBy(w => w.DescriptionOrUrl).ToArray();
 }
Esempio n. 12
0
 public static object GetRouteParams(SongContract contract, int?albumId = null)
 {
     return(new { id = contract.Id, albumId });
     //return new { id = contract.Id, friendlyName = VocaUrlHelper.GetUrlFriendlyName(contract.TranslatedName) };
 }
Esempio n. 13
0
 public SongLinkViewModel(SongContract song, int?albumId = null, bool tooltip = false)
 {
     Song    = song;
     AlbumId = albumId;
     Tooltip = tooltip;
 }
Esempio n. 14
0
 public SongDetailsContract(Song song, IEnumerable <SongInPoll> songInPolls)
 {
     Song          = new SongContract(song);
     WVRPlacements = songInPolls.Select(s => new SongWVRPlacementContract(s)).ToArray();
 }
Esempio n. 15
0
 public SongIconLinkViewModel(SongContract song, int?albumId = null)
 {
     Song    = song;
     AlbumId = albumId;
 }
Esempio n. 16
0
 public static RouteValueDictionary GetRouteValueDictionary(SongContract contract, int?albumId = null)
 {
     return(new RouteValueDictionary {
         { "id", contract.Id }, { "albumId", albumId }
     });
 }