コード例 #1
0
        public MainWindow()
        {
            InitializeComponent();

            var config = Configuration.DefaultVideoLibraryConfig;
            config.RootPath = @"C:\ProgramData\MediaBrowser\StartupFolder";

            library = Library.Initialize(config);
            var rootItem = library.GetRootItems()[0] as Folder;
            currentFolder.ItemsSource = rootItem.Children;
            currentFolder.DisplayMemberPath = "Name";
        }
コード例 #2
0
        public Item CreateItem(IMediaLocation location, Library library)
        {
            Item item = null;

            var folderLocation = location as IFolderMediaLocation;
            if (folderLocation != null) {

                // check for HDDVD,DVD,BluRay

                // check for movie
                int videoCount = 0;
                int childFolderCount = 0;
                foreach (var childLocation in folderLocation.Children) {
                    videoCount += childLocation.IsVideo() ? 1 : 0;
                    childFolderCount += childLocation is IFolderMediaLocation ? 1 : 0;
                    // TODO: config setting
                    if (videoCount > 2 || childFolderCount > 0) break;
                }

                if (videoCount <= 2 && childFolderCount == 0) {
                    item = new Movie();
                } else {
                    var folder = new Folder();
                    folder.Location = folderLocation;
                    item = folder;
                }
            }
            else if (location.IsVideo() ) {
                item = new Movie();
            }

            if (item != null) {
                item.Library = library;
                item.Name = Path.GetFileNameWithoutExtension(location.Path);
                item.Uri = location.Path;
            }

            return item;
        }
コード例 #3
0
 public IMediaLocation CreateMediaLocation(string path, Library library)
 {
     throw new NotImplementedException();
 }