Ejemplo n.º 1
0
        /// <summary>
        /// Constructor based on a Rekordbox.xml file
        /// </summary>
        /// <param name="RekordboxXMLFullPath">Full path to the Rekordbox.xml file</param>
        public DJ_PLAYLISTS(string RekordboxXMLFullPath)
        {
            this.RekordboxXMLFullPath = RekordboxXMLFullPath;
            XDocument xdoc = XDocument.Load(RekordboxXMLFullPath);

            DJ_PLAYLISTS djp = (from x in xdoc.Descendants("DJ_PLAYLISTS")
                                select new DJ_PLAYLISTS
            {
                Version = (string)x.Attribute("Version"),
                Product =
                    (from p in x.Descendants("PRODUCT")
                     select new PRODUCT
                {
                    Company = (string)p.Attribute("Company"),
                    Name = (string)p.Attribute("Name"),
                    Version = (string)p.Attribute("Version")
                }).First(),
                Collection =
                    (from c in x.Descendants("COLLECTION")
                     select new COLLECTION
                {
                    Entries = (int)c.Attribute("Entries"),
                    Tracks =
                        (from e in c.Descendants("TRACK")
                         select new TRACK
                    {
                        Album = (string)e.Attribute("Album"),
                        Artist = (string)e.Attribute("Artist"),
                        AverageBpm = (float)e.Attribute("AverageBpm"),
                        BitRate = (int)e.Attribute("BitRate"),
                        Color = (string)e.Attribute("Color"),
                        Comments = (string)e.Attribute("Comments"),
                        Composer = (string)e.Attribute("Composer"),
                        DateAdded = (DateTime)e.Attribute("DateAdded"),
                        DiscNumber = (int)e.Attribute("DiscNumber"),
                        Genre = (string)e.Attribute("Genre"),
                        Grouping = (string)e.Attribute("Grouping"),
                        Kind = (string)e.Attribute("Kind"),
                        Label = (string)e.Attribute("Label"),
                        Location = (string)e.Attribute("Location"),
                        Mix = (string)e.Attribute("Mix"),
                        Name = (string)e.Attribute("Name"),
                        PlayCount = (int)e.Attribute("PlayCount"),
                        Rating = (int)e.Attribute("Rating"),
                        Remixer = (string)e.Attribute("Remixer"),
                        SampleRate = (int)e.Attribute("SampleRate"),
                        Size = (int)e.Attribute("Size"),
                        Tonality = (string)e.Attribute("Tonality"),
                        TotalTime = (int)e.Attribute("TotalTime"),
                        TrackID = (int)e.Attribute("TrackID"),
                        TrackNumber = (int)e.Attribute("TrackNumber"),
                        Year = (int)e.Attribute("Year"),
                        PositionMark =
                            (
                                from p in e.Elements("POSITION_MARK")
                                select new POSITION_MARK
                        {
                            Blue = (int?)p.Attribute("Blue"),
                            End = (float?)p.Attribute("End"),
                            Green = (int?)p.Attribute("Green"),
                            Name = (string)p.Attribute("Name"),
                            Num = (int)p.Attribute("Num"),
                            Red = (int?)p.Attribute("Red"),
                            Start = (float)p.Attribute("Start"),
                            Type = (int)p.Attribute("Type")
                        }
                            ).ToArray(),
                        Tempo =
                            (
                                from t in e.Elements("TEMPO")
                                select new TEMPO
                        {
                            Battito = (int)t.Attribute("Battito"),
                            Bpm = (float)t.Attribute("Bpm"),
                            Inizio = (float)t.Attribute("Inizio"),
                            Metro = (string)t.Attribute("Metro")
                        }
                            ).ToArray()
                    }
                        ).ToArray()
                }
                    ).First(),
                Playlists = (
                    from e in x.Descendants("PLAYLISTS").Descendants("NODE")
                    select new NODE
                {
                    Count = (int?)e.Attribute("Count"),
                    Entries = (int?)e.Attribute("Entries"),
                    KeyType = (int?)e.Attribute("KeyType"),
                    Name = (string)e.Attribute("Name"),
                    Type = (int)e.Attribute("Type"),
                    Tracks = (
                        from t in e.Elements("TRACK")
                        select new TRACKNODE
                    {
                        Key = (int)t.Attribute("Key")
                    }
                        ).ToArray()
                }
                    ).ToArray()
            }).First();

            this.Version    = djp.Version;
            this.Product    = djp.Product;
            this.Playlists  = djp.Playlists;
            this.Collection = djp.Collection;
        }
Ejemplo n.º 2
0
 /// <summary>
 /// Default constructor
 /// </summary>
 public DJ_PLAYLISTS()
 {
     Collection = new COLLECTION();
 }