An eBook Implementation Method and System Based on Flat File Parsing and Storage
By constructing a five-layer flat file parsing and storage method, a file path index table is generated, solving the problem of e-book conversion that does not support file object storage systems, and realizing convenient storage and reading of e-books in non-file object storage systems.
Patent Information
- Application Number
- CN202411581044.8
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2024-11-07
- Publication Date
- 2025-12-02
- Estimated Expiration
- 2044-11-07
AI Technical Summary
In existing technologies, converting ebooks is quite difficult for systems that do not support file object storage.
A flat file parsing and storage method is adopted, and a five-layer architecture is constructed, including a web browser, a web server, a reverse proxy server, a file parsing server, and a flat file storage server. The file parsing server parses unparsed e-book files into files without a fixed hierarchical structure and generates a file path index table, thereby achieving accurate conversion of e-books.
It effectively reduces the forced coupling between ebooks and object storage, enabling ebooks to be conveniently stored in non-file object storage systems and achieving accurate conversion of ebooks.
Smart Images

Figure CN119720960B_ABST
Abstract
Description
Technical Field
[0001] This application relates to the field of computer technology, and in particular to an e-book implementation method and system based on flat file parsing and storage. Background Technology
[0002] In related technologies, when parsing files with complex structures, most of the time the entire file is parsed and stored using a file object storage area. For systems that do not support file object storage, it is very difficult to convert such files into e-books. Summary of the Invention
[0003] The main objective of this application is to propose an e-book implementation method and system based on flat file parsing and storage, aiming to achieve accurate conversion of e-books in systems that do not support file object storage.
[0004] To achieve the above objectives, one aspect of this application proposes an e-book implementation method based on flattened file parsing and storage, the method comprising:
[0005] Construct a five-layer architecture including a web browser, a web server, a reverse proxy server, a file parsing server, and a flat file storage service server;
[0006] Obtain the original e-book file uploaded by the first user, and upload the original e-book file to the flat file storage server;
[0007] The file parsing server detects unparsed files and parses the unparsed original ebook files into files without a fixed hierarchical structure, thus obtaining the first file data and the file path index table.
[0008] The web browser obtains the second user's e-book reading request and sends it to the web server through the reverse proxy server. The web server then generates a resource acquisition path based on the file path index table.
[0009] According to the resource acquisition path, the first file data is obtained from the flat file storage server and displayed in the web browser to realize e-book reading.
[0010] In some embodiments, the construction includes a five-layer architecture comprising a web browser, a web server, a reverse proxy server, a file parsing server, and a flat file storage server, comprising the following steps:
[0011] Build a web browser to provide an entry point for e-book reading;
[0012] A reverse proxy server is built on top of the web browser to perform load balancing of server requests;
[0013] The web server is built on top of the reverse proxy server to assemble the file structure and order;
[0014] A flat file storage device is built on top of the web server for unstructured storage of the original ebook files and the parsed resource files;
[0015] A file parsing server is built on top of the flat file storage server to parse the original ebook file into a binary stream file.
[0016] In some embodiments, the step of detecting unparsed files through the file parsing server, parsing the unparsed original ebook file into a file without a fixed hierarchical structure, and obtaining the first file data and file path index table includes the following steps:
[0017] Obtain the first file path of each file in the original ebook file;
[0018] Configure the source file ID for the original eBook file;
[0019] The original ebook file is converted into several binary file streams;
[0020] Configure a file stream ID for each binary file stream;
[0021] Use the file stream ID and the binary file stream as the first file data;
[0022] Generate a file path index table based on the first file path, source file ID, and file stream ID.
[0023] In some embodiments, when the original ebook file is a PDF file, converting the original ebook file into several binary file streams includes the following steps:
[0024] To parse each page of the original ebook file into an image, a binary file stream is obtained; wherein, the binary file stream is an image binary stream.
[0025] In some embodiments, when the original ebook file is an epub format file, converting the original ebook file into several binary file streams includes the following steps:
[0026] Retrieve all small files within the epub file;
[0027] The small file is parsed to obtain a binary file stream; wherein the binary file stream includes at least one of the following: image binary stream, style file binary stream, content file binary stream, and OPF file binary stream.
[0028] In some embodiments, the step of sending the e-book reading request of the second user obtained by the web browser to the web server through the reverse proxy server, and the web server generating a resource acquisition path according to the file path index table, includes the following steps:
[0029] The web browser is used to obtain the e-book reading request of the second user.
[0030] The reverse proxy server performs load balancing on the e-book reading requests and sends them to the network server.
[0031] For files parsed from epub files, the network server retrieves the file stream ID from the file path index table based on the requested file path carried in the ebook reading request; for files parsed from pdf files, the file stream ID is directly retrieved from the file path index table.
[0032] The network server generates a resource acquisition path for the flat file storage service server based on the file stream ID;
[0033] Return the resource access path to the web browser.
[0034] In some embodiments, the method further includes the following steps:
[0035] In the flat file storage server, a target folder is created for each of the first users; wherein, no other folders exist within the target folder;
[0036] Based on the resource access request of the first user, a resource access path is generated according to the file path index table;
[0037] The first user accesses the contents of the target folder through the resource access path and updates the contents of the target folder.
[0038] To achieve the above objective, another aspect of this application proposes an e-book implementation system based on flattened file parsing and storage, the system comprising:
[0039] The first module is used to build a five-layer architecture that includes a web browser, a web server, a reverse proxy server, a file parsing server, and a flat file storage service server.
[0040] The second module is used to obtain the original e-book file uploaded by the first user and upload the original e-book file to the flat file storage server;
[0041] The third module is used to detect unparsed files through the file parsing server, parse the unparsed original e-book file into a file without a fixed hierarchical structure, and obtain the first file data and the file path index table.
[0042] The fourth module is used to send the e-book reading request of the second user obtained by the web browser to the web server through the reverse proxy server, and the web server generates a resource acquisition path according to the file path index table.
[0043] The fifth module is used to obtain the first file data from the flat file storage server according to the resource acquisition path, and display it in the web browser to realize e-book reading;
[0044] In some embodiments, the system may further include the following modules:
[0045] The sixth module is used to enable the first user to update the ebook, specifically for:
[0046] In the flat file storage server, a target folder is created for each of the first users; wherein, no other folders exist within the target folder;
[0047] Based on the resource access request of the first user, a resource access path is generated according to the file path index table;
[0048] The first user accesses the contents of the target folder through the resource access path and updates the contents of the target folder.
[0049] To achieve the above objectives, another aspect of this application provides an electronic device, which includes a memory and a processor. The memory stores a computer program, and the processor executes the computer program to implement the method described above.
[0050] To achieve the above objectives, another aspect of the embodiments of this application proposes a computer-readable storage medium storing a computer program that, when executed by a processor, implements the methods described above.
[0051] The embodiments of this application include at least the following beneficial effects: This application provides an e-book implementation method and system based on flat file parsing and storage. This solution adopts flat file storage plus file parsing, parses the hierarchical structure in the file, and stores the file path index rules separately. The parsed file can be stored in the file system without following the structure. The corresponding file is then retrieved from the file system according to the stored file path index rules. This effectively reduces the forced coupling between e-books and object storage, allowing e-books to be conveniently stored in non-file object storage systems, and enabling accurate conversion of e-books in systems that do not support file object storage. Attached Figure Description
[0052] The accompanying drawings are used to provide a further understanding of the technical solutions of this application and constitute a part of the specification. They are used together with the embodiments of this application to explain the technical solutions of this application and do not constitute a limitation on the technical solutions of this application.
[0053] Figure 1 This is a flowchart illustrating the steps of an e-book implementation method based on flat file parsing and storage provided in an embodiment of this application;
[0054] Figure 2 This is a schematic diagram of the data server hierarchy provided in an embodiment of this application;
[0055] Figure 3 This is a schematic diagram of the data processing flow provided in the embodiments of this application;
[0056] Figure 4 This is a schematic diagram of the epub file structure provided in the embodiments of this application;
[0057] Figure 5 This is a schematic diagram of a module of an e-book implementation system based on flat file parsing and storage provided in an embodiment of this application;
[0058] Figure 6 This is a schematic diagram of the hardware structure of the electronic device provided in the embodiments of this application. Detailed Implementation
[0059] To make the objectives, technical solutions, and advantages of this application clearer, the following detailed description is provided in conjunction with the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are merely illustrative of this application and are not intended to limit it. In the following description, when referring to the accompanying drawings, unless otherwise indicated, the same numbers in different drawings represent the same or similar elements. The embodiments described in the following exemplary embodiments do not represent all embodiments consistent with those of this application; they are merely examples of apparatuses and methods consistent with some aspects of the embodiments of this application as detailed in the appended claims.
[0060] Although functional modules are divided in the system diagram and a logical order is shown in the flowchart, in some cases, the steps shown or described may be performed in a different order than the module division in the system or the order in the flowchart. The terms "first / S100," "second / S200," etc., in the specification, claims, and the aforementioned figures are used to distinguish similar objects and are not necessarily used to describe a specific order or sequence.
[0061] It is understood that the terms “first,” “second,” etc., used in this application may be used herein to describe various concepts, but unless otherwise stated, these concepts are not limited by these terms. These terms are only used to distinguish one concept from another. For example, without departing from the scope of the embodiments of this application, first information may also be referred to as second information, and similarly, second information may also be referred to as first information. Depending on the context, the words “if,” “when,” or “in response to a determination” as used herein may be interpreted as “when…” or “when…” or “in response to a determination.”
[0062] As used in this application, the terms "at least one", "multiple", "each", "any", etc., "at least one" includes one, two or more, "multiple" includes two or more, "each" refers to each of the corresponding multiples, and "any" refers to any one of the multiples.
[0063] In this document, the term "embodiment" means that a particular feature, structure, or characteristic described in connection with an embodiment may be included in at least one embodiment of this application. The appearance of this phrase in various places throughout the specification does not necessarily refer to the same embodiment, nor is it a separate or alternative embodiment mutually exclusive with other embodiments. It will be explicitly and implicitly understood by those skilled in the art that the embodiments described herein can be combined with other embodiments.
[0064] Unless otherwise defined, all technical and scientific terms used herein have the same meaning as commonly understood by one of ordinary skill in the art to which this application belongs. The terminology used herein is for the purpose of describing embodiments of this application only and is not intended to limit this application.
[0065] In related technologies, when parsing files with complex structures, most of the time the entire file is parsed and stored using a file object storage area. For systems that do not support file object storage, it is very difficult to convert such files into e-books.
[0066] In view of this, this application provides an e-book implementation method and system based on flat file parsing and storage. This solution breaks the forced coupling between e-books and object storage systems. It adopts flat file storage plus file parsing. After parsing the structure copied in the file, the file rules are stored separately. The parsed file can be stored in the file system without following the structure. The business retrieves the corresponding file from the file system according to the stored file rules, which effectively reduces the forced coupling between e-books and object storage, allowing e-books to be stored in non-file object storage systems.
[0067] This application provides an e-book implementation method based on flat file parsing and storage, relating to the field of computer technology. This e-book implementation method based on flat file parsing and storage can be applied to a terminal, a server, or software running on a terminal or server. In some embodiments, the terminal can be a smartphone, tablet, laptop, desktop computer, smart speaker, smartwatch, or in-vehicle terminal, but is not limited thereto; the server can be configured as an independent physical server, a server cluster or distributed system composed of multiple physical servers, or a cloud server providing basic cloud computing services such as cloud services, cloud databases, cloud computing, cloud functions, cloud storage, network services, cloud communication, middleware services, domain name services, security services, CDN, and big data and artificial intelligence platforms. The server can also be a node server in a blockchain network; the software can be an application implementing an e-book implementation method based on flat file parsing and storage, but is not limited to the above forms.
[0068] This application can be used in a wide variety of general-purpose or special-purpose computer system environments or configurations. Examples include: personal computers, server computers, handheld or portable devices, tablet devices, multiprocessor systems, microprocessor-based systems, set-top boxes, programmable consumer electronics, network PCs, minicomputers, mainframe computers, and distributed computing environments including any of the above systems or devices. This application can be described in the general context of computer-executable instructions executed by a computer, such as program modules. Generally, program modules include routines, programs, objects, components, data structures, etc., that perform specific tasks or implement specific abstract data types. This application can also be practiced in distributed computing environments where tasks are performed by remote processing devices connected via a communication network. In distributed computing environments, program modules can reside in local and remote computer storage media, including storage devices.
[0069] It should be noted that in all specific embodiments of this application, when processing data related to user identity or characteristics, such as user information, user behavior data, user historical data, and user location information, user permission or consent is obtained first. Furthermore, the collection, use, and processing of this data comply with relevant laws, regulations, and standards. In addition, when embodiments of this application require access to sensitive personal information of users, separate permission or consent from the user is obtained through pop-ups or redirection to confirmation pages. Only after obtaining the user's separate permission or consent is the necessary user-related data required for the proper functioning of these embodiments acquired.
[0070] Figure 1 This is an optional flowchart of an e-book implementation method based on flat file parsing and storage provided in an embodiment of this application. Figure 1 The method may include, but is not limited to, steps S100 to S500.
[0071] Step S100: Construct a five-layer architecture including a web browser, a web server, a reverse proxy server, a file parsing server, and a flat file storage service server.
[0072] Step S200: Obtain the original e-book file uploaded by the first user and upload the original e-book file to the flat file storage server.
[0073] Step S300: Unparsed files are detected by the file parsing server, and the unparsed original e-book file is parsed into a file without a fixed hierarchical structure to obtain the first file data and the file path index table.
[0074] In step S400, the e-book reading request of the second user obtained by the web browser is sent to the web server through the reverse proxy server, and the web server generates a resource acquisition path according to the file path index table.
[0075] Step S500: According to the resource acquisition path, obtain the first file data from the flat file storage server and display it in the web browser to realize e-book reading.
[0076] Steps S100 to S500 as shown in the embodiments of this application employ flat file storage and file parsing. After parsing the hierarchical structure in the file, the file path index rules are stored separately. The parsed file can be stored in the file system without following the structure. The corresponding file is then retrieved from the file system according to the stored file path index rules. This effectively reduces the forced coupling between e-books and object storage, allowing e-books to be conveniently stored in non-file object storage systems, and enabling accurate conversion of e-books in systems that do not support file object storage.
[0077] In some embodiments, step S100 may include, but is not limited to, steps S110 to S150:
[0078] Step S110: Build a web browser to provide an entry point for e-book reading;
[0079] Step S120: Build a reverse proxy server on top of the web browser to perform load balancing of server requests.
[0080] Step S130: Build a web server on top of the reverse proxy server to assemble the file structure and order;
[0081] Step S140: A flat file storage device is built on the upper layer of the web server for unstructured storage of the original e-book files and the parsed resource files;
[0082] Step S150: A file parsing server is built on top of the flat file storage server to parse the original e-book file into a binary stream file.
[0083] In some embodiments, step S300 includes, but is not limited to, the following steps S310 to S360:
[0084] Step S310: Obtain the first file path of each file in the original e-book file;
[0085] Step S320: Configure the source file ID for the original e-book file;
[0086] Step S330: Convert the original ebook file into several binary file streams;
[0087] Step S340: Configure a file stream ID for each binary file stream;
[0088] Step S350: Use the file stream ID and the binary file stream as the first file data;
[0089] Step S360: Generate a file path index table based on the first file path, source file ID, and file stream ID.
[0090] In some embodiments, when the original ebook file is a PDF file, step S330 includes, but is not limited to, the following step S331:
[0091] Step S331 involves parsing each page of the original ebook file into an image to obtain a binary file stream; wherein the binary file stream is an image binary stream.
[0092] In some embodiments, when the original ebook file is an epub format file, step S330 includes, but is not limited to, the following steps S332 to S333:
[0093] Step S332: Obtain all small files within the epub file;
[0094] Step S333: Parse the small file to obtain a binary file stream; wherein the binary file stream includes at least one of an image binary stream, a style file binary stream, a content file binary stream, and an OPF file binary stream.
[0095] In some embodiments, step S400 includes, but is not limited to, the following steps S410 to S450:
[0096] Step S410: Obtain the second user's e-book reading request through the web browser;
[0097] Step S420: The e-book reading request is load-balanced through the reverse proxy server and sent to the network server;
[0098] Step S430: For files parsed from epub files, the network server retrieves the file stream ID from the file path index table based on the requested file path carried in the ebook reading request; for files parsed from pdf files, the file stream ID is directly retrieved from the file path index table.
[0099] Step S440: The network server generates a resource acquisition path for the flat file storage service server based on the file stream ID;
[0100] Step S450: Return the resource access path to the web browser.
[0101] In some embodiments, the method further includes the step S600 of implementing the first user updating the e-book. Specifically, step S600 may include, but is not limited to, the following steps S610 to S630:
[0102] Step S610: In the flat file storage server, a target folder is created for each of the first users; wherein, no other folders exist within the target folder;
[0103] Step S620: Based on the resource access request of the first user, generate a resource access path according to the file path index table;
[0104] In step S630, the first user accesses the contents of the target folder through the resource access path and updates the contents of the target folder.
[0105] The following section provides a detailed description and explanation of the solutions in this application embodiment, using specific e-book implementation scenarios as examples:
[0106] This application provides an e-book implementation method based on flat file parsing and storage, which can be applied to provide e-book storage and reading functions in non-file object storage systems.
[0107] Specifically, such as Figure 2 As shown, this application embodiment constructs a 5-layer server architecture consisting of a web browser, a web server, a reverse proxy server (nginx), a file parsing server (fileAnalyze-server), and a flat file storage server.
[0108] The reverse proxy server nginx sits above the web browser and is used for load balancing of requests.
[0109] The web server is located above the reverse proxy server nginx, and can use the Tomcat server to provide the function of assembling file structure and order.
[0110] The flat file storage server (file-server) is located above the web server (web-server) and is used to store source files and parsed files. It creates a specific folder for each user, and users can only access the contents of this specific folder when accessing resources. There are no other folders in this folder. User files are converted into binary streams for storage, and a file ID is generated as the file name of the file.
[0111] The file analyzer, fileAnalyze-server, runs independently on top of the flat file storage server, file-server, and is used to parse source files. When the file being parsed is a PDF, it generates an image for each page of the PDF file; when the file being parsed is an EPUB file, it parses the hierarchical files within the EPUB file, locates all files, and finally stores the files uniformly and unstructured on the flat file storage server, file-server.
[0112] Based on this, such as Figure 3 As shown, the e-book implementation method of this application embodiment may include the following steps:
[0113] (1) The first user (uploader) uploads the original ebook (in PDF or Epub format) to the flat file storage file server in the web-server.
[0114] (2) The first user can create a corresponding e-book product in the business system, which is used to provide a reading entry point.
[0115] (3) The file parsing server (fileAnalyze-server) detects an unparsed file and begins parsing it:
[0116] ① For PDF files, the file parsing server fileAnalyze-server parses each page into an image, generating a small file of the image binary stream. The image binary stream is then uploaded to the flat file storage server file-server. The storage structure of the file stream after PDF parsing is shown in Table 1:
[0117] Table 1
[0118] small file ID File Stream fileId1 Image binary stream fileId2 Image binary stream fileId3 Image binary stream fileId4 Image binary stream
[0119] ②For epub files, such as Figure 4 As shown, the source file contains small files such as images, style files, and content files. The file parsing server fileAnalyze-server obtains all small files within the epub file and parses them into corresponding binary streams. The parsed files are then uploaded to the flat file storage server file-server. The storage structure of the epub file stream is shown in Table 2.
[0120] Table 2
[0121] small file ID File Stream fileId1 Image binary stream fileId2 Style file binary stream fileId3 Content file binary stream fileId4 OPF file binary stream
[0122] (4) After parsing, the file paths of the small files in Tables 1 and 2 above are stored in the database to form a rule table (i.e., a file path index table). The storage structure of the rule table is shown in Table 3.
[0123] Table 3
[0124]
[0125]
[0126] (5) The second user (reader) reads the ebook through a web browser. During reading, the user first obtains the file path, then converts it into a resource retrieval path for the flat file storage service server using the rule table stored on the web server. This resource retrieval path is then returned to the web browser. For example, the format of the resource retrieval path can be: https: / / domain / xxx / yyy / fileId1. The first user can obtain the resource access path for their specific folder and update the contents of the folder according to the resource access path. This update can be modification, addition, deletion, etc. The method of obtaining the resource access path is similar to the method described above and will not be repeated here.
[0127] (6) The web browser obtains the resource access path, initiates resource retrieval to the flat file system via HTTP, and displays the obtained e-book file content on the browser page.
[0128] In some embodiments, the web server can retrieve the relevant e-book resources from the flat file storage server based on the obtained resource retrieval path, and then return the retrieved resources to the web browser for display.
[0129] Based on this, the embodiments of this application include at least the following beneficial effects:
[0130] By breaking the forced coupling between ebooks and object storage systems, a flat file storage and file parsing approach is adopted. After parsing the structure copied in the file, the file rules are stored separately. The parsed file can be stored in the file system without following the structure. The business then retrieves the corresponding file from the file system according to the stored file rules, which effectively reduces the forced coupling between ebooks and object storage, allowing ebooks to be stored in non-file object storage systems.
[0131] Please see Figure 5 This application also provides an e-book implementation system based on flat file parsing and storage, which can implement the above-mentioned e-book implementation method based on flat file parsing and storage. The system includes:
[0132] The first module 101 is used to build a five-layer architecture including a web browser, a web server, a reverse proxy server, a file parsing server, and a flat file storage service server;
[0133] The second module 102 is used to obtain the original e-book file uploaded by the first user and upload the original e-book file to the flat file storage server;
[0134] The third module 103 is used to detect unparsed files through the file parsing server, parse the unparsed original e-book file into a file without a fixed hierarchical structure, and obtain the first file data and the file path index table.
[0135] The fourth module 104 is used to send the e-book reading request of the second user obtained by the web browser to the web server through the reverse proxy server, and the web server generates a resource acquisition path according to the file path index table.
[0136] The fifth module 105 is used to obtain the first file data from the flat file storage server according to the resource acquisition path, and display it in the web browser to realize e-book reading.
[0137] In some embodiments, the system may further include the following modules:
[0138] The sixth module is used to enable the first user to update the ebook, specifically for:
[0139] In the flat file storage server, a target folder is created for each of the first users; wherein, no other folders exist within the target folder;
[0140] Based on the resource access request of the first user, a resource access path is generated according to the file path index table;
[0141] The first user accesses the contents of the target folder through the resource access path and updates the contents of the target folder.
[0142] It is understood that the content of the above method embodiments is applicable to this system embodiment. The specific functions implemented in this system embodiment are the same as those in the above method embodiments, and the beneficial effects achieved are also the same as those achieved in the above method embodiments.
[0143] This application also provides an electronic device, which includes a memory and a processor. The memory stores a computer program, and the processor executes the computer program to implement the aforementioned e-book implementation method based on flat file parsing and storage. This electronic device can be any smart terminal, including tablet computers, in-vehicle computers, etc.
[0144] It is understood that the content of the above method embodiments is applicable to this device embodiment. The specific functions implemented by this device embodiment are the same as those of the above method embodiments, and the beneficial effects achieved are also the same as those achieved by the above method embodiments.
[0145] Please see Figure 6 , Figure 6 The hardware structure of an electronic device according to another embodiment is illustrated. The electronic device includes:
[0146] The processor 201 can be implemented using a general-purpose CPU (Central Processing Unit), microprocessor, application-specific integrated circuit (ASIC), or one or more integrated circuits, and is used to execute relevant programs to implement the technical solutions provided in the embodiments of this application.
[0147] The memory 202 can be implemented as a read-only memory (ROM), static storage device, dynamic storage device, or random access memory (RAM). The memory 202 can store the operating system and other applications. When the technical solutions provided in the embodiments of this specification are implemented through software or firmware, the relevant program code is stored in the memory 202 and is called and executed by the processor 201 to implement an e-book implementation method based on flat file parsing and storage according to an embodiment of this application.
[0148] Input / output interface 203 is used to implement information input and output;
[0149] The communication interface 204 is used to enable communication and interaction between this device and other devices. Communication can be achieved through wired means (such as USB, network cable, etc.) or wireless means (such as mobile network, WIFI, Bluetooth, etc.).
[0150] Bus 205 transmits information between various components of the device (e.g., processor 201, memory 202, input / output interface 203, and communication interface 204);
[0151] The processor 201, memory 202, input / output interface 203 and communication interface 204 are connected to each other within the device via bus 205.
[0152] This application also provides a computer-readable storage medium storing a computer program that, when executed by a processor, implements the above-described e-book implementation method based on flat file parsing and storage.
[0153] It is understood that the content of the above method embodiments is applicable to this storage medium embodiment. The specific functions implemented in this storage medium embodiment are the same as those in the above method embodiments, and the beneficial effects achieved are also the same as those achieved in the above method embodiments.
[0154] Memory, as a non-transitory computer-readable storage medium, can be used to store non-transitory software programs and non-transitory computer-executable programs. Furthermore, memory may include high-speed random access memory, and may also include non-transitory memory, such as at least one disk storage device, flash memory device, or other non-transitory solid-state storage device. In some embodiments, memory may optionally include memory remotely located relative to the processor, and these remote memories can be connected to the processor via a network. Examples of such networks include, but are not limited to, the Internet, intranets, local area networks, mobile communication networks, and combinations thereof.
[0155] The embodiments described in this application are for the purpose of more clearly illustrating the technical solutions of the embodiments of this application, and do not constitute a limitation on the technical solutions provided by the embodiments of this application. As those skilled in the art will know, with the evolution of technology and the emergence of new application scenarios, the technical solutions provided by the embodiments of this application are also applicable to similar technical problems.
[0156] Those skilled in the art will understand that the technical solutions shown in the figures do not constitute a limitation on the embodiments of this application, and may include more or fewer steps than shown, or combine certain steps, or different steps.
[0157] The system embodiments described above are merely illustrative. The units described as separate components may or may not be physically separate; that is, they may be located in one place or distributed across multiple network units. Some or all of the modules can be selected to achieve the purpose of this embodiment according to actual needs.
[0158] Those skilled in the art will understand that all or some of the steps in the methods disclosed above, as well as the functional modules / units in the systems and devices, can be implemented as software, firmware, hardware, or suitable combinations thereof.
[0159] The terms “first,” “second,” “third,” “fourth,” etc. (if present) in the specification and accompanying drawings of this application are used to distinguish similar objects and are not necessarily used to describe a specific order or sequence. It should be understood that such data can be interchanged where appropriate so that the embodiments of this application described herein can be implemented in orders other than those illustrated or described herein. Furthermore, the terms “comprising” and “having,” and any variations thereof, are intended to cover non-exclusive inclusion; for example, a process, method, system, product, or apparatus that comprises a series of steps or units is not necessarily limited to those steps or units explicitly listed, but may include other steps or units not explicitly listed or inherent to such processes, methods, products, or apparatus.
[0160] It should be understood that in this application, "at least one (item)" means one or more, and "more than" means two or more. "And / or" is used to describe the relationship between related objects, indicating that three relationships can exist. For example, "A and / or B" can represent three cases: only A exists, only B exists, and both A and B exist simultaneously, where A and B can be singular or plural. The character " / " generally indicates that the preceding and following related objects are in an "or" relationship. "At least one (item) of the following" or similar expressions refer to any combination of these items, including any combination of single or plural items. For example, at least one (item) of a, b, or c can represent: a, b, c, "a and b", "a and c", "b and c", or "a and b and c", where a, b, and c can be single or multiple.
[0161] In the several embodiments provided in this application, it should be understood that the disclosed apparatus and methods can be implemented in other ways. For example, the system embodiments described above are merely illustrative; for instance, the division of the units described above is only a logical functional division, and in actual implementation, there may be other division methods. For example, multiple units or components may be combined or integrated into another system, or some features may be ignored or not executed. Furthermore, the coupling or direct coupling or communication connection shown or discussed may be an indirect coupling or communication connection through some interfaces, apparatuses, or units, and may be electrical, mechanical, or other forms.
[0162] The units described above as separate components may or may not be physically separate. The components shown as units may or may not be physical units; that is, they may be located in one place or distributed across multiple network units. Some or all of the units can be selected to achieve the purpose of this embodiment according to actual needs.
[0163] Furthermore, the functional units in the various embodiments of this application can be integrated into one processing unit, or each unit can exist physically separately, or two or more units can be integrated into one unit. The integrated unit can be implemented in hardware or as a software functional unit.
[0164] If the integrated unit is implemented as a software functional unit and sold or used as an independent product, it can be stored in a computer-readable storage medium. Based on this understanding, the technical solution of this application, in essence, or the part that contributes to the prior art, or all or part of the technical solution, can be embodied in the form of a software product. This computer software product is stored in a storage medium and includes multiple instructions to cause a computer device (which may be a personal computer, server, or network device, etc.) to execute all or part of the steps of the methods of the various embodiments of this application. The aforementioned storage medium includes various media capable of storing programs, such as USB flash drives, portable hard drives, read-only memory (ROM), random access memory (RAM), magnetic disks, or optical disks.
[0165] The preferred embodiments of the present application have been described above with reference to the accompanying drawings, but this does not limit the scope of the claims of the present application. Any modifications, equivalent substitutions, and improvements made by those skilled in the art without departing from the scope and substance of the embodiments of the present application shall be within the scope of the claims of the present application.
Claims
1. An e-book implementation method based on flat file parsing and storage, characterized in that, Includes the following steps: Construct a five-layer architecture including a web browser, a web server, a reverse proxy server, a file parsing server, and a flat file storage service server; Obtain the original e-book file uploaded by the first user, and upload the original e-book file to the flat file storage server; The file parsing server detects unparsed files and parses the unparsed original ebook files into files without a fixed hierarchical structure, thus obtaining the first file data and the file path index table. The web browser obtains the second user's e-book reading request and sends it to the web server through the reverse proxy server. The web server then generates a resource acquisition path based on the file path index table. According to the resource acquisition path, the first file data is obtained from the flat file storage server and displayed in the web browser to realize e-book reading; The step of detecting unparsed files through the file parsing server, parsing the unparsed original ebook file into a file without a fixed hierarchical structure, and obtaining the first file data and file path index table includes the following steps: Obtain the first file path of each file in the original ebook file; Configure the source file ID for the original eBook file; The original ebook file is converted into several binary file streams; Configure a file stream ID for each binary file stream; Use the file stream ID and the binary file stream as the first file data; Generate a file path index table based on the first file path, source file ID, and file stream ID; When the original ebook file is in epub format, the process of converting the original ebook file into several binary file streams includes the following steps: Retrieve all small files within the epub format file; The small file is parsed to obtain a binary file stream; wherein the binary file stream includes at least one of the following: image binary stream, style file binary stream, content file binary stream, and OPF file binary stream.
2. The method according to claim 1, characterized in that, The construction includes a five-layer architecture comprising a web browser, a web server, a reverse proxy server, a file parsing server, and a flat file storage server, and includes the following steps: Build a web browser to provide an entry point for e-book reading; A reverse proxy server is built on top of the web browser to perform load balancing of server requests; The web server is built on top of the reverse proxy server to assemble the file structure and order; A flat file storage device is built on top of the web server for unstructured storage of the original ebook files and the parsed resource files; A file parsing server is built on top of the flat file storage server to parse the original ebook file into a binary stream file.
3. The method according to claim 1, characterized in that, When the original ebook file is a PDF file, converting the original ebook file into several binary file streams includes the following steps: To parse each page of the original ebook file into an image, a binary file stream is obtained; wherein, the binary file stream is an image binary stream.
4. The method according to claim 1, characterized in that, The step of sending the e-book reading request from the second user obtained by the web browser to the web server via the reverse proxy server, and the web server generating a resource acquisition path based on the file path index table, includes the following steps: The web browser is used to obtain the e-book reading request of the second user. The reverse proxy server performs load balancing on the e-book reading requests and sends them to the web server. For files parsed from epub format files, the web server retrieves the file stream ID from the file path index table based on the requested file path carried in the ebook reading request; for files parsed from pdf files, the file stream ID is directly retrieved from the file path index table. The web server generates a resource acquisition path for the flat file storage service server based on the file stream ID; Return the resource retrieval path to the web browser.
5. The method according to claim 1, characterized in that, The method further includes the following steps: In the flat file storage server, a target folder is created for each of the first users; wherein, no other folders exist within the target folder; Based on the resource access request of the first user, a resource access path is generated according to the file path index table; The first user accesses the contents of the target folder through the resource access path and updates the contents of the target folder.
6. An e-book implementation system based on flat file parsing and storage, characterized in that, include: The first module is used to build a five-layer architecture that includes a web browser, a web server, a reverse proxy server, a file parsing server, and a flat file storage service server. The second module is used to obtain the original e-book file uploaded by the first user and upload the original e-book file to the flat file storage server; The third module is used to detect unparsed files through the file parsing server, parse the unparsed original e-book file into a file without a fixed hierarchical structure, and obtain the first file data and the file path index table. The fourth module is used to send the e-book reading request of the second user obtained by the web browser to the web server through the reverse proxy server, and the web server generates a resource acquisition path according to the file path index table. The fifth module is used to obtain the first file data from the flat file storage server according to the resource acquisition path, and display it in the web browser to realize e-book reading; The third module is specifically used for: Obtain the first file path of each file in the original ebook file; Configure the source file ID for the original eBook file; The original ebook file is converted into several binary file streams; Configure a file stream ID for each binary file stream; Use the file stream ID and the binary file stream as the first file data; Generate a file path index table based on the first file path, source file ID, and file stream ID; When the original ebook file is in epub format, the process of converting the original ebook file into several binary file streams includes the following steps: Retrieve all small files within the epub format file; The small file is parsed to obtain a binary file stream; wherein the binary file stream includes at least one of the following: image binary stream, style file binary stream, content file binary stream, and OPF file binary stream.
7. An electronic device, characterized in that, Including the processor and memory; The memory is used to store programs; The processor executes the program to implement the method as described in any one of claims 1 to 5.
8. A computer storage medium storing a processor-executable program, characterized in that, The processor-executable program, when executed by the processor, is used to implement the method as described in any one of claims 1 to 5.
Citation Information
Patent Citations
Method and system for watching PDF file with mobile terminal
CN104935666A
Information processing device, information processing system and program
JP2013003622A