mirror of
https://github.com/C9Glax/tranga.git
synced 2025-05-30 00:53:02 +02:00
Compare commits
6 Commits
fb2b4d6920
...
698d138642
Author | SHA1 | Date | |
---|---|---|---|
698d138642 | |||
8efb60652b | |||
fe60b98cb8 | |||
63442e9af6 | |||
703e32a30e | |||
4ddfe4a54c |
@ -172,13 +172,18 @@ public class Chapter : IComparable<Chapter>
|
||||
internal string GetComicInfoXmlString()
|
||||
{
|
||||
XElement comicInfo = new("ComicInfo",
|
||||
new XElement("Tags", string.Join(',', ParentManga.MangaTags.Select(tag => tag.Tag))),
|
||||
new XElement("LanguageISO", ParentManga.OriginalLanguage),
|
||||
new XElement("Title", Title),
|
||||
new XElement("Writer", string.Join(',', ParentManga.Authors.Select(author => author.AuthorName))),
|
||||
new XElement("Volume", VolumeNumber),
|
||||
new XElement("Number", ChapterNumber)
|
||||
);
|
||||
if(Title is not null)
|
||||
comicInfo.Add(new XElement("Title", Title));
|
||||
if(ParentManga.MangaTags.Count > 0)
|
||||
comicInfo.Add(new XElement("Tags", string.Join(',', ParentManga.MangaTags.Select(tag => tag.Tag))));
|
||||
if(VolumeNumber is not null)
|
||||
comicInfo.Add(new XElement("Volume", VolumeNumber));
|
||||
if(ParentManga.Authors.Count > 0)
|
||||
comicInfo.Add(new XElement("Writer", string.Join(',', ParentManga.Authors.Select(author => author.AuthorName))));
|
||||
if(ParentManga.OriginalLanguage is not null)
|
||||
comicInfo.Add(new XElement("LanguageISO", ParentManga.OriginalLanguage));
|
||||
return comicInfo.ToString();
|
||||
}
|
||||
|
||||
|
@ -51,10 +51,18 @@ public class DownloadSingleChapterJob : Job
|
||||
Log.Info($"No imageUrls for chapter {ChapterId}");
|
||||
return [];
|
||||
}
|
||||
context.Entry(Chapter.ParentManga).Reference<LocalLibrary>(m => m.Library).Load(); //Need to explicitly load, because we are not accessing navigation directly...
|
||||
string saveArchiveFilePath = Chapter.FullArchiveFilePath;
|
||||
Log.Debug($"Chapter path: {saveArchiveFilePath}");
|
||||
|
||||
//Check if Publication Directory already exists
|
||||
string directoryPath = Path.GetDirectoryName(saveArchiveFilePath)!;
|
||||
string? directoryPath = Path.GetDirectoryName(saveArchiveFilePath);
|
||||
if (directoryPath is null)
|
||||
{
|
||||
Log.Error($"Directory path could not be found: {saveArchiveFilePath}");
|
||||
this.state = JobState.Failed;
|
||||
return [];
|
||||
}
|
||||
if (!Directory.Exists(directoryPath))
|
||||
{
|
||||
Log.Info($"Creating publication Directory: {directoryPath}");
|
||||
|
@ -41,7 +41,7 @@ public class RetrieveChaptersJob : Job
|
||||
protected override IEnumerable<Job> RunInternal(PgsqlContext context)
|
||||
{
|
||||
// This gets all chapters that are not downloaded
|
||||
Chapter[] allChapters = Manga.MangaConnector.GetChapters(Manga, Language);
|
||||
Chapter[] allChapters = Manga.MangaConnector.GetChapters(Manga, Language).DistinctBy(c => c.ChapterId).ToArray();
|
||||
Chapter[] newChapters = allChapters.Where(chapter => Manga.Chapters.Contains(chapter) == false).ToArray();
|
||||
Log.Info($"{newChapters.Length} new chapters.");
|
||||
|
||||
|
@ -228,8 +228,8 @@ public class MangaDex : MangaConnector
|
||||
string? id = jToken.Value<string>("id");
|
||||
|
||||
JObject? attributes = jToken["attributes"] as JObject;
|
||||
string? name = attributes?["title"]?.Value<string>("en");
|
||||
string? description = attributes?["description"]?.Value<string>("en");
|
||||
string? name = attributes?["title"]?.Value<string>("en") ?? attributes?["title"]?.First?.First?.Value<string>();
|
||||
string? description = attributes?["description"]?.Value<string>("en")??attributes?["description"]?.First?.First?.Value<string>();
|
||||
string? status = attributes?["status"]?.Value<string>();
|
||||
uint? year = attributes?["year"]?.Value<uint>();
|
||||
string? originalLanguage = attributes?["originalLanguage"]?.Value<string>();
|
||||
@ -288,7 +288,7 @@ public class MangaDex : MangaConnector
|
||||
|
||||
List<MangaTag> tags = tagsJArray
|
||||
.Where(t => t.Value<string>("type") == "tag")
|
||||
.Select(t => t["attributes"]?["name"]?.Value<string>("en"))
|
||||
.Select(t => t["attributes"]?["name"]?.Value<string>("en")??t["attributes"]?["name"]?.First?.First?.Value<string>())
|
||||
.Select(str => str is not null ? new MangaTag(str) : null)
|
||||
.Where(x => x is not null).ToList()!;
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user