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 static AudioStream CreateAudioStream(Path path, string label, MPDSongResponseBlock block) { AudioStream result = new AudioStream(path, label); result.Title = block.Title; result.Name = block.Name; return result; }
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 AudioStream CreateAudioStream(Path path, string label, MPDSongResponseBlock block) { AudioStream result = new AudioStream(path, label); result.Title = block.Title; result.Name = block.Name; return(result); }
public static Link CreateLink(Path path, MPDSongResponseBlock block) { Link result = new Link(path); result.Title = block.Title; result.Artist = block.Artist; result.Album = block.Album; result.Date = block.Date; return result; }
public static Link CreateLink(Path path, MPDSongResponseBlock block) { Link result = new Link(path); result.Title = block.Title; result.Artist = block.Artist; result.Album = block.Album; result.Date = block.Date; return(result); }
public static Playable FetchSongOrCreateLink(Path path, MPDSongResponseBlock block, Database database) { Song song = null; if (database.Songs.TryGetValue(path, out song)) { return(song); } else { return(CreateLink(path, block)); } }
public static Song FetchSong(Path path, MPDSongResponseBlock block, Database database) { Song song = null; if (database.Songs.TryGetValue(path, out song)) { return song; } else { throw new Exception("PlayableFactory.FetchSong(): expected to find \"" + block.File + "\" in library, didn't."); } }
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 Song(MPDSongResponseBlock block) { Path = new Path(block.File); Title = block.Title; Length = block.Time; Track = block.Track; Length = block.Time; Filename = Path.Directories.Last(); // These need to be set by the caller as they require external external objects. Artist = null; Album = null; Genre = null; Date = null; Directory = null; }
public Song(MPDSongResponseBlock block) { Path = new Path(block.File); Title = block.Title; Length = block.Time; Track = block.Track; Length = block.Time; LastModified = block.LastModified ?? DateTime.MinValue; // These need to be set by the caller as they require external external objects. Artist = null; Album = null; Genre = null; Date = null; Directory = null; }
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)); } }