Skip to content

Commit

Permalink
Merge pull request metafates#158 from an-prata/main
Browse files Browse the repository at this point in the history
  • Loading branch information
metafates committed Feb 20, 2023
2 parents 81ee720 + 3c1c9ec commit 165f7ca
Showing 1 changed file with 3 additions and 9 deletions.
12 changes: 3 additions & 9 deletions provider/mangadex/chapters.go
Original file line number Diff line number Diff line change
Expand Up @@ -62,17 +62,11 @@ func (m *Mangadex) ChaptersOf(manga *source.Manga) ([]*source.Chapter, error) {
continue
}

num, err := strconv.ParseUint(chapter.GetChapterNum(), 10, 16)
n := uint16(num)
if err != nil {
n = uint16(i)
}

name := chapter.GetTitle()
if name == "" {
name = fmt.Sprintf("Chapter %d", n)
name = fmt.Sprintf("Chapter %s", chapter.GetChapterNum())
} else {
name = fmt.Sprintf("Chapter %d - %s", n, name)
name = fmt.Sprintf("Chapter %s - %s", chapter.GetChapterNum(), name)
}

var volume string
Expand All @@ -81,7 +75,7 @@ func (m *Mangadex) ChaptersOf(manga *source.Manga) ([]*source.Chapter, error) {
}
chapters = append(chapters, &source.Chapter{
Name: name,
Index: n,
Index: uint16(i),
ID: chapter.ID,
URL: fmt.Sprintf("https://mangadex.org/chapter/%s", chapter.ID),
Manga: manga,
Expand Down

0 comments on commit 165f7ca

Please sign in to comment.