public PlaylistItem(MPDSongResponseBlock block, DataModel dataModel) { Path = new Path(block.File); Position = block.Pos; Id = block.Id; if (Path.IsStream()) { Artist = null; Album = null; AudioStream stream = dataModel.StreamsCollection.StreamByPath(Path); if (stream != null) { Title = stream.Label; } else { Title = block.Name ?? Path.ToString(); } } else { Title = block.Title; Album = block.Album; if (Settings.Default.UseAlbumArtist) { Artist = block.AlbumArtist ?? block.Artist; } Artist = block.Artist; } }
public PlaylistItem(MPDSongResponseBlock block, DataModel dataModel) { Path = new Path(block.File); Position = block.Pos; Id = block.Id; if (Path.IsStream()) { Artist = null; Album = null; AudioStream stream = dataModel.StreamsCollection.StreamByPath(Path); if (stream != null) { Title = stream.Label; } else { Title = block.Name ?? Path.ToString(); } } else { Title = block.Title ?? Path.Filename; Album = block.Album; if (Settings.Default.UseAlbumArtist) { Artist = block.AlbumArtist ?? block.Artist; } Artist = block.Artist; } }
public static Playable CreatePlayable(MPDSongResponseBlock block, DataModel dataModel = null) { Path path = new Path(block.File); if (path.IsStream()) { return CreateAudioStream(path, null, block); } else if (dataModel == null || !path.IsLocal()) { return CreateLink(path, block); } return FetchSong(path, block, dataModel.Database); }
public static Playable CreatePlayable(MPDSongResponseBlock block, DataModel dataModel = null) { Path path = new Path(block.File); if (path.IsStream()) { return(CreateAudioStream(path, null, block)); } else if (dataModel != null && path.IsLocal()) { return(FetchSongOrCreateLink(path, block, dataModel.Database)); } else { return(CreateLink(path, block)); } }