Пример #1
0
        private static void UpdatesImagesForGenreMetaData(Dao.GenreMetaData gm)
        {
            // if there's a new front cover image path
            if (gm.UpdatedImagePath != null)
            {
                // delete the old one if it exists
                if (gm.PhotoID != null)
                {
                    Dao.TitleCollectionDao.SetDeleteImage((int)gm.PhotoID);
                }

                // add the new one
                gm.PhotoID = ImageManager.AddImageToDB(gm.UpdatedImagePath);

                // clear it out
                gm.UpdatedImagePath = null;
            }
        }
Пример #2
0
        public static void SaveGenreMetaDataChanges()
        {
            System.Data.Linq.ChangeSet changeset = Dao.DBContext.Instance.GetChangeSet();

            // Find actual SQL run to process the update - debugging purposes
            string s = Dao.DBContext.Instance.GetType().GetMethod("GetChangeText", System.Reflection.BindingFlags.Instance | System.Reflection.BindingFlags.NonPublic).Invoke(Dao.DBContext.Instance, null) as string;

            // updates all the pending image changes
            foreach (object gmd in changeset.Updates)
            {
                Dao.GenreMetaData daoGMD = gmd as Dao.GenreMetaData;

                if (daoGMD != null)
                {
                    UpdatesImagesForGenreMetaData(daoGMD);
                }
            }
            Dao.DBContext.Instance.SubmitChanges();
        }
Пример #3
0
 partial void DeleteGenreMetaData(GenreMetaData instance);
Пример #4
0
 partial void UpdateGenreMetaData(GenreMetaData instance);
Пример #5
0
 partial void InsertGenreMetaData(GenreMetaData instance);
Пример #6
0
 internal GenreMetaData(OMLEngine.Dao.GenreMetaData genreMetaData)
 {
     _genreMetaData = genreMetaData;
 }
Пример #7
0
 public GenreMetaData()
 {
     _genreMetaData = new OMLEngine.Dao.GenreMetaData();
 }
Пример #8
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);*/
        }
Пример #9
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);*/
        }
Пример #10
0
 internal GenreMetaData(OMLEngine.Dao.GenreMetaData genreMetaData)
 {
     _genreMetaData = genreMetaData;
 }
Пример #11
0
 public GenreMetaData()
 {
     _genreMetaData = new OMLEngine.Dao.GenreMetaData();
 }