Example #1
0
        Preference::insert('plex_servername', 'Plex Server Name', 'Ampache', '25', 'string', 'internal');
        Preference::insert('plex_public_address', 'Plex Public Address', '', '25', 'string', 'internal');
        Preference::insert('plex_public_port', 'Plex Public Port', '32400', '25', 'string', 'internal');
        Preference::insert('plex_local_auth', 'myPlex authentication required on local network', '0', '25', 'boolean', 'internal');
        Preference::insert('plex_match_email', 'Link myPlex users to Ampache based on e-mail address', '1', '25', 'boolean', 'internal');
        User::rebuild_all_preferences();
    }
}
init_db();
$myplex_username = Plex_XML_Data::getMyPlexUsername();
$myplex_authtoken = Plex_XML_Data::getMyPlexAuthToken();
$myplex_published = Plex_XML_Data::getMyPlexPublished();
$plex_servername = Plex_XML_Data::getServerName();
$plex_public_address = Plex_XML_Data::getServerPublicAddress();
$plex_public_port = Plex_XML_Data::getServerPublicPort();
$plex_local_port = Plex_XML_Data::getServerPort();
$plex_local_auth = AmpConfig::get('plex_local_auth');
$plex_match_email = AmpConfig::get('plex_match_email');
$plexact = $_REQUEST['plexact'];
switch ($plexact) {
    case 'auth_myplex':
        $myplex_username = $_POST['myplex_username'];
        $myplex_password = $_POST['myplex_password'];
        $plex_public_port = $_POST['plex_public_port'];
        if (!empty($myplex_username)) {
            // Register the server on myPlex and get auth token
            $myplex_authtoken = Plex_Api::validateMyPlex($myplex_username, $myplex_password);
            if (!empty($myplex_authtoken)) {
                echo T_('myPlex authentication completed.') . "<br />\r\n";
                Preference::update('myplex_username', -1, $myplex_username, true, true);
                Preference::update('myplex_authtoken', -1, $myplex_authtoken, true, true);
Example #2
0
 public static function playqueues($params)
 {
     $n = count($params);
     $r = Plex_XML_Data::createLibContainer();
     if ($n == 1) {
         $playlistID = $params[0];
         Plex_XML_Data::setTmpPlayQueue($r, $playlistID);
     } else {
         $type = $_GET['type'];
         $playlistID = $_GET['playlistID'];
         $uri = $_GET['uri'];
         $key = $_GET['key'];
         $shuffle = $_GET['shuffle'];
         Plex_XML_Data::setPlayQueue($r, $type, $playlistID, $uri, $key, $shuffle);
     }
     Plex_XML_Data::setContainerSize($r);
     self::apiOutputXml($r->asXML());
 }
Example #3
0
 protected static function get_users_account($authtoken = '')
 {
     if (empty($authtoken)) {
         $authtoken = Plex_XML_Data::getMyPlexAuthToken();
     }
     $action = 'users/account?auth_token=' . $authtoken;
     $res = self::myPlexRequest($action);
     return $res['xml'];
 }
Example #4
0
/* vim:set softtabstop=4 shiftwidth=4 expandtab: */
/**
 *
 * LICENSE: GNU General Public License, version 2 (GPLv2)
 * Copyright 2001 - 2014 Ampache.org
 *
 * 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.
 *
 */
require_once '../../lib/class/plex_xml_data.class.php';
$ow_config = array('http_host' => Plex_XML_Data::getServerAddress() . ':' . Plex_XML_Data::getServerPort(), 'web_path' => '/web');
require_once '../../lib/init.php';
if (!AmpConfig::get('plex_backend')) {
    echo "Disabled.";
    exit;
}
if (!defined('NO_SESSION') && !Access::check('interface', '100')) {
    Error::add('general', T_('Unauthorized.'));
    exit;
}
Example #5
0
        Preference::insert('plex_uniqid', 'Plex Server Unique Id', uniqid(), '25', 'string', 'internal');
        Preference::insert('plex_servername', 'Plex Server Name', 'Ampache', '25', 'string', 'internal');
        Preference::insert('plex_public_address', 'Plex Public Address', '', '25', 'string', 'internal');
        Preference::insert('plex_public_port', 'Plex Public Port', '32400', '25', 'string', 'internal');
        Preference::insert('plex_local_auth', 'myPlex authentication required on local network', '0', '25', 'boolean', 'internal');
        Preference::insert('plex_match_email', 'Link myPlex users to Ampache based on e-mail address', '1', '25', 'boolean', 'internal');
        User::rebuild_all_preferences();
    }
}
init_db();
$myplex_username = Plex_XML_Data::getMyPlexUsername();
$myplex_authtoken = Plex_XML_Data::getMyPlexAuthToken();
$myplex_published = Plex_XML_Data::getMyPlexPublished();
$plex_servername = Plex_XML_Data::getServerName();
$plex_public_address = Plex_XML_Data::getServerPublicAddress();
$plex_public_port = Plex_XML_Data::getServerPublicPort();
$plex_local_auth = AmpConfig::get('plex_local_auth');
$plex_match_email = AmpConfig::get('plex_match_email');
$plexact = $_REQUEST['plexact'];
switch ($plexact) {
    case 'auth_myplex':
        $myplex_username = $_POST['myplex_username'];
        $myplex_password = $_POST['myplex_password'];
        $plex_public_port = $_POST['plex_public_port'];
        if (!empty($myplex_username)) {
            // Register the server on myPlex and get auth token
            $myplex_authtoken = Plex_Api::validateMyPlex($myplex_username, $myplex_password);
            if (!empty($myplex_authtoken)) {
                echo T_('myPlex authentication completed.') . "<br />\r\n";
                Preference::update('myplex_username', -1, $myplex_username, true, true);
                Preference::update('myplex_authtoken', -1, $myplex_authtoken, true, true);