summaryrefslogtreecommitdiff
path: root/src/CueSheets/Banshee.CueSheets/Playlists/CS_PlayListCollection.cs
blob: 56f7b39c7547aa072ebdcbc3e952efd7f9cc4b4b (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
using System;
using System.Collections.Generic;

namespace Banshee.CueSheets
{
	public class CS_PlayListCollection : List<CS_PlayList>
	{
		private CS_TrackInfoDb		_db;
		private CueSheetCollection 	_csc;
		
		public CS_PlayListCollection (CS_TrackInfoDb db,CueSheetCollection csc) {
			_csc=csc;
			_db=db;
		}
		
		public void Load() {
			Reload ();			
		}
		
		public void Reload() {
			base.Clear ();
			List<string> keys=_db.getKeysStartingWith("playlist:");
			foreach (string key in keys) {
				Hyena.Log.Information ("adding key"+key);
				string name=key.Substring(9);
				CS_PlayList pl=new CS_PlayList(_db,name,_csc);
				Add (pl);
			}
			base.Sort (new CS_PlayList.Comparer());
		}
		
		public CS_PlayList NewPlayList(string name) {
			CS_PlayList pls=new CS_PlayList(_db,name,_csc);
			pls.Save ();
			return pls;
		}
	}
}