Beispiel #1
0
        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();
        }
Beispiel #2
0
        public override void Reload()
        {
            _filteredList.Clear();
            List <CueSheet> s = MySource.getSheets();
            int             i, N;
            string          artist = "";

            if (_artist != null)
            {
                artist = Loosely.prepare(_artist.Name);
            }
            string composer = "";

            if (_composer != null)
            {
                composer = Loosely.prepare(_composer.Name);
            }
            for (i = 0, N = s.Count; i < N; i++)
            {
                bool do_add = true;
                if (_genre != null)
                {
                    if (s[i].genre() != _genre.Genre)
                    {
                        do_add = false;
                    }
                }
                if (_artist != null && do_add)
                {
                    if (!Loosely.eqp(artist, s[i].performer()))
                    {
                        do_add = false;
                    }
                }
                if (_composer != null && do_add)
                {
                    if (!Loosely.eqp(composer, s[i].composer()))
                    {
                        do_add = false;
                    }
                }
                if (_album_search != null && do_add)
                {
                    if (!s[i].title().ToLower().Contains(_album_search) &&
                        !s[i].performer().ToLower().Contains(_album_search) &&
                        !s[i].composer().ToLower().Contains(_album_search))
                    {
                        if (_also_in_tracks)
                        {
                            CueSheet q = s[i];
                            int      k, M;
                            bool     can_add = false;
                            for (k = 0, M = q.nEntries(); k < M && !can_add; k++)
                            {
                                CueSheetEntry e = q.entry(k);
                                if (e.title().ToLower().Contains(_album_search) ||
                                    e.performer().ToLower().Contains(_album_search) ||
                                    e.getComposer().ToLower().Contains(_album_search))
                                {
                                    can_add = true;
                                }
                            }
                            do_add = can_add;
                        }
                        else
                        {
                            do_add = false;
                        }
                    }
                }

                if (do_add)
                {
                    _filteredList.Add(new CS_AlbumInfo(s[i]));
                }
            }
            _filteredList.Sort(new CS_AlbumInfo.Comparer());
            base.RaiseReloaded();
        }