Example #1
0
        public GenrePivot(IModelItemOwner owner, string stDescription, string stNoContentText, List<OMLEngine.TitleFilter> filters, OMLEngine.TitleFilterType filterType)
            : base(owner, stDescription, stNoContentText, null)
        {
            this.SetupContextMenu();
            //this.ContentLabel = "OML";
            this.SupportsJIL = true;
            this.ContentTemplate = "resx://Library/Library.Resources/V3_Controls_BrowseGallery#Gallery";
            this.ContentItemTemplate = "twoRowGalleryItemGenre";
            this.DetailTemplate = Library.Code.V3.BrowsePivot.ExtendedDetailTemplate;

            this.SupportedContentItemTemplates.Add("View Large", "twoRowGalleryItemGenre");
            //this.SupportedContentItemTemplates.Add("View Small", "twoRowGalleryItemPoster");
            this.SupportedContentItemTemplates.Add("View List", "ListViewItem");

            this.m_filters = filters;
            this.m_filterType = filterType;
            this.m_listContent = new VirtualList(new ItemCountHandler(this.InitializeListCount));
            ((VirtualList)this.m_listContent).RequestItemHandler = new RequestItemHandler(this.GetItem);
        }
 public void WatchTitle(OMLEngine.Title item)
 {
     TitleEventArgs t = new TitleEventArgs(item);
     this.OnTitleWatched(t);
 }
 public void DeleteTitle(OMLEngine.Title item)
 {
     foreach (Disk d in item.Disks)
     {
         string status = deleteDisk(d);
         if (!string.IsNullOrEmpty(status))
         {
             this.MediaCenterEnvironment.Dialog(
                 string.Format("Unable to delete this movie: {0}", status),
                 "Failed", DialogButtons.Ok, 5, false);
             return;
         }
         else
         {
             TitleCollectionManager.DeleteTitle(item);
         }
     }
     TitleEventArgs t = new TitleEventArgs(item);
     this.OnTitleDeleted(t);
 }
 public TitleEventArgs(OMLEngine.Title title)
 {
     this.Title = title;
 }
 private object GetCommandForItem(OMLEngine.Title item)
 {
     this.pulleditemCount++;
     Console.WriteLine(this.pulleditemCount.ToString());
     return new Library.Code.V3.MovieItem(item, this);
 }
Example #6
0
        private bool IsFilterDoubled(OMLEngine.TitleFilterType type)
        {
            if (this.Filters == null)
                return false;

            foreach (OMLEngine.TitleFilter f in this.Filters)
            {
                if (f.FilterType == type)
                    return true;
            }
            return false;
        }
Example #7
0
        /// <summary>
        /// Go through all the people in the movie and send them in batch to sql to see who exists
        /// as a person already
        /// </summary>
        /// <param name="title"></param>
        /// <returns></returns>
        private static Dictionary<string, BioData> GetAllExistingPeople(OMLDataDataContext context, OMLEngine.Title title)
        {
            List<string> names = new List<string>(title.ActingRoles.Count + title.Writers.Count + title.Directors.Count + title.Producers.Count);

            foreach (Role person in title.ActingRoles)
                names.Add(person.PersonName);

            foreach (OMLEngine.Person person in title.Writers)
                names.Add(person.full_name);

            foreach (OMLEngine.Person person in title.Directors)
                names.Add(person.full_name);

            foreach (OMLEngine.Person person in title.Producers)
                names.Add(person.full_name);

            // now that we have all the people - query to see who exists
            var actors = from actor in context.BioDatas
                         where names.Contains(actor.FullName)
                         select actor;

            Dictionary<string, BioData> existingPeople = new Dictionary<string, BioData>();

            System.Diagnostics.Trace.WriteLine("Actors in current Context - " + actors.Count().ToString());

            foreach (BioData data in actors)
                if (!existingPeople.ContainsKey(data.FullName))
                    existingPeople.Add(data.FullName, data);

            return existingPeople;
        }
Example #8
0
        private object GetCommandForItem(OMLEngine.Title item)
        {
            if ((item.TitleType & OMLEngine.TitleTypes.AllMedia) != 0)
            {
                return new Library.Code.V3.MovieItem(item, this);
            }

            if ((item.TitleType & OMLEngine.TitleTypes.Collection) != 0)
            {
                return new Library.Code.V3.CollectionItem(item, this);
            }

            if ((item.TitleType & OMLEngine.TitleTypes.TVShow) != 0)
            {
                return new Library.Code.V3.CollectionItem(item, this);
            }

            if ((item.TitleType & OMLEngine.TitleTypes.Season) != 0)
            {
                return new Library.Code.V3.SeasonItem(item, this);
            }

            return new Library.Code.V3.MovieItem(item, this);

            /*switch (item.TitleType)
            {
                case OMLEngine.TitleTypes.Movie:
                    {
                    }
                case OMLEngine.TitleTypes.Collection:
                    {
                        return new Library.Code.V3.CollectionItem(item, this);
                    }
                default:
                    {
                        return new Library.Code.V3.MovieItem(item, this);
                    }

            }*/
        }
 internal GenreMetaData(OMLEngine.Dao.GenreMetaData genreMetaData)
 {
     _genreMetaData = genreMetaData;
 }
Example #10
0
        public static void SetupCollectionsToBeAdded(OMLDataDataContext context, OMLEngine.Title title)
        {
            Title daoTitle = title.DaoTitle;

            // patch up the sort name if it's missing
            if (string.IsNullOrEmpty(daoTitle.SortName))
                daoTitle.SortName = daoTitle.Name;

            // add the genres
            foreach (string genre in title.Genres)
            {
                // see if we've added this genre locally already
                Genre daoGenre = daoTitle.Genres.FirstOrDefault(t => t.MetaData.Name.Equals(genre));

                // genres must be unique
                if (daoGenre != null)
                    continue;

                // try to see if the genre exists
                GenreMetaData metaData = context.GenreMetaDatas.SingleOrDefault(t => t.Name.ToLower() == genre.ToLower());

                if (metaData == null)
                {
                    // if it doesn't exist create a new one
                    metaData = new GenreMetaData();
                    metaData.Name = genre;
                    context.GenreMetaDatas.InsertOnSubmit(metaData);
                    context.SubmitChanges();
                }

                // setup the genre
                daoGenre = new Genre();
                daoGenre.MetaData = metaData;

                // add the genre to the title
                daoTitle.Genres.Add(daoGenre);
            }

            // add the tags
            foreach (string name in title.Tags)
            {
                // see if we've added this tag locally already
                Tag tag = daoTitle.Tags.FirstOrDefault(t => t.Name.Equals(name));

                // tags must be unique
                if (tag != null)
                    continue;

                // try to see if the tag exists in the db already
                //tag = context.Tags.SingleOrDefault(t => t.Name.ToLower() == name.ToLower());

                if (tag == null)
                {
                    // if it doesn't exist create a new one
                    tag = new Tag();
                    tag.Name = name;
                }

                // add the tag
                daoTitle.Tags.Add(tag);
            }

            // grab from the db who we know about already
            Dictionary<string, BioData> existingPeople = GetAllExistingPeople(context, title);

            int actorIndex = 0;

            // add the actors
            foreach (Role actor in title.DaoTitle.UpdatedActors)
            {
                Person person = CreatePerson(context, actor.PersonName, actor.RoleName, PeopleRole.Actor, existingPeople);

                // maintain the order
                person.Sort = (short)(actorIndex++);

                // add them to the title
                daoTitle.People.Add(person);
            }

            // add the directors
            foreach (OMLEngine.Person director in title.DaoTitle.UpdatedDirectors)
            {
                Person person = CreatePerson(context, director.full_name, null, PeopleRole.Director, existingPeople);

                // maintain the order
                person.Sort = (short)(actorIndex++);

                // add them to the title
                var e = (from p in daoTitle.People
                         where p.MetaData.Id == person.MetaData.Id
                         select p);

                if (e.Count() == 0)
                {
                    daoTitle.People.Add(person);
                }
            }

            // add the writers
            foreach (OMLEngine.Person writer in title.DaoTitle.UpdatedWriters)
            {
                Person person = CreatePerson(context, writer.full_name, null, PeopleRole.Writer, existingPeople);

                // maintain the order
                person.Sort = (short)(actorIndex++);

                // add them to the title
                daoTitle.People.Add(person);
            }

            // add the producers
            foreach (OMLEngine.Person name in title.DaoTitle.UpdatedProducers)
            {
                Person person = CreatePerson(context, name.full_name, null, PeopleRole.Producers, existingPeople);

                // maintain the order
                person.Sort = (short)(actorIndex++);

                // add them to the title
                daoTitle.People.Add(person);
            }

            // Debugging code
            var b = (from p in daoTitle.People
                     select p);
            foreach (Person pr in b)
            {
                System.Diagnostics.Trace.WriteLine("Adding " + pr.Role + " - " + pr.MetaData.FullName + " as " + pr.CharacterName + " [" + pr.MetaData.Id +"]");
            }

            // ignore the rest for now

            // add all the disks
            /*foreach (OMLEngine.Disk disk in title.Disks)
            {
                Disk daoDisk = new Disk();
                daoDisk.Name = disk.Name;
                daoDisk.Path = disk.Path;
                daoDisk.VideoFormat = (byte)disk.Format;

                daoTitle.Disks.Add(daoDisk);
            }

            // add the audio tracks
            daoTitle.AudioTracks = GetDelimitedStringFromCollection(title.AudioTracks);

            // add the subtitles
            daoTitle.Subtitles = GetDelimitedStringFromCollection(title.Subtitles);

            // add the trailers
            daoTitle.Trailers = GetDelimitedStringFromCollection(title.Trailers);*/
        }
Example #11
0
 public void TestLookup(string name, string path, OMLEngine.VideoFormat format)
 {
     OMLEngine.DiskInfo di = new OMLEngine.DiskInfo(name, path, format);
     Console.ReadKey();
 }
Example #12
0
 internal BioData(OMLEngine.Dao.BioData bioData)
 {
     _bioData = bioData;
 }
 public static void GenreMap_Add(OMLEngine.Dao.GenreMapping maping)
 {
     OMLDataSettingsDBContext.Instance.GenreMappings.InsertOnSubmit(maping);
     OMLDataSettingsDBContext.Instance.SubmitChanges();
 }
 public static void WatchedFolder_Add(OMLEngine.Dao.WatchedFolder watchedfolder)
 {
     OMLDataSettingsDBContext.Instance.WatchedFolders.InsertOnSubmit(watchedfolder);
     OMLEngine.Dao.OMLDataSettingsDBContext.Instance.SubmitChanges();
 }
 public bool ItemIsAllowed(OMLEngine.Title item)
 {
     if (this.Enabled)
     {
         string itemRating = item.ParentalRating.ToUpperInvariant();
         if (string.IsNullOrEmpty(itemRating))
         {
             if (MCMovieRatings[itemRating] <= this.MaxAllowed)
                 return true;
         }
         else
         {
             if (this.BlockUnrated)
                 return false;
         }
     }
     return true;
 }