Exemplo n.º 1
0
        public void addPicture(String path)
        {
            Media media = new Media();

            var stuff = from entry in listPicture
                        where (entry.path == path)
                        select entry;

            foreach (Media med in stuff)
            {
                return;
            }

            TagLib.File tagfile = TagLib.File.Create(path);

            TagLib.Properties p  = tagfile.Properties;
            TagLib.MediaTypes mt = p.MediaTypes;
            media.artist    = tagfile.Tag.FirstArtist;
            media.album     = tagfile.Tag.Album;
            media.name      = tagfile.Tag.Title;
            media.path      = path;
            media.genre     = tagfile.Tag.FirstGenre;
            media.copyright = tagfile.Tag.Copyright;

            ListPicture.Add(media);
        }
Exemplo n.º 2
0
        public void addCurrent(String path)
        {
            Media media = new Media();

            TagLib.File tagfile = TagLib.File.Create(path);

            TagLib.Properties p  = tagfile.Properties;
            TagLib.MediaTypes mt = p.MediaTypes;
            media.artist    = tagfile.Tag.FirstArtist;
            media.album     = tagfile.Tag.Album;
            media.name      = tagfile.Tag.Title;
            media.path      = path;
            media.genre     = tagfile.Tag.FirstGenre;
            media.copyright = tagfile.Tag.Copyright;

            if (mt == TagLib.MediaTypes.Audio)
            {
                media.type = eMediaType.SOUND;
            }
            else if (mt == TagLib.MediaTypes.Photo)
            {
                media.type = eMediaType.PICTURE;
            }
            else if (mt == TagLib.MediaTypes.Video)
            {
                media.type = eMediaType.VIDEO;
            }
            listCurrent.Add(media);
        }
Exemplo n.º 3
0
        public void Load(string filepath)
        {
            Filepath = filepath;
            TagLib.File f = TagLib.File.Create(filepath, TagLib.ReadStyle.Average);
            Tag        = f.Tag;
            Properties = f.Properties;

            SaveThumb();
            f.Dispose();
        }
Exemplo n.º 4
0
        public void loadPath(String path, int _nb, ObservableCollection <Media> _listinCurr)
        {
            if (File.Exists(path))
            {
                pause      = true;
                TextPlay   = "|>";
                listinCurr = _listinCurr;
                try
                {
                    TagLib.File       tagfile = TagLib.File.Create(path);
                    String            artist  = tagfile.Tag.FirstArtist;
                    TagLib.Properties p       = tagfile.Properties;
                    TagLib.MediaTypes mt      = p.MediaTypes;
                    if (mt == TagLib.MediaTypes.Audio)
                    {
                        mediatype = eMediaType.SOUND;
                        db.addSound(path);
                        myMedElem.Source = new Uri(path);
                        nb = _nb;
                    }
                    else if (mt == TagLib.MediaTypes.Photo)
                    {
                        mediatype = eMediaType.PICTURE;
                        db.addPicture(path);

                        myMedElem.Source = new Uri(path);
                        pause            = false;
                        TextPlay         = "||";
                        myMedElem.Play();
                        nb = _nb;
                    }
                    else if ((p.MediaTypes & TagLib.MediaTypes.Video) != TagLib.MediaTypes.None)
                    {
                        mediatype = eMediaType.VIDEO;
                        db.addVideo(path);
                        myMedElem.Source = new Uri(path);
                        nb = _nb;
                    }
                }
                catch (TagLib.UnsupportedFormatException e)
                {
                }
            }
        }