Electronic book implementation method and system based on flattened file analysis and storage
By using a flat file parsing storage method in a system that does not support file object storage, a five-layer architecture is built for parsing and storing e-books, which solves the problems of e-book conversion and storage in the existing technology, and realizes efficient storage and conversion of e-books in non-file object storage systems.
Patent Information
- Application Number
- CN202411581044.8
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-11-07
- Publication Date
- 2025-03-28
- Estimated Expiration
- 2044-11-07
AI Technical Summary
In systems that do not support file object storage, it is difficult to achieve accurate conversion and storage of e-books.
The method based on flat file parsing and storage is adopted to parse and store e-books by building a five-layer architecture, including web browsers, web servers, reverse proxy servers, file parsing and storage of flat file storage servers. This method parses the original e-book file into a non-fixed hierarchical structure file and generates a file path index table to achieve accurate conversion and storage of e-books.
It effectively reduces the forced coupling between e-books and object storage, so that e-books can be conveniently stored in non-file object storage systems, and realizes accurate conversion of e-books in systems that do not support file object storage.
Smart Images

Figure CN119720960A_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the field of computer technology, and in particular to an electronic book implementation method and system based on flattened file parsing and storage. Background Art
[0002] In the related art, when parsing a file with a relatively complex structure, most of the time, the parsing and storage of the entire file is completed in a file object storage area. For a system that does not support file object storage, it is very difficult to convert such a file into an e-book. Summary of the invention
[0003] The main purpose of the embodiments of the present application is to propose an e-book implementation method and system based on flattened file parsing and storage, aiming to achieve accurate conversion of e-books in a system that does not support file object storage.
[0004] To achieve the above purpose, one aspect of an embodiment of the present application proposes an e-book implementation method based on flattened file parsing and storage, the method comprising:
[0005] Build a five-layer architecture including web browser, web server, reverse proxy server, file parsing server and flat file storage server;
[0006] Acquire the original e-book file uploaded by the first user, and upload the original e-book file to the flat file storage server;
[0007] Perform unparsed file detection through the file parsing server, parse the unparsed original electronic book file into a file with no fixed hierarchical structure, and obtain first file data and a file path index table;
[0008] 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;
[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 of a web browser, a web server, a reverse proxy server, a file parsing server, and a flat file storage server, including the following steps:
[0011] Build a web browser to provide an entry point for e-book reading;
[0012] Build a reverse proxy server on top of the web browser to load balance server requests;
[0013] Building a web server on top of the reverse proxy server to assemble the file structure and sequence;
[0014] A flat file storage is constructed on the upper layer of the web page server to store the original e-book files and the parsed resource files in an unstructured manner;
[0015] A file parsing server is constructed on the upper layer of the flat file storage server to parse the original electronic book file into a binary stream file.
[0016] In some embodiments, the unparsed file detection is performed by the file parsing server, the unparsed original electronic book file is parsed into a file with no fixed hierarchical structure, and the first file data and the file path index table are obtained, including the following steps:
[0017] Obtaining the first file path of each file in the original electronic book file;
[0018] Configuring a source file id for the original e-book file;
[0019] Convert the original electronic book file into a plurality of binary file streams;
[0020] Configure a file stream id for each binary file stream;
[0021] Using the file stream id and the binary file stream as first file data;
[0022] Generate a file path index table according to the first file path, source file ID and file stream ID.
[0023] In some embodiments, when the original electronic book file is a file in PDF format, converting the original electronic book file into a plurality of binary file streams comprises the following steps:
[0024] Each page of the original electronic book file is parsed into a picture to obtain a binary file stream; wherein the binary file stream is a picture binary stream.
[0025] In some embodiments, when the original electronic book file is an epub format file, converting the original electronic book file into a plurality of binary file streams comprises the following steps:
[0026] Get all small files in 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 a picture binary stream, a style file binary stream, a content file binary stream, and an 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] Acquiring an e-book reading request of a second user through the web browser;
[0030] Perform load balancing processing on the e-book reading request through the reverse proxy server and send it to the network server;
[0031] For a file parsed from an epub file, the network server obtains the file stream id from the file path index table according to the requested file path carried in the e-book reading request; for a file parsed from a pdf file, the network server directly obtains the file stream id in the file path index table;
[0032] The network server generates a resource acquisition path for the flat file storage server according to the file stream ID;
[0033] The resource access path is returned to the network browser.
[0034] In some embodiments, the method further comprises 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 in the target folder;
[0036] Based on the resource access request of the first user, generating a resource access path according to the file path index table;
[0037] The first user accesses the content of the target folder through the resource access path, and updates the content of the target folder.
[0038] To achieve the above purpose, another aspect of the embodiment of the present 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 including a web browser, a web server, a reverse proxy server, a file parsing server, and a flat file storage 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 perform unparsed file detection through the file parsing server, parse the unparsed original electronic book file into a file with no fixed hierarchical structure, and obtain first file data and a file path index table;
[0042] A 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] A fifth module is used to obtain the first file data from the flat file storage server according to the resource acquisition path, and display the first file data 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 e-book, 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 in the target folder;
[0047] Based on the resource access request of the first user, generating a resource access path according to the file path index table;
[0048] The first user accesses the content of the target folder through the resource access path, and updates the content of the target folder.
[0049] To achieve the above-mentioned purpose, another aspect of an embodiment of the present application provides an electronic device, the electronic device comprising a memory and a processor, the memory storing a computer program, and the processor implementing the above-mentioned method when executing the computer program.
[0050] To achieve the above objective, another aspect of an embodiment of the present application provides a computer-readable storage medium, wherein the computer-readable storage medium stores a computer program, and when the computer program is executed by a processor, the method described above is implemented.
[0051] The embodiments of the present application include at least the following beneficial effects: The present application provides an e-book implementation method and system based on flattened file parsing and storage. The solution adopts flat file storage plus 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 being structured. The corresponding file can be obtained from the file system according to the stored file path index rules, which effectively reduces the forced coupling between the e-book and the object storage, so that the e-book can be conveniently stored in the non-file object storage system, and the accurate conversion of the e-book can be realized in the system that does not support file object storage. BRIEF DESCRIPTION OF THE DRAWINGS
[0052] The accompanying drawings are used to provide further understanding of the technical solution of the present application and constitute a part of the specification. Together with the embodiments of the present application, they are used to explain the technical solution of the present application and do not constitute a limitation on the technical solution of the present application.
[0053] Figure 1 It is a step diagram of an e-book implementation method based on flattened file parsing and storage provided by an embodiment of the present application;
[0054] Figure 2 It is a schematic diagram of the hierarchical structure of a number of servers provided in an embodiment of the present application;
[0055] Figure 3 It is a schematic diagram of the data processing flow provided by the embodiment of the present application;
[0056] Figure 4 This is a schematic diagram of the epub file structure provided in the embodiment of the present application;
[0057] Figure 5 It is a module diagram of an e-book implementation system based on flattened file parsing and storage provided by an embodiment of the present application;
[0058] Figure 6 It is a schematic diagram of the hardware structure of the electronic device provided in the embodiment of the present application. DETAILED DESCRIPTION
[0059] In order to make the purpose, technical solutions and advantages of the present application clearer, the present application is further described in detail below in conjunction with the accompanying drawings and examples. It should be understood that the specific embodiments described herein are only used to explain the present application and are not intended to limit the present application. When the following description refers to the 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 the embodiments of the present application. They are only examples of devices and methods consistent with some aspects of the embodiments of the present application as detailed in the attached claims.
[0060] Although the functional modules are divided in the system schematic diagram and the 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 above drawings 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 can be used to describe various concepts in this article, but unless otherwise specified, these concepts are not limited by these terms. These terms are only used to distinguish one concept from another concept. For example, without departing from the scope of the embodiment of the present application, the first information may also be referred to as the second information, and similarly, the second information may also be referred to as the first information. Depending on the context, the words "if" and "if" as used herein can be interpreted as "at the time of" or "when" or "in response to determination".
[0062] The terms "at least one", "multiple", "each", "any", etc. used in this application, at least one includes one, two or more, multiple includes two or more, each refers to each of the corresponding multiple, and any refers to any one of the multiple.
[0063] Reference to "embodiments" herein means that a particular feature, structure, or characteristic described in conjunction with the embodiments may be included in at least one embodiment of the present application. The appearance of the phrase in various locations in the specification does not necessarily refer to the same embodiment, nor is it an independent or alternative embodiment that is mutually exclusive with other embodiments. It is explicitly and implicitly understood by those skilled in the art that the embodiments described herein may be combined with other embodiments.
[0064] Unless otherwise defined, all technical and scientific terms used herein have the same meaning as those commonly understood by those skilled in the art to which this application belongs. The terms used herein are only for the purpose of describing the embodiments of this application and are not intended to limit this application.
[0065] In the related art, when parsing a file with a relatively complex structure, most of the time, the parsing and storage of the entire file is completed in a file object storage area. For a system that does not support file object storage, it is very difficult to convert such a file into an e-book.
[0066] In view of this, an embodiment of the present application provides an e-book implementation method and system based on flattened file parsing and storage. This solution breaks the forced coupling between e-books and object storage systems, adopts flat file storage plus file parsing, and after parsing the copied structure in the file, the file rules are stored separately. The parsed file may not be stored in the file system according to the structure. The business then obtains the corresponding file from the file system according to the stored file rules, effectively reducing the forced coupling between e-books and object storage, so that e-books can be stored in non-file object storage systems.
[0067] The embodiment of the present application provides an e-book implementation method based on flattened file parsing and storage, which relates to the field of computer technology. The embodiment of the present application provides an e-book implementation method based on flattened file parsing and storage, which can be applied to a terminal, a server, or a software running in a terminal or a server. In some embodiments, the terminal can be a smart phone, a tablet computer, a laptop computer, a desktop computer, a smart speaker, a smart watch, and a car terminal, etc., but is not limited to this; the server side can be configured as an independent physical server, or a server cluster or distributed system composed of multiple physical servers, and can also be configured as a cloud server that provides basic cloud computing services such as cloud services, cloud databases, cloud computing, cloud functions, cloud storage, network services, cloud communications, 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 that implements an e-book implementation method based on flattened file parsing and storage, etc., but is not limited to the above forms.
[0068] The present application can be used in many general or special computer system environments or configurations. For example: 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, distributed computing environments including any of the above systems or devices, etc. The present 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. The present application can also be practiced in distributed computing environments, in which tasks are performed by remote processing devices connected through a communication network. In a distributed computing environment, program modules can be located in local and remote computer storage media including storage devices.
[0069] It should be noted that in each specific implementation of the present application, when it comes to the need to perform relevant processing based on data related to user identity or characteristics such as user information, user behavior data, user historical data, and user location information, the user's permission or consent will be obtained first, and the collection, use, and processing of these data will comply with relevant laws, regulations, and standards. In addition, when the embodiment of the present application needs to obtain the user's sensitive personal information, the user's separate permission or consent will be obtained through a pop-up window or by jumping to a confirmation page. After clearly obtaining the user's separate permission or consent, the necessary user-related data for the normal operation of the embodiment of the present application will be obtained.
[0070] Figure 1 is an optional flow chart of an e-book implementation method based on flattened file parsing and storage provided in an embodiment of the present application. Figure 1 The method may include but is not limited to steps S100 to S500.
[0071] Step S100, constructing a five-layer architecture including a web browser, a web server, a reverse proxy server, a file parsing server and a flat file storage server.
[0072] Step S200: acquiring the original electronic book file uploaded by the first user, and uploading the original electronic book file to the flat file storage server.
[0073] Step S300: performing unparsed file detection through the file parsing server, parsing the unparsed original electronic book file into a file with no fixed hierarchical structure, and obtaining first file data and a file path index table.
[0074] Step S400: 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 generates a resource acquisition path according to the file path index table.
[0075] Step S500, obtaining first file data from the flat file storage server according to the resource acquisition path, and displaying the first file data in the web browser to realize e-book reading.
[0076] In steps S100 to S500 shown in the embodiment of the present application, after the hierarchical structure in the file is parsed, the file path index rules are stored separately by adopting flat file storage and file parsing. The parsed file may not be stored in the file system according to the structure, and the corresponding file is obtained from the file system according to the stored file path index rules, thereby effectively reducing the forced coupling between the e-book and the object storage, so that the e-book can be conveniently stored in the non-file object storage system, and the accurate conversion of the e-book can be realized in the system that does 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, constructing a web browser to provide an entry for e-book reading;
[0079] Step S120, constructing a reverse proxy server on the upper layer of the web browser to perform load balancing processing on server requests;
[0080] Step S130, building a web server on the upper layer of the reverse proxy server to assemble the file structure and sequence;
[0081] Step S140, constructing a flat file storage device on the upper layer of the web server for unstructured storage of the original electronic book file and the parsed resource file;
[0082] Step S150: construct a file parsing server on the upper layer of the flat file storage server to parse the original electronic 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, obtaining the first file path of each file in the original electronic book file;
[0085] Step S320, configuring a source file ID for the original electronic book file;
[0086] Step S330, converting the original electronic book file into a plurality of binary file streams;
[0087] Step S340, configuring a file stream id for each binary file stream;
[0088] Step S350, using the file stream id and the binary file stream as first file data;
[0089] Step S360, generating a file path index table according to the first file path, source file ID and file stream ID.
[0090] In some embodiments, when the original electronic book file is a pdf format file, step S330 includes but is not limited to the following steps S331:
[0091] Step S331 is to parse each page of the original electronic book file into a picture to obtain a binary file stream; wherein the binary file stream is a picture binary stream.
[0092] In some embodiments, when the original electronic book file is an epub format file, step S330 includes but is not limited to the following steps S332 to S333:
[0093] Step S332, obtaining all small files in 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 a picture 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, obtaining an e-book reading request of a second user through the web browser;
[0097] Step S420, performing load balancing processing on the e-book reading request through the reverse proxy server and sending it to the network server;
[0098] Step S430, for a file parsed from an epub file, the network server obtains a file stream ID from the file path index table according to the requested file path carried in the e-book reading request; for a file parsed from a pdf file, the network server directly obtains the file stream ID from the file path index table;
[0099] Step S440, the network server generates a resource acquisition path for the flat file storage server according to the file stream ID;
[0100] Step S450: returning the resource access path to the network browser.
[0101] In some embodiments, the method further includes the following step S600 of enabling the first user to update the electronic book. Specifically, step S600 may include but is not limited to the following steps S610 to S630:
[0102] Step S610: creating a target folder for each of the first users in the flat file storage server; wherein no other folders exist in the target folder;
[0103] Step S620, based on the resource access request of the first user, generating a resource access path according to the file path index table;
[0104] Step S630: The first user accesses the content of the target folder through the resource access path to update the content of the target folder.
[0105] Below, in conjunction with a specific e-book implementation scenario application example, the solution of the embodiment of the present application is described in detail and explained:
[0106] In an embodiment of the present application, a method for implementing an e-book based on flattened file parsing and storage is provided, which can be applied to provide e-book storage and reading functions in a non-file object storage system.
[0107] Specifically, Figure 2 As shown, the embodiment of the present application constructs a 5-layer server architecture consisting of a web browser web-browser, a web server web-server, a reverse proxy server nginx, a file analysis server fileAnalyze-server, and a flat file storage server.
[0108] The reverse proxy server nginx is located on the upper layer of the web browser web-browser and is used to load balance requests.
[0109] The web server web-server is located on the upper layer of the reverse proxy server nginx, and can use the Tomcat server to provide the function of assembling file structure and sequence.
[0110] The flat file storage server file-server is located on the upper layer of the web server web-server. It is used to store source files and parsed files. A specific folder is created for each user. Users can only access the contents of this specific folder when accessing resources. There are no other folders in the folder. User files will be converted into binary streams for storage, and a file id will be generated as the file name.
[0111] The file analyzer fileAnalyze-server is located on the upper layer of the flat file storage server file-server, runs independently, and is used to analyze the source file. When the file being analyzed is a PDF, it generates an image for each page resource in the PDF file; when the file being analyzed is an epub file, it analyzes the hierarchical files in the epub file, finds all the files, and finally stores the files uniformly and unstructuredly in the flat file storage server file-server.
[0112] Based on this, Figure 3 As shown, the electronic book implementation method of the embodiment of the present application may include the following steps:
[0113] (1) The first user (uploader) uploads the original electronic book (in PDF or EPUB format) file to the flat file storage file-server in the web server web-server.
[0114] (2) The first user can create a corresponding e-book product in the business system, and the e-book product is used to provide a reading entrance.
[0115] (3) The file analysis server fileAnalyze-server detects that there are unparsed files and starts to parse the files:
[0116] ① For PDF files, the file analysis server fileAnalyze-server analyzes each page into images, generates small files of image binary streams, and uploads the image binary streams to the flat file storage server file-server. The storage structure of the file stream after PDF analysis 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 in the figure, there are small files such as pictures, style files, and content files in the source file. The file analysis server fileAnalyze-server obtains all small files in the epub file and parses them into corresponding binary streams, and uploads the parsed files to the flat file storage server file-server. The storage structure of the file stream after epub 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 the parsing is completed, the file paths of the small files in Table 1 and Table 2 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 e-book through a web browser. When reading, the file path is first obtained, and the file path is converted into a resource acquisition path of the flat file storage server through the above rule table stored in the web server web-server, and then the resource acquisition path is returned to the web browser. Exemplarily, the format of the resource acquisition path can be: https: / / domain / xxx / yyy / fileId1. The first user can obtain the resource access path for the specific folder corresponding to himself, and update the content in the folder according to the resource access path. The update can be modification, addition, deletion, etc. The method of obtaining the resource access path is similar to the method of obtaining the resource acquisition path mentioned above, and will not be repeated here.
[0127] (6) The web browser obtains the resource access path, initiates resource acquisition to the flat file system through HTTP, and displays the obtained e-book file content on the browser page.
[0128] In some embodiments, the web server may also obtain relevant e-book resources from the flat file storage server according to the obtained resource acquisition path, and then return the obtained resources to the web browser for display.
[0129] Based on this, the embodiments of the present application include at least the following beneficial effects:
[0130] To break the forced coupling between e-books and object storage systems, flat file storage plus file parsing is used. After parsing the copied structure in the file, the file rules are stored separately. The parsed files can be stored in the file system without being structured. The business can then obtain the corresponding files from the file system based on the stored file rules, effectively reducing the forced coupling between e-books and object storage, allowing e-books to be stored in non-file object storage systems.
[0131] See also Figure 5 The embodiment of the present application further provides an e-book implementation system based on flattened file parsing and storage, which can implement the above-mentioned e-book implementation method based on flattened file parsing and storage, and the system includes:
[0132] The first module 101 is used to 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 server;
[0133] The second module 102 is used to obtain the original electronic book file uploaded by the first user, and upload the original electronic book file to the flat file storage server;
[0134] The third module 103 is used to perform unparsed file detection through the file parsing server, parse the unparsed original electronic book file into a file with no fixed hierarchical structure, and obtain first file data and a 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 e-book, 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 in the target folder;
[0140] Based on the resource access request of the first user, generating a resource access path according to the file path index table;
[0141] The first user accesses the content of the target folder through the resource access path, and updates the content of the target folder.
[0142] It can be understood that the contents of the above method embodiments are all applicable to the present system embodiments, the functions specifically implemented by the present system embodiments 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.
[0143] The embodiment of the present application also provides an electronic device, the electronic device includes a memory and a processor, the memory stores a computer program, and the processor implements the above-mentioned e-book implementation method based on flattened file parsing and storage when executing the computer program. The electronic device can be any intelligent terminal including a tablet computer, a car computer, etc.
[0144] It can be understood that the contents of the above method embodiments are all applicable to the present device embodiments, the functions specifically implemented by the present device embodiments 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] See also Figure 6 , Figure 6 The hardware structure of an electronic device of another embodiment is illustrated, and the electronic device includes:
[0146] The processor 201 may be implemented by a general-purpose CPU (Central Processing Unit), a microprocessor, an 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 the present application;
[0147] The memory 202 can be implemented in the form of a read-only memory (ROM), a static storage device, a dynamic storage device, or a random access memory (RAM). The memory 202 can store an operating system and other application programs. When the technical solution provided in the embodiment of this specification is implemented by software or firmware, the relevant program code is stored in the memory 202, and the processor 201 calls and executes an electronic book implementation method based on flattened file parsing and storage in the embodiment of this application;
[0148] Input / output interface 203, used to implement information input and output;
[0149] The communication interface 204 is used to realize the communication interaction between the device and other devices. The communication can be realized through a wired manner (such as USB, network cable, etc.) or a wireless manner (such as mobile network, WIFI, Bluetooth, etc.);
[0150] Bus 205 , which 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 , the memory 202 , the input / output interface 203 and the communication interface 204 are connected to each other in communication within the device via the bus 205 .
[0152] An embodiment of the present application also provides a computer-readable storage medium, which stores a computer program. When the computer program is executed by a processor, it implements the above-mentioned e-book implementation method based on flattened file parsing and storage.
[0153] It can be understood that the contents of the above method embodiments are all applicable to the present storage medium embodiments, the functions specifically implemented by the present storage medium embodiments 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.
[0154] The memory, as a non-transient computer-readable storage medium, can be used to store non-transient software programs and non-transient computer executable programs. In addition, the memory may include a high-speed random access memory, and may also include a non-transient memory, such as at least one disk storage device, a flash memory device, or other non-transient solid-state storage device. In some embodiments, the memory may optionally include a memory remotely disposed relative to the processor, and these remote memories may be connected to the processor via a network. Examples of the above-mentioned network include, but are not limited to, the Internet, an intranet, a local area network, a mobile communication network, and combinations thereof.
[0155] The embodiments described in the embodiments of the present application are intended to more clearly illustrate the technical solutions of the embodiments of the present application and do not constitute a limitation on the technical solutions provided in the embodiments of the present application. Those skilled in the art will appreciate that with the evolution of technology and the emergence of new application scenarios, the technical solutions provided in the embodiments of the present application are also applicable to similar technical problems.
[0156] Those skilled in the art will appreciate that the technical solutions shown in the figures do not constitute a limitation on the embodiments of the present application, and may include more or fewer steps than shown in the figures, or a combination of certain steps, or different steps.
[0157] The system embodiments described above are merely illustrative, and the units described as separate components may or may not be physically separated, that is, they may be located in one place or distributed on multiple network units. Some or all of the modules may be selected according to actual needs to achieve the purpose of the present embodiment.
[0158] Those skilled in the art will appreciate that all or some of the steps in the methods disclosed above, and the functional modules / units in the systems and devices may be implemented as software, firmware, hardware, or a suitable combination thereof.
[0159] The terms "first", "second", "third", "fourth", etc. (if any) in the specification of the present application and the above-mentioned drawings are used to distinguish similar objects, and are not necessarily used to describe a specific order or sequence. It should be understood that the data used in this way can be interchangeable where appropriate, so that the embodiments of the present application described herein can be implemented in an order other than those illustrated or described herein. In addition, the terms "including" and "having" and any of their variations are intended to cover non-exclusive inclusions, for example, a process, method, system, product or device comprising a series of steps or units is not necessarily limited to those steps or units clearly listed, but may include other steps or units that are not clearly listed or inherent to these processes, methods, products or devices.
[0160] It should be understood that in the present application, "at least one (item)" means one or more, and "plurality" means two or more. "And / or" is used to describe the association relationship of associated objects, indicating that three relationships may exist. For example, "A and / or B" can mean: only A exists, only B exists, and A and B exist at the same time, where A and B can be singular or plural. The character " / " generally indicates that the objects associated before and after are in an "or" relationship. "At least one of the following" or similar expressions refers to any combination of these items, including any combination of single or plural items. For example, at least one of a, b or c can mean: a, b, c, "a and b", "a and c", "b and c", or "a and b and c", where a, b, c can be single or multiple.
[0161] In the several embodiments provided in the present application, it should be understood that the disclosed devices and methods can be implemented in other ways. For example, the system embodiments described above are only schematic. For example, the division of the above units is only a logical function division. There may be other division methods in actual implementation, such as multiple units or components can be combined or integrated into another system, or some features can be ignored or not executed. Another point is that the mutual coupling or direct coupling or communication connection shown or discussed can be an indirect coupling or communication connection through some interfaces, devices or units, which can be electrical, mechanical or other forms.
[0162] The units described above as separate components may or may not be physically separated, and the components shown as units may or may not be physical units, that is, they may be located in one place or distributed on multiple network units. Some or all of the units may be selected according to actual needs to achieve the purpose of the solution of this embodiment.
[0163] In addition, each functional unit in each embodiment of the present application may be integrated into one processing unit, or each unit may exist physically separately, or two or more units may be integrated into one unit. The above-mentioned integrated unit may be implemented in the form of hardware or in the form of software functional units.
[0164] If the integrated unit is implemented in the form of 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 the present application, 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, and the computer software product is stored in a storage medium, including multiple instructions to enable a computer device (which can be a personal computer, server, or network device, etc.) to execute all or part of the steps of the methods of various embodiments of the present application. The aforementioned storage medium includes: U disk, mobile hard disk, read-only memory (Read-Only Memory, referred to as ROM), random access memory (Random Access Memory, referred to as RAM), disk or optical disk and other media that can store programs.
[0165] The preferred embodiments of the present invention are described above with reference to the accompanying drawings, but the scope of the rights of the present invention is not limited thereto. Any modification, equivalent substitution and improvement made by a person skilled in the art without departing from the scope and essence of the present invention should be within the scope of the rights of the present invention.
Claims
1. A method for implementing an e-book based on flattened file parsing and storage, characterized in that: The following steps are involved: Build a five-layer architecture including web browser, web server, reverse proxy server, file parsing server and flat file storage server; Acquire the original e-book file uploaded by the first user, and upload the original e-book file to the flat file storage server; Perform unparsed file detection through the file parsing server, parse the unparsed original electronic book file into a file with no fixed hierarchical structure, and obtain first file data and a file path index table; 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; 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.
2. The method according to claim 1, characterized in that: The construction includes a five-layer architecture of a web browser, a web server, a reverse proxy server, a file parsing server and a flat file storage server, including the following steps: Build a web browser to provide an entry point for e-book reading; Build a reverse proxy server on top of the web browser to load balance server requests; Building a web server on top of the reverse proxy server to assemble the file structure and sequence; A flat file storage is constructed on the upper layer of the web page server to store the original e-book files and the parsed resource files in an unstructured manner; A file parsing server is constructed on the upper layer of the flat file storage server to parse the original electronic book file into a binary stream file.
3. The method according to claim 1, characterized in that The unparsed file detection is performed by the file parsing server, and the unparsed original electronic book file is parsed into a file with no fixed hierarchical structure, and the first file data and the file path index table are obtained, including the following steps: Obtaining the first file path of each file in the original electronic book file; Configuring a source file id for the original e-book file; Convert the original electronic book file into a plurality of binary file streams; Configure a file stream id for each binary file stream; Using the file stream id and the binary file stream as first file data; Generate a file path index table according to the first file path, source file ID and file stream ID.
4. The method according to claim 3, characterized in that When the original electronic book file is a file in PDF format, converting the original electronic book file into a plurality of binary file streams comprises the following steps: Each page of the original electronic book file is parsed into a picture to obtain a binary file stream; wherein the binary file stream is a picture binary stream.
5. The method according to claim 3, characterized in that: When the original electronic book file is an epub format file, converting the original electronic book file into a plurality of binary file streams comprises the following steps: Get all small files in the epub file; The small file is parsed to obtain a binary file stream; wherein the binary file stream includes at least one of a picture binary stream, a style file binary stream, a content file binary stream, and an opf file binary stream.
6. The method according to claim 1, characterized in that 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, comprises the following steps: Acquiring an e-book reading request of a second user through the web browser; Perform load balancing processing on the e-book reading request through the reverse proxy server and send it to the network server; For a file parsed from an epub file, the network server obtains the file stream id from the file path index table according to the requested file path carried in the e-book reading request; for a file parsed from a pdf file, the network server directly obtains the file stream id in the file path index table; The network server generates a resource acquisition path for the flat file storage server according to the file stream ID; The resource access path is returned to the network browser.
7. The method according to claim 1, characterized in that The method further comprises 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 in the target folder; Based on the resource access request of the first user, generating a resource access path according to the file path index table; The first user accesses the content of the target folder through the resource access path, and updates the content of the target folder.
8. An electronic book implementation system based on flattened file parsing and storage, characterized in that: include: The first module 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 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 perform unparsed file detection through the file parsing server, parse the unparsed original electronic book file into a file with no fixed hierarchical structure, and obtain first file data and a file path index table; A 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.
9. An electronic device, characterized in that: including a processor and a memory; The memory is used to store programs; The processor executes the program to implement the method according to any one of claims 1 to 7.
10. A computer storage medium storing a program executable by a processor, characterized in that: The program executable by the processor is used to implement the method according to any one of claims 1 to 7 when executed by the processor.
Citation Information
Patent Citations
Method and system for watching PDF file with mobile terminal
CN104935666A
Information processing device, information processing system and program
JP2013003622A