Beispiel #1
0
		/// <summary>Read the track data</summary>
		/// <param name="reader">a reader object to read the data from</param>
		/// <param name="items">the <see cref="KDDCupItems"/> object</param>
		static public void ReadTracks(TextReader reader, KDDCupItems items)
		{
			string line;

			while ( (line = reader.ReadLine()) != null )
			{
				string[] tokens = line.Split('|');

				int track_id  = int.Parse(tokens[0]);
				int album_id  = tokens[1] == "None" ? -1 : int.Parse(tokens[1]);
				int artist_id = tokens[2] == "None" ? -1 : int.Parse(tokens[2]);

				var genres = new int[tokens.Length - 3];
				for (int i = 0; i < genres.Length; i++)
					genres[i] = int.Parse(tokens[3 + i]);

				items.Insert(track_id, KDDCupItemType.Track, album_id, artist_id, genres);
			}
		}
Beispiel #2
0
		/// <summary>Read the genre data</summary>
		/// <param name="reader">a reader object to read the data from</param>
		/// <param name="items">the <see cref="KDDCupItems"/> object</param>
		static public void ReadGenres(TextReader reader, KDDCupItems items)
		{
			string line;

			while ( (line = reader.ReadLine()) != null )
			{
				int genre_id = int.Parse(line);

				items.Insert(genre_id, KDDCupItemType.Genre, -1, -1, null);
			}
		}
Beispiel #3
0
		/// <summary>Read the artist data</summary>
		/// <param name="reader">a reader object to read the data from</param>
		/// <param name="items">the <see cref="KDDCupItems"/> object</param>
		static public void ReadArtists(TextReader reader, KDDCupItems items)
		{
			string line;

			while ( (line = reader.ReadLine()) != null )
			{
				int artist_id = int.Parse(line);

				items.Insert(artist_id, KDDCupItemType.Artist, -1, artist_id, null);
			}
		}