Hi folks, this is a patch, which has a go at implementing support for
compilation CDs.
This makes the following changes:
In admin/editalbum.pl, a check is made to see if other albums with the
same name exist in the database. If there are, then these are listed, and
an option is presented to "Mark these n albums as a compilation disk?"
This option submits to admin/comp.pl, which then takes all the tracks of
all the albums with this name, and merges them into one album. This album
is assigned to the "Compilation" artist which is created if necessary.
NOTE:- The artist of each track is retained.
In album.pl, in addition to showing tracks on albums by the artist, it
also shows (under "Other") tracks by the artist on albums not by the
artist.
The patch is somewhat rough at the moment. In particular it doesn't handle
album names with apostrophes in them at all. It should also not show the
"other" heading if there are no additional tracks.
Can anybody see any other parts of Obs that will need fixing up to cope
with this. I checked the CleanUp.pl RemoveEmpties.pl and search.pl
scripts, and I think they should all still work no problems.
Rob
--
----------------------------------------------------
Remember: You are unique - just like everybody else.
Index: install-www.pl
===================================================================
RCS file: /src/repository/obs/install-www.pl,v
retrieving revision 1.20
diff -u -r1.20 install-www.pl
--- install-www.pl 2001/09/29 07:31:21 1.20
+++ install-www.pl 2001/11/09 14:16:30
@@ -54,6 +54,7 @@
admin/remartist.pl
admin/remtrack.pl
admin/clearqueue.pl
+admin/comp.pl
DBForm.pm
newtracks.pl
album.pl
Index: cgi-bin/album.pl
===================================================================
RCS file: /src/repository/obs/cgi-bin/album.pl,v
retrieving revision 1.8
diff -u -r1.8 album.pl
--- cgi-bin/album.pl 2001/09/28 23:12:36 1.8
+++ cgi-bin/album.pl 2001/11/09 14:16:31
@@ -197,6 +197,63 @@
{
print "Query failed.",$o->p;
}
+
+#Show tracks on compilation disks.
+ print '<table border=0 cellpadding=1 cellspacing=2 width=100%>';
+ print '<tr><td colspan=3> </td></tr><tr>';
+
+ print '<td colspan=4 bgcolor="#cccccc" align=right>';
+ print '<font face="helvetica" color="red" size=2>';
+
+ print "Other</font><br></td></tr>\n";
+
+ my ($sth2, @row2);
+ $sth2 = $dbh->prepare("select Track.id, Track.name, ".
+ "Track.Tracknum, Album.name, Track.Length from " .
+ "Track, Album where Track.Artist=$artist and ".
+ "Album.Artist<>$artist and Track.Album=Album.id ".
+ "order by Album.name");
+ if ($sth2->execute())
+ {
+ for($i = 1; @row2 = $sth2->fetchrow_array; $i++)
+ {
+ print "<tr><td bgcolor=white width=16 height=16>";
+ if ($sched)
+ {
+ print '<a target=editsched href="sched/editsched.pl?add=';
+ }
+ else
+ {
+ print '<a target=playlist href="playlist.pl?add=';
+ }
+ print $row2[0] . '">';
+ print '<img src="/obs/images/add.gif" border=0 ';
+ print 'alt="Add track to playlist"></a>';
+
+ print "</td><td bgcolor=white>";
+ print '<font face="helvetica" color=black link=black size=2>';
+ print $row2[2];
+ print "<font></td><td bgcolor=white width=100%>";
+ print '<font face="helvetica" color=black link=black size=2>';
+ if (Obs::Defs::IsAdmin)
+ {
+ print "<a target=playlist href=";
+ print "\"edittrack.pl?track=$row2[0]\">";
+ }
+ print $o->escapeHTML("$row2[1] -- $row2[3]");
+ if (Obs::Defs::IsAdmin)
+ {
+ print "</a>";
+ }
+ print qq|</td><td bgcolor=white width=40><font
+ face="helvetica" color=black link=black size=2>|;
+ print SecsToTimeString($row2[4] / 10) . "</font>";
+ print "</td></tr>\n";
+ }
+ }
+ $sth2->finish();
+ print '</table>';
+ print '</a>';
}
print "</TABLE>\n";
Index: cgi-bin/admin/editalbum.pl
===================================================================
RCS file: /src/repository/obs/cgi-bin/admin/editalbum.pl,v
retrieving revision 1.3
diff -u -r1.3 editalbum.pl
--- cgi-bin/admin/editalbum.pl 2001/09/09 01:03:31 1.3
+++ cgi-bin/admin/editalbum.pl 2001/11/09 14:16:31
@@ -84,7 +84,21 @@
print "Remove This Album</a>";
print "</center>";
- }
+
+ my $sth=$dbh->prepare("select Album.name, Artist.name from Album, Artist
+where" .
+ " Album.name = '$Album{Name}' and Artist.id=Album.artist"
+.
+ " and Album.id<>$Album{Id}");
+ $sth->execute();
+ my @row; my $i=1;
+ while (@row=$sth->fetchrow_array){
+ if ($i==1) {print "Similar Albums:<ul>\n";}
+ $i++;
+ print "<li>$row[0] -- $row[1]\n";
+ }
+ print "</ul><a href=\"comp.pl?album=$Album{Id}\">" .
+ "Mark these $i albums as a compilation disk?</a><br>" if ($i>1);
+
+ }
}
else
{