118 lines
3.2 KiB
PHP
Executable file
118 lines
3.2 KiB
PHP
Executable file
<?php
|
|
|
|
include __DIR__ . "/../src/AutoLoader.php";
|
|
|
|
|
|
use Animarr\Database;
|
|
use Animarr\Filter;
|
|
use Animarr\Release\Release;
|
|
use Animarr\Release\MultiRelease;
|
|
use Animarr\Downloader;
|
|
use Animarr\Torrent\Torrent;
|
|
|
|
|
|
define("NO_LOG", true);
|
|
chdir(__DIR__ . "/" . "..");
|
|
|
|
Database::parseConfig("config_".$_SERVER["SERVER_PORT"].".ini");
|
|
|
|
$aniDBPath = Database::getConfigKey("database.anidb", "/tmp/anidb.cache.dat");
|
|
|
|
$aniDB = new \Animarr\AniDB($aniDBPath, false);
|
|
|
|
$database = new Database($aniDB);
|
|
foreach($database->getAlternateTitles() as $t){
|
|
$aniDB->addEntryName($t["aid"], $t["language"], $t["title"], $t["type"]);
|
|
}
|
|
|
|
|
|
function getURLName(&$url){
|
|
if($url == ""){
|
|
return "";
|
|
}
|
|
|
|
if(preg_match("#nyaa\\.se/.*tid=([0-9]+)#", $url, $matches) > 0){
|
|
return "Nyaa#" . $matches[1];
|
|
}
|
|
|
|
if(preg_match("#anidex\\.(info|moe)/.*id=([0-9]+)#", $url, $matches) > 0){
|
|
return "AniDex#" . $matches[2];
|
|
}
|
|
|
|
if(preg_match("#anidex\\.(info|moe)/dl/([0-9]+)#", $url, $matches) > 0){
|
|
$url = "https://anidex.info/torrent/" . $matches[1];
|
|
return "AniDex#" . $matches[2];
|
|
}
|
|
|
|
//TODO: Remove this
|
|
if(preg_match("#^\\?page=torrent&id=([0-9]+)#", $url, $matches) > 0){
|
|
$url = "https://anidex.info/?page=torrent&id=" . $matches[1];
|
|
return "AniDex#" . $matches[1];
|
|
}
|
|
|
|
if(strpos($url, "urn:btih:") !== false){
|
|
return "Magnet#<small>" . Torrent::getMagnetHash($url) . "</small>";
|
|
}
|
|
|
|
if(preg_match("#nyaa\\.si/.*view/([0-9]+)#", $url, $matches) > 0){
|
|
return "NyaaSi#" . $matches[1];
|
|
}
|
|
|
|
if(preg_match("#animebytes\\.tv/torrents\\.php\\?.*torrentid=([0-9]+)#", $url, $matches) > 0){
|
|
return "AnimeBytes#" . $matches[1];
|
|
}
|
|
|
|
return @parse_url($url)["host"];
|
|
}
|
|
|
|
function printHeader($title){
|
|
?>
|
|
<!DOCTYPE html>
|
|
<html lang="en">
|
|
<head>
|
|
<meta charset="utf-8">
|
|
<meta http-equiv="X-UA-Compatible" content="IE=edge">
|
|
<meta name="viewport" content="width=device-width, initial-scale=1">
|
|
<title><?php echo $title; ?> - Animarr</title>
|
|
<meta name="referrer" content="no-referrer" />
|
|
<link rel="stylesheet" href="css/bootstrap.min.css">
|
|
<link rel="stylesheet" href="css/bootstrap-theme.min.css">
|
|
<script src="js/bootstrap.min.js"></script>
|
|
<link rel="stylesheet" href="css/base.css">
|
|
</head>
|
|
<body>
|
|
<div id="background">
|
|
<img src="bg.jpg" class="stretch" alt="" />
|
|
</div>
|
|
<nav class="navbar navbar-inverse navbar-fixed-top">
|
|
<div class="container">
|
|
<div class="navbar-header">
|
|
<a class="navbar-brand" href="#">Animarr</a>
|
|
</div>
|
|
<div id="navbar" class="collapse navbar-collapse">
|
|
<ul class="nav navbar-nav">
|
|
<li><a href="index.php">Home</a></li>
|
|
<li><a href="list.php">Recent</a></li>
|
|
<li><a href="add.php">Add</a></li>
|
|
<li><a href="logs.php">Logs</a></li>
|
|
<li><a href="dopoll.php" onclick="return confirm('Are you sure you want to do a full refresh?');"><span class="glyphicon glyphicon-refresh"></span></a></li>
|
|
</ul>
|
|
</div><!--/.nav-collapse -->
|
|
</div>
|
|
</nav>
|
|
|
|
<div class="container">
|
|
<div class="base-container">
|
|
|
|
<?php
|
|
}
|
|
|
|
function printFooter(){
|
|
?>
|
|
</div>
|
|
</div>
|
|
</body>
|
|
</html>
|
|
<?php
|
|
}
|