mirror of
https://github.com/YGGverse/YGGtracker.git
synced 2026-04-01 01:25:39 +00:00
draft torrent info page with related features #11
This commit is contained in:
parent
21ffd8aa01
commit
387acb59b6
7 changed files with 349 additions and 5 deletions
|
|
@ -29,6 +29,19 @@ class TorrentService
|
|||
$this->entityManagerInterface = $entityManagerInterface;
|
||||
}
|
||||
|
||||
public function decodeTorrentById(int $id): array
|
||||
{
|
||||
$decoder = new \BitTorrent\Decoder();
|
||||
|
||||
return $decoder->decodeFile(
|
||||
sprintf(
|
||||
'%s/var/torrents/%s.torrent',
|
||||
$this->kernelInterface->getProjectDir(),
|
||||
implode('/', str_split($id))
|
||||
)
|
||||
);
|
||||
}
|
||||
|
||||
public function decodeTorrentByFilepath(string $filepath): array
|
||||
{
|
||||
$decoder = new \BitTorrent\Decoder();
|
||||
|
|
@ -70,6 +83,13 @@ class TorrentService
|
|||
return '';
|
||||
}
|
||||
|
||||
public function getTorrent(int $id): ?Torrent
|
||||
{
|
||||
return $this->entityManagerInterface
|
||||
->getRepository(Torrent::class)
|
||||
->findOneByIdField($id);
|
||||
}
|
||||
|
||||
public function submit(
|
||||
string $filepath,
|
||||
int $userId,
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue