Ejemplo n.º 1
0
        private void ButtonLibraryShowClick(object sender, RoutedEventArgs e)
        {
            ShowLibraryService.GetLibrary.Load(_projectDetails.GetLibraryPath());

            ShowLibrary addNewShow = new ShowLibrary {
            };

            addNewShow.ShowDialog();
            Shows.GetShowService.Save();
            PopulateTree();
        }
Ejemplo n.º 2
0
 public ShowFilterViewModel(ShowLibrary lib)
 {
     library = lib;
 }
Ejemplo n.º 3
0
 private void ButtonLibrary_Click(object sender, RoutedEventArgs e)
 {
     ShowLibrary?.Invoke(sender, EventArgs.Empty);
 }
Ejemplo n.º 4
0
        /// <summary>
        /// Get Libraries
        /// </summary>
        /// <param name="filter">Library Filter (Optional)</param>
        /// <exception cref="ApplicationException">Invalid Library Exception</exception>
        /// <returns>List of Library Objects</returns>
        public async Task <List <LibraryBase> > Libraries(LibraryFilter filter = null)
        {
            var libraries = new List <LibraryBase>();
            var summary   = await this.plexServerClient.GetLibrariesAsync(this.AccessToken, this.Uri.ToString());

            foreach (var library in summary.Libraries)
            {
                switch (library.Type.ToUpper(CultureInfo.InvariantCulture))
                {
                case "MOVIE":
                    var movieLibrary = new MovieLibrary(this.plexServerClient, this.plexLibraryClient, this);
                    ObjectMapper.Mapper.Map(library, movieLibrary);
                    var movieFilterContainer = await this.plexLibraryClient.GetLibraryFilters(this.AccessToken, this.Uri.ToString(),
                                                                                              library.Key);

                    libraries.Add(movieLibrary);
                    break;

                case "SHOW":
                    var showLibrary = new ShowLibrary(this.plexServerClient, this.plexLibraryClient, this);
                    ObjectMapper.Mapper.Map(library, showLibrary);
                    var showFilterContainer = await this.plexLibraryClient.GetLibraryFilters(this.AccessToken, this.Uri.ToString(),
                                                                                             showLibrary.Key);

                    libraries.Add(showLibrary);
                    break;

                case "ARTIST":
                    var musicLibrary = new MusicLibrary(this.plexServerClient, this.plexLibraryClient, this);
                    ObjectMapper.Mapper.Map(library, musicLibrary);
                    var musicFilterContainer = await this.plexLibraryClient.GetLibraryFilters(this.AccessToken, this.Uri.ToString(),
                                                                                              musicLibrary.Key);

                    libraries.Add(musicLibrary);
                    break;

                case "PHOTO":
                    var photoLibrary = new PhotoLibrary(this.plexServerClient, this.plexLibraryClient, this);
                    ObjectMapper.Mapper.Map(library, photoLibrary);
                    var photoFilterContainer = await this.plexLibraryClient.GetLibraryFilters(this.AccessToken, this.Uri.ToString(),
                                                                                              photoLibrary.Key);

                    libraries.Add(photoLibrary);
                    break;

                default:
                    throw new ApplicationException("Invalid Library Type");
                }
            }

            if (filter != null)
            {
                if (filter.Keys.Count > 0)
                {
                    libraries = libraries
                                .Where(c => filter.Keys.Contains(c.Key, StringComparer.OrdinalIgnoreCase))
                                .ToList();
                }

                if (filter.Titles.Count > 0)
                {
                    libraries = libraries
                                .Where(c => filter.Titles.Contains(c.Title, StringComparer.OrdinalIgnoreCase))
                                .ToList();
                }

                if (filter.Types.Count > 0)
                {
                    libraries = libraries
                                .Where(c => filter.Types.Contains(c.Type, StringComparer.OrdinalIgnoreCase))
                                .ToList();
                }
            }

            return(libraries);
        }