Merge branch 'refs/heads/cuttingedge-merge-ServerV2' into Server-V2
# Conflicts: # Tranga/GlobalBase.cs # Tranga/Jobs/JobBoss.cs # Tranga/Jobs/UpdateMetadata.cs # Tranga/Manga.cs # Tranga/MangaConnectors/Bato.cs # Tranga/MangaConnectors/MangaKatana.cs # Tranga/MangaConnectors/MangaLife.cs # Tranga/MangaConnectors/Manganato.cs # Tranga/MangaConnectors/Mangasee.cs # Tranga/MangaConnectors/Mangaworld.cs
This commit is contained in:
commit
3d08b1f9f2
@ -18,7 +18,6 @@ public abstract class GlobalBase
|
||||
protected HashSet<NotificationConnector> notificationConnectors { get; init; }
|
||||
protected HashSet<LibraryConnector> libraryConnectors { get; init; }
|
||||
private Dictionary<string, Manga> cachedPublications { get; init; }
|
||||
|
||||
protected HashSet<MangaConnector> _connectors;
|
||||
public static readonly NumberFormatInfo numberFormatDecimalPoint = new (){ NumberDecimalSeparator = "." };
|
||||
protected static readonly Regex baseUrlRex = new(@"https?:\/\/[0-9A-z\.-]+(:[0-9]+)?");
|
||||
|
@ -181,18 +181,18 @@ public class JobBoss : GlobalBase
|
||||
}
|
||||
}
|
||||
|
||||
internal void UpdateJobFile(Job job)
|
||||
internal void UpdateJobFile(Job job, string? oldFile = null)
|
||||
{
|
||||
string jobFilePath = Path.Join(settings.jobsFolderPath, $"{job.id}.json");
|
||||
string newJobFilePath = Path.Join(settings.jobsFolderPath, $"{job.id}.json");
|
||||
|
||||
if (!this.jobs.Any(jjob => jjob.id == job.id))
|
||||
{
|
||||
try
|
||||
{
|
||||
Log($"Deleting Job-file {jobFilePath}");
|
||||
while(IsFileInUse(jobFilePath))
|
||||
Log($"Deleting Job-file {newJobFilePath}");
|
||||
while(IsFileInUse(newJobFilePath))
|
||||
Thread.Sleep(10);
|
||||
File.Delete(jobFilePath);
|
||||
File.Delete(newJobFilePath);
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
@ -201,12 +201,25 @@ public class JobBoss : GlobalBase
|
||||
}
|
||||
else
|
||||
{
|
||||
Log($"Exporting Job {jobFilePath}");
|
||||
string jobStr = JsonConvert.SerializeObject(job);
|
||||
while(IsFileInUse(jobFilePath))
|
||||
Log($"Exporting Job {newJobFilePath}");
|
||||
string jobStr = JsonConvert.SerializeObject(job, Formatting.Indented);
|
||||
while(IsFileInUse(newJobFilePath))
|
||||
Thread.Sleep(10);
|
||||
File.WriteAllText(jobFilePath, jobStr);
|
||||
File.WriteAllText(newJobFilePath, jobStr);
|
||||
}
|
||||
|
||||
if(oldFile is not null)
|
||||
try
|
||||
{
|
||||
Log($"Deleting old Job-file {oldFile}");
|
||||
while(IsFileInUse(oldFile))
|
||||
Thread.Sleep(10);
|
||||
File.Delete(oldFile);
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
Log(e.ToString());
|
||||
}
|
||||
}
|
||||
|
||||
private void UpdateAllJobFiles()
|
||||
|
@ -43,6 +43,7 @@ public class UpdateMetadata : Job
|
||||
|
||||
AddMangaToCache(manga.Value.WithMetadata(updatedManga));
|
||||
this.manga.Value.SaveSeriesInfoJson(settings.downloadLocation, true);
|
||||
this.mangaConnector.CopyCoverFromCacheToDownloadLocation((Manga)manga);
|
||||
this.progressToken.Complete();
|
||||
}
|
||||
else
|
||||
|
@ -21,7 +21,7 @@ public struct Manga
|
||||
public string[] tags { get; private set; }
|
||||
// ReSharper disable once UnusedAutoPropertyAccessor.Global
|
||||
public string? coverUrl { get; private set; }
|
||||
public string? coverFileNameInCache { get; }
|
||||
public string? coverFileNameInCache { get; private set; }
|
||||
// ReSharper disable once UnusedAutoPropertyAccessor.Global
|
||||
public Dictionary<string,string> links { get; }
|
||||
// ReSharper disable once MemberCanBePrivate.Global
|
||||
@ -85,8 +85,9 @@ public struct Manga
|
||||
altTitles = altTitles.UnionBy(newManga.altTitles, kv => kv.Key).ToDictionary(x => x.Key, x => x.Value),
|
||||
tags = tags.Union(newManga.tags).ToArray(),
|
||||
releaseStatus = newManga.releaseStatus,
|
||||
websiteUrl = newManga.websiteUrl,
|
||||
year = newManga.year,
|
||||
websiteUrl = newManga.websiteUrl
|
||||
coverFileNameInCache = newManga.coverFileNameInCache
|
||||
};
|
||||
}
|
||||
|
||||
@ -100,7 +101,8 @@ public struct Manga
|
||||
this.sortName == compareManga.sortName &&
|
||||
this.latestChapterAvailable.Equals(compareManga.latestChapterAvailable) &&
|
||||
this.authors.All(a => compareManga.authors.Contains(a)) &&
|
||||
this.websiteUrl.Equals(compareManga.websiteUrl) &&
|
||||
(this.coverFileNameInCache??"").Equals(compareManga.coverFileNameInCache) &&
|
||||
(this.websiteUrl??"").Equals(compareManga.websiteUrl) &&
|
||||
this.tags.All(t => compareManga.tags.Contains(t));
|
||||
}
|
||||
|
||||
|
@ -5,9 +5,9 @@ namespace Tranga.NotificationConnectors;
|
||||
|
||||
public class Ntfy : NotificationConnector
|
||||
{
|
||||
// ReSharper disable once MemberCanBePrivate.Global
|
||||
// ReSharper disable twice MemberCanBePrivate.Global
|
||||
public string endpoint { get; init; }
|
||||
private string auth { get; init; }
|
||||
public string auth { get; init; }
|
||||
private const string Topic = "tranga";
|
||||
private readonly HttpClient _client = new();
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user