-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
2 changed files
with
69 additions
and
27 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
<?php | ||
class MayaEpg{ | ||
public static array $data = []; | ||
|
||
static function getEpgDataFromMayaDb(){ | ||
$sqlTimeStampStr = (time() + 62135629200) . '0000000'; | ||
|
||
$PDO = new PDO('sqlite:../../TvMaid30/TvmaidMAYA/user/tvmaid-5.db'); | ||
$stmt = $PDO->prepare("select service.fsid, name, title, desc, start, end, duration from service | ||
left join ( | ||
select id, fsid, title, desc, start, end, duration from event | ||
where start < ? and end > ?) | ||
as _event on service.fsid = _event.fsid | ||
where driver = (select driver from tuner where name = 'siano') order by service.id" | ||
); | ||
$stmt->execute([$sqlTimeStampStr, $sqlTimeStampStr]); | ||
return $stmt->fetchAll(PDO::FETCH_ASSOC); | ||
} | ||
|
||
static function fetchEpgData(){ | ||
self::$data = self::getEpgDataFromMayaDb(); | ||
} | ||
|
||
public static function getEpgData(){ | ||
if(!self::$data){ | ||
self::fetchEpgData(); | ||
} | ||
|
||
return self::$data; | ||
} | ||
|
||
public static function getTimeFromMayaTime($mayaTime){ | ||
return intval($mayaTime) / 10000000 - 62135629200; | ||
} | ||
} |