[Muine] Grouping multi-disc albums



I've been using Muine for about a week now, and it sure is nifty.
However...  If the tracks of multi-disc albums are stored in one subdir
per disc ("CD1/" or "Disc One" or similar) under the album directory,
each such subdir shows up in the database as a separate album, which is
pretty annoying.  

So, I made a small patch to do some minor transformation on the database
album key, similar to how titles are normalized for amazon cover
lookup.  It should not affect people who don't store their albums that
way unless their organizing habits are very strange indeed.  I hope
y'all would consider including it in Muine.
--- src/SongDatabase.cs.~1~	2007-01-19 23:14:06.000000000 +0100
+++ src/SongDatabase.cs	2007-03-28 21:59:52.000000000 +0200
@@ -21,6 +21,7 @@
 
 using System;
 using System.Collections;
+using System.Text.RegularExpressions;
 using System.IO;
 
 namespace Muine
@@ -227,7 +228,11 @@
 		*/
 		public string MakeAlbumKey (string folder, string album_name)
 		{
-			return String.Format ("{0}:{1}", folder, album_name.ToLower ());
+			Regex subdir_re =
+				new Regex(@"/(cd|dis[ck])\s*(\d+|one|two|three|four|five|six|seven|eight|nine|ten)\s*$",
+				RegexOptions.IgnoreCase);
+			string fixed_folder = subdir_re.Replace (folder, "");
+			return String.Format ("{0}:{1}", fixed_folder, album_name.ToLower ());
 		}
 
 		// Methods :: Public :: Getters :: GetSong


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]