public override void Initialise(string sortCriteria, uint?offset = null, uint?count = null) { base.Initialise(sortCriteria, offset, count); HomogenousMap items = GetItems(sortCriteria); foreach (KeyValuePair <object, object> item in items.OrderBy(y => y.Key.ToString())) { try { if (item.Key == null) { continue; } string title = item.Key.ToString(); string key = Id + ":" + title; Add(new MediaLibraryYearItem(key, title, _necessaryMiaTypeIds, _optionalMiaTypeIds, Client)); } catch (Exception ex) { Logger.Error("Item '{0}' could not be added", ex, item.Key); } } }
public override void Initialise(string sortCriteria, uint?offset = null, uint?count = null) { base.Initialise(sortCriteria, offset, count); HomogenousMap items = GetItems(sortCriteria); foreach (var item in items.OrderBy(g => g.Key.ToString())) { try { if (item.Key == null) { continue; } string title = item.Key.ToString(); string key = Id + ":" + title; if (_necessaryMIAs.Contains(MovieAspect.ASPECT_ID)) { Add(new MediaLibraryMovieGenreItem(key, title, new RelationalFilter(GenreAspect.ATTR_GENRE, RelationalOperator.EQ, title), Client)); } else if (_necessaryMIAs.Contains(AudioAspect.ASPECT_ID)) { Add(new MediaLibraryMusicGenreItem(key, title, new RelationalFilter(GenreAspect.ATTR_GENRE, RelationalOperator.EQ, title), Client)); } else if (_necessaryMIAs.Contains(AudioAlbumAspect.ASPECT_ID)) { Add(new MediaLibraryAlbumGenreItem(key, title, new RelationalFilter(GenreAspect.ATTR_GENRE, RelationalOperator.EQ, title), Client)); } else if (_necessaryMIAs.Contains(SeriesAspect.ASPECT_ID)) { Add(new MediaLibrarySeriesGenreItem(key, title, new RelationalFilter(GenreAspect.ATTR_GENRE, RelationalOperator.EQ, title), Client)); } } catch (Exception ex) { Logger.Error("Item '{0}' could not be added", ex, item.Key); } } }