getID3 retrofitted with namespacing and autoloading

What features would you like to see in future versions of getID3() ?
Post Reply
edgeorge
User
Posts: 5
Joined: Fri May 30, 2014 5:30 pm
Are you a spambot?: no

getID3 retrofitted with namespacing and autoloading

Post by edgeorge » Fri May 30, 2014 5:59 pm

While recently upgrading a client's commercial music web site from PHP 5.2 to 5.4, I took the opportunity to simplify class loading, and improve class and function naming security, by using namespaces and the autoloading features in the SPL introduced in 5.3. By structuring the class directory sub-structure to mimic the namespaces, it is possible to simplify the code that deals with class loading quite considerably. While the SPL manual contains a few simple examples on autoloading (http://www.php.net/manual/en/language.oop5.autoload.php), a better reference is http://www.dreamincode.net/forums/topic ... toloading/.

For the XSPF flash player I'm using to play snippets of my client's music for visitors to her site, getID3 is used extensively to extract the ID3v2 tags embedded in the mp3 and mp4 files. As I was introducing the namespace and autoload features into my own code, I observed that the existing software design and directory structures in getID3 make it an ideal candidate to be retrofitted. I decided to see how difficult it would be to to add namespaces and autoloading to getID3. (The site is still using 1.9.3, although that will be upgraded to 1.9.8 shortly.) There was certainly some hunting and pecking that went on, mostly in getid3.php, but after a few days I had a working version. Of greatest surprise was how simple the upgrade is - just a very few lines of code. Once I migrate these upgrades to 1.9.8, I am happy to make them available to James and his community here if there is any interest. Please let me know. Comments and suggestions welcome.

James Heinrich
getID3() v1 developer
Posts: 1457
Joined: Fri May 04, 2001 4:00 pm
Are you a spambot?: no
Location: Northern Ontario, Canada
Contact:

Re: getID3 retrofitted with namespacing and autoloading

Post by James Heinrich » Fri May 30, 2014 8:40 pm

A patch against 1.9.8 would be welcome. You can either supply a patch on Github or just email me the patched getid3.php (and/or any other modified files) and I'll merge it in.

edgeorge
User
Posts: 5
Joined: Fri May 30, 2014 5:30 pm
Are you a spambot?: no

Re: getID3 retrofitted with namespacing and autoloading

Post by edgeorge » Fri May 30, 2014 9:27 pm

Once I'm satisfied that the 1.9.3 version is working satisfactorily, I'll email you an itemized list of the changes for comment, following which I'll try them out against 1.9.8 during which time I will keep you apprised so that we can agree on how to proceed.

James Heinrich
getID3() v1 developer
Posts: 1457
Joined: Fri May 04, 2001 4:00 pm
Are you a spambot?: no
Location: Northern Ontario, Canada
Contact:

Re: getID3 retrofitted with namespacing and autoloading

Post by James Heinrich » Fri May 30, 2014 9:32 pm

Just migrate your patch to v1.9.8 and once you're satisfied with that, send me the patched file(s). You can itemize the list of changes with comments then, if you like. I assume you're more familiar with namespacing than I am.

edgeorge
User
Posts: 5
Joined: Fri May 30, 2014 5:30 pm
Are you a spambot?: no

Re: getID3 retrofitted with namespacing and autoloading

Post by edgeorge » Fri May 30, 2014 9:58 pm

Stupid me. Yes, that's far simpler. It will likely be a week to ten days. I'll also send you namespacing and autoloading references so you can develop your own opinion regarding whether to introduce the approach - Cheers!

edgeorge
User
Posts: 5
Joined: Fri May 30, 2014 5:30 pm
Are you a spambot?: no

Re: getID3 retrofitted with namespacing and autoloading

Post by edgeorge » Sun Jun 01, 2014 11:07 pm

Autoloading id3v1 & 2, along with lyric3 and ape tag and other files, began working tonight. I'll harden up the code this week, migrate it to 1.9.8 files, then pass them along in a few days. I propose to suffix patched 1.9.8 files with an 'a'. Let me know if that is convenient for you, or if you would prefer something else.

James Heinrich
getID3() v1 developer
Posts: 1457
Joined: Fri May 04, 2001 4:00 pm
Are you a spambot?: no
Location: Northern Ontario, Canada
Contact:

Re: getID3 retrofitted with namespacing and autoloading

Post by James Heinrich » Mon Jun 02, 2014 12:31 am

You can name your patched files whatever is convenient. *a is fine

edgeorge
User
Posts: 5
Joined: Fri May 30, 2014 5:30 pm
Are you a spambot?: no

Re: getID3 retrofitted with namespacing and autoloading

Post by edgeorge » Tue Jun 10, 2014 6:25 pm

Namespacing and autoloading has been working with ver 1.9.8 for several days. The port up to 1.9.8 was straightforward. Further, the PHP autoloader was abandoned in favour of Symfony in order to acquire a managed multi-directory registry. This is working well, and will be included as part of the package. System testing and documentation have revealed a design flaw which I hope to have remedied later today. Will keep you posted. Can I email the package to info@getid3.org?

Post Reply