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