TheDJ has uploaded a new change for review.

  https://gerrit.wikimedia.org/r/284255

Change subject: Don't list transcodes that were never initiated as failures.
......................................................................

Don't list transcodes that were never initiated as failures.

Because we added a new transcode profile in I413a72be, almost every
single video/audio file is now listed on Special:TimedMediaHandler as
queued, because they were never initiated (relates to issue T104061),
and because the queued query was unspecific.
This makes the list less useful. I introduced a new state 'missing'
and narrowed 'queued', to stuff that was actually added to the
jobqueue.
Also recalculate totals, making sure failed, missing and currently
being transcoded are not part of the transcode total.

Bug: T132616
Change-Id: I9d96419b55c77924168ba14f2fe3a5ab3cac0698
---
M SpecialTimedMediaHandler.php
M i18n/en.json
M i18n/qqq.json
3 files changed, 12 insertions(+), 5 deletions(-)


  git pull 
ssh://gerrit.wikimedia.org:29418/mediawiki/extensions/TimedMediaHandler 
refs/changes/55/284255/1

diff --git a/SpecialTimedMediaHandler.php b/SpecialTimedMediaHandler.php
index 65fb0a5..31954ab 100644
--- a/SpecialTimedMediaHandler.php
+++ b/SpecialTimedMediaHandler.php
@@ -12,8 +12,9 @@
        // @codingStandardsIgnoreStart
        private $transcodeStates = array(
                'active' => 'transcode_time_startwork IS NOT NULL AND 
transcode_time_success IS NULL AND transcode_time_error IS NULL',
-               'failed' => 'transcode_error != "" AND transcode_time_success 
IS NULL',
-               'queued' => 'transcode_time_startwork IS NULL AND 
transcode_time_success IS NULL AND transcode_time_error IS NULL',
+               'failed' => 'transcode_time_startwork IS NOT NULL AND 
transcode_time_error IS NOT NULL',
+               'queued' => 'transcode_time_addjob IS NOT NULL AND 
transcode_time_startwork IS NULL',
+               'missing' => 'transcode_time_addjob IS NULL',
        );
        // @codingStandardsIgnoreEnd
        private $formats = array(
@@ -62,7 +63,7 @@
                $states = $this->getStates();
                $this->renderState( $out, 'transcodes', $states, false );
                foreach ( $this->transcodeStates as $state => $condition ) {
-                       $this->renderState( $out, $state, $states );
+                       $this->renderState( $out, $state, $states, $state !== 
'missing' );
                }
        }
 
@@ -78,7 +79,8 @@
                if ( $states[ $state ][ 'total' ] ) {
                        // Give grep a chance to find the usages:
                        // timedmedia-derivative-state-transcodes, 
timedmedia-derivative-state-active,
-                       // timedmedia-derivative-state-queued, 
timedmedia-derivative-state-failed
+                       // timedmedia-derivative-state-queued, 
timedmedia-derivative-state-failed,
+                       // timedmedia-derivative-state-missing
                        $out->addHTML(
                                "<h2>"
                                . $this->msg(
@@ -227,6 +229,9 @@
                                $key = $row->transcode_key;
                                $states[ 'transcodes' ][ $key ] = $row->count;
                                $states[ 'transcodes' ][ $key ] -= $states[ 
'queued' ][ $key ];
+                               $states[ 'transcodes' ][ $key ] -= $states[ 
'missing' ][ $key ];
+                               $states[ 'transcodes' ][ $key ] -= $states[ 
'active' ][ $key ];
+                               $states[ 'transcodes' ][ $key ] -= $states[ 
'failed' ][ $key ];
                                $states[ 'transcodes' ][ 'total' ] += $states[ 
'transcodes' ][ $key ];
                        }
                        $wgMemc->add( $memcKey, $states, 60 );
diff --git a/i18n/en.json b/i18n/en.json
index 6d72719..70ec2bd 100644
--- a/i18n/en.json
+++ b/i18n/en.json
@@ -151,6 +151,7 @@
        "timedmedia-derivative-state-active": "{{PLURAL:$1|$1 running 
transcode|$1 running transcodes}}",
        "timedmedia-derivative-state-queued": "{{PLURAL:$1|$1 queued 
transcode|$1 queued transcodes}}",
        "timedmedia-derivative-state-failed": "{{PLURAL:$1|$1 failed 
transcode|$1 failed transcodes}}",
+       "timedmedia-derivative-state-missing": "{{PLURAL:$1|$1 uninitialized 
transcode|$1 uninitialized transcodes}}",
        "timedmedia-no-derivatives": "No transcoding required.",
        "timedmedia-file": "File",
        "timedmedia-audios": "{{PLURAL:$1|$1 audio file|$1 audio files}}",
diff --git a/i18n/qqq.json b/i18n/qqq.json
index bf00ab3..01f7187 100644
--- a/i18n/qqq.json
+++ b/i18n/qqq.json
@@ -166,9 +166,10 @@
        "timedmedia-ogg-videos": "Number of Ogg videos on 
[[Special:TimedMediaHandler]]. Parameters:\n* $1 - number of 
videos\n{{Related|Timedmedia-format-type}}",
        "timedmedia-webm-videos": "Number of WebM videos on 
[[Special:TimedMediaHandler]]. Parameters:\n* $1 - number of 
videos\n{{Related|Timedmedia-format-type}}",
        "timedmedia-derivative-state-transcodes": "Number of transcodes. 
Parameters:\n* $1 - number of transcodes",
-       "timedmedia-derivative-state-active": "currently active 
transcoes\nParameters are:\n* $1 number of transcodes",
+       "timedmedia-derivative-state-active": "currently active 
transcodes\nParameters are:\n* $1 number of transcodes",
        "timedmedia-derivative-state-queued": "queued transcode 
jobs\nParameters are:\n* $1 number of transcodes",
        "timedmedia-derivative-state-failed": "failed transcode 
jobs\nParameters are:\n* $1 number of transcodes",
+       "timedmedia-derivative-state-missing": "uninitialized 
transcodes\nParameters are:\n* $1 number of transcodes",
        "timedmedia-no-derivatives": "Shown on file description page instead of 
a table with the transcoded derivates if this file does not require 
transcoding.",
        "timedmedia-file": "Used as table column header.\n{{Identical|File}}",
        "timedmedia-audios": "Number of audio files on 
[[Special:TimedMediaHandler]]. Parameters:\n* $1 - number of audio 
files\n{{Related|Timedmedia-format-type}}",

-- 
To view, visit https://gerrit.wikimedia.org/r/284255
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: I9d96419b55c77924168ba14f2fe3a5ab3cac0698
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/extensions/TimedMediaHandler
Gerrit-Branch: master
Gerrit-Owner: TheDJ <[email protected]>

_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits

Reply via email to