From d2e84139ed368bb0759488d35f23edbd163f5ecc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Nicol=C3=A1s=20Tamargo?= Date: Wed, 8 Jun 2022 16:15:53 +0300 Subject: [PATCH] MBS-12395: Report for videos in mediums that shouldn't support video This will help find both videos that have been wrongly reused in audio-only releases, and stuff like video CDs marked as just "CD". I hand-picked a list of formats that do not support video rather than a list of those that can because I'd rather have missing entries if we add a new format that doesn't support video than false positives if we add a new format that does. --- .../Server/Report/VideosInNonVideoMediums.pm | 91 +++++++++++++++++++ lib/MusicBrainz/Server/ReportFactory.pm | 2 + root/report/ReportsIndex.js | 4 + root/report/VideosInNonVideoMediums.js | 46 ++++++++++ root/server/components.js | 1 + 5 files changed, 144 insertions(+) create mode 100644 lib/MusicBrainz/Server/Report/VideosInNonVideoMediums.pm create mode 100644 root/report/VideosInNonVideoMediums.js diff --git a/lib/MusicBrainz/Server/Report/VideosInNonVideoMediums.pm b/lib/MusicBrainz/Server/Report/VideosInNonVideoMediums.pm new file mode 100644 index 00000000000..c315617b420 --- /dev/null +++ b/lib/MusicBrainz/Server/Report/VideosInNonVideoMediums.pm @@ -0,0 +1,91 @@ +package MusicBrainz::Server::Report::VideosInNonVideoMediums; +use Moose; + +with 'MusicBrainz::Server::Report::RecordingReport', + 'MusicBrainz::Server::Report::FilterForEditor::RecordingID'; + +my $NON_VIDEO_FORMATS = join(',', ( + 1, # CD + 3, # SACD + 6, # MiniDisc + 7, # Vinyl + 8, # Cassette + 10, # Reel-to-reel + 14, # Wax Cylinder + 15, # Piano Roll + 16, # DCC + 25, # HDCD + 29, # 7" Vinyl + 30, # 10" Vinyl + 31, # 12" Vinyl + 34, # 8cm CD + 36, # SHM-CD + 37, # HQCD + 38, # Hybrid SACD + 42, # Enhanced CD + 44, # DTS CD + 50, # Edison Diamond Disc + 51, # Flexi-disc + 52, # 7" Flexi-disc + 53, # Shellac + 54, # 10" Shellac + 55, # 12" Shellac + 56, # 7" Shellac + 57, # SHM-SACD + 58, # Pathé disc + 61, # Copy Control CD + 63, # Hybrid SACD (CD layer) + 64, # Hybrid SACD (SACD layer) + 67, # DualDisc (CD side) + 70, # DVDplus (CD side) + 73, # Phonograph record + 74, # PlayTape + 75, # HiPac + 81, # VinylDisc (Vinyl side) + 82, # VinylDisc (CD side) + 83, # Microcassette + 84, # SACD (2 channels) + 85, # SACD (multichannel) + 86, # Hybrid SACD (SACD layer, multichannel) + 87, # Hybrid SACD (SACD layer, 2 channels) + 88, # SHM-SACD (multichannel) + 89, # SHM-SACD (2 channels) + 90, # Tefifon + 128, # DataPlay + 129, # Mixed Mode CD +)); + +sub query {<<~"SQL"} + SELECT + q.id AS recording_ID, + row_number() OVER (ORDER BY q.aname COLLATE musicbrainz, q.rname COLLATE musicbrainz) + FROM ( + SELECT DISTINCT + r.id, + ac.name AS aname, + r.name AS rname + FROM + recording r + JOIN artist_credit ac ON r.artist_credit = ac.id + JOIN track t ON t.recording = r.id + JOIN medium m ON t.medium = m.id + WHERE + r.video IS TRUE + AND t.is_data_track IS FALSE + AND m.format IN ($NON_VIDEO_FORMATS) + ) AS q + SQL + +__PACKAGE__->meta->make_immutable; +no Moose; +1; + +=head1 COPYRIGHT AND LICENSE + +Copyright (C) 2022 MetaBrainz Foundation + +This file is part of MusicBrainz, the open internet music database, +and is licensed under the GPL version 2, or (at your option) any +later version: http://www.gnu.org/licenses/gpl-2.0.txt + +=cut diff --git a/lib/MusicBrainz/Server/ReportFactory.pm b/lib/MusicBrainz/Server/ReportFactory.pm index 16572ec6865..087dacf1b6d 100644 --- a/lib/MusicBrainz/Server/ReportFactory.pm +++ b/lib/MusicBrainz/Server/ReportFactory.pm @@ -104,6 +104,7 @@ use MusicBrainz::Server::PagedReport; TracksWithoutTimes TracksWithSequenceIssues UnlinkedPseudoReleases + VideosInNonVideoMediums WikidataLinksWithMultipleEntities WorkSameTypeAsParent ); @@ -201,6 +202,7 @@ use MusicBrainz::Server::Report::TracksNamedWithSequence; use MusicBrainz::Server::Report::TracksWithoutTimes; use MusicBrainz::Server::Report::TracksWithSequenceIssues; use MusicBrainz::Server::Report::UnlinkedPseudoReleases; +use MusicBrainz::Server::Report::VideosInNonVideoMediums; use MusicBrainz::Server::Report::WikidataLinksWithMultipleEntities; use MusicBrainz::Server::Report::WorkSameTypeAsParent; diff --git a/root/report/ReportsIndex.js b/root/report/ReportsIndex.js index be15fa11ebc..510eef06bd2 100644 --- a/root/report/ReportsIndex.js +++ b/root/report/ReportsIndex.js @@ -513,6 +513,10 @@ const ReportsIndex = ({$c}: Props): React.Element => ( content={l('Recordings with dates in the future')} reportName="RecordingsWithFutureDates" /> +

{l('Places')}

diff --git a/root/report/VideosInNonVideoMediums.js b/root/report/VideosInNonVideoMediums.js new file mode 100644 index 00000000000..71629c07c45 --- /dev/null +++ b/root/report/VideosInNonVideoMediums.js @@ -0,0 +1,46 @@ +/* + * @flow strict-local + * Copyright (C) 2022 MetaBrainz Foundation + * + * This file is part of MusicBrainz, the open internet music database, + * and is licensed under the GPL version 2, or (at your option) any + * later version: http://www.gnu.org/licenses/gpl-2.0.txt + */ + +import * as React from 'react'; + +import RecordingList from './components/RecordingList'; +import ReportLayout from './components/ReportLayout'; +import type {ReportDataT, ReportRecordingT} from './types'; + +const VideosInNonVideoMediums = ({ + canBeFiltered, + filtered, + generated, + items, + pager, +}: ReportDataT): React.Element => ( + + + +); + +export default VideosInNonVideoMediums; diff --git a/root/server/components.js b/root/server/components.js index 06a9ca4020f..51c9774d142 100644 --- a/root/server/components.js +++ b/root/server/components.js @@ -269,6 +269,7 @@ module.exports = { 'report/TracksWithSequenceIssues': require('../report/TracksWithSequenceIssues'), 'report/TracksWithoutTimes': require('../report/TracksWithoutTimes'), 'report/UnlinkedPseudoReleases': require('../report/UnlinkedPseudoReleases'), + 'report/VideosInNonVideoMediums': require('../report/VideosInNonVideoMediums'), 'report/WikidataLinksWithMultipleEntities': require('../report/WikidataLinksWithMultipleEntities'), 'report/WorkSameTypeAsParent': require('../report/WorkSameTypeAsParent'), 'search/SearchIndex': require('../search/SearchIndex'),