diff --git a/data/routes.php b/data/routes.php index bed241b7a..64e3bc5b7 100644 --- a/data/routes.php +++ b/data/routes.php @@ -15,6 +15,8 @@ $routes['/^transcription-manager\/?$/'] = 'UNL_MediaHub_TranscriptionManager'; +$routes['/^caption-review-list-manager\/?$/'] = 'UNL_MediaHub_CaptionReviewListManager'; + $routes['/^search\/(?P.*)$/'] = 'UNL_MediaHub_MediaList'; $routes['/^tags\/(?P.*)$/'] = 'UNL_MediaHub_MediaList'; diff --git a/src/UNL/MediaHub/CaptionReviewListManager.php b/src/UNL/MediaHub/CaptionReviewListManager.php new file mode 100644 index 000000000..2a8de2a53 --- /dev/null +++ b/src/UNL/MediaHub/CaptionReviewListManager.php @@ -0,0 +1,33 @@ +options = $options; + $this->auth = UNL_MediaHub_AuthService::getInstance(); + $this->auth->login(); + $this->user = $this->auth->getUser(); + $this->unreviewedMediaCaptionList = UNL_MediaHub_User::getMediaWithUnreviewedCaptions($this->user); + $this->user = $this->auth->getUser(); + } + + + public static function getURL() { + return UNL_MediaHub_Controller::$url . "caption-review-list-manager"; + } + + public static function getJSONURL() { + return UNL_MediaHub_Controller::$url . "caption-review-list-manager/?format=json"; + } + + public function hasUnreviewedCaptionMedia() { + return count($this->unreviewedMediaCaptionList->items) > 0; + } + + public function getUnreviewedCaptionMedia() { + return $this->unreviewedMediaCaptionList->items; + } +} diff --git a/src/UNL/MediaHub/Controller.php b/src/UNL/MediaHub/Controller.php index 6bc13d5cf..3849411db 100644 --- a/src/UNL/MediaHub/Controller.php +++ b/src/UNL/MediaHub/Controller.php @@ -714,6 +714,16 @@ public static function sharedTemplatePageActions($siteNotice, $context, &$page, if (isset($siteNotice) && $siteNotice->display) { $page->displayDCFNoticeMessage($siteNotice->title, $siteNotice->message, $siteNotice->type, $siteNotice->noticePath, $siteNotice->containerID); } + // Add a notice for logged users with: + // Active AI captions that have not been reviewed OR + // Videos that currently have no active captions but contain AI-generated captions that could be activated after review. + $auth = UNL_MediaHub_AuthService::getInstance(); + if($auth->isLoggedIn()) { + if(count(UNL_MediaHub_User::getMediaWithUnreviewedCaptions($auth->getUser())->items) > 0) { + $page->displayDCFNoticeMessage('You have unreviewed media captions', "Please review auto generated AI captions for your media for any missed context or inaccuracies. View Unreviewed Media Captions.", 'dcf-notice-warning', $siteNotice->noticePath, $siteNotice->containerID); + } + } + } /** diff --git a/src/UNL/MediaHub/MediaList/Filter/UnreviewedCaptions.php b/src/UNL/MediaHub/MediaList/Filter/UnreviewedCaptions.php new file mode 100644 index 000000000..c2256074e --- /dev/null +++ b/src/UNL/MediaHub/MediaList/Filter/UnreviewedCaptions.php @@ -0,0 +1,45 @@ +user = $user; + } + + public function apply(Doctrine_Query_Abstract $query) + { + $query->addFrom('LEFT JOIN mediahub.media_text_tracks mtt ON (mtt.media_id = m.id)'); + $query->addFrom('JOIN mediahub.feed_has_media fhm ON (fhm.media_id = m.id)'); + $query->addFrom('JOIN mediahub.user_has_permission uhm ON (uhm.feed_id = fhm.feed_id)'); + $query->where('(m.media_text_tracks_id IS NULL and mtt.source = "ai transcriptionist" and permission_id = 2) OR (mtt.source = "ai transcriptionist" and uhm.user_uid = ? and uhm.feed_id = fhm.feed_id and m.media_text_tracks_id IS NOT NULL and media_text_tracks_source_id is null and m.media_text_tracks_id = mtt.id and permission_id = 2)', $this->user->uid); + $query->groupBy('m.id'); + } + + public function getLabel() + { + return 'UnreviewedCaptions'; + } + + public function getType() + { + return 'UnreviewedCaptions'; + } + + public function getValue() + { + return $this->query; + } + + public function __toString() + { + return ''; + } + + public static function getDescription() + { + return 'List of all media that either have an active AI caption that has not been reviewed or have a generated AI caption that is not yet activated and is pending review.'; + } +} diff --git a/src/UNL/MediaHub/User.php b/src/UNL/MediaHub/User.php index a90b758f0..2a5e3d1bd 100644 --- a/src/UNL/MediaHub/User.php +++ b/src/UNL/MediaHub/User.php @@ -49,6 +49,17 @@ function getFeeds($options = array()) return new UNL_MediaHub_User_FeedList($options); } + /** + * Returns a list of media with unreviewed AI-generated captions. + * + * @return UNL_MediaHub_MediaList + */ + public static function getMediaWithUnreviewedCaptions($uid) + { + $options['filter'] = new UNL_MediaHub_MediaList_Filter_UnreviewedCaptions($uid); + return new UNL_MediaHub_MediaList($options); + } + /** * Get an array of feed IDs * @@ -66,7 +77,7 @@ public function getFeedIDs() $result = $q->fetchAll(PDO::FETCH_COLUMN); return $result; } - + public function canTranscode() { return UNL_MediaHub::$auto_transcode_hls_all_users; diff --git a/www/manager/templates/html/Feed/Media/FileUpload.tpl.php b/www/manager/templates/html/Feed/Media/FileUpload.tpl.php index 660940852..a34eac1c9 100644 --- a/www/manager/templates/html/Feed/Media/FileUpload.tpl.php +++ b/www/manager/templates/html/Feed/Media/FileUpload.tpl.php @@ -180,20 +180,23 @@ class="
AI Captions -
+

- Captions are free to generate and will automatically - be translated into English. You would only want to - check this if you have your own captions. + Captions are required for all media uploads. + Only select this option if you are providing your own captions.

- +

+ Captions are free to generate and will automatically + be translated into English. +

+

Note: All videos will be optimized for web in multiple resolutions automatically. diff --git a/www/manager/templates/html/Media/EditCaptions.tpl.php b/www/manager/templates/html/Media/EditCaptions.tpl.php index e8fdde2ad..a0872259e 100644 --- a/www/manager/templates/html/Media/EditCaptions.tpl.php +++ b/www/manager/templates/html/Media/EditCaptions.tpl.php @@ -97,21 +97,33 @@ class="dcf-btn dcf-btn-primary" -

- - Review - -

Captions need to be reviewed before activation

+
+ + +
+ > + +
+ +

Captions need to be reviewed

+ +

Captions need to be reviewed before activation

+
diff --git a/www/templates/html/CaptionReviewListManager.tpl.php b/www/templates/html/CaptionReviewListManager.tpl.php new file mode 100644 index 000000000..b67fb9c59 --- /dev/null +++ b/www/templates/html/CaptionReviewListManager.tpl.php @@ -0,0 +1,59 @@ +
+
+

Unreviewed Media Captions List

+

Captions for audio content are required for ADA compliance. Please review the list of media items that either have active AI-generated captions that have not been reviewed, or have generated captions pending activation and review. Ensure all AI-generated captions are reviewed for accuracy and context. You can also upload your own captions.

+ +
+
+ hasUnreviewedCaptionMedia()) { ?> +

List of all media that either have an active AI caption that has not been reviewed or have a generated AI caption that is not yet activated and is pending review.

+ + + + + + + + + + + + getUnreviewedCaptionMedia() as $media): ?> + + + + + + + + + +
MediaTypeDate UploadedUploaded ByAssociated ChannelsActions
+ + + + + getFeeds()->items as $channel) { + $a = $dom->createElement('a', htmlspecialchars($channel->title)); + $a->setAttribute('href', htmlspecialchars(UNL_MediaHub::escape(UNL_MediaHub_Controller::getURL($channel)))); + $channels_associated_with_media[] = $dom->saveHTML($a); + } ?> + + + + Manage Captions + +
+ +

There are currently no unreviewed AI-generated captions.

+ +
+
+
+
\ No newline at end of file diff --git a/www/templates/html/Navigation.tpl.php b/www/templates/html/Navigation.tpl.php index d489edcf6..56d17263f 100644 --- a/www/templates/html/Navigation.tpl.php +++ b/www/templates/html/Navigation.tpl.php @@ -8,6 +8,7 @@
  • Channels
  • Manage Media
  • isLoggedIn()) { ?> +
  • Unreviewed Media Captions
  • getUser()->isAdmin()) { ?>
  • Transcode Manager
  • Transcription Manager