コード例 #1
0
        public Dictionary <string, string> MetaManual(object obj)
        {
            List <string> TagList = new List <string>();

            if (obj.GetType() == typeof(Media))
            {
                Media m = (Media)obj;
                Dictionary <string, string> meta = new Dictionary <string, string>();
                meta.Add("File name", m.GetFileName());
                meta.Add("Format", "");
                meta.Add("Duration HH:MM:SS", "");
                if (m.GetType() == typeof(Song))
                {
                    Song         s  = (Song)m;
                    SongMetadata sm = (SongMetadata)s.GetMetadata();
                    meta.Add("Name", sm.GetName());
                    meta.Add("Artist", sm.GetArtist());
                    meta.Add("Album", sm.GetAlbum());
                    meta.Add("Genre", sm.GetGenre());
                    meta.Add("Release Year", sm.GetPublicationYear().ToString());
                    meta.Add("Label", sm.GetLabel());
                    meta.Add("Lyrics", sm.GetLyrics());;
                }

                else if (m.GetType() == typeof(Video))
                {
                    VideoMetadata vm = (VideoMetadata)((Video)m).GetMetadata();
                    meta.Add("Name", vm.GetName());
                    meta.Add("Creator", vm.GetCreator());
                    meta.Add("Genre", vm.GetGenre());;
                    meta.Add("Category", vm.GetCategory());
                    string actors = "";
                    foreach (string item in vm.GetActors())
                    {
                        actors += item;
                        actors += ", ";
                    }
                    actors  = actors.Substring(0, actors.Length - 2);
                    actors += ".";
                    meta.Add("Actors", actors);
                    meta.Add("Director", vm.GetDirector());
                    meta.Add("Studio", vm.GetStudio());
                    meta.Add("Release Year", vm.GetPubYear().ToString());
                    meta.Add("Description", vm.GetDescription());
                    meta.Add("Resolution", vm.GetResolution());
                    meta.Add("Aspect Ratio", vm.GetAspectRatio());
                }
                return(meta);
            }


            return(null);
        }
コード例 #2
0
        public Video(string fileName, VideoMetadata vm, string format, string duration) : base(fileName, format, duration)
        {
            MetaData = vm;
            Artist per;
            string director = vm.GetDirector();
            bool   dirEx    = Spotflix.GetPeopleDB.ContainsKey(director);

            if (dirEx)
            {
                per = Spotflix.GetPeopleDB[director];
                per.AddProfession("Director");
                per.AddWork(this);
            }
            else
            {
                per = new Artist(director);
                per.AddProfession("Director");
                per.AddWork(this);
                Spotflix.AddPerson(per);
            }
            List <string> actorList = vm.GetActors();

            foreach (string act in actorList)
            {
                Artist art;
                bool   acEx = Spotflix.GetPeopleDB.ContainsKey(act);
                if (acEx)
                {
                    art = Spotflix.GetPeopleDB[act];
                    art.AddProfession("Actor");
                    art.AddWork(this);
                }
                else
                {
                    art = new Artist(act);
                    art.AddProfession("Actor");
                    art.AddWork(this);
                    Spotflix.AddPerson(art);
                }
            }
            Spotflix.ImportMedia(this);
        }