r84972 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r84971‎ | r84972 | r84973 >
Date:18:32, 29 March 2011
Author:dale
Status:deferred
Tags:
Comment:
bug 28150 fixes for timedText for local files ( timedText ns was not properly registered locally )
minor code cleanup
Modified paths:
  • /trunk/extensions/TimedMediaHandler/ApiQueryVideoInfo.php (modified) (history)
  • /trunk/extensions/TimedMediaHandler/MwEmbedModules/TimedText/resources/mw.TimedText.js (modified) (history)
  • /trunk/extensions/TimedMediaHandler/TimedMediaHandler.hooks.php (modified) (history)
  • /trunk/extensions/TimedMediaHandler/TimedMediaHandler.php (modified) (history)
  • /trunk/extensions/TimedMediaHandler/handlers/TextHandler/TextHandler.php (modified) (history)

Diff [purge]

Index: trunk/extensions/TimedMediaHandler/handlers/TextHandler/TextHandler.php
@@ -5,7 +5,7 @@
66 * Timed text support is presently fairly limited. Unlike Ogg and WebM handlers,
77 * timed text does not extend the TimedMediaHandler class.
88 *
9 - * TODO On "new" timedtext laguage save purge all pages where file exists
 9+ * TODO On "new" timedtext language save purge all pages where file exists
1010 */
1111 class TextHandler {
1212
@@ -84,6 +84,7 @@
8585 wfDebug("Get text tracks from remote api \n");
8686 $query = $this->getTextPagesQuery();
8787
 88+
8889 // Error in getting timed text namespace return empty array;
8990 if( $query === false ){
9091 return array();
@@ -92,7 +93,7 @@
9394 if ( $data && $this->file->repo->descriptionCacheExpiry > 0 ) {
9495 $wgMemc->set( $key, $data, $this->file->repo->descriptionCacheExpiry );
9596 }
96 - return $this->getTextTracksFromData( $data );
 97+ return $this->getTextTracksFromData( $data );
9798 }
9899 function getLocalTextSources(){
99100 global $wgServer, $wgScriptPath;
@@ -110,11 +111,10 @@
111112
112113 $textTracks = array();
113114 $providerName = $this->file->repo->getName();
114 - // For a while commons repo in the manual was named "shared" if commons fix name
 115+ // For a while commons repo in the mediaWiki manual was called "shared"
115116 // ( we need commons to be named "commons" so that the javascript api provider names match up )
116117 if( $providerName == 'shared' ){
117118 // We could alternatively check $this->file->repo->mApiBase
118 - // ( but really we should add a getter )
119119 foreach( $wgForeignFileRepos as $repo ){
120120 if( $repo['name'] == $this->file->repo->getName()
121121 &&
@@ -149,7 +149,7 @@
150150 'data-mwtitle' => $namespacePrefix . $subTitle->getDBkey(),
151151 'data-mwprovider' => $providerName,
152152 'type' => 'text/x-srt',
153 - // TODO Should add a special entry point and output proper WebVTT format:
 153+ // TODO Should eventually add special entry point and output proper WebVTT format:
154154 // http://www.whatwg.org/specs/web-apps/current-work/webvtt.html
155155 'src' => $subTitle->getFullURL( array(
156156 'action' => 'raw',
Index: trunk/extensions/TimedMediaHandler/TimedMediaHandler.php
@@ -50,10 +50,9 @@
5151 // Location of the FFmpeg binary ( used to encode WebM and for thumbnails )
5252 $wgFFmpegLocation = '/usr/bin/ffmpeg';
5353
54 -// The NS for TimedText ( registerd on mediawiki.org )
 54+// The NS for TimedText ( registered on mediawiki.org )
5555 // http://www.mediawiki.org/wiki/Extension_namespace_registration
56 -// Note commons pre-dates TimedMediaHandler and should add $wgTimedTextNS = 102 per
57 -// their local settings config
 56+// Note commons pre-dates TimedMediaHandler and should set $wgTimedTextNS = 102 in localSettings.php
5857 $wgTimedTextNS = 700;
5958
6059 /**
Index: trunk/extensions/TimedMediaHandler/ApiQueryVideoInfo.php
@@ -2,7 +2,9 @@
33 /**
44 * Extends imageinfo with support for videoinfo sources property.
55 *
6 - * Alternativly core ApiQueryImageInfo could support being extended in obvious ways.
 6+ * Alternatively core ApiQueryImageInfo could support being extended in some straightforward ways.
 7+ * see: http://www.mediawiki.org/wiki/User:Catrope/Extension_review/TimedMediaHandler#ApiQueryVideoInfo.php
 8+ *
79 */
810 class ApiQueryVideoInfo extends ApiQueryImageInfo {
911
Index: trunk/extensions/TimedMediaHandler/TimedMediaHandler.hooks.php
@@ -11,8 +11,8 @@
1212 // Register TimedMediaHandler Hooks
1313 static function register(){
1414 global $wgParserOutputHooks, $wgHooks, $wgJobClasses, $wgJobTypesExcludedFromDefaultQueue,
15 - $wgMediaHandlers, $wgResourceModules, $wgExcludeFromThumbnailPurge,
16 - $tmhFileExtensions, $wgParserOutputHooks, $wgOut, $wgAPIPropModules;
 15+ $wgMediaHandlers, $wgResourceModules, $wgExcludeFromThumbnailPurge, $wgExtraNamespaces,
 16+ $tmhFileExtensions, $wgParserOutputHooks, $wgOut, $wgAPIPropModules, $wgTimedTextNS;
1717
1818 // Setup media Handlers:
1919 $wgMediaHandlers['application/ogg'] = 'OggHandler';
@@ -67,13 +67,13 @@
6868
6969 /**
7070 * Add support for the "TimedText" NameSpace
71 - */
72 - global $wgExtraNamespaces;
73 - $wgTimedTextNS = null;
74 -
 71+ */
7572 define( "NS_TIMEDTEXT", $wgTimedTextNS);
7673 define( "NS_TIMEDTEXT_TALK", $wgTimedTextNS +1);
7774
 75+ $wgExtraNamespaces[NS_TIMEDTEXT] = "TimedText";
 76+ $wgExtraNamespaces[NS_TIMEDTEXT_TALK] = "TimedText_talk";
 77+
7878 return true;
7979 }
8080 static function pageOutputHook( &$out, &$sk ){
Index: trunk/extensions/TimedMediaHandler/MwEmbedModules/TimedText/resources/mw.TimedText.js
@@ -635,6 +635,7 @@
636636 * Layout
637637 * Bellow video
638638 * Ontop video ( only available to supported plugins )
 639+ * TODO features:
639640 * [ Search Text ]
640641 * [ This video ]
641642 * [ All videos ]
@@ -642,8 +643,7 @@
643644 */
644645 getMainMenu: function() {
645646 var _this = this;
646 -
647 -
 647+
648648 // Build the source list menu item:
649649 $menu = $( '<ul>' );
650650 // Show text menu item ( if there are sources)
@@ -835,7 +835,7 @@
836836 },
837837
838838 /**
839 - * Get lagnuage name from language key
 839+ * Get language name from language key
840840 * @param {String} lang_key Language key
841841 */
842842 getLanguageName: function( lang_key ) {
@@ -1493,6 +1493,7 @@
14941494 *
14951495
14961496 // Will add a base class once we are serving more than just mediaWiki "commons"
 1497+ // also we should segment out these files
14971498 mw.BaseTextProvider = function() {
14981499 return this.init();
14991500 }

Status & tagging log