Beagle audio metadata (again)



Hi !

I just finished my other modifications to add metadata support for beagle.

I added musepack, monkey audio, mp3, ogg. (and the already committed flac).

Here is the layout:

beagle/Util:
  Tag.cs
  ApeReader.cs
  Mp3Reader.cs
  FlacReader.cs
  Mp3Reader.cs
beagle/Filters
  FilterMpc.cs
  FilterApe.cs
  FilterMp3.cs
  FilterOgg.cs
  FilterFlac.cs
  FilterMusic.cs
beagle/beagled/FilteredIndexable.cs
  Diff file.

Tag.cs is the unified tag interface, containing the most used fields in the different formats.

XXXReader.cs read the tag of the XXX format and return a Tag.cs instance or throw an exception.

FilterMusic.cs is a generic absract class for reading the tags on DoPullProperties. To do that, they call a subclass GetTag method, try/catch the exception that can appear and fill the values in the beagle property. Anything that has to be done for every music format, has to be done here.

FilterXXX.cs register themselves as a reader for the XXX format in beagle at the request of FilterMusic.cs. They read the tag when requested by FilterMusic.cs, and format specificities are handled here (eg. for id3, the id3 v1 and v2 are merged together)

The modification in FiltereIndexable.cs:
string path = ContentUri.LocalPath;

-	flavor = Flavor.FromMimeType (MimeType);

+	if (Path.HasExtension (path)) {
+		string ext = Path.GetExtension (path).ToLower ();
+		flavor = new Flavor(MimeType, ext);
+		} else {
+			flavor = Flavor.FromMimeType (MimeType);
+		}
+		filter = Filter.FromFlavor (flavor);

I replace the flavor creation from the mimetype to a flavor creation from mime-type and file extension. If this isn't done: the AddSupportedExtension (".xxx"); in filters won't work, because every file has an empty extension flavor.

Does this looks good ?

The Automake.am files have to be updated also...

With this patch the old ID3 reading class isn't needed anymore, but I don't know if it can be replaced ... (I think mine is slightly better, but more complicate :) )

Raphael
(http://entagged.sourceforge.net)
PS. I tried to clean up a little to comply with the coding standards, but it isn't perfect, sorry for that !

Attachment: beagle-audiotags.tar.bz2
Description: application/bzip

Attachment: signature.asc
Description: OpenPGP digital signature



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