-
Notifications
You must be signed in to change notification settings - Fork 43
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #13 from NguyenDanPhuong/dev
Support for CBZ output UI changes Fix mangafox.me
- Loading branch information
Showing
22 changed files
with
400 additions
and
131 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
using System; | ||
using System.Collections.Generic; | ||
using System.Linq; | ||
using System.Text; | ||
using System.Threading.Tasks; | ||
|
||
namespace MangaRipper.Core | ||
{ | ||
/// <summary> | ||
/// When chapters added to download list. They are added as tasks. | ||
/// A task include a chapter, and download information (percent downloaded, save to location, output format...) | ||
/// </summary> | ||
public class DownloadChapterTask | ||
{ | ||
public string Name => Chapter.Name; | ||
public string Url => Chapter.Url; | ||
public Chapter Chapter { get; private set; } | ||
public string SaveToFolder { get; private set; } | ||
public IEnumerable<OutputFormat> Formats { get; private set; } | ||
|
||
public string PropFormats | ||
{ | ||
get | ||
{ | ||
var s = Formats.Select(format => format.ToString()).ToList(); | ||
return string.Join(", ", s); | ||
} | ||
} | ||
|
||
public bool IsBusy { get; set; } | ||
public int Percent { get; set; } | ||
public DownloadChapterTask(Chapter chapter, string saveToFolder, IEnumerable<OutputFormat> formats) | ||
{ | ||
Chapter = chapter; | ||
SaveToFolder = saveToFolder; | ||
Formats = formats; | ||
} | ||
} | ||
} |
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,68 @@ | ||
using NLog; | ||
using System; | ||
using System.Collections.Generic; | ||
using System.Diagnostics; | ||
using System.Linq; | ||
using System.Text; | ||
using System.Threading; | ||
using System.Threading.Tasks; | ||
|
||
namespace MangaRipper.Core | ||
{ | ||
/// <summary> | ||
/// Support find chapters, images from MangaFox | ||
/// </summary> | ||
class KissMangaService : IMangaService | ||
{ | ||
private static Logger logger = LogManager.GetCurrentClassLogger(); | ||
|
||
public SiteInformation GetInformation() | ||
{ | ||
return new SiteInformation("KissManga", "http://kissmanga.com/", "English"); | ||
} | ||
|
||
public bool Of(string link) | ||
{ | ||
var uri = new Uri(link); | ||
return uri.Host.Equals("kissmanga.com"); | ||
} | ||
|
||
public async Task<IEnumerable<Chapter>> FindChapters(string manga, IProgress<int> progress, CancellationToken cancellationToken) | ||
{ | ||
progress.Report(0); | ||
var downloader = new Downloader(); | ||
var parser = new Parser(); | ||
|
||
// find all chapters in a manga | ||
string input = await downloader.DownloadStringAsync(manga); | ||
var chaps = parser.ParseGroup("<a href=\"(?<Value>/Manga/[^\"]+)\" title=\"[^\"]+\">\r(?<Name>[^<]+)</a>", input, "Name", "Value"); | ||
chaps = chaps.Select(c => | ||
{ | ||
var uri = new Uri(new Uri("http://kissmanga.com"), c.Url); | ||
return new Chapter(c.Name, uri.AbsoluteUri); | ||
}); | ||
progress.Report(100); | ||
return chaps; | ||
} | ||
|
||
public async Task<IEnumerable<string>> FindImanges(Chapter chapter, IProgress<int> progress, CancellationToken cancellationToken) | ||
{ | ||
progress.Report(0); | ||
var downloader = new Downloader(); | ||
var parser = new Parser(); | ||
|
||
// find all pages in a chapter | ||
string input = await downloader.DownloadStringAsync(chapter.Url); | ||
var images = parser.Parse(@"<option value=""(?<Value>[^""]+)"" (|selected=""selected"")>\d+</option>", input, "Value"); | ||
// transform pages link | ||
images = images.Select(p => | ||
{ | ||
var value = new Uri(new Uri(chapter.Url), (p + ".html")).AbsoluteUri; | ||
return value; | ||
}).ToList(); | ||
|
||
progress.Report(100); | ||
return images; | ||
} | ||
} | ||
} |
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
Oops, something went wrong.