new folder structure for php scripts
renamed api nodes php braces on same line
This commit is contained in:
45
api/src/SSettings.php
Normal file
45
api/src/SSettings.php
Normal file
@ -0,0 +1,45 @@
|
||||
<?php
|
||||
|
||||
/**
|
||||
* Class SSettings
|
||||
* class handling all Settings used by php scripts
|
||||
*/
|
||||
class SSettings {
|
||||
private ?Database $database;
|
||||
|
||||
/**
|
||||
* SSettings constructor.
|
||||
*/
|
||||
public function __construct() {
|
||||
$this->database = Database::getInstance();
|
||||
}
|
||||
|
||||
/**
|
||||
* get the videopath saved in db
|
||||
* @return string videopath
|
||||
*/
|
||||
public function getVideoPath() {
|
||||
$query = "SELECT video_path from settings";
|
||||
|
||||
$result = $this->database->getConnection()->query($query);
|
||||
|
||||
$r = mysqli_fetch_assoc($result);
|
||||
return $r['video_path'];
|
||||
}
|
||||
|
||||
/**
|
||||
* check if TMDB is enableds
|
||||
* @return bool isenabled?
|
||||
*/
|
||||
public function isTMDBGrabbingEnabled(): bool {
|
||||
$query = "SELECT TMDB_grabbing from settings";
|
||||
|
||||
$result = $this->database->getConnection()->query($query);
|
||||
if (!$result) {
|
||||
return true; // if undefined in db --> default true
|
||||
} else {
|
||||
$r = mysqli_fetch_assoc($result);
|
||||
return $r['TMDB_grabbing'] == '1';
|
||||
}
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user