Ejemplo n.º 1
0
 public static function photo($params)
 {
     if (count($params) == 2) {
         if ($params[0] == ':' && $params[1] == 'transcode') {
             $width = $_REQUEST['width'];
             $height = $_REQUEST['height'];
             $url = $_REQUEST['url'];
             // Replace 32400 request port with the real listening port
             // *** To `Plex Inc`: ***
             // Please allow listening port server configuration for your Plex server
             // and fix your clients to not request resources so hard-coded on 127.0.0.1:32400.
             // May be ok on Apple & UPnP world but that's really ugly for a server...
             // Yes, it's a little hack but it works.
             $localrs = "http://127.0.0.1:32400/";
             $options = Core::requests_options();
             if (strpos($url, $localrs) !== false) {
                 $options = array();
                 // In case proxy is set, no proxy for local addresses
                 $url = "http://127.0.0.1:" . Plex_XML_Data::getServerPort() . "/" . substr($url, strlen($localrs));
             }
             if ($width && $height && $url) {
                 $request = Requests::get($url, array(), $options);
                 if ($request->status_code == 200) {
                     ob_clean();
                     $mime = $request->headers['content-type'];
                     self::setHeader($mime);
                     $art = new Art(0);
                     $art->raw = $request->body;
                     $thumb = $art->generate_thumb($art->raw, array('width' => $width, 'height' => $height), $mime);
                     echo $thumb['thumb'];
                     exit;
                 }
             }
         }
     }
 }
Ejemplo n.º 2
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);
Ejemplo n.º 3
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;
}