forked from biblioverse/biblioteca
-
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.
feat(kobo): Convert ebooks using kepubify on the fly
- Loading branch information
Showing
12 changed files
with
363 additions
and
30 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
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
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,20 @@ | ||
<?php | ||
|
||
namespace App\Kobo; | ||
|
||
class BookDownloadInfo | ||
{ | ||
public function __construct(private int $size, private string $url) | ||
{ | ||
} | ||
|
||
public function getSize(): int | ||
{ | ||
return $this->size; | ||
} | ||
|
||
public function getUrl(): string | ||
{ | ||
return $this->url; | ||
} | ||
} |
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,37 @@ | ||
<?php | ||
|
||
namespace App\Kobo\Kepubify; | ||
|
||
use Symfony\Component\DependencyInjection\Attribute\Autowire; | ||
|
||
class KepubifyEnabler | ||
{ | ||
public function __construct( | ||
#[Autowire(param: 'KEPUBIFY_BIN')] | ||
private string $kepubifyBinary, | ||
) { | ||
} | ||
|
||
public function setKepubifyBinary(string $kepubifyBinary): void | ||
{ | ||
$this->kepubifyBinary = $kepubifyBinary; | ||
} | ||
|
||
public function isEnabled(): bool | ||
{ | ||
return trim($this->kepubifyBinary) !== ''; | ||
} | ||
|
||
public function getKepubifyBinary(): string | ||
{ | ||
return $this->kepubifyBinary; | ||
} | ||
|
||
public function disable(): string | ||
{ | ||
$lastValue = $this->kepubifyBinary; | ||
$this->kepubifyBinary = ''; | ||
|
||
return $lastValue; | ||
} | ||
} |
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,21 @@ | ||
<?php | ||
|
||
namespace App\Kobo\Kepubify; | ||
|
||
/** | ||
* Convert an ebook with kepubify binary | ||
* The destination property will be set to the path of the converted file, | ||
*/ | ||
class KepubifyMessage | ||
{ | ||
/** | ||
* @var string|null Path of the destination file (which aim to be a temporary file). Null if the conversion failed. | ||
*/ | ||
public ?string $destination = null; | ||
|
||
public function __construct( | ||
/** Path of the source ebook to convert */ | ||
public string $source, | ||
) { | ||
} | ||
} |
Oops, something went wrong.