fix bug of non existing insert query
This commit is contained in:
parent
653146213e
commit
c2991bcd50
@ -136,10 +136,17 @@ class VideoParser {
|
|||||||
// convert video to base64
|
// convert video to base64
|
||||||
$backpic64 = 'data:image/jpeg;base64,' . base64_encode($backpic);
|
$backpic64 = 'data:image/jpeg;base64,' . base64_encode($backpic);
|
||||||
|
|
||||||
|
// set default insert query without tmdb poster
|
||||||
|
$insert_query = "INSERT INTO videos(movie_name,movie_url,thumbnail,quality,length)
|
||||||
|
VALUES ('" . mysqli_real_escape_string($this->conn, $moviename) . "',
|
||||||
|
'" . mysqli_real_escape_string($this->conn, $this->videopath . $filename) . "',
|
||||||
|
'$backpic64',
|
||||||
|
'$width',
|
||||||
|
'$duration')";
|
||||||
|
|
||||||
// check if tmdb grabbing is enabled
|
// check if tmdb grabbing is enabled
|
||||||
if ($this->TMDBenabled) {
|
if ($this->TMDBenabled) {
|
||||||
// search in tmdb api
|
// search in tmdb api
|
||||||
try {
|
|
||||||
if (!is_null($dta = $this->tmdb->searchMovie($moviename, $year))) {
|
if (!is_null($dta = $this->tmdb->searchMovie($moviename, $year))) {
|
||||||
$poster = file_get_contents($this->tmdb->picturebase . $dta->poster_path);
|
$poster = file_get_contents($this->tmdb->picturebase . $dta->poster_path);
|
||||||
|
|
||||||
@ -147,6 +154,7 @@ class VideoParser {
|
|||||||
if ($poster) {
|
if ($poster) {
|
||||||
$poster_base64 = 'data:image/jpeg;base64,' . base64_encode($poster);
|
$poster_base64 = 'data:image/jpeg;base64,' . base64_encode($poster);
|
||||||
|
|
||||||
|
// override insert query if pic loaded correctly
|
||||||
$insert_query = "INSERT INTO videos(movie_name,movie_url,poster,thumbnail,quality,length)
|
$insert_query = "INSERT INTO videos(movie_name,movie_url,poster,thumbnail,quality,length)
|
||||||
VALUES ('" . mysqli_real_escape_string($this->conn, $moviename) . "',
|
VALUES ('" . mysqli_real_escape_string($this->conn, $moviename) . "',
|
||||||
'" . mysqli_real_escape_string($this->conn, $this->videopath . $filename) . "',
|
'" . mysqli_real_escape_string($this->conn, $this->videopath . $filename) . "',
|
||||||
@ -154,27 +162,13 @@ class VideoParser {
|
|||||||
'$poster_base64',
|
'$poster_base64',
|
||||||
'$width',
|
'$width',
|
||||||
'$duration')";
|
'$duration')";
|
||||||
} else {
|
|
||||||
throw new Exception("faild to load pic");
|
|
||||||
}
|
}
|
||||||
// store genre ids for parsing later
|
// store genre ids for parsing later
|
||||||
$genres = $dta->genre_ids;
|
$genres = $dta->genre_ids;
|
||||||
} else {
|
} else {
|
||||||
// nothing found with tmdb
|
// nothing found with tmdb
|
||||||
echo "my moviename: " . $moviename;
|
echo "my moviename: " . $moviename;
|
||||||
|
|
||||||
$this->writeLog("nothing found with TMDB! -- $moviename\n");
|
$this->writeLog("nothing found with TMDB! -- $moviename\n");
|
||||||
throw new Exception("nothing found with TMDB! -- $moviename");
|
|
||||||
}
|
|
||||||
} catch (Exception $e) {
|
|
||||||
echo $e->getMessage();
|
|
||||||
|
|
||||||
$insert_query = "INSERT INTO videos(movie_name,movie_url,thumbnail,quality,length)
|
|
||||||
VALUES ('" . mysqli_real_escape_string($this->conn, $moviename) . "',
|
|
||||||
'" . mysqli_real_escape_string($this->conn, $this->videopath . $filename) . "',
|
|
||||||
'$backpic64',
|
|
||||||
'$width',
|
|
||||||
'$duration')";
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user