1
0
Fork 0
mirror of https://github.com/Yetangitu/ampache synced 2025-10-06 03:49:56 +02:00

Comitted initial Rio Player Plugin. This is going to need a lot of work ;)

This commit is contained in:
pb1dft 2007-02-26 19:24:51 +00:00
parent 2e0f0a31e5
commit 1681e9eef3
11 changed files with 2152 additions and 0 deletions

View file

@ -0,0 +1,35 @@
This is a crappy readme for the Rio Player plugin
Work in progress... Plugin isn't functional yet..
INSTALLATION
A full helpfile will be available at http://ampache.bountysource.com/wiki as soon as possible
NFS Setup
Edit you're /etc/exports and add the line below.
/your/nfs/path (rw,no_root_squash)
Create a directory in your NFS root with the ip address of your box as the folder name like;
/your/nfs/path/192.168.0.6
untar the mercury.arf in this folder with the command tar xf mercury.arf this file can be found in the normal Audio Receiver
setup ("c:\Program Files\Audio Receiver") when unchanged.
APACHE setup
Add this to your apache configuration;
Alias /layout/ "<ampache_root>/modules/rio/layout/"
Alias /query "<ampache_root>/modules/rio/rio.php"
Alias /results "<ampache_root>/modules/rio/rio.php"
AliasMatch ^/content/ "<ampache_root>/modules/rio/rio.php"
AliasMatch ^/favourites/ "<ampache_root>/modules/rio/rio.php"
AliasMatch ^/list/ "<ampache_root>/modules/rio/rio.php"
AliasMatch ^/tags "<ampache_root>/modules/rio/rio.php"
Ampache Setup
Copy the modules directory to the root of ampache.

View file

@ -0,0 +1,87 @@
<?php
/*
Copyright (c) 2001 - 2006 Ampache.org
All rights reserved.
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License v2
as published by the Free Software Foundation.
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., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
class AmpacheRioPlayer {
var $name ='Rio Player';
var $description ='Sets up ampache so a Rio Player can access it';
var $url ='';
var $version ='000001';
var $min_ampache ='333001';
var $max_ampache ='333005';
/**
* Constructor
* This function does nothing...
*/
function PluginRioPlayer() {
return true;
} // PluginLastfm
/**
* install
* This is a required plugin function it inserts the required preferences
* into Ampache
*/
function install() {
/* We need to insert the new preferences */
$sql = "INSERT INTO preferences (`name`,`value`,`description`,`level`,`type`,`catagory`) " .
"VALUES ('rio_querylimit','3000','Rio Player Query Limit','100','integer','system')";
$db_results = mysql_query($sql,dbh());
$sql = "INSERT INTO preferences (`name`,`value`,`description`,`level`,`type`,`catagory`) " .
"VALUES ('rio_track_stats','0','Rio Player Track Stats','100','boolean','system')";
$db_results = mysql_query($sql,dbh());
$sql = "INSERT INTO preferences (`name`,`value`,`description`,`level`,`type`,`catagory`) " .
"VALUES ('rio_user','','Rio Player Global User','100','string','system')";
$db_results = mysql_query($sql,dbh());
$sql = "INSERT INTO preferences (`name`,`value`,`description`,`level`,`type`,`catagory`) " .
"VALUES ('rio_global_stats','0','Rio Player Group Stats','100','boolean','system')";
$db_results = mysql_query($sql,dbh());
fix_all_users_prefs();
} // install
/**
* uninstall
* This is a required plugin function it removes the required preferences from
* the database returning it to its origional form
*/
function uninstall() {
/* We need to remove the preivously added preferences */
$sql = "DELETE FROM preferences WHERE name='rio_querylimit' OR name='rio_track_stats' OR name='rio_user' OR name='rio_global_stats'";
$db_results = mysql_query($sql,dbh());
fix_all_users_prefs();
} // uninstall
} // end AmpacheRioPlayer
?>

View file

@ -0,0 +1,5 @@
/layout/en_UK/all_info=All Info
/layout/en_UK/remaining=Remaining Time
/layout/en_UK/scope=Scope View
/layout/en_UK/inverse_scope=Inverse Scope
/layout/en_UK/big_title=Big Title

View file

@ -0,0 +1,161 @@
de_private_playlists=0
// When doing filtered queries, should we match from the beginning or anywhere?
// eg. Should "bea" match "The Beatles" (0) or only "Beatles" (1)
// 0=do not filter from beginning
// 1=filter from beginning (default)
filter_from_beginning=1
// The reciver can hang or reboot on large queries. Use this setting to specify a Query Limit.
// eg. query_limit=3000 to limit large queries to 3000 entries. This is the default.
// The breaking point varies possibly depending on specific data returned and usage conditions (that use cache etc.?)
// If your rio hangs or reboots on some queries, try lowering this number.
// This entry should be an integer > 0
query_limit=3000
// RECEIVER STATS
// ==============
// You can treat each receiver as individual ampache users, or group all receivers into a single user.
// All usernames must be valid, existing ampache users.
// Basically this tries to make a receiver behave like a specific ampache user, and share stats and ACLs etc. with it.
// First you have to enable receiver stats.
// If disabled, ampache will not track any play stats or impose any sort of filters on the receivers, in
// which case the unit is simply levraging ampache's database, but operating outside of ampache itself.
//
// This will associate a receiver with an ampache user (more details below) and try to associate as many
// user specifc preferences as possible including 'most popular' lists, playlists and eventually ACLs etc.
// If you set track_receiver_stats=1, then you must configure the rest of this section. Otherwise this section is ignored.
// 0=Disable
// 1=Enable (default)
track_receiver_stats=1
// Next you must specify if you want to assocaiate each with specific ampache users as individuals,
// or group alll receivers to a single ampache user.
// Note that for individual receiver association this to be reliable, your DHCP server should be configured to always
// assign a specific IP to a specifc receiver, based on it's MAC address. Otherwise a receiver could have multiple IPs,
// or IPs could bounce between receivers, in which case tracking individually will be ineffective.
// 0=Track receivers individually (default)
// 1=Group receivers together
group_receivers_together=0
// Next you must specify if you want ampache to automatically create the users to associate the receivers with.
// If enabled, then whenever a new unit is seen, an associated ampache user will be created, if it doesn't already exist.
// If you have specifed the username in this config file, that username will be used, otherwise a default
// username will be created in the form of 'rio-<dotted_ip_address>', like 'rio-192.168.0.10'
// If you specified group_receivers_together=1, then a user for the IP '0.0.0.0' will be created.
// Automatically created users will have their access level set as 'disabled' and a random password will be set, since
// the receiver doesn't actually 'log in'.
// If you want to modify the user access level or password you can do so in the ampache web interface as any Admin user.
// If you do not enable this setting, then you MUST specify all receivers by IP (or 0.0.0.0) and assign a username,
// which you've previously created in ampache.
// 0=User will manually create receiver-mappings and manually create those user accounts
// 1=Users will be automatically created for new units (default)
//
// NOTE: If you let users be automatically created, the rest of this setup is easy and can be ignored
// otherwise it's up to you to make everything work the way you want.
// 0=You have to create ampache users manually for the receivers
// 1=Users will be automatically created for you (default)
automatically_create_users=1
// Finally you specify each of your receivers and an associated ampache username to assign their play stats to.
// If you specified automatically_create_users=0, you MUST do this for each receiver.
// otherwise you can simply let the system auto-create the users with default usernames.
// Remember, if you set group_receivers_together=1, then you MUST create an entry for 0.0.0.0
// if you also specified automatically_create_users=0
// The format is:
// rio_user_<dotted_ip_address_of_receiver>=<ampache_username>
//
// eg:
// rio_user_0.0.0.0=rio (special address for group_receivers_together=1)
// rio_user_192.168.0.10=bedroom
//
// If not user specified, any automatically created username will be 'rio-<dotted_ip_address>'
// eg:
// 'all receivers if grouped' would be 'rio-0.0.0.0'
// '192.168.0.10' would be 'rio-192.168.0.10'
//
// Note: You can specify an existing ampache user, to update that user's stats as well as inherit it's Most Popular lists etc.
rio_user_0.0.0.0=rio
// DYNAMIC PLAYLISTS
// -----------------
// These playlists are generated on the fly based on usage data and newest album info etc. in the
// same manner as those in the ampache web interface.
// For each playlist, specify the maximum number of entries you want to be retreived for that list.
// Setting a particular playlist to 0 removes it from the UI entirely
// Note that in order to use 'user' spcific playlists, you must have track_receiver_stats=1 above
playlist_global_most_popular_songs=50
playlist_user_most_popular_songs=50
// These playlists contain each track from the album.
// The value indicates how many albums you want on the list. You can have up to 100 each.
// They are preceded by a 3-letter code to indicate what type it is:
// new - Newest Albums
// gAl - Most Popular Albums (Global)
// gAr - Most Popular Artists (Global)
// uAl - Most Popular Albums (User)
// uAr - Most Popular Artists (User)
playlist_newest_albums=5
playlist_global_most_popular_albums=5
playlist_user_most_popular_albums=5
playlist_global_most_popular_artists=5
playlist_user_most_popular_artists=5
// If you want to print divider lines "-----" between each playlist section,
// to make navigating large lists a bit easier, set this:
// 0=Don't print divider lines (default)
// 1=Print divider lines
playlist_dividers=1
// FAVORITES
// ---------
// You can dynamically populate the "favorites" list, acessible via the "List" button on the receiver's
// remote control. This list can have up to 100 entries TOTAL, a limitiation of the hardware. Only the first
// 100 entries will be used.
// Specify how many of each type you want to appear on the list.
favorites_newest_albums=5
favorites_global_most_popular_albums=5
favorites_user_most_popular_albums=5
favorites_global_most_popular_artists=5
favorites_user_most_popular_artists=5
// If you want to print divider/header lines "---<section>---" between each favorites section, set this:
// 0=Don't print divider lines (default)
// 1=Print divider lines
favorites_dividers=1

File diff suppressed because it is too large Load diff

105
contrib/plugins/RioPlayer/ssdp.pl Executable file
View file

@ -0,0 +1,105 @@
#!/usr/bin/perl -T -w
#
# UDP server for auto-configuration of Dell Audio Radio.
#
# Listens on UDP port 21075 for SSDP requests and
# replies to point the client box to the appropriate
# server.
#
# Typically put this is /etc/ssdp.pl and run it from
# /etc/rc.d/rc.local (or equiv). This runs as a
# daemon and consumes few resources. The client box
# sends out a couple of requests when it powers up
# and none otherwise.
#
use strict;
use POSIX;
use IO::Socket;
$ENV{PATH} = "/usr/bin:/bin:/usr/local/bin";
$ENV{BASH_ENV} = "/root/.bashrc";
sub mlog($) {
my $msg = shift;
system("logger -t SSDP \"$msg\"");
}
sub mdie($) {
my $msg = shift;
mlog $msg;
exit 1;
}
sub sig_handle($) {
mdie "SSDP server exit on signal";
}
# $mserve_ip must be a dotted-quad unless you modify the client
# NFS image to include /etc/resolv.conf.
#
my $ssdp_port = 21075;
my $mserve_ip = "10.60.60.16"; # web and NFS server IP address
my $mserve_port = "80"; # web server port
#
# The box makes two different requests. One comes from the kernel
# during initial booting, the second comes from the player application
# after the second boot when the player starts.
#
# The respones are different for Linux. If there is a port number
# on the first "linux" request then the client box will use that port
# for portmapper lookups, which is generally bad when talking to
# another linux box.
#
# The second "player" response includes a port number that indicates
# the port number to use for HTTP music related requests. I use
# port 81 and setup a virtual server in Apache to respond to music
# requests, but you may want to do this differently.
#
my $player_request = "^upnp:uuid:1D274DB0-F053-11d3-BF72-0050DA689B2F";
my $linux_request = "^upnp:uuid:1D274DB1-F053-11d3-BF72-0050DA689B2F";
my (
$pid, # PID of server
$server, # Handle for server socket
$him, # peer making UDP request
$datagram, # Packet from client
);
#
# Cruft to become a daemon
#
$pid = fork;
exit if $pid;
mlog "SSDP server started";
mdie "Could not fork: $!" unless defined($pid);
POSIX::setsid() or mdie "Cannot start new session: $!";
$SIG{INT} = \&sig_handle;
$SIG{TERM} = \&sig_handle;
$SIG{HUP} = \&sig_handle;
$0 = "ssdp";
#
# Get a socket to be a UDP server
$server = IO::Socket::INET->new(LocalPort => $ssdp_port,
Proto => "udp")
or mdie "Couldn't be a udp server on port $ssdp_port : $@\n";
#
# Wait for requests and respond if appropriate
#
while ($him = $server->recv($datagram, 256, 0)) {
my ($port, $iaddr) = sockaddr_in($server->peername);
my $peer = inet_ntoa($iaddr);
$datagram =~ s/\n//g;
if ($datagram =~ $linux_request) {
mlog "Linux request from $peer.";
$server->send("http://$mserve_ip/descriptor.xml\n");
}
if ($datagram =~ $player_request) {
mlog "Player request from $peer.";
$server->send("http://$mserve_ip:$mserve_port/descriptor.xml\n");
}
}