public void AddMedia(PlaylistMedia media) { int playlist_id = GetPlaylistID (media.Playlist); if (playlist_id > -1) addMedia (media, -1, playlist_id); }
// add media to the playlist public void AddMedia(string path, Playlist playlist) { PlaylistMedia media = new PlaylistMedia (path, playlist); if (media.LoadTag ()) { playlist.MediaList.Add (media); AddMedia (media); data_manager.AddMedia (media); } }
/// <summary> /// Retrieves all the media from the database. /// </summary> public void LoadMedia(Playlist playlist) { int playlist_id = GetPlaylistID (playlist); StringBuilder sb = new StringBuilder (); sb.AppendFormat ("SELECT path,artist,title,album,comment,year,track_number,track_count,duration FROM media WHERE playlist_id={0}", parse(playlist_id)); ExecuteQuery (sb.ToString (), delegate (IDataReader reader) { while (reader.Read ()) { string path = reader.GetString (0); string artist = reader.GetString (1); string title = reader.GetString (2); string album = reader.GetString (3); string comment = reader.GetString (4); int year = reader.GetInt32 (5); int track_number = reader.GetInt32 (6); int track_count = reader.GetInt32 (7); TimeSpan duration = TimeSpan.FromSeconds (reader.GetDouble (8)); PlaylistMedia media = new PlaylistMedia (path, playlist); media.Artist = artist; media.Title = title; media.Album = album; media.Comment = comment; media.Year = year; media.TrackNumber = track_number; media.TrackCount = track_count; media.Duration = duration; playlist.MediaList.Add (media); } }); }