public Playlist GetPlaylistfromPath(string path) { using (var db = new SQLiteConnection(Tables.DBPath)) { try { if (db.Table <Library.TableModels.Playlist>().Any()) { Playlist m3 = PluginCore.Instance() .GetPlaylist( new FileInfo(db.Table <Library.TableModels.Playlist>().Where(c => c.Path == path).First().Path).Extension.ToLower ()); m3.ID = db.Table <Library.TableModels.Playlist>().First().ID; m3.Path = db.Table <Library.TableModels.Playlist>().First().Path; CPlaylistID = m3.ID; return(m3); } } catch { } } return(null); }
public void RemovePlaylist(Playlist ipl) { using (var db = new SQLiteConnection(Tables.DBPath)) { if (ipl != null) { var p = new Library.TableModels.Playlist(); p.ID = ipl.ID; p.Path = ipl.Path; db.Delete(p); } } }
public IEnumerable <Playlist> GetAllPlaylists() { using (var db = new SQLiteConnection(Tables.DBPath)) { if (db.Table <Library.TableModels.Playlist>().Any()) { foreach (Library.TableModels.Playlist v in db.Table <Library.TableModels.Playlist>()) { if (v.Path != null) { Playlist m3 = PluginCore.Instance().GetPlaylist(new FileInfo(v.Path).Extension.ToLower()); m3.Path = v.Path; m3.ID = v.ID; m3.Name = v.Name; CPlaylistID = m3.ID; yield return(m3); } } } } }
public Playlist GetFirst() { using (var db = new SQLiteConnection(Tables.DBPath)) { try { if (db.Table <Library.TableModels.Playlist>().Any()) { var ext = new FileInfo(db.Table <Library.TableModels.Playlist>().First().Path).Extension.ToLower(); Playlist m3 = PluginCore.Instance().GetPlaylist(ext); m3.Path = db.Table <Library.TableModels.Playlist>().First().Path; m3.ID = db.Table <Library.TableModels.Playlist>().First().ID; CPlaylistID = m3.ID; return(m3); } } catch { } } return(null); }