A while ago I happened across this nice demonstrator for reading ID3
tags from MP3 files:
http://blog.nihilogic.dk/2008/08/reading-id3-tags-with-javascript.html
Looking at this with Jeremy we spotted at least two interesting things
to learn from this library:
1) ID3 tags in his example appear as the last 128 bytes of the binary
file, so the binaryajax library sets the HTTP Range header to ask for
only the end of the file (where the server has sent back an "Accept-
Ranges" header in a previous HEAD request):
if (aRange && bAcceptRanges) {
oHTTP.setRequestHeader("Range", "bytes=" + aRange[0] + "-" +
aRange[1]);
}
2) there's a bunch of methods to access a String as a binary blob,
even though it may have been munged by the browser's character
encoding. Interestingly enough he seems to have solved this for most
browsers apart from Opera, but including IE, by virtue of a nice hack
which writes a pair of VBScript functions to the document:
Function IEBinary_getByteAt(strBinary, iOffset)
Function IEBinary_getLength(strBinary)
which are wrappers for the VB MidB binary string functions, which
sadly may be deprecated:
http://msdn.microsoft.com/en-us/library/05e63829.aspx
I've started to play, evolving the library to support the myriad of
ID3 tag formats, and cases where the tags appear at the start of the
file, so checked in a copy, here:
http://svn.tiddlywiki.org/Trunk/contributors/PaulDowney/plugins/ID3TagsPlugin/
Along with some qunit tests, which I've deployed here:
http://whatfettle.com/2008/07/ID3TagsPlugin/test.html
Note, the library only supports v1.1 tags at the end of an MP3 file,
so only one of the 5 test files parses.
Running on windoze this afternoon proved the library actually works in
IE7!
My plans aren't very formal, but can imagine at least three
interesting plugins:
1) binary file access plugin based on the binaryajax code
2) an ID3 parser for reading a music library into TiddlyWiki
3) an EXIF parser for reading a photo library into TiddlyWiki
I'm not feeling brave enough to experiment with writing binary data,
yet, but that could open up a new universe of TiddlyWiki hacks :)
#1 may provide useful information for improving the core, especially
in the area of saving?
Paul (psd)
--
http://blog.whatfettle.com
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"TiddlyWikiDev" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/TiddlyWikiDev?hl=en
-~----------~----~----~----~------~----~------~--~---