/
dudl-musalist
45 lines (36 loc) · 1.07 KB
/
dudl-musalist
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
#!/usr/bin/perl -w
#
# Copyright (c) 2008 Rainer Clasen
#
# This program is free software; you can redistribute it and/or modify
# it under the terms described in the file LICENSE included in this
# distribution.
#
# generate list of all albums as quick reference when checking for new
# stuff to add
use strict;
use Getopt::Long;
use Dudl::DB;
my $dudl = new Dudl::DB;
my $db = $dudl->db;
my $res = $db->select(
"aa.nname, a.album, date_part('year', a.publish_date) ".
"FROM ".
"mus_album a ".
"INNER JOIN mus_artist aa ON a.artist_id = aa.id ".
"WHERE ".
"a.id > 0 ".
"AND aa.id > 0 ".
"ORDER BY lower(aa.nname), lower(a.album)" )
or die $db->errstr;
my( $artist, $album, $year );
$res->bind_columns(\( $artist, $album, $year ));
while( $res->fetch ){
$year ||= "";
print "$artist:\t$album ($year)\n";
}
# TODO: indicate broken files
=cut
SELECT count(*), album_id FROM store_file WHERE broken and album_id > 0 GROUP BY album_id;
SELECT count(*), album_id FROM store_file WHERE album_id > 0 GROUP BY album_id;
SELECT *,total,badquality,broken FROM mus_xfile WHERE album_id > 0;