DB/Util/Ratings.pm untested

filter: Statementstmt 0.0% 0 / 16 Branchbran n/a Conditioncond n/a MC/DCmcdc n/a Subroutinesub 0.0% 0 / 4 Podpod 0.0% 0 / 1 totaltotal 0.0% 0 / 21 CC 1 SCAR 6.9
CC
1
Cov
0%
add_user
2.0
BEGIN
2.0
BEGIN
2.0
CRAP 2.0
1 # SongStats.pm provides methods that allow individual users to rate songs.
2 # It also does things like calculate the average rating for a song,
3 # as well as handling the incrementing of playcounts.
4  
5 package Audio::DB::Util::SongStats;
6 $Id: Ratings.pm,v 1.2 2005/02/27 16:56:25 todd Exp $
7  
8 use strict 'vars';
9 use lib '/Users/todd/projects_personal';
10 use Audio::DB::Util::Rearrange; # Ubiquitous rearrange...
11 use vars qw($VERSION @ISA @EXPORT @EXPORT_OK);
12 @ISA = 'Exporter';
13 @EXPORT_OK = qw(add_to_playlist delete_from_playlist fetch_playlists);
14  
15 sub add_user {
16 my ($self,@p) = @_;
17 my ($username,$login,$password,$privileges) = rearrange([qw/NAME USER PASS PRIVS/],@p);
18
19
20 }
21  
22  
23  
24  
25 1;
26  
27 =pod
28 Methods:
29 user management
30 multiplaylists / user (and option to share with others)
31
32 user ratings (for songs and playlists)
33
34 browse by letter of alphabet, genre, album
35 Stats reporting
36  
37  
38 =head1 NAME
39  
40 Apache::Audio::DB - Generate a database of your tunes complete with searchable interface and nifty statistical analyses!
41  
42 =head1 SYNOPSIS
43  
44 # httpd.conf or srm.conf
45 AddType audio/mpeg mp3 MP3
46
47 # httpd.conf or access.conf
48 <Location /songs>
49 SetHandler perl-script
50 PerlHandler Apache::MP3::Sorted
51 PerlSetVar SortFields Album,Title,-Duration
52 PerlSetVar Fields Title,Artist,Album,Duration
53 </Location>
54  
55 =head1 TODO
56  
57  
58 Streaming code and links
59  
60 BUILDING URLs from non-blessed items...need to handle this because
61 it will come up alot
62  
63 DB.pm Use lincolns code for scanning files
64  
65 Browse filesystem
66  
67 Update DB scripts
68  
69 HTML module of common formatting options
70 configuration page...
71 limits to return
72 option to download tarballs
73
74 Figure out how to track paths and such...
75 Preserving this state is kinda hairy
76  
77 CLEAN UP THE BUILD URL SUB
78 OPTIMIZE QUERIES AND OBJECT CONSTRUCTION
79 SEPEERATE OUT OBJECT CODE
80  
81 Seperate out HTML formatting into a seperate module
82  
83 Error checking and handling
84  
85 Streaming code
86 Column Sorting
87 User management
88 Playlist integration
89 Playlist sharing
90 Multiple Playlists
91 Interface preferences
92  
93  
94 =head1 DESCRIPTION
95  
96 Apache::Audio::DB subclasses Apache::MP3 to generate a relational database
97 of your music collection. This allows browsing by various criteria that
98 are not available when simply browsing the filesystem. For example,
99 users my browse by genre, year, or era. Apache::Audio::DB also provides
100 search capabilities.
101  
102 =head1 CUSTOMIZING
103  
104 This class adds several new Apache configuration variable.
105  
106 Database specific variables:
107 ----------------------------
108 Value Default
109 PerlSetVar DB_Name database name musicdb
110 PerlSetVar Create boolean no
111 PerlSetVar Host database user name localhost
112 PerlSetVar User user name
113 PerlSetVar Password db password
114
115 =over 4
116  
117 =item B<DB_Name> I<field>
118  
119 This is the name of the database. If not provided, musicdb will be used.
120  
121 =item B<Create>
122  
123 Examples:
124  
125 PerlSetVar SortFields Album,Title # sort ascending by album, then title
126 PerlSetVar SortFields +Artist,-Kbps # sort ascending by artist, descending by kbps
127  
128 When constructing a playlist from a recursive directory listing,
129 sorting will be B<global> across all directories. If no sort order is
130 specified, then the module reverts to sorting by file and directory
131 name. A good value for SortFields is to sort by Artist,Album and
132 track:
133  
134 PerlSetVar SortFields Artist,Album,Track
135  
136 Alternatively, you might want to sort by Description, which
137 effectively sorts by title, artist and album.
138  
139 The following are valid fields:
140  
141 Field Description
142
143 album The album
144 artist The artist
145 bitrate Streaming rate of song in kbps
146 comment The comment field
147 description Description, as controlled by DescriptionFormat
148 duration Duration of the song in hour, minute, second format
149 filename The physical name of the .mp3 file
150 genre The genre
151 samplerate Sample rate, in KHz
152 seconds Duration of the song in seconds
153 title The title of the song
154 track The track number
155  
156 Field names are case insensitive.
157  
158 =back
159  
160 =head1 METHODS
161  
162 Apache::MP3::Sorted overrides the following methods:
163  
164 sort_mp3s() mp3_table_header() mp3_list_bottom()
165  
166 It adds one new method:
167  
168 =over 4
169  
170 =item $field = $mp3->sort_fields
171  
172 Returns a list of the names of the fields to sort on by default.
173  
174  
175  
176 #### UI ELEMENTS THAT HAVEN'T BEEN REWORKED YET
177 #sub amg_link {
178 # my ($artist,$link_text) = @_;
179
180 # # Encode $artist for searching: UC, replace \s with |, replace ' and ,
181 # my $artist_encoded = uc $artist;
182 # $artist_encoded =~ s/\s/|/g;
183 # $artist_encoded =~ s/[,\'\-]//g;
184 # my $base_url = 'http://allmusic.com/cg/x.dll?p=amg&optl=1&sql=1';
185
186 # my $full_url = $base_url . $artist_encoded;
187
188 # # Formulate the AMG URL
189 # my $amg_link = '<a href="' . $base_url . $artist_encoded . '">' .
190 # $link_text . "</a>";
191
192 # return($amg_link);
193 #}
194  
195 #sub print_search_button {
196 # print center(
197 # startform(-action=>$full_url),
198 # submit(-name=>'submit',
199 # -value=>'Search Again'),
200 # endform);
201 # return;
202 #}