fix some bugs

pull/9/head
root 4 years ago
parent 3c031424ff
commit 766b0fd92b

@ -213,7 +213,7 @@ class Controller_Rest_Install extends Controller_Rest
'plex_key' => array('constraint' => 36, 'type' => 'varchar'),
'type' => array('constraint' => 20, 'type' => 'varchar'),
'number' => array('constraint' => 11, 'type' => 'int', 'null' => true),
'studio' => array('constraint' => 36, 'type' => 'varchar', 'null' => true),
'studio' => array('constraint' => 255, 'type' => 'varchar', 'null' => true),
'title' => array('constraint' => 255, 'type' => 'varchar'),
'originalTitle' => array('constraint' => 255, 'type' => 'varchar', 'null' => true),
'summary' => array('type' => 'text', 'null' => true),

@ -17,12 +17,13 @@ class Controller_Rest_Movie extends Controller_Rest
if (!$movie_id)
throw new FuelException('No movie id');
/** @var Model_Movie $movie */
$movie = Model_Movie::find_by_pk($movie_id);
if (!$movie)
throw new FuelException('No movie found');
if(!Model_Permission::isGranted('RIGHT_WATCH_DISABLED', $movie))
if (!Model_Permission::isGranted('RIGHT_WATCH_DISABLED', $movie->getLibrary()))
throw new FuelException('You dont have the permission to watch in this library!');
$user_settings = Model_Setting::find_one_by('user_id', Session::get('user')->id);

@ -66,6 +66,9 @@ class Model_Movie extends Model_Overwrite
return $this->_tv_show;
}
/**
* @return Model_Library|null
*/
public function getLibrary()
{
if(!$this->_library) {
@ -428,7 +431,9 @@ class Model_Movie extends Model_Overwrite
->and_where('library_id', $library_id)
->and_where_close()
;
})[0] ?: Model_Movie::forge();
});
$movie = $movie !== null ? $movie[0] : Model_Movie::forge();
if($library === null && $season === null)
throw new FuelException('Missing Parameters for the movie');

@ -133,7 +133,9 @@ class Model_Season extends Model_Overwrite
->select('*')
->where('plex_key', $XMLseason['@attributes']['ratingKey'])
->and_where('tv_show_id', $tvshow_id);
})[0] ?: Model_Season::forge();
});
$season = $season !== null ? $season[0] : Model_Season::forge();
$season->set([
'tv_show_id' => $tvshow->id,

@ -164,7 +164,9 @@ class Model_Tvshow extends Model_Overwrite
->select('*')
->where('plex_key', $subsection['@attributes']['ratingKey'])
->and_where('library_id', $library_id);
})[0] ?: Model_Tvshow::forge();
});
$tvshow = $tvshow !== null ? $tvshow[0] : Model_Tvshow::forge();
$tvshow->set([
'library_id' => $library->id,
@ -226,7 +228,7 @@ class Model_Tvshow extends Model_Overwrite
$seasons = Format::forge($curl->response()->body, 'xml')->to_array();
if (isset($seasons['Directory']))
if ($seasons !== null && isset($seasons['Directory']))
return Model_Season::BrowseSeason($server, $seasons['Directory'], $tvshow);
} catch (Exception $exception) {
throw new FuelException($exception->getMessage(),$exception->getCode());

@ -11,8 +11,7 @@
<div class="PageContent-pageContent-16mK6 Scroller-scroller-d5-b- Scroller-vertical-1bgGS ">
<div class="DashboardPage-dashboardPageContent-2rN8X PageContent-innerPageContent-3ktLT">
<div style="opacity: 1; pointer-events: auto;">
<?php use Fuel\Core\Debug;
<?php
if ($watching_movies) : ?>
<div class="HubCell-hubCell-3Ys17" style="visibility: visible;" data-qa-id="hub--home.continue">
<div class="HubCellHeader-hubCellHeader-2pvYN HubCellHeader-hubCellHeader-2pvYN">

@ -4796,7 +4796,7 @@ label.disabled {
.alert-status > .alert-icon {
left: 15px;
margin-top: -14px;
margin-top: -10px;
font-size: 16px
}

Loading…
Cancel
Save