mirror of
https://github.com/C9Glax/tranga.git
synced 2025-10-16 02:10:46 +02:00
Implement #310 optional comicinfo.xml
Some checks are pending
Docker Image CI / build (push) Waiting to run
Some checks are pending
Docker Image CI / build (push) Waiting to run
This commit is contained in:
@@ -16,4 +16,6 @@ public struct Constants
|
|||||||
public static readonly int PostgresCommandTimeout = int.Parse(Environment.GetEnvironmentVariable("POSTGRES_COMMAND_TIMEOUT") ?? "60");
|
public static readonly int PostgresCommandTimeout = int.Parse(Environment.GetEnvironmentVariable("POSTGRES_COMMAND_TIMEOUT") ?? "60");
|
||||||
|
|
||||||
public static readonly bool UpdateChaptersDownloadedBeforeStarting = bool.Parse(Environment.GetEnvironmentVariable("CHECK_CHAPTERS_BEFORE_START") ?? "true");
|
public static readonly bool UpdateChaptersDownloadedBeforeStarting = bool.Parse(Environment.GetEnvironmentVariable("CHECK_CHAPTERS_BEFORE_START") ?? "true");
|
||||||
|
|
||||||
|
public static readonly bool CreateComicInfoXml = bool.Parse(Environment.GetEnvironmentVariable("CREATE_COMICINFO_XML") ?? "true");
|
||||||
}
|
}
|
@@ -120,10 +120,9 @@ public class DownloadChapterFromMangaconnectorWorker(MangaConnectorId<Chapter> c
|
|||||||
|
|
||||||
await CopyCoverFromCacheToDownloadLocation(chapter.ParentManga);
|
await CopyCoverFromCacheToDownloadLocation(chapter.ParentManga);
|
||||||
|
|
||||||
Log.Debug($"Creating ComicInfo.xml {chapter}");
|
Log.Debug($"Loading collections {chapter}");
|
||||||
foreach (CollectionEntry collectionEntry in DbContext.Entry(chapter.ParentManga).Collections)
|
foreach (CollectionEntry collectionEntry in DbContext.Entry(chapter.ParentManga).Collections)
|
||||||
await collectionEntry.LoadAsync(CancellationToken);
|
await collectionEntry.LoadAsync(CancellationToken);
|
||||||
string comicInfo = chapter.GetComicInfoXmlString();
|
|
||||||
|
|
||||||
if (File.Exists(saveArchiveFilePath))
|
if (File.Exists(saveArchiveFilePath))
|
||||||
{
|
{
|
||||||
@@ -137,10 +136,18 @@ public class DownloadChapterFromMangaconnectorWorker(MangaConnectorId<Chapter> c
|
|||||||
Log.Debug($"Creating archive: {saveArchiveFilePath}");
|
Log.Debug($"Creating archive: {saveArchiveFilePath}");
|
||||||
//ZIP-it and ship-it
|
//ZIP-it and ship-it
|
||||||
using ZipArchive archive = ZipFile.Open(saveArchiveFilePath, ZipArchiveMode.Create);
|
using ZipArchive archive = ZipFile.Open(saveArchiveFilePath, ZipArchiveMode.Create);
|
||||||
Log.Debug("Writing ComicInfo.xml");
|
|
||||||
Stream comicStream = archive.CreateEntry("ComicInfo.xml").Open();
|
if (Constants.CreateComicInfoXml)
|
||||||
await comicStream.WriteAsync(Encoding.UTF8.GetBytes(comicInfo), CancellationToken);
|
{
|
||||||
await comicStream.DisposeAsync();
|
Log.Debug("Writing ComicInfo.xml");
|
||||||
|
Stream comicStream = archive.CreateEntry("ComicInfo.xml").Open();
|
||||||
|
string comicInfo = chapter.GetComicInfoXmlString();
|
||||||
|
await comicStream.WriteAsync(Encoding.UTF8.GetBytes(comicInfo), CancellationToken);
|
||||||
|
await comicStream.DisposeAsync();
|
||||||
|
}
|
||||||
|
else
|
||||||
|
Log.Debug("Skipping ComicInfo.xml. CREATE_COMICINFO_XML is set to false");
|
||||||
|
|
||||||
for (int i = 0; i < images.Count; i++)
|
for (int i = 0; i < images.Count; i++)
|
||||||
{
|
{
|
||||||
Log.Debug($"Packaging images to archive {chapter} , image {i}");
|
Log.Debug($"Packaging images to archive {chapter} , image {i}");
|
||||||
|
@@ -139,6 +139,7 @@ The file also includes [tranga-website](https://github.com/C9Glax/tranga-website
|
|||||||
| POSTGRES_COMMAND_TIMEOUT | [`60`](https://www.npgsql.org/doc/connection-string-parameters.html?q=Command%20Timeout) |
|
| POSTGRES_COMMAND_TIMEOUT | [`60`](https://www.npgsql.org/doc/connection-string-parameters.html?q=Command%20Timeout) |
|
||||||
| POSTGRES_CONNECTION_TIMEOUT | `30` |
|
| POSTGRES_CONNECTION_TIMEOUT | `30` |
|
||||||
| CHECK_CHAPTERS_BEFORE_START | `true` |
|
| CHECK_CHAPTERS_BEFORE_START | `true` |
|
||||||
|
| CREATE_COMICINFO_XML | `true` |
|
||||||
|
|
||||||
For compatibility do not execute the compose as root (which you should not do anyways...) but as user that can
|
For compatibility do not execute the compose as root (which you should not do anyways...) but as user that can
|
||||||
access the folder. Permission conflicts with Komga and Kavita should thus be limited.
|
access the folder. Permission conflicts with Komga and Kavita should thus be limited.
|
||||||
|
@@ -17,9 +17,10 @@ services:
|
|||||||
- POSTGRES_USER=postgres
|
- POSTGRES_USER=postgres
|
||||||
- POSTGRES_PASSWORD=postgres
|
- POSTGRES_PASSWORD=postgres
|
||||||
#- FLARESOLVERR_URL=
|
#- FLARESOLVERR_URL=
|
||||||
#- POSTGRES_COMMAND_TIMEOUT=120
|
#- POSTGRES_COMMAND_TIMEOUT=30
|
||||||
#- POSTGRES_CONNECTION_TIMEOUT=
|
#- POSTGRES_CONNECTION_TIMEOUT=30
|
||||||
#- CHECK_CHAPTERS_BEFORE_START=false
|
#- CHECK_CHAPTERS_BEFORE_START=true
|
||||||
|
#- CREATE_COMICINFO_XML=true
|
||||||
restart: unless-stopped
|
restart: unless-stopped
|
||||||
logging:
|
logging:
|
||||||
driver: json-file
|
driver: json-file
|
||||||
|
Reference in New Issue
Block a user