Bootstrap starter template
+Use this document as a way to quickly start any new project.
All you get is this text and a mostly barebones HTML document.
diff --git a/config/routes.yaml b/config/routes.yaml index c3283aa..a808cf9 100644 --- a/config/routes.yaml +++ b/config/routes.yaml @@ -1,3 +1,7 @@ #index: # path: / # controller: App\Controller\DefaultController::index + +test: + path: / + controller: App\Controller\TestController::test \ No newline at end of file diff --git a/public/css/style.css b/public/css/style.css new file mode 100644 index 0000000..e69de29 diff --git a/public/favicon.ico b/public/favicon.ico new file mode 100644 index 0000000..e59f188 Binary files /dev/null and b/public/favicon.ico differ diff --git a/src/Controller/TestController.php b/src/Controller/TestController.php new file mode 100644 index 0000000..0afd011 --- /dev/null +++ b/src/Controller/TestController.php @@ -0,0 +1,18 @@ +getLastTorrents(10); + + return $this->render('torrent_list.html.twig', [ + 'torrents' => $torrents, + ]); + } +} \ No newline at end of file diff --git a/src/Entity/File.php b/src/Entity/File.php new file mode 100644 index 0000000..bdf1091 --- /dev/null +++ b/src/Entity/File.php @@ -0,0 +1,64 @@ +id; + } + + public function getTorrent(): int + { + return $this->torrent; + } + + public function getSize(): int + { + return $this->size; + } + + public function getPath(): string + { + return $this->path; + } +} diff --git a/src/Entity/Torrent.php b/src/Entity/Torrent.php new file mode 100644 index 0000000..4c29697 --- /dev/null +++ b/src/Entity/Torrent.php @@ -0,0 +1,97 @@ +id; + } + + public function getInfoHash() + { + return $this->infoHash; + } + + public function getInfoHashAsHex() + { + return bin2hex(stream_get_contents($this->infoHash)); + } + + public function getName(): string + { + return $this->name; + } + + public function getTotalSize(): int + { + return $this->totalSize; + } + + public function getDiscoveredOn(): int + { + return $this->discoveredOn; + } + + /** + * @return File[]|ArrayCollection + */ + public function getFiles(): iterable + { + return $this->files; + } +} diff --git a/src/Repository/Torrent.php b/src/Repository/Torrent.php new file mode 100644 index 0000000..fcec593 --- /dev/null +++ b/src/Repository/Torrent.php @@ -0,0 +1,24 @@ +createQueryBuilder('t') + ->orderBy('t.discoveredOn', 'DESC') + ->setMaxResults($number) + ; + + return $qb->getQuery()->getResult(); + } +} \ No newline at end of file diff --git a/templates/base.html.twig b/templates/base.html.twig new file mode 100644 index 0000000..e4511ee --- /dev/null +++ b/templates/base.html.twig @@ -0,0 +1,79 @@ + + +
+ {% block meta %} + + + + + {% endblock %} + + +Use this document as a way to quickly start any new project.
All you get is this text and a mostly barebones HTML document.
ID | +Name | +Size | +Discovered | +Files | + + {# @var torrent \App\Entity\\App\Entity\Torrent #} + {% for torrent in torrents %} +
---|---|---|---|---|
{{ torrent.id }} | ++ {{ torrent.name }} + | +{{ torrent.totalSize }} | +{{ torrent.discoveredOn }} | +
+ {#
+
|
+