Index: MediaInternetYouTubeHandler.inc
===================================================================
RCS file: MediaInternetYouTubeHandler.inc
diff -N MediaInternetYouTubeHandler.inc
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ MediaInternetYouTubeHandler.inc	24 Feb 2011 03:18:34 -0000
@@ -0,0 +1,73 @@
+<?php
+// $Id$
+
+class MediaInternetYouTubeHandler extends MediaInternetBaseHandler {
+  public function claim($embedCode) {
+    if (media_youtube_media_parse($embedCode)) {
+      return TRUE;
+    }
+  }
+
+  public function validate() {
+    // @todo Media module currently fails when two files try to have the same
+    //   URI, so catch that in the validation step. Some day, it would be nice
+    //   to allow it, however. See http://drupal.org/node/952422.
+    $uri = media_youtube_media_parse($this->embedCode);
+    $existing_files = file_load_multiple(array(), array('uri' => $uri));
+    if (count($existing_files)) {
+      throw new MediaInternetValidationException(t('You have entered a URL for a video that is already in your library.'));
+    }
+  }
+
+  public function save() {
+    $file = $this->getFileObject();
+    file_save($file);
+    return $file;
+  }
+
+  public function getFileObject() {
+    $uri = media_youtube_media_parse($this->embedCode);
+    //@todo: this is terribly broken in some ways because the function is really
+    // made for local files which are 'real'
+    return file_uri_to_object($uri);
+  }
+
+  /**
+   * Returns information about the media. See http://video.search.yahoo.com/mrss.
+   *
+   * @return
+   *   If ATOM+MRSS information is available, a SimpleXML element containing
+   *   ATOM and MRSS elements, as per those respective specifications.
+   *
+   * @todo Would be better for the return value to be an array rather than a
+   *   SimpleXML element, but media_retrieve_xml() needs to be upgraded to
+   *   handle namespaces first.
+   */
+  public function getMRSS() {
+    $uri = media_youtube_media_parse($this->embedCode);
+    $video_id = arg(1, file_uri_target($uri));
+    $rss_url = url('http://gdata.youtube.com/feeds/api/videos/' . $video_id, array('query' => array('v' => '2')));
+    // @todo Use media_retrieve_xml() once it's upgraded to include elements
+    //   from all namespaces, not just the document default namespace.
+    $entry = simplexml_load_file($rss_url);
+    return $entry;
+  }
+
+  /**
+   * Returns information about the media. See http://www.oembed.com/.
+   *
+   * @return
+   *   If oEmbed information is available, an array containing 'title', 'type',
+   *   'url', and other information as specified by the oEmbed standard.
+   *   Otherwise, NULL.
+   */
+  public function getOEmbed() {
+    $uri = media_youtube_media_parse($this->embedCode);
+    $external_url = drupal_realpath($uri);
+    $oembed_url = url('http://www.youtube.com/oembed', array('query' => array('url' => $external_url, 'format' => 'json')));
+    $response = drupal_http_request($oembed_url);
+    if (!isset($response->error)) {
+      return drupal_json_decode($response->data);
+    }
+  }
+}
Index: media_youtube.info
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/media_youtube/media_youtube.info,v
retrieving revision 1.1.4.5
diff -u -p -r1.1.4.5 media_youtube.info
--- media_youtube.info	5 Jan 2011 15:47:28 -0000	1.1.4.5
+++ media_youtube.info	24 Feb 2011 03:18:34 -0000
@@ -8,4 +8,5 @@ files[] = media_youtube.module
 files[] = MediaYouTubeStreamWrapper.inc
 files[] = media_youtube.admin.inc
 files[] = includes/media_youtube.styles.inc
+files[] = MediaInternetYouTubeHandler.inc
 dependencies[] = media_internet
Index: media_youtube.module
===================================================================
RCS file: /cvs/drupal-contrib/contributions/modules/media_youtube/media_youtube.module,v
retrieving revision 1.1.4.56
diff -u -p -r1.1.4.56 media_youtube.module
--- media_youtube.module	11 Jan 2011 20:57:18 -0000	1.1.4.56
+++ media_youtube.module	24 Feb 2011 03:18:34 -0000
@@ -249,74 +249,3 @@ function media_youtube_media_internet_pr
     ),
   );
 }
-
-class MediaInternetYouTubeHandler extends MediaInternetBaseHandler {
-  public function claim($embedCode) {
-    if (media_youtube_media_parse($embedCode)) {
-      return TRUE;
-    }
-  }
-
-  public function validate() {
-    // @todo Media module currently fails when two files try to have the same
-    //   URI, so catch that in the validation step. Some day, it would be nice
-    //   to allow it, however. See http://drupal.org/node/952422.
-    $uri = media_youtube_media_parse($this->embedCode);
-    $existing_files = file_load_multiple(array(), array('uri' => $uri));
-    if (count($existing_files)) {
-      throw new MediaInternetValidationException(t('You have entered a URL for a video that is already in your library.'));
-    }
-  }
-
-  public function save() {
-    $file = $this->getFileObject();
-    file_save($file);
-    return $file;
-  }
-
-  public function getFileObject() {
-    $uri = media_youtube_media_parse($this->embedCode);
-    //@todo: this is terribly broken in some ways because the function is really
-    // made for local files which are 'real'
-    return file_uri_to_object($uri);
-  }
-
-  /**
-   * Returns information about the media. See http://video.search.yahoo.com/mrss.
-   *
-   * @return
-   *   If ATOM+MRSS information is available, a SimpleXML element containing
-   *   ATOM and MRSS elements, as per those respective specifications.
-   *
-   * @todo Would be better for the return value to be an array rather than a
-   *   SimpleXML element, but media_retrieve_xml() needs to be upgraded to
-   *   handle namespaces first.
-   */
-  public function getMRSS() {
-    $uri = media_youtube_media_parse($this->embedCode);
-    $video_id = arg(1, file_uri_target($uri));
-    $rss_url = url('http://gdata.youtube.com/feeds/api/videos/' . $video_id, array('query' => array('v' => '2')));
-    // @todo Use media_retrieve_xml() once it's upgraded to include elements
-    //   from all namespaces, not just the document default namespace.
-    $entry = simplexml_load_file($rss_url);
-    return $entry;
-  }
-
-  /**
-   * Returns information about the media. See http://www.oembed.com/.
-   *
-   * @return
-   *   If oEmbed information is available, an array containing 'title', 'type',
-   *   'url', and other information as specified by the oEmbed standard.
-   *   Otherwise, NULL.
-   */
-  public function getOEmbed() {
-    $uri = media_youtube_media_parse($this->embedCode);
-    $external_url = drupal_realpath($uri);
-    $oembed_url = url('http://www.youtube.com/oembed', array('query' => array('url' => $external_url, 'format' => 'json')));
-    $response = drupal_http_request($oembed_url);
-    if (!isset($response->error)) {
-      return drupal_json_decode($response->data);
-    }
-  }
-}
