fix(scanner): always attempt cover extraction for EPUBs and relax manga detection
Two changes to EPUB metadata extraction: 1. Restructure extractMetadata so that fixed-layout detection and cover extraction always run for EPUBs, even when extractEPUBMetadata returns an error. Previously, a partial failure from the EPUB parser would skip cover and format detection entirely, leaving books without covers. 2. Remove the language restriction (ja/jpn) from manga reading direction detection. Manga tagged with 'manga' should default to RTL regardless of the language metadata, since the tag is an explicit signal from the user or metadata source.
This commit is contained in:
@@ -953,7 +953,7 @@ func determineReadingDirection(comicInfo *ComicInfo) string {
|
|||||||
if strings.Contains(tags, "webtoon") || strings.Contains(tags, "manhwa") {
|
if strings.Contains(tags, "webtoon") || strings.Contains(tags, "manhwa") {
|
||||||
return "vertical" // Korean/Chinese webcomics
|
return "vertical" // Korean/Chinese webcomics
|
||||||
}
|
}
|
||||||
if strings.Contains(tags, "manga") && (lang == "ja" || lang == "jpn") {
|
if strings.Contains(tags, "manga") {
|
||||||
return "rtl" // Japanese manga
|
return "rtl" // Japanese manga
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1077,8 +1077,14 @@ func (s *MediaScanner) extractMetadata(path string) (*MediaMetadata, error) {
|
|||||||
|
|
||||||
switch ext {
|
switch ext {
|
||||||
case ".epub":
|
case ".epub":
|
||||||
metadata, err := s.extractEPUBMetadata(path)
|
metadata := &MediaMetadata{}
|
||||||
if err != nil {
|
result, err := s.extractEPUBMetadata(path)
|
||||||
|
if err == nil {
|
||||||
|
return result, nil
|
||||||
|
}
|
||||||
|
if result != nil {
|
||||||
|
metadata = result
|
||||||
|
}
|
||||||
// Enhanced format detection for EPUBs
|
// Enhanced format detection for EPUBs
|
||||||
isFixedLayout, detectErr := s.DetectFixedLayoutEPUB(path)
|
isFixedLayout, detectErr := s.DetectFixedLayoutEPUB(path)
|
||||||
if detectErr == nil && isFixedLayout {
|
if detectErr == nil && isFixedLayout {
|
||||||
@@ -1104,8 +1110,6 @@ func (s *MediaScanner) extractMetadata(path string) (*MediaMetadata, error) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
return metadata, nil
|
return metadata, nil
|
||||||
}
|
|
||||||
return metadata, nil
|
|
||||||
case ".pdf":
|
case ".pdf":
|
||||||
return s.extractPDFMetadata(path)
|
return s.extractPDFMetadata(path)
|
||||||
default:
|
default:
|
||||||
|
|||||||
Reference in New Issue
Block a user