Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Better export to epub #1144

Open
wants to merge 17 commits into
base: master
Choose a base branch
from

Conversation

CD-Z
Copy link
Contributor

@CD-Z CD-Z commented Jul 14, 2024

I finally found the time to work a bit on the library and implemented it in LNReader with a few changes for better compatibility.

  • changed lineheight and textsize to be rem based instead of px
  • changed epub text to be wrapped in div with id chapter instead of a chapter element, since the epub standard doesn't accept custom elements.
  • added to id chapter to the readerscreen chapter element.

This PR closes:

@nyagami
Copy link
Member

nyagami commented Jul 15, 2024

Why should we export reader ui to epub?

package.json Outdated
Comment on lines 19 to 20
"@cd-z/epub-constructor": "^3.0.1",
"@cd-z/react-native-epub-creator": "^3.0.0",
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Are they duplicated?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I fucked up the dependency so i had to create another version and installed it manually to make sure it works, however it can be removed again since it lt's not neccessary.

@@ -51,6 +53,7 @@
"react-native-device-info": "^8.4.7",
"react-native-drawer-layout": "^3.2.2",
"react-native-error-boundary": "^1.1.16",
"react-native-file-access": "^3.1.0",
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Any usage in app?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It belongs to my package as dependency, however if you don't install it manually, for some reason it says the package is not linked and can't be used. Which means the export feature is broken.

Comment on lines +8 to +11
const jsFilePath = path.resolve(
__dirname + '/../android/app/src/main/assets/css/',
'index.js',
);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If this file is created in building time only, it should be ignore from git.

@@ -1,6 +1,6 @@
import React, { useState } from 'react';
import { StyleSheet, View } from 'react-native';
import { Modal, TextInput, Text } from 'react-native-paper';
import { Modal, TextInput, Text } from 'react-native-paper'; //@ts-ignore
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
import { Modal, TextInput, Text } from 'react-native-paper'; //@ts-ignore
import { Modal, TextInput, Text } from 'react-native-paper';

Comment on lines +15 to +16
//@ts-ignore
import css from '../../../../../android/app/src/main/assets/css/index';
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

for static files, you should import by using require to avoiding TS warning

@CD-Z
Copy link
Contributor Author

CD-Z commented Jul 15, 2024

Why should we export reader ui to epub?

Where do I export the reader ui?

@nyagami
Copy link
Member

nyagami commented Jul 15, 2024

Why should we export reader ui to epub?

Where do I export the reader ui?

` + (css as string).replace(/chapter/g, '#chapter')

@nyagami
Copy link
Member

nyagami commented Jul 15, 2024

Btw, you could use implemented FileManager.pickerFolder to pick a folder with resolved path.

@CD-Z CD-Z force-pushed the feature/export_to_epub_version_bump branch from 28aea06 to 8c2f8e6 Compare July 27, 2024 13:28
@Palloxin

This comment was marked as outdated.

@Palloxin
Copy link
Contributor

Feature request:
Make chapter file numbering start from chapter 1
Screenshot_20240727-184907_1_1
The majority of webnovels dont have a chapter before chapter 1.

@CD-Z
Copy link
Contributor Author

CD-Z commented Jul 27, 2024

Feature request: Make chapter file numbering start from chapter 1

Not planed, since only a minority of users will open the epub

@Palloxin
Copy link
Contributor

Palloxin commented Jul 27, 2024

F-r
Add warning in case the downloaded chapters have hole in between.
chapter 1-8 — downloaded
chapter 9-16 — NOT downloaded
chapter 17-100 — downloaded

It would be nice to know. Not necessary tho.
Hole: like in the example above, means undownloaded stuff between two groups of downloaded chapters.

@Palloxin
Copy link
Contributor

Palloxin commented Jul 27, 2024

Performance issue:
Export speed slower in beta(tested on latest), both 2100+ chapters

beta(2:25):

YouCut_20240728_001100235.mp4

Stable(1:10):

YouCut_20240728_000134690.mp4

Detail: i tested on a beta build that doesnt have the changes of this pr..Commit 7cf8692. It's as fast as stable. I assume this pr modifications are the cause.

@Palloxin
Copy link
Contributor

Palloxin commented Sep 7, 2024

Bug
Screenshot_20240907-235310_1
Export failed due to missing images in a chapter. The chapter is downloaded but somehow the images werent, maybe an app bug or the plugin failed to pick them.

-Novelfull 1.0.0, Cultivation chat group, chapter 841

Solution: override or/and make a window appear that says that these chapter failed for some reason

@Palloxin
Copy link
Contributor

Palloxin commented Sep 27, 2024

Export error:
Screenshot_20240927-024203_1

It comes from an imported EPUB entry.
922k.txt
note: RENAME the extension from .txt to .epub (github doesnt accept epub files)
Import the epub, then try to export it.

@Palloxin
Copy link
Contributor

Palloxin commented Oct 6, 2024

Flaw
Directory error after 2 min of exporting:
Screenshot_20241006-110019_1
The problem is that I used a path that was picked in the past, and somehow it disappeared, so it gave the error.
Solution:
-Check the directory avaiability first, to make the error pop up immediately and not waste 2 minutes.

@Palloxin

This comment was marked as resolved.

@Palloxin
Copy link
Contributor

Suggestion:
Way to inject directly JS or CSS, ignoring the code in customJS and CSS of the app.
It's a little cumbersome to go there, paste the code and then come back to the entry to export.

It's more comfortable.

@CD-Z
Copy link
Contributor Author

CD-Z commented Oct 11, 2024

Suggestion: Way to inject directly JS or CSS, ignoring the code in customJS and CSS of the app. It's a little cumbersome to go there, paste the code and then come back to the entry to export.

It's more comfortable.

Why would you want that? What exactly is the use case to have js/css specific only for the epub. Especially when most epub readers don't support it.

@Palloxin
Copy link
Contributor

Palloxin commented Oct 11, 2024

Why would you want that? What exactly is the use case to have js/css specific only for the epub. Especially when most epub readers don't support it.

Just more comfortable. Since js can already be included, allow to directly do it from this place, it's just a shortcut:
Screenshot_20241011-105549_1

Also, IF you have the intention of implementing the Perma-edit feature above, the "especially when most epub readers don't support it" wouldnt matter anymore.

@CD-Z
Copy link
Contributor Author

CD-Z commented Oct 11, 2024

Well it won't come with this PR, for now I need to find the time to finish this one.

A perma edit would be the best solution to it, however this would also need a lot of work.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants