public void InitializeFromSong(Song result, ISubsonicService subsonicService) { Artist = result.Artist; Title = result.Title; Uri = result.Type == SubsonicModelTypeEnum.Video ? subsonicService.GetUriForVideoWithId(result.Id) : subsonicService.GetUriForFileWithId(result.Id); CoverArtUrl = subsonicService.GetCoverArtForId(result.CoverArt); PlayingState = PlaylistItemState.NotPlaying; Duration = result.Duration; Type = result.Type == SubsonicModelTypeEnum.Video ? PlaylistItemTypeEnum.Video : PlaylistItemTypeEnum.Audio; }
public static PlaylistItem AsPlaylistItem(this ISongModel songModel, ISubsonicService subsonicService) { var playlistItem = new PlaylistItem { Artist = songModel.Artist, Title = songModel.Name, Duration = songModel.Duration, Uri = songModel.Type == SubsonicModelTypeEnum.Video ? subsonicService.GetUriForVideoWithId(songModel.Id) : subsonicService.GetUriForFileWithId(songModel.Id), CoverArtUrl = subsonicService.GetCoverArtForId(songModel.CoverArt), Type = songModel.Type == SubsonicModelTypeEnum.Video ? PlaylistItemTypeEnum.Video : PlaylistItemTypeEnum.Audio }; return playlistItem; }
public static PlaylistItem AsPlaylistItem(this ISongModel songModel, ISubsonicService subsonicService) { var playlistItem = new PlaylistItem { Artist = songModel.Artist, Title = songModel.Name, Duration = songModel.Duration, Uri = songModel.Type == SubsonicModelTypeEnum.Video ? subsonicService.GetUriForVideoWithId(songModel.Id) : subsonicService.GetUriForFileWithId(songModel.Id), CoverArtUrl = subsonicService.GetCoverArtForId(songModel.CoverArt), Type = songModel.Type == SubsonicModelTypeEnum.Video ? PlaylistItemTypeEnum.Video : PlaylistItemTypeEnum.Audio }; return(playlistItem); }