Compare commits
No commits in common. "439d69d8e002eeb59f37ff9b3cb5e77fa4f6be00" and "0d3799e00d15a4af509d95d3b82f5f2f27806b4b" have entirely different histories.
439d69d8e0
...
0d3799e00d
@ -70,7 +70,9 @@ public abstract class Connector
|
|||||||
{
|
{
|
||||||
logger?.WriteLine(this.GetType().ToString(), $"Cloning cover {publication.sortName} {publication.internalId}");
|
logger?.WriteLine(this.GetType().ToString(), $"Cloning cover {publication.sortName} {publication.internalId}");
|
||||||
//Check if Publication already has a Folder and cover
|
//Check if Publication already has a Folder and cover
|
||||||
string publicationFolder = publication.CreatePublicationFolder(downloadLocation);
|
string publicationFolder = Path.Join(downloadLocation, publication.folderName);
|
||||||
|
if(!Directory.Exists(publicationFolder))
|
||||||
|
Directory.CreateDirectory(publicationFolder);
|
||||||
DirectoryInfo dirInfo = new (publicationFolder);
|
DirectoryInfo dirInfo = new (publicationFolder);
|
||||||
if (dirInfo.EnumerateFiles().Any(info => info.Name.Contains("cover.")))
|
if (dirInfo.EnumerateFiles().Any(info => info.Name.Contains("cover.")))
|
||||||
{
|
{
|
||||||
@ -82,8 +84,6 @@ public abstract class Connector
|
|||||||
string newFilePath = Path.Join(publicationFolder, $"cover.{Path.GetFileName(fileInCache).Split('.')[^1]}" );
|
string newFilePath = Path.Join(publicationFolder, $"cover.{Path.GetFileName(fileInCache).Split('.')[^1]}" );
|
||||||
logger?.WriteLine(this.GetType().ToString(), $"Cloning cover {fileInCache} -> {newFilePath}");
|
logger?.WriteLine(this.GetType().ToString(), $"Cloning cover {fileInCache} -> {newFilePath}");
|
||||||
File.Copy(fileInCache, newFilePath, true);
|
File.Copy(fileInCache, newFilePath, true);
|
||||||
if(RuntimeInformation.IsOSPlatform(OSPlatform.Linux))
|
|
||||||
File.SetUnixFileMode(newFilePath, GroupRead | GroupWrite | OtherRead | OtherWrite | UserRead | UserWrite);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
|
@ -1,4 +1,5 @@
|
|||||||
using System.Net;
|
using System.Collections;
|
||||||
|
using System.Net;
|
||||||
using System.Text.RegularExpressions;
|
using System.Text.RegularExpressions;
|
||||||
using HtmlAgilityPack;
|
using HtmlAgilityPack;
|
||||||
using Logging;
|
using Logging;
|
||||||
@ -14,14 +15,14 @@ public class Manganato : Connector
|
|||||||
this.name = "Manganato";
|
this.name = "Manganato";
|
||||||
this.downloadClient = new DownloadClient(new Dictionary<byte, int>()
|
this.downloadClient = new DownloadClient(new Dictionary<byte, int>()
|
||||||
{
|
{
|
||||||
{(byte)1, 60}
|
{(byte)1, 100}
|
||||||
}, logger);
|
}, logger);
|
||||||
}
|
}
|
||||||
|
|
||||||
public override Publication[] GetPublications(string publicationTitle = "")
|
public override Publication[] GetPublications(string publicationTitle = "")
|
||||||
{
|
{
|
||||||
logger?.WriteLine(this.GetType().ToString(), $"Getting Publications (title={publicationTitle})");
|
logger?.WriteLine(this.GetType().ToString(), $"Getting Publications (title={publicationTitle})");
|
||||||
string sanitizedTitle = string.Concat(Regex.Matches(publicationTitle, "[A-z]* *")).ToLower().Replace(' ', '_');
|
string sanitizedTitle = publicationTitle.ToLower().Replace(' ', '_');
|
||||||
logger?.WriteLine(this.GetType().ToString(), $"Getting Publications (title={sanitizedTitle})");
|
logger?.WriteLine(this.GetType().ToString(), $"Getting Publications (title={sanitizedTitle})");
|
||||||
string requestUrl = $"https://manganato.com/search/story/{sanitizedTitle}";
|
string requestUrl = $"https://manganato.com/search/story/{sanitizedTitle}";
|
||||||
DownloadClient.RequestResult requestResult =
|
DownloadClient.RequestResult requestResult =
|
||||||
@ -151,7 +152,7 @@ public class Manganato : Connector
|
|||||||
string fullString = chapterInfo.Descendants("a").First(d => d.HasClass("chapter-name")).InnerText;
|
string fullString = chapterInfo.Descendants("a").First(d => d.HasClass("chapter-name")).InnerText;
|
||||||
|
|
||||||
string? volumeNumber = fullString.Contains("Vol.") ? fullString.Replace("Vol.", "").Split(' ')[0] : null;
|
string? volumeNumber = fullString.Contains("Vol.") ? fullString.Replace("Vol.", "").Split(' ')[0] : null;
|
||||||
string? chapterNumber = fullString.Split(':')[0].Split("Chapter ")[1].Replace('-','.');
|
string? chapterNumber = fullString.Split(':')[0].Split(' ')[^1];
|
||||||
string chapterName = string.Concat(fullString.Split(':')[1..]);
|
string chapterName = string.Concat(fullString.Split(':')[1..]);
|
||||||
string url = chapterInfo.Descendants("a").First(d => d.HasClass("chapter-name"))
|
string url = chapterInfo.Descendants("a").First(d => d.HasClass("chapter-name"))
|
||||||
.GetAttributeValue("href", "");
|
.GetAttributeValue("href", "");
|
||||||
|
@ -50,19 +50,11 @@ public readonly struct Publication
|
|||||||
this.internalId = Convert.ToBase64String(Encoding.ASCII.GetBytes($"{onlyLowerLetters}{this.year}"));
|
this.internalId = Convert.ToBase64String(Encoding.ASCII.GetBytes($"{onlyLowerLetters}{this.year}"));
|
||||||
}
|
}
|
||||||
|
|
||||||
public string CreatePublicationFolder(string downloadDirectory)
|
public void SaveSeriesInfoJson(string downloadDirectory)
|
||||||
{
|
{
|
||||||
string publicationFolder = Path.Join(downloadDirectory, this.folderName);
|
string publicationFolder = Path.Join(downloadDirectory, this.folderName);
|
||||||
if(!Directory.Exists(publicationFolder))
|
if(!Directory.Exists(publicationFolder))
|
||||||
Directory.CreateDirectory(publicationFolder);
|
Directory.CreateDirectory(publicationFolder);
|
||||||
if(RuntimeInformation.IsOSPlatform(OSPlatform.Linux))
|
|
||||||
File.SetUnixFileMode(publicationFolder, GroupRead | GroupWrite | GroupExecute | OtherRead | OtherWrite | OtherExecute | UserRead | UserWrite | UserExecute);
|
|
||||||
return publicationFolder;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void SaveSeriesInfoJson(string downloadDirectory)
|
|
||||||
{
|
|
||||||
string publicationFolder = CreatePublicationFolder(downloadDirectory);
|
|
||||||
string seriesInfoPath = Path.Join(publicationFolder, "series.json");
|
string seriesInfoPath = Path.Join(publicationFolder, "series.json");
|
||||||
if(!File.Exists(seriesInfoPath))
|
if(!File.Exists(seriesInfoPath))
|
||||||
File.WriteAllText(seriesInfoPath,this.GetSeriesInfoJson());
|
File.WriteAllText(seriesInfoPath,this.GetSeriesInfoJson());
|
||||||
|
@ -14,7 +14,9 @@ public class DownloadNewChaptersTask : TrangaTask
|
|||||||
Connector connector = taskManager.GetConnector(this.connectorName);
|
Connector connector = taskManager.GetConnector(this.connectorName);
|
||||||
|
|
||||||
//Check if Publication already has a Folder
|
//Check if Publication already has a Folder
|
||||||
pub.CreatePublicationFolder(taskManager.settings.downloadLocation);
|
string publicationFolder = Path.Join(connector.downloadLocation, pub.folderName);
|
||||||
|
if(!Directory.Exists(publicationFolder))
|
||||||
|
Directory.CreateDirectory(publicationFolder);
|
||||||
List<Chapter> newChapters = UpdateChapters(connector, pub, language!, ref taskManager.chapterCollection);
|
List<Chapter> newChapters = UpdateChapters(connector, pub, language!, ref taskManager.chapterCollection);
|
||||||
this.tasksCount = newChapters.Count;
|
this.tasksCount = newChapters.Count;
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user