Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
MBS-11117: Create report for too long discIDs
DiscIDs should be assigned to only CD format mediums and should not be above 80-something minutes. CDTOC above the cutoff (set to 100 minutes here) were probably created with a buggy version of foo_musicbrainz and can be removed.
- Loading branch information
Showing
8 changed files
with
219 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
package MusicBrainz::Server::Report::CdTocDubiousLength; | ||
use Moose; | ||
|
||
with 'MusicBrainz::Server::Report::CdTocReport'; | ||
|
||
sub component_name { 'CdTocDubiousLength' } | ||
|
||
sub query { | ||
q{ | ||
SELECT | ||
cdtoc.discid, | ||
medium_format.name AS format, | ||
cdtoc.leadout_offset / 75 AS length, -- seconds | ||
row_number() OVER ( | ||
ORDER BY medium_format.name, cdtoc.leadout_offset DESC) | ||
FROM | ||
cdtoc | ||
JOIN medium_cdtoc ON medium_cdtoc.cdtoc = cdtoc.id | ||
JOIN medium ON medium_cdtoc.medium = medium.id | ||
JOIN medium_format ON medium.format = medium_format.id | ||
WHERE | ||
leadout_offset > 75 * 60 * 100 -- cutoff 100 minutes | ||
ORDER BY | ||
medium_format.name, | ||
cdtoc.leadout_offset DESC | ||
} | ||
} | ||
|
||
__PACKAGE__->meta->make_immutable; | ||
no Moose; | ||
1; | ||
|
||
=head1 COPYRIGHT AND LICENSE | ||
Copyright (C) 2020 Jerome Roy | ||
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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
package MusicBrainz::Server::Report::CdTocReport; | ||
use Moose::Role; | ||
|
||
with 'MusicBrainz::Server::Report::QueryReport'; | ||
|
||
around inflate_rows => sub { | ||
my $orig = shift; | ||
my $self = shift; | ||
|
||
my $items = $self->$orig(@_); | ||
|
||
return [ | ||
@$items | ||
]; | ||
}; | ||
|
||
1; | ||
|
||
=head1 COPYRIGHT | ||
Copyright (C) 2020 Jerome Roy | ||
This program is free software; you can redistribute it and/or modify | ||
it under the terms of the GNU General Public License as published by | ||
the Free Software Foundation; either version 2 of the License, or | ||
(at your option) any later version. | ||
This program is distributed in the hope that it will be useful, | ||
but WITHOUT ANY WARRANTY; without even the implied warranty of | ||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
GNU General Public License for more details. | ||
You should have received a copy of the GNU General Public License | ||
along with this program; if not, write to the Free Software | ||
Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. | ||
=cut |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
/* | ||
* @flow strict-local | ||
* Copyright (C) 2020 Jerome Roy | ||
* | ||
* 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 Layout from '../layout'; | ||
import formatUserDate from '../utility/formatUserDate'; | ||
|
||
import CdTocList from './components/CdTocList'; | ||
import FilterLink from './FilterLink'; | ||
import type {ReportDataT, ReportCdTocT} from './types'; | ||
|
||
const CdTocDubiousLength = ({ | ||
$c, | ||
generated, | ||
items, | ||
pager, | ||
}: ReportDataT<ReportCdTocT>): React.Element<typeof Layout> => ( | ||
<Layout $c={$c} fullWidth title={l('Disc IDs with dubious duration')}> | ||
<h1>{l('Disc IDs with dubious duration')}</h1> | ||
|
||
<ul> | ||
<li> | ||
{l(`This report shows disc IDs indicating a total duration much longer | ||
than what a standard CD allows (at least 100 minutes). This usually | ||
means a disc ID was created for the wrong format (SACD) or with a buggy | ||
tool. These disc IDs can safely be removed.`)} | ||
</li> | ||
<li> | ||
{texp.l('Total releases found: {count}', | ||
{count: pager.total_entries})} | ||
</li> | ||
<li> | ||
{texp.l('Generated on {date}', | ||
{date: formatUserDate($c, generated)})} | ||
</li> | ||
</ul> | ||
|
||
<CdTocList items={items} pager={pager} /> | ||
|
||
</Layout> | ||
); | ||
|
||
export default CdTocDubiousLength; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,71 @@ | ||
/* | ||
* @flow strict-local | ||
* Copyright (C) 2020 Jerome Roy | ||
* | ||
* 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 PaginatedResults from '../../components/PaginatedResults'; | ||
import loopParity from '../../utility/loopParity'; | ||
import type {ReportCdTocT} from '../types'; | ||
import formatTrackLength | ||
from '../../static/scripts/common/utility/formatTrackLength'; | ||
|
||
type Props = { | ||
+items: $ReadOnlyArray<ReportCdTocT>, | ||
+pager: PagerT, | ||
}; | ||
|
||
const CdTocList = ({ | ||
items, | ||
pager, | ||
}: Props): React.Element<typeof PaginatedResults> => { | ||
const colSpan = 3; | ||
|
||
return ( | ||
<PaginatedResults pager={pager}> | ||
<table className="tbl"> | ||
<thead> | ||
<tr> | ||
<th>{l('Disc ID')}</th> | ||
<th>{l('Format')}</th> | ||
<th>{l('Length')}</th> | ||
</tr> | ||
</thead> | ||
<tbody> | ||
{items.map((item, index) => { | ||
return ( | ||
<tr className={loopParity(index)} key={item.cdtoc_id}> | ||
{item.discid ? ( | ||
<> | ||
<td> | ||
<a href={'/cdtoc/' + item.discid}> | ||
{item.discid} | ||
</a> | ||
</td> | ||
<td> | ||
{item.format} | ||
</td> | ||
<td> | ||
{formatTrackLength(1000 * item.length)} | ||
</td> | ||
</> | ||
) : ( | ||
<td colSpan={colSpan}> | ||
{l('This Disc ID no longer exists.')} | ||
</td> | ||
)} | ||
</tr> | ||
); | ||
})} | ||
</tbody> | ||
</table> | ||
</PaginatedResults> | ||
); | ||
}; | ||
|
||
export default CdTocList; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters