Exemplo n.º 1
0
 private void ClearWatchedCount()
 {
     OMLApplication.ExecuteSafe(delegate
     {
         TitleCollectionManager.ClearWatchedCount(this.TitleObject);
     });
 }
Exemplo n.º 2
0
        public ResolveGenres(Dictionary <string, string> genreIssueList, Title title)
        {
            InitializeComponent();

            _title = title;
            if (TitleCollectionManager.GetAllGenreMetaDatas().Count() > 0)
            {
                String[] arrGenre = (from gmd in TitleCollectionManager.GetAllGenreMetaDatas()
                                     select gmd.Name).ToArray();

                _genreList.AddRange(arrGenre);
            }

            foreach (string key in genreIssueList.Keys)
            {
                if (String.IsNullOrEmpty(genreIssueList[key]))
                {
                    _genreMapping.Add(new GenreMapping()
                    {
                        SourceGenre = key, DestinationGenre = string.Empty, Action = MapActionEnum.Ignore
                    });
                }
                else
                {
                    _genreMapping.Add(new GenreMapping()
                    {
                        SourceGenre = key, DestinationGenre = genreIssueList[key], Action = MapActionEnum.Map
                    });
                }
            }
            RenderGenreMapping();
        }
Exemplo n.º 3
0
 private void IncrementPlayCount()
 {
     OMLApplication.ExecuteSafe(delegate
     {
         TitleCollectionManager.IncrementWatchedCount(this.TitleObject);
     });
 }
Exemplo n.º 4
0
        public void AddCurrentTitle()
        {
            if (TitleCollectionManager.ContainsDisks(CurrentTitle.Disks))
            {
                OMLApplication.DebugLine("[Setup UI] Skipping title: " + CurrentTitle.Name + " because already in the collection");
                AddInHost.Current.MediaCenterEnvironment.Dialog(CurrentTitle.Name + " was found to already exist in your database and has been skipped.",
                                                                "Skipped Title",
                                                                DialogButtons.Ok,
                                                                2,
                                                                false);
                TotalTitlesSkipped++;
            }
            else
            {
                OMLApplication.DebugLine("[Setup UI] Adding title: " + CurrentTitle.Id);
                //_titleCollection.Add(CurrentTitle);
                TotalTitlesAdded++;
            }
            CurrentTitleIndex++;

            if (TotalTitlesFound > CurrentTitleIndex)
            {
                CurrentTitle = _titles[CurrentTitleIndex];
            }
            else
            {
                AllTitlesProcessed = true;
            }
        }
Exemplo n.º 5
0
        private void loadBackground(object options)
        {
            foreach (FilteredTitleCollection dateAdded in TitleCollectionManager.GetAllDateAddedGrouped(m_filters))
            {
                Library.Code.V3.YearBrowseGroup testGroup2 = new Library.Code.V3.YearBrowseGroup(new List <Title>(dateAdded.Titles));

                testGroup2.Owner        = this;
                testGroup2.Description  = dateAdded.Name;
                testGroup2.DefaultImage = null;// new Image("resx://Library/Library.Resources/Genre_Sample_mystery");
                testGroup2.Invoked     += delegate(object sender, EventArgs args)
                {
                    OMLProperties properties = new OMLProperties();
                    properties.Add("Application", OMLApplication.Current);
                    properties.Add("I18n", I18n.Instance);
                    Command CommandContextPopOverlay = new Command();
                    properties.Add("CommandContextPopOverlay", CommandContextPopOverlay);

                    List <TitleFilter> newFilter = new List <TitleFilter>(m_filters);
                    newFilter.Add(new TitleFilter(TitleFilterType.DateAdded, dateAdded.Name));

                    Library.Code.V3.GalleryPage gallery = new Library.Code.V3.GalleryPage(newFilter, testGroup2.Description);

                    properties.Add("Page", gallery);
                    OMLApplication.Current.Session.GoToPage(@"resx://Library/Library.Resources/V3_GalleryPage", properties);
                };
                testGroup2.ContentLabelTemplate = Library.Code.V3.BrowseGroup.StandardContentLabelTemplate;
                this.m_listContent.Add(testGroup2);
            }

            this.IsBusy = false;
        }
Exemplo n.º 6
0
        public bool CheckOrphanedTitles(out List <Title> OrphanedTitles)
        {
            Dictionary <int, Title> _movieList;

            OrphanedTitles = new List <Title>();

            _movieList = (TitleCollectionManager.GetAllTitles(TitleTypes.Everything)).ToDictionary(k => k.Id);

            foreach (KeyValuePair <int, Title> t in _movieList)
            {
                if (t.Value.ParentTitleId != null)
                {
                    if (!_movieList.ContainsKey((int)t.Value.ParentTitleId))
                    {
                        // Cannot find parent
                        OrphanedTitles.Add(t.Value);
                    }
                }
            }

            if (OrphanedTitles.Count() != 0)
            {
                return(true);
            }
            else
            {
                return(false);
            }
        }
Exemplo n.º 7
0
 public void AddAllCurrentTitles()
 {
     OMLApplication.DebugLine("[Setup] Starting deferred all titles import");
     Application.DeferredInvokeOnWorkerThread(delegate
     {
         OMLApplication.DebugLine("[Setup] AddingAllCurrentTitles Started");
         AddingAllStarted = true;
         for (CurrentTitleIndex = CurrentTitleIndex; TotalTitlesFound > CurrentTitleIndex; CurrentTitleIndex++)
         {
             CurrentTitle = _titles[CurrentTitleIndex];
             if (TitleCollectionManager.ContainsDisks(CurrentTitle.Disks))
             {
                 OMLApplication.DebugLine("[Setup UI] Skipping title: " + CurrentTitle.Name + " because already in the collection");
                 TotalTitlesSkipped++;
             }
             else
             {
                 OMLApplication.DebugLine("[Setup UI] Adding title: " + CurrentTitle.Id);
                 //_titleCollection.Add(CurrentTitle);
                 TotalTitlesAdded++;
             }
         }
     }, delegate
     {
         OMLApplication.DebugLine("[Setup] AddingAllCurrentTitles Completed");
         AddingAllComplete  = true;
         AllTitlesProcessed = true;
         FirePropertyChanged("TotalTitlesAdded");
     }, null);
 }
Exemplo n.º 8
0
        public MovieGallery(List <TitleFilter> filters)
        {
            this.filters = filters;

            if (filters != null && filters.Count != 0)
            {
                // create the title given the list of filters
                StringBuilder sb = new StringBuilder(filters.Count * 10);
                sb.Append(Filter.Home);

                foreach (TitleFilter filter in filters)
                {
                    sb.Append(" > ");
                    if (!string.IsNullOrEmpty(filter.FilterText))
                    {
                        sb.Append(filter.FilterText);
                    }
                    else
                    {
                        sb.Append(filter.FilterType.ToString());
                    }
                }

                _title = sb.ToString();
            }
            else
            {
                _title = Filter.Home;
            }

            Initialize(TitleCollectionManager.GetFilteredTitles(this.filters));
        }
Exemplo n.º 9
0
        public void TEST_GET_ALL_ALPHAINDEX()
        {
            Console.WriteLine("Starting to get all date added values");
            DateTime start = DateTime.Now;

            List <List <Title> > titlesCollection = new List <List <Title> >();

            IEnumerable <FilteredTitleCollection> items = TitleCollectionManager.GetAllAlphaIndex(null);

            List <FilteredTitleCollection> allItems = new List <FilteredTitleCollection>(items);

            foreach (FilteredTitleCollection item in allItems)
            {
                List <Title> list = new List <Title>();

                foreach (Title title in item.Titles)
                {
                    list.Add(title);
                }

                titlesCollection.Add(list);
            }

            Console.WriteLine(string.Format("Done - Took: {0} milliseconds for {1} titles",
                                            (DateTime.Now - start).TotalMilliseconds.ToString(),
                                            titlesCollection.Count));
        }
Exemplo n.º 10
0
        public void TEST_DISK_ALREADY_EXISTS()
        {
            Console.WriteLine("Starting to check if disk already exists");

            string existingPath = null;

            foreach (Title title in TitleCollectionManager.GetAllTitles())
            {
                existingPath = title.Disks[0].Path;
                break;
            }

            DateTime start = DateTime.Now;

            bool found = false;

            Assert.AreEqual(true, found = TitleCollectionManager.ContainsDisks(existingPath), "Disk path should have been found");

            Console.WriteLine("Result : " + found);

            Console.WriteLine(string.Format("Done - Took: {0} milliseconds",
                                            (DateTime.Now - start).TotalMilliseconds.ToString()));

            Console.WriteLine("Starting to check to verify disk is not found");

            Assert.AreEqual(false, found = TitleCollectionManager.ContainsDisks(existingPath + "test"), "Disk path should not have been found");

            Console.WriteLine("Result : " + found);
        }
Exemplo n.º 11
0
        public void SetMRULists()
        {
            if (OMLEngine.Settings.OMLSettings.UseMPAAList)
            {
                // MaskBox is a hidden property
                // It is explained on the DevExpress Website at:
                //
                // http://www.devexpress.com/Support/Center/p/Q181219.aspx
                //
                teParentalRating.MaskBox.AutoCompleteMode   = AutoCompleteMode.SuggestAppend;
                teParentalRating.MaskBox.AutoCompleteSource = AutoCompleteSource.CustomSource;
                teParentalRating.MaskBox.AutoCompleteCustomSource.AddRange(OMLEngine.Settings.OMLSettings.MPAARatings.Split('|'));
            }
            else
            {
                teParentalRating.MaskBox.AutoCompleteMode   = AutoCompleteMode.SuggestAppend;
                teParentalRating.MaskBox.AutoCompleteSource = AutoCompleteSource.CustomSource;
                foreach (string name in from t in TitleCollectionManager.GetAllParentalRatings(null) select t.Name)
                {
                    teParentalRating.MaskBox.AutoCompleteCustomSource.Add(name);
                }
            }

            txtStudio.MaskBox.AutoCompleteMode   = AutoCompleteMode.SuggestAppend;
            txtStudio.MaskBox.AutoCompleteSource = AutoCompleteSource.CustomSource;
            foreach (string name in from t in TitleCollectionManager.GetAllStudios(null) select t.Name)
            {
                txtStudio.MaskBox.AutoCompleteCustomSource.Add(name);
            }

            txtAspectRatio.MaskBox.AutoCompleteMode   = AutoCompleteMode.SuggestAppend;
            txtAspectRatio.MaskBox.AutoCompleteSource = AutoCompleteSource.CustomSource;
            foreach (string name in from t in TitleCollectionManager.GetAllAspectRatios(null) select t.Name)
            {
                txtAspectRatio.MaskBox.AutoCompleteCustomSource.Add(name);
            }

            txtCountryOfOrigin.MaskBox.AutoCompleteMode   = AutoCompleteMode.SuggestAppend;
            txtCountryOfOrigin.MaskBox.AutoCompleteSource = AutoCompleteSource.CustomSource;
            foreach (string name in from t in TitleCollectionManager.GetAllCountryOfOrigin(null) select t.Name)
            {
                txtCountryOfOrigin.MaskBox.AutoCompleteCustomSource.Add(name);
            }

            teVideoResolution.MaskBox.AutoCompleteMode   = AutoCompleteMode.SuggestAppend;
            teVideoResolution.MaskBox.AutoCompleteSource = AutoCompleteSource.CustomSource;
            foreach (string name in from t in TitleCollectionManager.GetAllAspectRatios(null) select t.Name)
            {
                teVideoResolution.MaskBox.AutoCompleteCustomSource.Add(name);
            }

            teVideoStandard.MaskBox.AutoCompleteMode   = AutoCompleteMode.SuggestAppend;
            teVideoStandard.MaskBox.AutoCompleteSource = AutoCompleteSource.CustomSource;
            //teVideoStandard.MaskBox.AutoCompleteCustomSource.AddRange(MainEditor._titleCollection.GetAllVideoStandards.ToArray());

            teImporter.MaskBox.AutoCompleteMode   = AutoCompleteMode.SuggestAppend;
            teImporter.MaskBox.AutoCompleteSource = AutoCompleteSource.CustomSource;
            //teImporter.MaskBox.AutoCompleteCustomSource.AddRange(MainEditor._titleCollection.GetAllImporterSources.ToArray());
        }
Exemplo n.º 12
0
        private void PopulateMediaTree()
        {
            Dictionary <int, Title> mediatreefolders         = TitleCollectionManager.GetAllTitles(TitleTypes.AllFolders).ToDictionary(k => k.Id);
            Dictionary <int, int>   _parentchildRelationship = new Dictionary <int, int>(); // titleid, parentid

            if (_mediaTree == null)
            {
                _mediaTree = new Dictionary <int, TreeNode>();
            }
            else
            {
                _mediaTree.Clear();
            }

            treeMedia.Nodes.Clear();
            TreeNode rootnode = new TreeNode("All Media");

            rootnode.Name = "All Media";
            treeMedia.Nodes.Add(rootnode);
            //SelectedTreeRoot = null;

            foreach (KeyValuePair <int, Title> title in mediatreefolders)
            {
                if ((title.Value.TitleType & TitleTypes.Shortcut) == 0)
                {
                    TreeNode tn = new TreeNode(title.Value.Name);
                    tn.Name = title.Value.Id.ToString();
                    _mediaTree[title.Value.Id] = tn;
                    if (title.Value.ParentTitleId != null)
                    {
                        _parentchildRelationship[title.Value.Id] = (int)title.Value.ParentTitleId;
                    }
                    //if (title.Value.Id == title.Value.ParentTitleId) { rootnode.Nodes.Add(tn); }
                    if ((title.Value.TitleType & TitleTypes.Root) != 0)
                    {
                        rootnode.Nodes.Add(tn);
                    }
                }
            }


            foreach (KeyValuePair <int, TreeNode> kvp in _mediaTree)
            {
                if (_parentchildRelationship.ContainsKey(kvp.Key))
                {
                    if (kvp.Key != _parentchildRelationship[kvp.Key])
                    {
                        // This title has a parent.
                        if (_mediaTree.ContainsKey(_parentchildRelationship[kvp.Key]))
                        {
                            _mediaTree[_parentchildRelationship[kvp.Key]].Nodes.Add(_mediaTree[kvp.Key]);
                        }
                    }
                }
            }

            treeMedia.Refresh();
        }
Exemplo n.º 13
0
        public void CreateFilm(int parent, int no)
        {
            Title tt = new Title();

            tt.Name          = "Film " + no.ToString();
            tt.TitleType     = TitleTypes.Movie;
            tt.ParentTitleId = parent;
            TitleCollectionManager.AddTitle(tt);
        }
Exemplo n.º 14
0
        void actorCommand_Invoked(object sender, EventArgs e)
        {
            Library.Code.V3.CastCommand actor  = (Library.Code.V3.CastCommand)sender;
            List <TitleFilter>          filter = new List <TitleFilter>();

            filter.Add(new TitleFilter(TitleFilterType.Person, actor.Description));
            IEnumerable <Title> items = TitleCollectionManager.GetFilteredTitles(filter);
            GalleryPage         page  = new GalleryPage(items, actor.Description);
        }
Exemplo n.º 15
0
        public void CreateTVEpisode(int parent, int programno, int seriesno, int episodeno)
        {
            Title tt = new Title();

            tt.Name          = "TV P" + programno.ToString() + " S" + seriesno.ToString() + " E" + episodeno.ToString();
            tt.TitleType     = TitleTypes.Episode;
            tt.ParentTitleId = parent;
            TitleCollectionManager.AddTitle(tt);
        }
Exemplo n.º 16
0
 public void SetMRULists()
 {
     if (this.Text == "Genres")
     {
         cbeItem.Properties.Items.AddRange(TitleCollectionManager.GetAllGenreMetaDatas().ToArray());
     }
     else if ((this.Text == "Tags"))
     {
         cbeItem.Properties.Items.AddRange(TitleCollectionManager.GetAllTagsList().ToArray());
     }
 }
Exemplo n.º 17
0
 public void SetFilter(List <TitleFilter> tf)
 {
     try
     {
         List <Title> titles = TitleCollectionManager.GetFilteredTitles(tf).ToList();
         ShowResults(titles);
     }
     catch
     {
         grdTitles.Rows.Clear();
     }
 }
Exemplo n.º 18
0
        /*public bool IsNew()
         * {
         *  return TitleCollectionManager.GetTitle(_dvdTitle.Id) == null;
         * }*/

        public void SaveChanges()
        {
            titleSource.CurrencyManager.Refresh();

            _dvdTitle.ModifiedDate = DateTime.Now;

            _dvdTitle.TitleType = (_dvdTitle.TitleType & TitleTypes.Root) |
                                  (TitleTypes)Enum.Parse(typeof(TitleTypes), cbTitleType.Text);

            TitleCollectionManager.SaveTitleUpdates();
            ClearEditor(false);
        }
Exemplo n.º 19
0
        public void TEST_GET_ALL_PEOPLE()
        {
            Console.WriteLine("Starting to get all people");
            DateTime start = DateTime.Now;

            IEnumerable <FilteredCollection> items = TitleCollectionManager.GetAllPeople(null, PeopleRole.Actor);

            List <FilteredCollection> allItems = new List <FilteredCollection>(items);

            Console.WriteLine(string.Format("Done - Took: {0} milliseconds for {1} titles",
                                            (DateTime.Now - start).TotalMilliseconds.ToString(),
                                            allItems.Count));
        }
Exemplo n.º 20
0
        public static IEnumerable <FilteredTitleCollection> GetAllAlphaIndex(List <TitleFilter> filters)
        {
            IEnumerable <char> firstLetters = from t in GetFilteredTitlesWrapper(filters)
                                              select GetProperIndex(t.SortName.ToUpper()[0]);

            return(from l in firstLetters
                   group l by l into g
                   orderby g.Key ascending
                   select new FilteredTitleCollection()
            {
                Name = g.Key.ToString(), Titles = TitleCollectionManager.ConvertDaoTitlesToTitles(from t in ApplyAlphaFilter(GetFilteredTitlesWrapper(filters), g.Key.ToString()) select t)
            });
        }
Exemplo n.º 21
0
 void ms_OnSave(MediaSource ms)
 {
     foreach (Disk d in this.TitleObject.Disks)
     {
         if (d == ms.Disk)
         {
             d.ExtraOptions = ms.UpdateExtraOptions(d.ExtraOptions);
             //OMLApplication.Current.SaveTitles();
             TitleCollectionManager.SaveTitleUpdates();
             break;
         }
     }
 }
Exemplo n.º 22
0
        public void CreateTVSeries(int parent, int programno, int seriesno)
        {
            Title tt = new Title();

            tt.Name          = "TV P" + programno.ToString() + " S" + seriesno.ToString();
            tt.TitleType     = TitleTypes.Season;
            tt.ParentTitleId = parent;
            TitleCollectionManager.AddTitle(tt);

            for (int i = 0; i < episodesperseries; i++)
            {
                CreateTVEpisode(tt.Id, programno, seriesno, i);
            }
        }
Exemplo n.º 23
0
        public static IEnumerable <FilteredTitleCollection> GetAllYearsGrouped(List <TitleFilter> filters)
        {
            IQueryable <Title> filteredTitles = GetFilteredTitlesWrapper(filters);

            return(from t in filteredTitles
                   where t.ReleaseDate != null
                   group t by t.ReleaseDate.Value.Year into g
                   orderby g.Key descending
                   select new FilteredTitleCollection()
            {
                Name = g.Key.ToString(),
                Titles = TitleCollectionManager.ConvertDaoTitlesToTitles(from t in filteredTitles where t.ReleaseDate != null && t.ReleaseDate.Value.Year == g.Key orderby t.SortName select t)
            });
        }
Exemplo n.º 24
0
        public void CreateTVProgram(int parent, int programno)
        {
            Title tt = new Title();

            tt.Name          = "TV P" + programno.ToString();
            tt.TitleType     = TitleTypes.TVShow;
            tt.ParentTitleId = parent;
            TitleCollectionManager.AddTitle(tt);

            for (int i = 0; i < seriesperprogram; i++)
            {
                CreateTVSeries(tt.Id, programno, i);
            }
        }
Exemplo n.º 25
0
        public void GET_ALL_GENRES_WITH_COVERS()
        {
            DateTime start = DateTime.Now;

            IEnumerable <FilteredCollection> allGenres = TitleCollectionManager.GetAllGenres(null);

            foreach (FilteredCollection item in allGenres)
            {
                Console.WriteLine(item.Name + " " + item.ImagePath + " " + item.Count);
            }


            Console.WriteLine("Took: " + (DateTime.Now - start).TotalMilliseconds + " milliseconds");
        }
Exemplo n.º 26
0
        public void UpdateWatched()
        {
            OMLApplication.ExecuteSafe(delegate
            {
                bool watched = (bool)_watched.Chosen;

                if (watched && _movieDetails.TitleObject.WatchedCount == 0)
                {
                    TitleCollectionManager.IncrementWatchedCount(_movieDetails.TitleObject);
                }
                else if (!watched && _movieDetails.TitleObject.WatchedCount != 0)
                {
                    TitleCollectionManager.ClearWatchedCount(_movieDetails.TitleObject);
                }
            });
        }
Exemplo n.º 27
0
 public void Uninitialize()
 {
     try
     {
         ExtenderDVDPlayer.Uninitialize();
     }
     catch (Exception err)
     {
         DebugLine("Unhandled Exception: {0}", err);
     }
     finally
     {
         // close the db connections
         TitleCollectionManager.CloseDBConnection();
     }
 }
Exemplo n.º 28
0
        public void TEST_GET_ALL_GENRES()
        {
            Console.WriteLine("Starting to get all genres");
            DateTime start = DateTime.Now;

            IEnumerable <FilteredCollection> items = TitleCollectionManager.GetAllGenres(null);

            foreach (FilteredCollection item in items)
            {
                Console.WriteLine(item.Name + " " + item.Count + " " + item.ImagePath);
            }

            Console.WriteLine(string.Format("Done - Took: {0} milliseconds for {1} titles",
                                            (DateTime.Now - start).TotalMilliseconds.ToString(),
                                            items.Count()));
        }
Exemplo n.º 29
0
        public void TEST_GET_ALL_MOVIES_FOR_ACTOR()
        {
            Console.WriteLine("Starting to get all Tim Burton movies");
            DateTime start = DateTime.Now;

            IEnumerable <Title> items = TitleCollectionManager.GetFilteredTitles(TitleFilterType.Person, "Tim Burton");

            foreach (Title title in items)
            {
                Console.WriteLine(title.Name);
            }

            Console.WriteLine(string.Format("Done - Took: {0} milliseconds for {1} titles",
                                            (DateTime.Now - start).TotalMilliseconds.ToString(),
                                            items.Count()));
        }
Exemplo n.º 30
0
        public void TEST_GET_ALL_DATEADDED()
        {
            Console.WriteLine("Starting to get all date added values");
            DateTime start = DateTime.Now;

            IEnumerable <FilteredCollection> items = TitleCollectionManager.GetAllDateAdded(null);

            List <FilteredCollection> allItems = new List <FilteredCollection>(items);

            Console.WriteLine(string.Format("Done - Took: {0} milliseconds for {1} titles",
                                            (DateTime.Now - start).TotalMilliseconds.ToString(),
                                            allItems.Count));
            foreach (FilteredCollection item in allItems)
            {
                Console.WriteLine(String.Format("{0}-{1}", item.Name, item.Count));
            }
        }