A preview method, device, equipment and medium for multiple types of files

By obtaining file types and content, matching the preview proportion and components, adaptively adjusting the display area, and generating thumbnail information, the problems of loading delay and poor interaction experience in multi-type file preview are solved, and efficient and compatible file preview is achieved , adapt to different types and quantities of file requirements.

CN118860985BActive Publication Date: 2024-12-27ZHEJIANG HAIGUI TECH CO LTD
View PDF 5 Cites 0 Cited by

Patent Information

Application Number
CN202411312049.0
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2024-09-20
Publication Date
2024-12-27
Estimated Expiration
2044-09-20

AI Technical Summary

Technical Problem

The existing technology has problems in multi-type file previews with loading delays, poor interactive experience, security vulnerabilities and file type identification limitations. In particular, the preview of the format may cause delays. The third-party library preview cannot meet the needs of split-screen dragging. The user preview interaction experience is poor, and there are limitations in file type identification dependency suffix storage.

Method used

Provide a multi-type file preview method, by obtaining file types and contents, matching the comparison table to determine the preview proportion and components, adaptively adjust the display area, generate thumbnail information, use the target preview component to display the file content in the display area, and File type acquisition is achieved through binary file conversion and MIME type recognition, and supports the generation of abbreviation information of video files.

Benefits of technology

It realizes efficient preview of multiple types of files, improves user experience and performance, compatibility, supports different file layouts and business scenarios, saves resources, provides an intuitive and personalized user interface, and adapts to different number and types of file requirements.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN118860985B_ABST
    Figure CN118860985B_ABST
Patent Text Reader

Abstract

The present application provides a preview method, device, equipment and medium for multiple types of files, and relates to the field of file preview technology, including: matching the target interface preview ratio corresponding to the file type from a comparison table of different file types and different preview ratios stored; determining the display area of ​​the target file in the file preview interface based on the interface size, file type and target interface preview ratio; matching the target preview component corresponding to the file type and file content from a comparison table of different file types, different file contents and different preview components stored; determining the display area as the file preview size of the target file, and using the target preview component to display the file content of the target file in the display area. The present application can improve the performance and compatibility of file preview; the user interface can provide a more intuitive and personalized experience.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application relates to the technical field of file preview, and in particular to a method, device, equipment and medium for previewing multiple types of files. Background Art

[0002] Currently, when implementing previews of multiple types of files, it is usually necessary to convert different types of files into a common format, or use existing third-party libraries to implement file preview and interface operation functions; or open a new browser window to preview the file.

[0003] However, previewing different types of files by converting formats may cause loading delays; previewing through third-party libraries may not fully meet specific requirements such as split-screen dragging and may have security vulnerabilities; and previewing using browser pages provides a poor interactive experience.

[0004] At the same time, existing file type identification is generally achieved through suffixes. If the suffix fails to pre-store the corresponding file category, the file type cannot be identified. Therefore, the existing file type identification method cannot meet all business needs and has limitations. Summary of the invention

[0005] The purpose of the embodiments of the present application is to provide a preview method, device, equipment and medium for multiple types of files, so as to solve the above-mentioned problems existing in the prior art and to efficiently preview multiple different types of files.

[0006] In a first aspect, a method for previewing multiple types of files is provided, and the method may include:

[0007] Obtaining the interface size of the file preview interface, and the file type and file content of the target file to be displayed corresponding to the file preview interface;

[0008] Matching the target interface preview ratio corresponding to the file type from a comparison table of different file types and different preview ratios stored;

[0009] Determining a display area of ​​the target file in the file preview interface based on the interface size, the file type, and the target interface preview ratio;

[0010] Matching a target preview component corresponding to the file type and the file content from a comparison table of different file types, different file contents and different preview components;

[0011] Determine the display area as a file preview size of the target file, and display the file content of the target file in the display area using a target preview component;

[0012] Generate thumbnail information of the target file according to the file content;

[0013] The thumbnail information is displayed on one side of the file preview interface.

[0014] In an optional implementation, the method for obtaining the file type includes:

[0015] Convert the target file into a binary file to obtain a target binary file; wherein the target binary file includes a file header identifier;

[0016] Matching the target file type corresponding to the file header identifier from a comparison table of different file header identifiers and different file types, and obtaining the file type of the target file;

[0017] Or, get the MIME field type in the browser response information;

[0018] From the comparison table between different MIME field types and different file types, the target file type corresponding to the MIME field type is matched to obtain the file type of the target file.

[0019] In an optional implementation, determining a display area of ​​the target file in the file preview interface based on the interface size, the file type, and the target interface preview ratio includes:

[0020] Acquire a dynamic adjustment strategy for the target file and a layout preference corresponding to a file type of the target file;

[0021] The quotient obtained by dividing the target interface preview ratio of the target file by the sum of the target interface preview ratios of all target files is used as the adjusted preview ratio of the target file;

[0022] Determining a display size of the target file according to the interface size and the adjusted preview ratio of the target file;

[0023] Using the dynamic adjustment strategy of the target file, adjusting the first display size of the target file to obtain a second display size of the target file;

[0024] Based on the layout preference and the second display size, a display area of ​​the target file in the file preview interface is determined.

[0025] In an optional implementation, determining a display area of ​​the target file in the file preview interface based on the layout preference and the second display size includes:

[0026] Sort all target files according to their weight values ​​to obtain sorted target files;

[0027] From the sorted target files, select the target file with the largest weight value as the first target file;

[0028] The coordinate system of the preview interface is constructed with the lower left corner of the file preview interface as the origin of the coordinate system;

[0029] determining, according to a layout preference corresponding to the file type of the first target file, a coordinate of any vertex of the first target file in a preview interface coordinate system;

[0030] The coordinates of all the vertex corners of the first target file in the preview interface coordinate system are obtained according to the coordinates of any vertex corner in the preview interface coordinate system and the second display size; the coordinates of all the vertex corners of the first target file in the preview interface coordinate system are the display area of ​​the first target file in the file preview interface.

[0031] In an optional implementation, the file type includes video;

[0032] When the file type of the target file is a video, generating thumbnail information of the target file according to the file content includes:

[0033] Acquire the audio data corresponding to the target file to obtain the target audio data;

[0034] Performing speech recognition on the target audio data to obtain a first target recognition text corresponding to the target audio data;

[0035] Extracting key video frames from the target file;

[0036] Performing optical character recognition on the key video frame to obtain a second target recognition text;

[0037] Based on the first target recognition text and the second target recognition text, thumbnail information of the target file is generated.

[0038] In an optional implementation, generating the abbreviated information of the target file based on the first target recognition text and the second target recognition text includes:

[0039] Extracting target information from the first target recognition text;

[0040] Performing natural language processing on the first target recognition text and the second target recognition text to obtain a recognition result;

[0041] Based on the recognition result and the target information, thumbnail information of the target file is generated.

[0042] In an optional implementation, after displaying the thumbnail information on one side of the file preview interface, the method further includes:

[0043] Responding to a file preview request received from a third-party application;

[0044] Extracting a file to be previewed from the file preview request;

[0045] Convert the file to be previewed into a binary file to obtain the binary file to be previewed;

[0046] Broadcasting the binary file to be previewed;

[0047] The third-party application receives the binary file to be previewed, converts the binary file to be previewed, and obtains the file to be previewed for display.

[0048] In a second aspect, a preview device for multiple types of files is provided, and the device may include:

[0049] An acquisition unit, used to acquire the interface size of the file preview interface, and the file type and file content of the target file to be displayed corresponding to the file preview interface;

[0050] A matching unit is used to match the target interface preview ratio corresponding to the file type from a comparison table of different file types and different preview ratios stored; determine the display area of ​​the target file in the file preview interface based on the interface size, the file type and the target interface preview ratio; match the target preview component corresponding to the file type and the file content from a comparison table of different file types, different file contents and different preview components stored;

[0051] A generating unit, used for generating thumbnail information of the target file according to the content of the file;

[0052] The preview unit is used to determine the display area as the file preview size of the target file, and use the target preview component to display the file content of the target file in the display area; and display the thumbnail information on one side of the file preview interface.

[0053] In a third aspect, an electronic device is provided, the electronic device comprising a processor, a communication interface, a memory and a communication bus, wherein the processor, the communication interface and the memory communicate with each other via the communication bus;

[0054] Memory, used to store computer programs;

[0055] The processor is used to implement any method step described in the first aspect when executing the program stored in the memory.

[0056] In a fourth aspect, a computer-readable storage medium is provided, wherein a computer program is stored in the computer-readable storage medium, and when the computer program is executed by a processor, any method step described in the first aspect is implemented.

[0057] This application can preview multiple types of files at the same time, which is convenient for data comparison and viewing; and by adaptively adjusting the size of different file previews, it can meet the preview requirements of files of different numbers and types, thereby improving the user experience; at the same time, the files that need to be viewed are unified in the Viewer component with abbreviated important information, which is convenient for organizers to directly switch to the files that need to be viewed and compared without closing the files to find the corresponding files from hundreds or thousands of files.

[0058] This application can improve the performance and compatibility of file preview; the user interface can provide a more intuitive and personalized experience. This application is simple to access and flexible to use, and the component supports various file layouts and business scenarios.

[0059] This application can realize simultaneous preview of files of different types and numbers. At the same time, based on information such as user preferences, the display areas of different files can be adjusted in a targeted manner, so that the preview interface is more in line with the user's personal habits, improves the user experience, and can be applied to different scenarios; at the same time, this application can effectively save resources and improve the quality of the preview interface. BRIEF DESCRIPTION OF THE DRAWINGS

[0060] In order to more clearly illustrate the technical solutions of the embodiments of the present application, the drawings required for use in the embodiments of the present application will be briefly introduced below. It should be understood that the following drawings only show certain embodiments of the present application and therefore should not be regarded as limiting the scope. For ordinary technicians in this field, other related drawings can be obtained based on these drawings without paying creative work.

[0061] Figure 1 A flowchart of a method for previewing multiple types of files provided in an embodiment of the present application;

[0062] Figure 2 A schematic diagram of the structure of a preview device for multiple types of files provided in an embodiment of the present application;

[0063] Figure 3 A schematic diagram of the structure of an electronic device provided in an embodiment of the present application. DETAILED DESCRIPTION

[0064] The following will be combined with the drawings in the embodiments of the present application to clearly and completely describe the technical solutions in the embodiments of the present application. Obviously, the described embodiments are only part of the embodiments of the present application, not all of the embodiments. Based on the embodiments of the present application, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of this application.

[0065] The preview method of multiple types of files provided in the embodiment of the present application can be applied in a server or in a terminal with strong computing power. The server can be a physical server, a server cluster or a distributed system composed of multiple physical servers, or a cloud server that provides cloud services, cloud databases, cloud computing, cloud functions, cloud storage, network services, cloud communications, middleware services, domain name services, security services, content delivery networks (Content Delivery Network, CDN), and basic cloud computing services such as big data and artificial intelligence platforms. The terminal can be a user equipment (User Equipment, UE) such as a mobile phone, a smart phone, a laptop, a digital broadcast receiver, a personal digital assistant (PDA), a tablet computer (PAD), a handheld device, a vehicle-mounted device, a wearable device, a computing device or other processing equipment connected to a wireless modem, a mobile station (Mobile Station, MS), a mobile terminal (Mobile Terminal), etc. The terminal and the server can be directly or indirectly connected through a wired or wireless communication method, which is not limited in this application.

[0066] The preferred embodiments of the present application are described below in conjunction with the drawings in the specification. It should be understood that the preferred embodiments described herein are only used to illustrate and explain the present application, and are not used to limit the present application. In addition, the embodiments and features in the embodiments of the present application may be combined with each other if there is no conflict.

[0067] Figure 1 A flowchart of a preview method for multiple types of files provided in an embodiment of the present application. Figure 1 As shown, the method may include:

[0068] Step S110, obtaining the interface size of the file preview interface, and the file type and file content of the target file to be displayed corresponding to the file preview interface; matching the target interface preview ratio corresponding to the file type from a comparison table of different file types and different preview ratios stored.

[0069] In the embodiment of the present application, the target file may be one or more. If there are multiple target files, the file types of different target files may be the same or different.

[0070] In an embodiment of the present application, the target file can be uploaded by passing in one or more URLs, ArrayBuffer, Blob or other format files.

[0071] In the embodiment of the present application, the file types of the target files include video, word, Excel, audio, picture, web page files and the like.

[0072] In an embodiment of the present application, a method for obtaining the file type of a target file can be implemented by identifying the suffix of the target file, and by matching the file type corresponding to the suffix of the target file through a comparison table of different suffixes and corresponding file types stored to obtain the file type of the target file.

[0073] In one embodiment of the present application, the method for obtaining the file type of the target file may also include: converting the target file into a binary file to obtain a target binary file; matching the target file type corresponding to the file header identifier from a stored comparison table of different file header identifiers and different file types to obtain the file type of the target file.

[0074] In an embodiment of the present application, the target binary file includes a file header identifier; different file types have different file header identifiers, for example, JPEG / JPG: the file header identifier is ff, d8; therefore, the file type of the target file can be determined by the file types corresponding to the different file header identifiers stored in advance.

[0075] In actual applications, when a user modifies the suffix of a file by renaming it, the file type identified by the suffix will not match the actual file type. However, when the file is converted to a binary file, the file header in the binary file is the file header identifier of the actual file type and will not change as the user renames the file. Therefore, this application uses the method of converting the file to a binary file to avoid the situation where the file type identified based on the suffix does not match the actual file type due to the user modifying the suffix or part of the file from the beginning.

[0076] In another embodiment of the present application, the method for obtaining the file type further includes:

[0077] The MIME field type in the browser response information is obtained; the target file type corresponding to the MIME field type is matched from the comparison table of different MIME field types and different file types stored, and the file type of the target file is obtained.

[0078] In actual applications, by sending a preview request to the browser server, the browser will return a response message, which contains the MIME field type. Different file types correspond to different MIME field types. For example, the MIME field type corresponding to a text type file is text / plain; therefore, the corresponding file type can be matched by the MIME field type.

[0079] In an embodiment of the present application, different preview ratios are pre-set for different file types, and the user can adjust the preview ratio according to their own usage habits or application scenarios; for example, a larger preview ratio can be set for video files.

[0080] In an embodiment of the present application, the interface size of the file preview interface can be adjusted. The user can expand and change the interface size of the file preview interface by dragging the page, splitting the screen, zooming in and out, maximizing / minimizing, and other operations. Since the target file is previewed in the preview interface, when the size of the preview interface changes, the size of the preview window of the target file will also change accordingly.

[0081] Step S120: Determine a display area of ​​the target file in the file preview interface based on the interface size, file type, and target interface preview ratio.

[0082] In an embodiment of the present application, an algorithm is used to allocate the number of previews and file types in the container to achieve the order and layout of files in the container. Dynamic calculation of width and height and proportional allocation of the overall container are used to make each file preview more intuitive.

[0083] In an embodiment of the present application, determining the display area of ​​the target file in the file preview interface based on the interface size, file type, and target interface preview ratio includes:

[0084] The weight of the target file, the dynamic adjustment strategy of the target file, and the layout preference corresponding to the file type of the target file are obtained; the quotient obtained by dividing the target interface preview ratio of the target file by the sum of the target interface preview ratios of all target files is used as the adjusted preview ratio of the target file; the first display size of the target file is determined according to the interface size and the adjusted preview ratio of the target file; the first display size of the target file is adjusted by using the dynamic adjustment strategy of the target file to obtain the second display size of the target file; all target files are sorted according to the weight values ​​to obtain sorted target files; from the sorted target files, the target file with the largest weight value is selected as the first target file; the preview interface coordinate system is constructed with the lower left corner of the file preview interface as the origin of the coordinate system; according to the layout preference corresponding to the file type of the first target file, the coordinates of any vertex of the first target file in the preview interface coordinate system are determined; according to the coordinates of any vertex in the preview interface coordinate system and the second display size of the first target file, the coordinates of all vertex of the first target file in the preview interface coordinate system are obtained; the coordinates of all vertex of the first target file in the preview interface coordinate system are the display area of ​​the first target file in the file preview interface.

[0085] In an embodiment of the present application, a method for calculating the weight of a target file includes:

[0086] Obtain multiple weighted influence factors of the target file and initial weight coefficients of different weighted influence factors; for any weighted influence factor, calculate the weighted score of the target file according to the weighted influence factor to obtain the weight of the target file.

[0087] In the embodiment of the present application, the weight influencing factors include: usage frequency: the number of times a user accesses a file; dwell time: the average time a user stays on a file; last access time: the last time a user accessed a file, a more recent access may indicate a higher relevance; user feedback: the user's rating of the file or specific user feedback; cumulative weight distribution: allocating the remaining space based on the cumulative weights of all files.

[0088] In the present embodiment, the initial weight coefficient of each weight influence factor may be assigned by the user according to the actual application scenario; the initial weight coefficient reflects the relative importance of the weight influence factor in the overall score.

[0089] In the embodiment of the present application, the weight of the target file is updated periodically once a week, and the user is allowed to manually adjust the weight coefficient to reflect personal preference.

[0090] In this embodiment, in view of the impact of large data volume on the performance of the weighted algorithm, if there is a very large data set in the later stage, data sampling technology is used to reduce the amount of data that needs to be processed. Ensure that the sampling is representative to maintain the accuracy of the algorithm, and recalculate the weight of the entire data set for daily use, and only incrementally update the new or updated data. At the same time, the use of new data can also reduce the impact of old data on the current weight.

[0091] In an embodiment of the present application, the dynamic adjustment strategy includes: a minimum size limit strategy and a maximum size limit strategy; the minimum size limit strategy is to set a minimum display size for each file type to ensure that even if the weight is low, the file can still be clearly seen by the user; the maximum size limit strategy is used to prevent a file from occupying too much space due to excessive weight.

[0092] In an embodiment of the present application, different layout preferences are pre-matched for different file types; the layout preference can be obtained based on the user's historical preview habit analysis; it can also be directly set by the user according to his or her own preferences or application scenarios; for example, if the file type is word, it is laid out horizontally in the upper layer of the file preview interface or vertically from the left; if the file type is a picture, it is displayed in the lower layer of the file preview interface; if the file type is a video, it is displayed in the right area of ​​the file preview interface.

[0093] In the embodiment of the present application, the layout preference corresponding to the file type includes the horizontal and vertical starting coordinates or the horizontal and vertical ending coordinates of the file of the file type and the adjustment rules in the horizontal and / or vertical directions; for example, if the file type is word and the corresponding layout preference is left vertical layout, then the horizontal and vertical starting coordinates of the file of the file type in the file preview interface are (x0, y1, y2, y3, y4, y5, y6, y7, y8, y9, y10, y11, y12, y13, y14, y15, y16, y17, y18, y19, y20, y21, y22, y23, y24, y25, y26, y27, y28, y29, y30, y31, y32, y33, y3 H ), the horizontal adjustment rule is to expand to the end horizontal coordinate of the first file of the file type, and the vertical adjustment rule is to reduce to the vertical coordinate of 0; wherein x0 represents the initial horizontal coordinate of the file preview interface; y H Indicates the ending vertical coordinate of the file preview interface, that is, the coordinates of the upper left corner of the file preview interface are used as the horizontal and vertical starting coordinates of files of this file type in the file preview interface.

[0094] In an embodiment of the present application, determining the coordinates of any vertex of the first target file in the preview interface coordinate system according to the layout preference corresponding to the file type of the first target file includes:

[0095] Obtain a historical first target file with all vertex coordinates determined, and determine whether the file types of the first target file and the historical first target file are the same; if different, determine the coordinates of any vertex of the first target file in the preview interface coordinate system according to the layout preference corresponding to the file type of the first target file; if the same, determine the coordinates of any vertex of the first target file in the preview interface coordinate system based on all vertex coordinates of the historical first target file and the layout preference corresponding to the file type of the first target file.

[0096] For example, if the layout preference of a word document is to layout vertically from the upper left corner, and there is already a word document in the first position in the upper left corner, the bottom vertical coordinate of the word document is used as the starting vertical coordinate of the upper left corner of the first target file; 0 is used as the starting horizontal coordinate of the upper left corner of the first target file. Then, when calculating the coordinates of all the top corners of the first target file, the starting horizontal and vertical coordinates of the upper left corner are used as the base point for calculation.

[0097] In another embodiment of the present application, the weight of the target file may not only be used to determine the coordinate calculation order of the file; the preview ratio may be adjusted based on the weight of the first target file, and the specific steps are as follows:

[0098] Obtain the weight of the target file, the dynamic adjustment strategy of the target file, and the layout preference corresponding to the file type of the target file; multiply the weight of the target file by the target interface preview ratio of the target file to obtain a first preview ratio; divide the first preview ratio of the target file by the sum of the first preview ratios of all target files to obtain a quotient as the second preview ratio of the target file; determine the first display size of the target file according to the interface size and the second preview ratio of the target file; use the dynamic adjustment strategy of the target file to adjust the first display size of the target file to obtain the second display size of the target file; arrange all target files according to the weight value Sorting to obtain sorted target files; selecting the target file with the largest weight value from the sorted target files as the first target file; constructing the preview interface coordinate system with the lower left corner of the file preview interface as the origin of the coordinate system; determining the coordinates of any vertex of the first target file in the preview interface coordinate system according to the layout preference corresponding to the file type of the first target file; obtaining the coordinates of all vertex corners of the first target file in the preview interface coordinate system according to the coordinates of any vertex in the preview interface coordinate system and the second display size of the first target file; the coordinates of all vertex corners of the first target file in the preview interface coordinate system are the display area of ​​the first target file in the file preview interface.

[0099] In another embodiment of the present application, the weight of the target file may not only be used to determine the coordinate calculation order of the file; the display area of ​​the first target file may be determined based on the weight of the first target file; the specific steps are as follows:

[0100] The sum of the weights of all target files is used as the total weight; the quotient of the weight of the first target file divided by the total weight is used as the normalized weight of the first target file; the second display size is adjusted using the normalized weight to obtain a corresponding third display size; and the display area of ​​the first target file is determined based on the third display size of the first target file and the layout preference corresponding to the file type of the first target file.

[0101] In the embodiment of the present application, the layout preference corresponding to the third display size of the first target file and the file type of the first target file includes:

[0102] Determine the layout preference corresponding to the file type of the first target file and the optimal position in the layout preference; determine the size comparison result of the optimal position and the third display size of the first target file; adjust the size of the optimal position based on the size comparison result, and calculate the coordinates of all vertex corners of the first target file.

[0103] In an embodiment of the present application, files of different file types can be set to use different display frames, such as a triangular display frame, a square display frame, a rectangular display frame or a circular display frame; if it is a display frame with vertex angles such as a triangle, the coordinates of all vertex angles are calculated, and if it is a circle, the center of the circle is used as all vertex angles; the display area is determined directly based on the coordinates of the center of the circle and the display size.

[0104] In the embodiment of the present application, the coordinates include a horizontal coordinate and a vertical coordinate; the second display size includes length and width or radius or diameter or height, etc.

[0105] In the embodiment of the present application, the coordinates of all the vertex corners of the first target file in the preview interface coordinate system are obtained according to the coordinates of any vertex corner in the preview interface coordinate system and the second display size of the first target file, including:

[0106] Determine the display shape of the first target file; match the corresponding vertex calculation formula according to the display shape; and obtain the coordinates of all corresponding vertex angles based on the coordinates of any vertex angle in the preview interface coordinate system, the second display size and the vertex calculation formula.

[0107] For example, if the display shape of the first target file is a rectangle, then the horizontal coordinate of any vertex in the preview interface coordinate system is added to the length of the second display size to obtain the first coordinate; the vertical coordinate of any vertex in the preview interface coordinate system is added to the width or height of the second display size to obtain the second coordinate; based on the first coordinate and the second coordinate, the third coordinate is calculated; based on the vertex coordinate, the first coordinate, the second coordinate and the third coordinate, the coordinates of all vertex corners are obtained.

[0108] For example, there are three files: A, B and C, and their target interface preview ratios are , and ; First, calculate the total target interface preview ratio: = + + ; File A adjusted preview proportion = / ; File B adjusted preview proportion = / ; File C adjusted preview proportion = / Assuming the width of the interface is W and the height is H, the space is allocated according to the proportion: the first display size of file A is W A =W × proportion of file A, file H A = H × proportion of file A; Similarly, space can be allocated for files B and C. If file A has the largest proportion, it will get the largest share of space.

[0109] In an embodiment of the present application, if there are multiple target files, the first target file is deleted from the sorted target files to obtain a new sorted target file; from the sorted target files, the target file with the largest weight value is selected as the new first target file; return to the execution step: according to the layout preference corresponding to the file type of the first target file, determine the coordinates of any vertex of the first target file in the preview interface coordinate system until the display area of ​​all target files in the file preview interface is obtained.

[0110] In an embodiment of the present application, after obtaining the coordinates of all vertex corners of the first target file in the preview interface coordinate system, the obtained coordinates of all vertex corners are encapsulated as a display area object or a data structure; the defined display area object is used to set the layout parameters of the file content on the preview interface to ensure that the file is displayed according to the calculated area; at the same time, the user can also dynamically adjust the display area through operations such as dragging and zooming, and repeat the above calculation process to respond to changes in the interface size; once the display area parameters are updated, the interface is refreshed immediately to display the new layout.

[0111] In an embodiment of the present application, the interface size can be obtained by querying the interface layout parameters; when there are already files displayed in the file preview interface, the width and height of the current blank or idle file preview interface are obtained; when previewing multiple files at the same time, for each target file, the interface size should be the remaining value after calculating the previous target file; only the interface size of the first target file is the size of the file preview interface.

[0112] In an embodiment of the present application, the display area of ​​the target file in the file preview interface may be determined not only based on the interface size, file type and target interface preview ratio, but also in combination with the priority, shape factor and optimization items of the target file.

[0113] Specifically, the priority of the target file can be determined based on the number of times the user has historically accessed the file or the setting of the display area for files of the same type or with the same title or similar content as the target file in the historical preview. The user can also directly set the priority of different types of files, or set the priority of files with different titles or files with different keywords in the titles.

[0114] The shape factor of the target file can be determined according to the type of file or actual needs. For example, the shape factor of a video file can be set to a horizontal rectangle, that is, the length is greater than the width; for another example, the shape of an ordinary document file can be set to a vertical rectangle, that is, the width is greater than twice the length; the shape factor is used to adjust the aspect ratio of the preview; the shape factor can be determined by analyzing the user's history of viewing different types of files and adjusting the size of the display area of ​​the corresponding file.

[0115] In one embodiment of the present application, determining the display area of ​​each target file in the file preview interface based on the interface size, file type, target interface preview ratio, priority, form factor, and optimization item includes the following steps:

[0116] First, all target files are sorted by file priority. Starting from high priority, space is allocated to each target file in turn based on the target interface preview ratio and interface size. Secondly, the aspect ratio of the target file is adjusted according to the shape factor and file type of each target file to make the file more visually coordinated. Finally, the position and size of the target file are adjusted according to the optimization items to reduce blank area and improve space utilization.

[0117] In the embodiment of the present application, the target interface preview ratios of all target files are standardized so that the sum of the target interface preview ratios of all target files is equal to 1; then, based on the standardized target interface preview ratios, the first area where the files of each file type are located is determined, and the first preview size of the target files of each file type is determined; based on the number of target files of the same file type and the first preview size, the second preview size (including preview width and preview height) of each target file is determined;

[0118] Starting from the target file with the highest priority, space is allocated for each target file: the second preview size of the target file is optimized and adjusted based on the file priority, shape factor and optimization items to obtain the third preview size of the target file; the target file with the highest priority is divided into an area of ​​the same size as the third preview size of the target file in the first area to obtain the display area of ​​the target file in the file preview interface.

[0119] In an embodiment of the present application, the first area where files of each file type are located can be determined by a static layout method, for example, the file preview interface is divided up and down or left and right, and the different divided areas are used as the first areas where files of different file types are located; for example, if all target files contain two categories, namely word type and picture type, and after standardization, the preview ratio of the two is 0.5; then the file preview interface is divided into two parts based on the center line, one part of which is used as the first area where files of the picture type are located; and the other part is used as the first area where files of the word type are located.

[0120] In another embodiment of the present application, the display areas of different target files in the file preview interface may be directly determined based on the third preview size of each target file based on the streaming layout technology; that is, there is no need to first determine the first areas where different types of files are located.

[0121] In an embodiment of the present application, the target file with the highest priority is divided into areas of the same size as the third preview size of the target file in the first area, including: when dividing, the higher the priority, the more likely it is that the files will occupy the center position, or they can be laid out from one side, for example, all word type target files are laid out from left to right in the first area where the word type files are located until the allocated width limit or length limit (i.e., the width or length of the first area) is reached.

[0122] In an embodiment of the present application, the display area of ​​the target file in the file preview interface may be much smaller than the size displayed by its file content, that is, the display area corresponding to the target file cannot display the complete target file. At this time, a scroll bar is automatically generated, and the entire content of the target file can be browsed by dragging the scroll bar.

[0123] In actual applications, due to the large amount of memory occupied during preview, although a scroll bar will be generated, when the user does not drag the scroll bar, the subsequent content of the target file will not be loaded; instead, only the home page of the target file or the page located by the user will be called, such as a video file only displays keywords, thereby effectively reducing the occupied resources.

[0124] For example, the interface size is 800x600 pixels, and contains 2 video files, 2 pictures, 1 document, and 1 Excel table. The video occupies 50% of the interface width, the image occupies 20%, the document occupies 20%, and the Excel table occupies 10%. The videos are arranged from left to right, the pictures are arranged from left to right, the documents are arranged from right to left, and the Excel table is arranged from right to left. The preview sizes of the videos are (300x200) and (250x300), and the shape factors are 1.5 and 0.8 respectively, and the video files are enlarged for preview; the preview sizes of the pictures are (200x150) and (150x200), and the shape factors are 1.5 and 1.0 respectively; the preview size of the document is (100x150) and the shape factor is 0.7; the preview size of the Excel table is (100x200) and the shape factor is 0.5, and the Excel table is horizontally extended. The priority order of the files is 3, 1, 5, 2, 4, 6.

[0125] In another embodiment of the present application, a preview window allocation model based on a neural network may be pre-constructed, and a display area of ​​a target file in a file preview interface may be determined based on the preview window allocation model; the preview window allocation model includes:

[0126] The input layer is used to input file type encoding, interface size, target interface preview ratio, file priority, shape factor, and optimization items. The file type encoding is obtained by one-hot encoding the file type of the target file. The shape factor is used to calculate the aspect ratio of the file, that is, the width divided by the height. The optimization items are used to use multiple Boolean values ​​or categories to represent different optimization strategies to adjust the display layout according to different users or different scenarios. The optimization items can be whether to give priority to compact layout, whether to keep the spacing between files consistent, etc.

[0127] Hidden layer, used to determine the fusion vectors of different target files based on the input file type code, interface size, target interface preview ratio, file priority, shape factor and optimization items;

[0128] The output layer includes: a position coordinate prediction layer and a preview size prediction layer; the position coordinate prediction layer is used to predict the position coordinates (x, y) of each target file using a fully connected layer; the preview size prediction layer is used to predict the preview size (width, height) of each target file using another fully connected layer.

[0129] In the embodiment of the present application, the hidden layer includes:

[0130] The embedding layer is used to convert the file type encoding from a sparse representation to a dense low-dimensional vector representation. Specifically, it uses an embedding matrix whose row index corresponds to each category in the file type encoding and the columns are the dimensions of the embedding vector. The one-hot encoding of the file type is used as input, and the output is the embedding vector of the corresponding file type.

[0131] A series of fully connected layers (also called dense layers or linear layers) are used to extract features of interface size, target interface preview ratio, file priority, shape factor, and optimization options; each fully connected layer consists of a set of weights and biases, which are used to extract useful features from file size, file priority, shape factor, and optimization options respectively, and use activation functions (such as ReLU) to increase nonlinear capabilities;

[0132] The fusion layer is used to fuse the outputs of the embedding layer and the fully connected layer; the fusion layer concatenates the embedding vector and the output vector of the fully connected layer into a fused vector, which is then passed to the next fully connected layer for further processing.

[0133] In the embodiment of the present application, the steps adopted by the fusion layer are as follows:

[0134] First, construct the fusion vector: Assuming that the dimension of the output vector of the embedding layer is E, and the dimension of the output vector of the fully connected layer is F, then the dimension of the output vector of the fusion layer is E+F; concatenate the embedding vector and the output vector of the fully connected layer to form a vector, for example, v=[v1,v2,…,vE+F ];

[0135] Secondly, use the fully connected layer to predict the position coordinates: Fully connected layer configuration: the input dimension is the dimension E+F of the fusion vector; the output dimension is that the position coordinate has two dimensions, namely x and y, so the output dimension is 2; the activation function can use a linear activation function (no activation function) because the position coordinate is a continuous value; mathematical expression: Assuming that the weight matrix of the fully connected layer is R ((E+F)×2 matrix) and the bias vector is b (2-dimensional vector), the prediction of the position coordinate can be expressed as:

[0136] ;

[0137] Where p is the position coordinate vector containing the predicted x and y coordinates.

[0138] In an embodiment of the present application, after constructing the preview window allocation model, the constructed preview window allocation model is trained using an enhanced data set using a dynamic learning rate combined with regularization and early stopping training strategy to obtain a trained preview window allocation model.

[0139] Training strategies include: dynamic learning rate: adopt a learning rate decay strategy or use a learning rate scheduler (such as cosine annealing) to help the model gradually converge during training; regularization technology: use regularization technology (such as L1 or L2 regularization) to prevent model overfitting; early stopping method: monitor the performance on the validation set, and if the performance no longer improves, stop training in advance to avoid overfitting.

[0140] In an embodiment of the present application, a target loss function is constructed based on mean square error (MSE), layout aesthetics and compactness, and appropriate weights are assigned to different loss items in order to find a balance between multiple objectives.

[0141] In an embodiment of the present application, the enhanced data set is a labeled data set, in which each record contains input data and corresponding output data (i.e., the actual location coordinates of the file and the preview size); the preview window allocation model can be trained by minimizing the error between the predicted value and the true value; the loss function can use mean square error (MSE) or smooth L1 loss, etc.

[0142] In an embodiment of the present application, after the preview window allocation model is trained, the model is evaluated by the position coordinate prediction error and the preview size prediction error. The position coordinate prediction error: the Euclidean distance or Manhattan distance can be used to measure the difference between the predicted position and the actual position; the preview size prediction error: the mean square error (MSE) or mean absolute error (MAE) and other indicators can be used to evaluate the accuracy of the size prediction.

[0143] In another embodiment of the present application, the corresponding display area may also be determined based on the user's historical preference.

[0144] Step S130: Match the target preview component corresponding to the file type and the file content from the stored comparison table of different file types, different file contents and different preview components.

[0145] In the embodiment of the present application, video files can be imported and previewed using VideoJS. If the current file is not an mp4 file but a playable video source, ffmpeg is used to transcode and play the video locally without relying on server-side transmission transcoding.

[0146] In the embodiment of the present application, for a word file, if the file content does not contain pictures, the target file is directly converted into an HTML file, and the DOM node is rendered for preview; if the file content contains pictures and typesetting, the target file is converted into a PDF file for preview; if the pictures contained in the file content are seal-type files that require high-resolution restoration, each page of the target file is adaptively drawn into a picture with the same proportion, and then the converted pictures are spliced ​​into a long picture for preview.

[0147] In an embodiment of the present application, if the file type is word, the file content needs to be analyzed before matching the target preview component. The analysis method may include: converting the target files into HTML files, and determining whether the converted HTML files contain pictures; if contained, analyzing the picture content, or inputting the picture into a pre-trained seal image classification model to determine whether the picture is a seal picture.

[0148] In the embodiment of the present application, the analysis method further includes: converting the target files uniformly into pictures, and determining whether the target files contain pictures by analyzing the contents of the pictures; the specific steps are as follows:

[0149] Use the python-docx library in Python to extract the content of the Word document, and use pandoc to convert it into a picture format. After obtaining the picture, use opencv to perform image processing, extract features in the picture (such as color histogram, shape descriptor, or texture feature), analyze the features in the extracted picture, and determine whether the target file contains the picture and whether the contained picture is a seal picture.

[0150] In the embodiment of the present application, the features in the extracted image are analyzed, including:

[0151] Color histogram: If the histogram shows obvious differences in multiple color channels, it indicates that the image contains complex color information rather than pure text; Shape descriptors: Detect edges and contours in the image. If there are obvious geometric shapes or object boundaries, it indicates the presence of image features; Texture features: Analyze the texture of the image using methods such as gray-level co-occurrence matrix (GLCM). Complex texture patterns may indicate image features.

[0152] In an embodiment of the present application, the workbook object containing the style of the Excel file and other contents in the file read by Excel through local ExcelJs is converted into the data format required by x-data-spreadsheet, and the preview function of x-data-spreadsheet can be used to realize Excel style preview.

[0153] Step S140: determine the display area as the file preview size of the target file, and use the target preview component to display the file content of the target file in the display area.

[0154] In an embodiment of the present application, the file preview size of the target file is controlled to be consistent with the size of the display area, so that the target file is displayed in the display area of ​​the preview interface, while other display areas of the preview interface can display other files, thereby realizing simultaneous preview of multiple types of files in one preview interface.

[0155] Step S150: Generate thumbnail information of the target file according to the file content; and display the thumbnail information on one side of the file preview interface.

[0156] In an embodiment of the present application, when the file type of the target file is a video, thumbnail information of the target file is generated according to the file content, including:

[0157] Acquire audio data corresponding to a target file to obtain target audio data; perform speech recognition on the target audio data to obtain first target recognition text corresponding to the target audio data; extract target information from the first target recognition text; extract key video frames from the target file; perform optical character recognition on the key video frames to obtain second target recognition text; perform natural language processing on the first target recognition text and the second target recognition text to obtain a recognition result; and generate thumbnail information of the target file based on the recognition result and the target information.

[0158] In an embodiment of the present application, speech recognition is performed on target audio data to obtain a first target recognition text corresponding to the target audio data, including: using DeepSpeech speech recognition technology to convert audio into text data.

[0159] In the embodiment of the present application, the target information may be: the time and location where the target audio data is generated.

[0160] In an embodiment of the present application, the time and place of the target audio data are extracted from the first target recognition text, including: using a rule engine and dictionary matching to identify time expressions, such as using regular expressions to detect date formats; BiLSTM-CRF model to identify place names in the text; for example, identifying "August 9, 2024" as the time and "XX City Court" as the place. When applied to court scenarios, for audio data in scenarios such as mediation or execution, it is necessary to determine the corresponding audio occurrence and time, and to form the corresponding abbreviated information.

[0161] In another embodiment of the present application, the first target recognition text can be directly searched for the keyword "today", and the time and place of the corresponding audio can be obtained by analyzing the sentence containing the keyword "today" and the context of the sentence.

[0162] In an embodiment of the present application, key video frames are extracted from a target file, including: combining audio and video analysis, for example, when specific keywords are detected in the audio, simultaneously capturing video frames as key frames; allowing the user to provide feedback on the selection of key frames, and the system performs self-optimization based on the feedback.

[0163] In another embodiment of the present application, extracting key video frames from a target file includes:

[0164] Perform noise reduction on the video and adjust the video frames to the same size for subsequent processing; use color histogram and edge detection to extract the features of each frame; select Euclidean distance as the distance measurement method to calculate the feature differences between adjacent frames; set an appropriate threshold, such as when the difference between adjacent frames exceeds 5%, select one of the frames as the key frame.

[0165] In another embodiment of the present application, extracting key video frames from the target file further includes:

[0166] Extract the color histogram, optical flow field, and personnel position features of the target file; based on the above features, use the pre-trained video frame classifier to extract key video frames from the target file.

[0167] In the embodiment of the present application, the training of the video frame classifier includes: collecting video clips in the application scenario and marking key frames, such as collecting videos of the clerk reading the case number, time, and court participants in the court scenario; removing unclear or meaningless frames; dividing the data according to the ratio of 70% training set, 15% validation set, and 15% test set; the video frame classifier uses the chi-square test to score the color histogram and optical flow field features, and selects the features with the highest scores. The video frame classifier can be a support vector machine (SVM) as a classifier.

[0168] In an embodiment of the present application, optical character recognition is performed on key video frames to obtain a second target recognized text, including: for key video frames, using Tesseract to recognize and extract text information in the frames; post-processing the OCR results, using the BERT model to understand the context of the OCR output text, and predicting more accurate words or phrases to replace the incorrectly recognized text.

[0169] In an embodiment of the present application, the second target recognition text can also be determined by the following method: using Boyer-Moore to quickly locate keyword matching technology in audio text, or using regular matching format to search for audio segments containing case numbers or execution numbers; the time-series text of the speech has been recognized, and the audio time period corresponding to the keyword is located; using a customized NER model, fine-tuning legal terms and job titles to identify personnel information in the text; applying a target detection algorithm based on a YOLO model to detect and count people in the video, combined with field-specific dictionaries or databases to improve the accuracy of identifying specific occupational names (such as judges, clerks).

[0170] In the embodiment of the present application, the generation of thumbnail information of video files may further include:

[0171] Use speech recognition to record the location of key video frames with dialogue or monologue in the video and perform OCR text recognition on these video frames to obtain all the text under the frame, and convert the frame number into a picture for image recognition, perform scene and feature analysis and understanding on the input image, extract useful information from it or identify the objects, scenes, features, etc. in the image. Combine the text information recognized by OCR, such as picture frame information (two people are eating) and text information recognized by OCR (A: It's delicious, I won't eat it next time. B: Indeed), perform natural language processing (NLP), identify the subject-verb-object relationship, clause structure, and modifiers to obtain important information of the video segment. Finally, perform natural language analysis on the information in all segments of the video to obtain the video's thumbnail information.

[0172] In the embodiment of the present application, when the file type of the target file is word, the thumbnail information of the target file is generated according to the file content, including:

[0173] The target file is analyzed by using a natural language model to obtain an analysis result; based on the analysis result and the file title and file name of the target file, abbreviated information of the target file is generated.

[0174] In the embodiment of the present application, when the file type of the target file is a picture, thumbnail information of the target file is generated according to the file content, including:

[0175] The image is analyzed to obtain an image analysis result; based on the image analysis result and the file title and file name of the target file, thumbnail information of the target file is generated.

[0176] In an embodiment of the present application, analyzing an image to obtain an image analysis result includes: extracting information from the image using OCR (optical character recognition) technology to obtain an image analysis result.

[0177] In the embodiment of the present application, when there are multiple target files, the thumbnail information of different target files is distributed on one side of the preview interface in a list-like form. When there is only one target file, the thumbnail information may not be displayed.

[0178] In the embodiment of the present application, each file type is displayed in a different way + icon, which helps to quickly locate the file type and file content.

[0179] In the embodiment of the present application, after displaying the thumbnail information on one side of the file preview interface, the method further includes:

[0180] The browser-based global event propagation and monitoring provide preview files that can be dragged to external applications for preview. The process uses conversion to streaming or binary format for propagation, and the external application listens for broadcast acquisition.

[0181] In an embodiment of the present application, the propagation method includes:

[0182] The current position coordinates of the browser are obtained, and the browser responds to the file preview request sent by the third-party application; the browser extracts the file to be previewed from the file preview request; the browser converts the file to be previewed into a binary file to obtain the binary file to be previewed; the browser broadcasts the binary file to be previewed and its own current position coordinates; the third-party application receives the binary file to be previewed according to the coordinate information, converts the binary file to be previewed, obtains the file to be previewed, and performs preview display.

[0183] In the embodiment of the present application, propagation (or data sharing) is achieved through SharedWorker, postMessage is used to send corresponding coordinate information and file information, onmessage is used to capture the information in the host application, and after obtaining the corresponding information, it is modified in the dormitory application to achieve broadcast acquisition.

[0184] In an embodiment of the present application, the preview method of the multi-type files further includes:

[0185] Use machine learning and natural language processing technologies, such as making recommendations based on the type of files being opened, to provide users with personalized thumbnail information prompts and file location order recommendations; use modern Web APIs (such as drag-and-drop APIs, WebRTC, etc.) to implement the function of dragging files from the browser to external applications and previewing them in external applications. Stream files or convert them into binary format on the browser side for previewing in external applications. At the same time, listen to and parse these transmitted data streams or binary format files in external applications to implement the file preview function.

[0186] In one embodiment of the present application, the preview method of multiple types of files of the present application can be applied to compare and verify files in court scenarios. When there is a document or evidence file that needs to be compared with element information to verify whether it is correct, a display window is generated to display thumbnail information or file content; the display window is dragged, maximized or minimized, and split-screen displayed to display the file content. If the evidence information is word, video, or mp3, you only need to pass the file source into the component, and the shortcut bar below will have important information about the file, which is convenient for auditors to quickly find the file that needs to be verified and compared. By supporting dragging, rotating, and other operations within the component (for example, some evidence is an ID card picture, and the user uploaded it without taking a standardized photo), the file display can be adjusted.

[0187] Corresponding to the above method, the present application embodiment also provides a preview device for multiple types of files, such as Figure 2 As shown, the preview device of the multi-type files includes:

[0188] The acquisition unit 210 is used to acquire the interface size of the file preview interface, and the file type and file content of the target file to be displayed corresponding to the file preview interface;

[0189] The matching unit 220 is used to match the target interface preview ratio corresponding to the file type from the stored comparison table of different file types and different preview ratios; determine the display area of ​​the target file in the file preview interface based on the interface size, file type and target interface preview ratio; match the target preview component corresponding to the file type and file content from the stored comparison table of different file types, different file contents and different preview components;

[0190] The generating unit 230 is used to generate thumbnail information of the target file according to the file content;

[0191] The preview unit 240 is used to determine the display area as the file preview size of the target file, and use the target preview component to display the file content of the target file in the display area; and display the thumbnail information on one side of the file preview interface.

[0192] The functions of the functional units of the preview device for multiple types of files provided in the above embodiments of the present application can be implemented through the above method steps. Therefore, the specific working process and beneficial effects of each unit in the preview device for multiple types of files provided in the embodiments of the present application are not repeated here.

[0193] The present application also provides an electronic device, such as Figure 3 As shown, it includes a processor 310 , a communication interface 320 , a memory 330 and a communication bus 340 , wherein the processor 310 , the communication interface 320 , and the memory 330 communicate with each other via the communication bus 340 .

[0194] Memory 330, for storing computer programs;

[0195] The processor 310 is used to execute the program stored in the memory 330 to implement the following steps:

[0196] Obtain the interface size of the file preview interface, and the file type and file content of the target file to be displayed corresponding to the file preview interface;

[0197] Match the target interface preview ratio corresponding to the file type from a comparison table of different file types and different preview ratios; determine the display area of ​​the target file in the file preview interface based on the interface size, file type and target interface preview ratio; match the target preview component corresponding to the file type and file content from a comparison table of different file types, different file contents and different preview components;

[0198] Generate abbreviated information of the target file according to the file content;

[0199] The display area is determined as the file preview size of the target file, and the file content of the target file is displayed in the display area using the target preview component; and the thumbnail information is displayed on one side of the file preview interface.

[0200] The communication bus mentioned above can be a Peripheral Component Interconnect (PCI) bus or an Extended Industry Standard Architecture (EISA) bus, etc. The communication bus can be divided into an address bus, a data bus, a control bus, etc. For ease of representation, only one thick line is used in the figure, but it does not mean that there is only one bus or one type of bus.

[0201] The communication interface is used for communication between the above electronic device and other devices.

[0202] The memory may include a random access memory (RAM) or a non-volatile memory (NVM), such as at least one disk memory. Optionally, the memory may also be at least one storage device located away from the aforementioned processor.

[0203] The above-mentioned processor can be a general-purpose processor, including a central processing unit (CPU), a network processor (NP), etc.; it can also be a digital signal processor (DSP), an application specific integrated circuit (ASIC), a field programmable gate array (FPGA) or other programmable logic devices, discrete gate or transistor logic devices, discrete hardware components.

[0204] The implementation methods and beneficial effects of the components of the electronic device in the above embodiments to solve the problems can be seen in Figure 1 The various steps in the illustrated embodiment are implemented, therefore, the specific working process and beneficial effects of the electronic device provided by the embodiment of the present application are not repeated here.

[0205] In another embodiment provided by the present application, a computer-readable storage medium is provided, in which instructions are stored. When the computer-readable storage medium is executed on a computer, the computer executes the preview method for multiple types of files described in any one of the above embodiments.

[0206] In another embodiment provided by the present application, a computer program product including instructions is also provided, which, when executed on a computer, enables the computer to execute the preview method for multiple types of files described in any one of the above embodiments.

[0207] Those skilled in the art will appreciate that the embodiments in the present application can be provided as methods, systems, or computer program products. Therefore, the embodiments in the present application can be in the form of a complete hardware embodiment, a complete software embodiment, or an embodiment combining software and hardware. Moreover, the embodiments in the present application can be in the form of a computer program product implemented on one or more computer-usable storage media (including but not limited to disk storage, CD-ROM, optical storage, etc.) containing computer-usable program codes.

[0208] The embodiments of the present application are described with reference to the flowcharts and / or block diagrams of the methods, devices (systems), and computer program products according to the embodiments of the present application. It should be understood that each process and / or box in the flowchart and / or block diagram, as well as the combination of the processes and / or boxes in the flowchart and / or block diagram, can be implemented by computer program instructions. These computer program instructions can be provided to a processor of a general-purpose computer, a special-purpose computer, an embedded processor, or other programmable data processing device to produce a machine, so that the instructions executed by the processor of the computer or other programmable data processing device generate instructions for implementing the processes in the process. Figure 1 A process or multiple processes and / or boxes Figure 1 A device that provides the functions specified in a block or multiple blocks.

[0209] These computer program instructions may also be stored in a computer-readable memory capable of directing a computer or other programmable data processing device to operate in a specific manner, so that the instructions stored in the computer-readable memory produce an article of manufacture comprising an instruction device, which implements the process Figure 1 A process or multiple processes and / or boxes Figure 1 A function specified in one or more boxes.

[0210] These computer program instructions can also be loaded onto a computer or other programmable data processing device so that a series of operating steps are executed on the computer or other programmable device to produce a computer-implemented process, thereby providing instructions for implementing the process. Figure 1 A process or multiple processes and / or boxes Figure 1 The steps for the functions specified in one or more boxes.

[0211] Although the preferred embodiments of the present application have been described, those skilled in the art may make additional changes and modifications to these embodiments once they have learned the basic creative concept. Therefore, the appended claims are intended to be interpreted as including the preferred embodiments and all changes and modifications falling within the scope of the embodiments of the present application.

[0212] Obviously, those skilled in the art can make various changes and modifications to the embodiments in the present application without departing from the spirit and scope of the embodiments in the present application. Thus, if these modifications and variations of the embodiments in the present application fall within the scope of the claims and their equivalents in the embodiments of the present application, the embodiments of the present application are also intended to include these modifications and variations.

Claims

1. A preview method for multiple types of files, characterized in that: The method comprises: Obtaining the interface size of the file preview interface, and the file type and file content of the target file to be displayed corresponding to the file preview interface; Matching the target interface preview ratio corresponding to the file type from a comparison table of different file types and different preview ratios stored; Determining a display area of ​​the target file in the file preview interface based on the interface size, the file type, and the target interface preview ratio; Matching a target preview component corresponding to the file type and the file content from a comparison table of different file types, different file contents and different preview components; Determine the display area as a file preview size of the target file, and display the file content of the target file in the display area using a target preview component; Generate thumbnail information of the target file according to the file content; Displaying the thumbnail information on one side of the file preview interface; The method for obtaining the file type includes: Convert the target file into a binary file to obtain a target binary file; wherein the target binary file includes a file header identifier; Matching the target file type corresponding to the file header identifier from a comparison table of different file header identifiers and different file types, and obtaining the file type of the target file; or, Get the MIME field type in the browser response information; From the comparison table between different MIME field types and different file types, the target file type corresponding to the MIME field type is matched to obtain the file type of the target file.

2. The method according to claim 1, characterized in that Determining a display area of ​​the target file in the file preview interface based on the interface size, the file type, and the target interface preview ratio includes: Acquire a dynamic adjustment strategy for the target file and a layout preference corresponding to a file type of the target file; The quotient obtained by dividing the target interface preview ratio of the target file by the sum of the target interface preview ratios of all target files is used as the adjusted preview ratio of the target file; Determining a display size of the target file according to the interface size and the adjusted preview ratio of the target file; Using the dynamic adjustment strategy of the target file, adjusting the first display size of the target file to obtain a second display size of the target file; Based on the layout preference and the second display size, a display area of ​​the target file in the file preview interface is determined.

3. The method according to claim 2, characterized in that Determining a display area of ​​the target file in the file preview interface based on the layout preference and the second display size includes: Sort all target files according to their weight values ​​to obtain sorted target files; From the sorted target files, select the target file with the largest weight value as the first target file; The coordinate system of the preview interface is constructed with the lower left corner of the file preview interface as the origin of the coordinate system; determining, according to a layout preference corresponding to the file type of the first target file, a coordinate of any vertex of the first target file in a preview interface coordinate system; The coordinates of all the vertex corners of the first target file in the preview interface coordinate system are obtained according to the coordinates of any vertex corner in the preview interface coordinate system and the second display size; the coordinates of all the vertex corners of the first target file in the preview interface coordinate system are the display area of ​​the first target file in the file preview interface.

4. The method according to claim 1, characterized in that The file types include video; When the file type of the target file is a video, generating thumbnail information of the target file according to the file content includes: Acquire the audio data corresponding to the target file to obtain the target audio data; Performing speech recognition on the target audio data to obtain a first target recognition text corresponding to the target audio data; Extracting key video frames from the target file; Performing optical character recognition on the key video frame to obtain a second target recognition text; Based on the first target recognition text and the second target recognition text, thumbnail information of the target file is generated.

5. The method according to claim 4, characterized in that Generating the abbreviated information of the target file based on the first target recognition text and the second target recognition text includes: Extracting target information from the first target recognition text; Performing natural language processing on the first target recognition text and the second target recognition text to obtain a recognition result; Based on the recognition result and the target information, thumbnail information of the target file is generated.

6. The method according to claim 1, characterized in that After displaying the thumbnail information on one side of the file preview interface, the method further includes: Responding to a file preview request received from a third-party application; Extracting a file to be previewed from the file preview request; Convert the file to be previewed into a binary file to obtain the binary file to be previewed; Broadcasting the binary file to be previewed; The third-party application receives the binary file to be previewed, converts the binary file to be previewed, and obtains the file to be previewed for display.

7. A preview device for multiple types of files, characterized in that: The device comprises: An acquisition unit, used to acquire the interface size of the file preview interface, and the file type and file content of the target file to be displayed corresponding to the file preview interface; A matching unit is used to match the target interface preview ratio corresponding to the file type from a comparison table of different file types and different preview ratios stored; determine the display area of ​​the target file in the file preview interface based on the interface size, the file type and the target interface preview ratio; match the target preview component corresponding to the file type and the file content from a comparison table of different file types, different file contents and different preview components stored; A generating unit, used for generating thumbnail information of the target file according to the content of the file; A preview unit, configured to determine the display area as a file preview size of the target file, and display the file content of the target file in the display area using a target preview component; and display the thumbnail information on one side of the file preview interface; The method for obtaining the file type includes: Convert the target file into a binary file to obtain a target binary file; wherein the target binary file includes a file header identifier; Matching the target file type corresponding to the file header identifier from a comparison table of different file header identifiers and different file types, and obtaining the file type of the target file; or, Get the MIME field type in the browser response information; From the comparison table between different MIME field types and different file types, the target file type corresponding to the MIME field type is matched to obtain the file type of the target file.

8. An electronic device, characterized in that: The electronic device comprises a processor, a communication interface, a memory and a communication bus, wherein the processor, the communication interface and the memory communicate with each other via the communication bus; Memory, used to store computer programs; A processor, used to implement any method described in claims 1-6 when executing a program stored in a memory.

9. A computer-readable storage medium, characterized in that: The computer-readable storage medium stores a computer program, and when the computer program is executed by a processor, the method according to any one of claims 1 to 6 is implemented.

Citation Information

Patent Citations

  • A file preview method, apparatus and storage medium

    CN110582764A

  • File information display method, terminal equipment and computer readable storage medium

    CN112347049A

  • File previewing method and device, electronic equipment and storage medium

    CN113010063A

  • File previewing method and device, equipment, storage medium and program product

    CN118585281A

  • Method and system for previewing file information

    US20150052178A1