Ejemplo n.º 1
0
        public void TestSplitSameArtistAlbum()
        {
            Cddb.DTitle artistAndAlbum = Cddb.SplitDiscTitle("Ensiferum");

            Assert.AreEqual("Ensiferum", artistAndAlbum.Artist);
            Assert.AreEqual("Ensiferum", artistAndAlbum.Title);
        }
Ejemplo n.º 2
0
    public void TestDTitleConstructor() {
      const string testArtist = "R. Tist";
      const string testTitle = "Yes";

      Cddb.DTitle discTitle = new Cddb.DTitle(testArtist, testTitle);

      Assert.AreEqual(testArtist, discTitle.Artist);
      Assert.AreEqual(testTitle, discTitle.Title);
    }
Ejemplo n.º 3
0
        public void TestSplitDifferentArtistAlbum()
        {
            Cddb.DTitle artistAndAlbum = Cddb.SplitDiscTitle(
                "Catamenia / VIII: The Time Unchained"
                );

            Assert.AreEqual("Catamenia", artistAndAlbum.Artist);
            Assert.AreEqual("VIII: The Time Unchained", artistAndAlbum.Title);
        }
Ejemplo n.º 4
0
        public void TestDTitleConstructor()
        {
            const string testArtist = "R. Tist";
            const string testTitle  = "Yes";

            Cddb.DTitle discTitle = new Cddb.DTitle(testArtist, testTitle);

            Assert.AreEqual(testArtist, discTitle.Artist);
            Assert.AreEqual(testTitle, discTitle.Title);
        }
Ejemplo n.º 5
0
    /// <summary>Interprets a keyword assignment appearing in an XMCD file</summary>
    /// <param name="name">Name of the keyword</param>
    /// <param name="value">Value assigned to the keyword</param>
    private void interpretKeyword(string name, string value) {
      if(name == "DISCID") {
        this.haveDiscId = true;
        this.entry.DiscIds = parseDiscIds(value);
      } else if(name == "DTITLE") {
        this.haveTitle = true;
        Cddb.DTitle dTitle = Cddb.SplitDiscTitle(value);
        this.entry.Artist = dTitle.Artist;
        this.entry.Album = dTitle.Title;
      } else if(name == "DYEAR") {
        this.haveYear = true;
        this.entry.Year = Convert.ToInt32(value);
      } else if(name == "DGENRE") {
        this.haveGenre = true;
        this.entry.Genre = value;
      } else if(name == "EXTD") {
        this.haveExtendedData = true;
      } else if(name == "PLAYORDER") {
        this.havePlayOrder = true;
      } else if(name.StartsWith("TTITLE")) {
        int trackIndex = Convert.ToInt32(name.Substring(6));

        // Make sure there are enough entries in the list (minus one because it allows
        // us to use the Add() method then, instead of adding an empty entry and replacing
        // it further down
        while(this.trackTitles.Count < trackIndex) {
          this.trackTitles.Add(new Cddb.DTitle());
        }

        // Get the track title. If a " / " sequence is contained in the title, the track
        // contains an artist specification. Otherwise, leave the artist field set to
        // null because we can't be sure that the disc title field has been filled already.
        Cddb.DTitle track;
        if(value.Contains(" / ")) {
          track = Cddb.SplitDiscTitle(value);
        } else {
          track = new Cddb.DTitle(null, value);
        }

        // Finally, add the track to the track list. If it is an out-of-order track, we
        // will replace the existing, empty entry. Otherwise, the list will be just one
        // element short of the track and we can normally add it.
        if(this.trackTitles.Count == trackIndex) {
          this.trackTitles.Add(track);
        } else {
          this.trackTitles[trackIndex] = track;
        }
      } else if(name.StartsWith("EXTT")) {
        // Ignore for now
      }
    }
Ejemplo n.º 6
0
        /// <summary>Interprets a keyword assignment appearing in an XMCD file</summary>
        /// <param name="name">Name of the keyword</param>
        /// <param name="value">Value assigned to the keyword</param>
        private void interpretKeyword(string name, string value)
        {
            if (name == "DISCID")
            {
                this.haveDiscId    = true;
                this.entry.DiscIds = parseDiscIds(value);
            }
            else if (name == "DTITLE")
            {
                this.haveTitle = true;
                Cddb.DTitle dTitle = Cddb.SplitDiscTitle(value);
                this.entry.Artist = dTitle.Artist;
                this.entry.Album  = dTitle.Title;
            }
            else if (name == "DYEAR")
            {
                this.haveYear   = true;
                this.entry.Year = Convert.ToInt32(value);
            }
            else if (name == "DGENRE")
            {
                this.haveGenre   = true;
                this.entry.Genre = value;
            }
            else if (name == "EXTD")
            {
                this.haveExtendedData = true;
            }
            else if (name == "PLAYORDER")
            {
                this.havePlayOrder = true;
            }
            else if (name.StartsWith("TTITLE"))
            {
                int trackIndex = Convert.ToInt32(name.Substring(6));

                // Make sure there are enough entries in the list (minus one because it allows
                // us to use the Add() method then, instead of adding an empty entry and replacing
                // it further down
                while (this.trackTitles.Count < trackIndex)
                {
                    this.trackTitles.Add(new Cddb.DTitle());
                }

                // Get the track title. If a " / " sequence is contained in the title, the track
                // contains an artist specification. Otherwise, leave the artist field set to
                // null because we can't be sure that the disc title field has been filled already.
                Cddb.DTitle track;
                if (value.Contains(" / "))
                {
                    track = Cddb.SplitDiscTitle(value);
                }
                else
                {
                    track = new Cddb.DTitle(null, value);
                }

                // Finally, add the track to the track list. If it is an out-of-order track, we
                // will replace the existing, empty entry. Otherwise, the list will be just one
                // element short of the track and we can normally add it.
                if (this.trackTitles.Count == trackIndex)
                {
                    this.trackTitles.Add(track);
                }
                else
                {
                    this.trackTitles[trackIndex] = track;
                }
            }
            else if (name.StartsWith("EXTT"))
            {
                // Ignore for now
            }
        }