From 6347b1753e6395ea02a2c718bc8e7c570a0ec4d4 Mon Sep 17 00:00:00 2001
From: andrew morton <drewish@katherinehouse.com>
Date: Wed, 24 Aug 2011 13:56:52 -0400
Subject: [PATCH] Issue #1212854 by anrikun: Allow getid3 module to work with
 version 1.9.0 of the getid3 library.

---
 getid3.module |   15 +++++++++++++--
 1 files changed, 13 insertions(+), 2 deletions(-)

diff --git a/getid3.module b/getid3.module
index 5fde7d6..ef07f8a 100644
--- a/getid3.module
+++ b/getid3.module
@@ -51,7 +51,7 @@ function getid3_load($display_warning = TRUE) {
     $getid3 = new getID3;
     require_once($getid3_path . '/write.php');
 
-    return defined('GETID3_VERSION');
+    return method_exists($getid3, 'version') || defined('GETID3_VERSION');
   }
   else {
     drupal_set_message(t("The getid3() module cannot find the getID3 library used to read and write ID3 tags. The site administrator will need to verify that it is installed and then update the <a href='!admin-settings-audio-getid3'>settings</a>.", array('!admin-settings-audio-getid3' => url('admin/config/media/getid3'))), 'error', FALSE);
@@ -102,5 +102,16 @@ function getid3_get_path() {
  * Returns the version number of getID3() that is installed.
  */
 function getid3_get_version() {
-  return getid3_load(FALSE) ? GETID3_VERSION : NULL;
+  if (getid3_load(FALSE)) {
+    $getid3 = new getID3;
+    // 1.9 and newer has a version method.
+    if (method_exists($getid3, 'version')) {
+      return $getid3->version();
+    }
+    // Older versions defined a constant.
+    if (defined('GETID3_VERSION')) {
+      return GETID3_VERSION;
+    }
+  }
+  return NULL;
 }
-- 
1.7.6

