blob: a6186341e94cf4aa0abcb20c9309baba116fff52 (
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
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
|
using System;
using Banshee.Collection;
using System.Collections.Generic;
namespace Banshee.CueSheets
{
public class CS_ComposerModel : BansheeListModel<CS_ComposerInfo>
{
private CueSheetsSource MySource;
private List<CS_ComposerInfo> _composers;
private CS_ComposerInfo _nullComposer;
private GenreInfo _genre;
private ArtistInfo _artist;
public CS_ComposerModel (CueSheetsSource s) {
MySource=s;
_nullComposer=new CS_ComposerInfo (null);
_composers=new List<CS_ComposerInfo>();
Selection=new Hyena.Collections.Selection();
}
public override void Clear () {
// Does nothing
}
private bool exists(string artist) {
int i,N;
for(i=0,N=_composers.Count;i<N && !Loosely.eq (_composers[i].Name,artist);i++);
return i<N;
}
public override void Reload () {
HashSet<string> added=new HashSet<String>();
_composers.Clear ();
List<CueSheet> s=MySource.getSheets ();
_composers.Add(_nullComposer);
string artist="";
if (_artist!=null) { artist=Loosely.prepare(_artist.Name); }
for(int i=0;i<s.Count;i++) {
string comp=Loosely.prepare (s[i].composer ());
if (!added.Contains (comp)) {
bool do_add=true;
if (_genre!=null) {
if (s[i].genre ()!=_genre.Genre) { do_add=false; }
}
if (_artist!=null) {
if (!Loosely.eqp (artist,s[i].performer ())) { do_add=false; }
}
if (do_add) {
CS_ComposerInfo a=new CS_ComposerInfo (s[i]);
_composers.Add (a);
added.Add (comp);
}
}
}
_composers.Sort (new CS_ComposerInfo.Comparer());
base.RaiseReloaded ();
}
public bool isNullComposer(CS_ComposerInfo a) {
CS_ComposerInfo aa=(CS_ComposerInfo) a;
return aa.getCueSheet ()==null;
}
public override int Count {
get {
return _composers.Count;
}
}
public void filterGenre(GenreInfo g) {
_genre=g;
Reload ();
}
public void filterArtist(ArtistInfo g) {
_artist=g;
Reload ();
}
public override CS_ComposerInfo this[int index] {
get {
return _composers[index];
}
}
}
}
|