CN112632016A - File editing method and device - Google Patents

File editing method and device Download PDF

Info

Publication number
CN112632016A
CN112632016A CN201910906389.9A CN201910906389A CN112632016A CN 112632016 A CN112632016 A CN 112632016A CN 201910906389 A CN201910906389 A CN 201910906389A CN 112632016 A CN112632016 A CN 112632016A
Authority
CN
China
Prior art keywords
file
field
server
field value
contained
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Pending
Application number
CN201910906389.9A
Other languages
Chinese (zh)
Inventor
刘嘉鑫
刘里
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Tencent Technology Shenzhen Co Ltd
Original Assignee
Tencent Technology Shenzhen Co Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Tencent Technology Shenzhen Co Ltd filed Critical Tencent Technology Shenzhen Co Ltd
Priority to CN201910906389.9A priority Critical patent/CN112632016A/en
Publication of CN112632016A publication Critical patent/CN112632016A/en
Pending legal-status Critical Current

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F16/00Information retrieval; Database structures therefor; File system structures therefor
    • G06F16/10File systems; File servers
    • G06F16/18File system types
    • G06F16/1873Versioning file systems, temporal file systems, e.g. file system supporting different historic versions of files
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F16/00Information retrieval; Database structures therefor; File system structures therefor
    • G06F16/10File systems; File servers
    • G06F16/18File system types
    • G06F16/182Distributed file systems
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L67/00Network arrangements or protocols for supporting network services or applications
    • H04L67/01Protocols
    • H04L67/10Protocols in which an application is distributed across nodes in the network
    • H04L67/104Peer-to-peer [P2P] networks
    • H04L67/1044Group management mechanisms 
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L67/00Network arrangements or protocols for supporting network services or applications
    • H04L67/01Protocols
    • H04L67/10Protocols in which an application is distributed across nodes in the network
    • H04L67/1095Replication or mirroring of data, e.g. scheduling or transport for data synchronisation between network nodes

Landscapes

  • Engineering & Computer Science (AREA)
  • Theoretical Computer Science (AREA)
  • Physics & Mathematics (AREA)
  • Computer Networks & Wireless Communication (AREA)
  • Signal Processing (AREA)
  • Data Mining & Analysis (AREA)
  • Databases & Information Systems (AREA)
  • General Engineering & Computer Science (AREA)
  • General Physics & Mathematics (AREA)
  • Computing Systems (AREA)
  • Mathematical Physics (AREA)
  • Information Retrieval, Db Structures And Fs Structures Therefor (AREA)

Abstract

The application provides a file editing method. The method comprises the following steps: receiving an editing instruction of a first file input by a user, and generating a second file according to the first file and the editing instruction; determining whether a third file can be acquired from a server before the second file is released to the server, wherein the third file is the latest version of the first file stored in the server; if the third file can be acquired from the server, generating an edited file according to the second file and the third file; and issuing the edited file to the server. The embodiment of the application can realize a file centralized version management mechanism of a data layer, and ensure that edited files submitted by multiple persons cannot be mutually covered.

Description

File editing method and device
Technical Field
The present application relates to the field of network technologies, and in particular, to a method and an apparatus for editing a file.
Background
With the development of network technology, people can edit movie and television videos online through a network, namely interactive movies and television. The interactive movie and television is divided into a C end, a C end background and a B end. The B terminal is a management background which is provided by the interactive movie and television for the creator to edit the interactive video on line, and finally, the produced data is edited or falls into a database; the C end is an interactive video client contacted by a common user; the background of the C end provides server service for the C end, and the data source of the background is the database which the B end finally lands on.
Currently, the B-side needs to provide a lot of operations to improve the use experience of the creator, for example, (1) each video clip can be dragged and their location needs to be saved; (2) video clips can be added or deleted and need to be stored immediately; (3) jumping among video segments can be added or deleted, and the video segments need to be stored immediately; (4) the UI and the sound effect of the jump among the video segments can be edited by a user and need to be stored immediately; (5) and multiple persons are supported to edit the same interactive drama at the same time. The above operations make the B-side function very complex, and the conventional development idea solves the problem that the interface for updating data is dispersed, the workload is huge, the update data forwarding logic is complex, and the like.
Disclosure of Invention
An object of the present application is to provide a method and an apparatus for editing a file, which at least reduce the development workload of a data layer to a certain extent, implement a centralized version management mechanism of the data layer, and ensure that edited files submitted by multiple users do not overlap each other.
According to an aspect of the embodiments of the present application, a file editing method is applied, the method including:
receiving an editing instruction of a first file input by a user, and generating a second file according to the first file and the editing instruction;
determining whether a third file can be acquired from a server before the second file is released to the server, wherein the third file is the latest version of the first file stored in the server;
if the third file can be acquired from the server, generating an edited file according to the second file and the third file;
and issuing the edited file to the server.
According to an aspect of the embodiments of the present application, a file editing apparatus is applied, including:
the receiving module is used for receiving an editing instruction of a first file input by a user and generating a second file according to the first file and the editing instruction;
a determining module, configured to determine whether a third file can be acquired from a server before the second file is released to the server, where the third file is a latest version of the first file stored in the server;
the generating module is used for generating an edited file according to the second file and the third file if the third file can be acquired from the server;
and the publishing module is used for publishing the edited file to the server.
In one embodiment, the determining module comprises:
the first obtaining unit is used for determining whether a file with an identification number larger than that of the first file can be obtained from the server or not according to the identification number of the first file;
and the processing unit is used for determining that the third file can be acquired from the server if the file with the identification number larger than that of the first file can be acquired from the server.
In one embodiment, the receiving module comprises:
the copying unit is used for copying the first file to obtain a copy of the first file and generating a second file according to the first file and the editing instruction;
the apparatus is further configured to:
storing the identification number of the copy of the first file so as to determine the identification number of the first file according to the stored identification number of the copy of the first file;
and determining whether a third file exists according to the identification number of the copy of the first file, wherein the identification number of the third file is greater than the identification number of the copy of the first file.
In one embodiment, the generating module comprises:
a second obtaining unit, configured to obtain a field included in the second file and a field included in the third file, respectively;
and the merging unit is used for merging the fields contained in the second file and the fields contained in the third file to generate an edited file.
In one embodiment, the field comprises a field identification and a field value, the merging unit is configured to:
merging the field identification contained in the second file and the field identification contained in the third file to obtain a field identification set;
according to the field value contained in the second file and the field value contained in the third file, acquiring the field value corresponding to each field identifier in the field identifier set;
and obtaining an edited file according to the field identification set and the field value corresponding to each field identification in the field identification set.
In an embodiment, the obtaining, according to a field value included in the second file and a field value included in the third file, a field value corresponding to each field identifier in the field identifier set includes:
for a first type field identifier which is contained in the field identifier set and has a corresponding field value in the second file and does not have a corresponding field value in the third file, setting the field value of the first type field identifier as the corresponding field value in the second file;
for a second type field identifier which is contained in the field identifier set and has a corresponding field value in the third file and does not have a corresponding field value in the second file, setting the field value of the second type field identifier as the corresponding field value in the third file;
and for a third type field identifier which is contained in the field identifier set, has corresponding field values in the second file and the third file at the same time and has different corresponding field values, setting the field value of the third type field identifier as the field value corresponding to the second file.
In one embodiment, the apparatus further comprises:
the updating module is used for obtaining an updated first file according to a fourth file and the first file if the fourth file sent by a server is received before an editing instruction of the first file input by a user is received, wherein the fourth file is an updated version of the first file.
In one embodiment, the receiving module is further configured to:
and receiving an editing instruction of the updated first file input by a user, and generating a second file according to the updated first file and the editing instruction.
In one embodiment, the update module is to:
respectively acquiring fields contained in the first file and fields contained in the fourth file;
merging the field identification contained in the first file and the field identification contained in the fourth file to obtain a field identification set;
according to the field value contained in the first file and the field value contained in the fourth file, acquiring the field value corresponding to each field identifier in the field identifier set;
and obtaining the updated first file according to the field identification set and the field value corresponding to each field identification in the field identification set.
According to an aspect of the embodiments of the present application, an electronic device is provided, including:
one or more processors;
a storage device, configured to store one or more programs, which when executed by the one or more processors, cause the one or more processors to implement the file editing method mentioned in the above first aspect or any possible implementation manner of the above first aspect.
According to an aspect of embodiments of the present application, a computer program medium is claimed, having computer readable instructions stored thereon, which, when executed by a processor of a computer, cause the computer to perform the method as described above.
The technical scheme provided by the embodiment of the application can have the following beneficial effects: according to the technical scheme, the first file is edited by a receiving user, the second file is generated, whether a third file stored in the server can be acquired from the server or not is determined before the second file is published to the server, the third file is the latest version of the first file stored in the server, and if the third file can be acquired, the edited file is generated according to the second file and the third file, and the edited file is published to the server. Therefore, when multiple persons edit the file, the edited file does not need to be transmitted to the server for processing, complex transmitting logic is avoided, occupation of server resources is avoided, the latest version of the file is directly obtained from the server, the edited file is generated according to the latest version of the file and the second file, and the edited files respectively submitted when the multiple persons edit the file are not mutually covered.
Other features and advantages of the present application will be apparent from the following detailed description, or may be learned by practice of the application.
It is to be understood that both the foregoing general description and the following detailed description are exemplary and explanatory only and are not restrictive of the application.
Drawings
The accompanying drawings, which are incorporated in and constitute a part of this specification, illustrate embodiments consistent with the invention and together with the description, serve to explain the principles of the invention. It is obvious that the drawings in the following description are only some embodiments of the invention, and that for a person skilled in the art, other drawings can be derived from them without inventive effort.
In the drawings:
fig. 1 shows a system architecture diagram of a file editing method application according to an embodiment of the present application.
FIG. 2 shows a flow diagram of a file editing method according to one embodiment of the present application.
Fig. 3 shows a flowchart for determining whether a third file can be acquired from a server according to an embodiment of the present application.
FIG. 4 shows a flow diagram of a file editing method according to another embodiment of the present application.
Fig. 5 shows a detailed flowchart of step S230 according to an embodiment of the present application.
FIG. 6 shows a detailed flowchart of step S2302 according to one embodiment of the present application.
FIG. 7 illustrates a flowchart for obtaining an updated first file from a fourth file and the first file, according to an embodiment of the present application.
Fig. 8 shows an interaction flowchart of a file editing method applied in an application scenario of an interactive video according to an embodiment of the present application.
Fig. 9 shows a block diagram of a file editing apparatus according to an embodiment of the present application.
FIG. 10 shows a schematic structural diagram of a computer system of an electronic device according to one embodiment of the present application.
Detailed Description
Example embodiments will now be described more fully with reference to the accompanying drawings. Example embodiments may, however, be embodied in many different forms and should not be construed as limited to the examples set forth herein; rather, these example embodiments are provided so that this disclosure will be thorough and complete, and will fully convey the concept of example embodiments to those skilled in the art. The drawings are merely schematic illustrations of the present application and are not necessarily drawn to scale. The same reference numerals in the drawings denote the same or similar parts, and thus their repetitive description will be omitted.
Furthermore, the described features, structures, or characteristics may be combined in any suitable manner in one or more example embodiments. In the following description, numerous specific details are provided to give a thorough understanding of example embodiments of the present application. One skilled in the relevant art will recognize, however, that the subject matter of the present application can be practiced without one or more of the specific details, or with other methods, components, steps, and so forth. In other instances, well-known structures, methods, implementations, or operations are not shown or described in detail to avoid obscuring aspects of the application.
Some of the block diagrams shown in the figures are functional entities and do not necessarily correspond to physically or logically separate entities. These functional entities may be implemented in the form of software, or in one or more hardware modules or integrated circuits, or in different networks and/or processor devices and/or microcontroller devices.
An architecture to which the file editing method according to the embodiment of the present application is applied will be described below with reference to fig. 1.
As shown in fig. 1, the architecture 100 may include one or more of terminal devices 101, 102, 103, a network 104, and a server 105. The network 104 serves as a medium for providing communication links between the terminal devices 101, 102, 103 and the server 105. Network 104 may include various connection types, such as wired, wireless communication links, or fiber optic cables, to name a few. The terminal devices 101, 102, 103 may be various electronic devices having a display screen, including but not limited to desktop computers, portable computers, smart phones, tablet computers, and the like. It should be understood that the number of terminal devices, networks, and servers in fig. 1 is merely illustrative. There may be any number of terminal devices, networks, and servers, as desired for implementation. For example, server 105 may be a server cluster comprised of multiple servers, or the like.
The file editing method provided by the embodiment of the present disclosure is generally executed by the terminal devices 101, 102, and 103, and accordingly, the file editing apparatus is generally disposed in the terminal devices 101, 102, and 103. However, it is easily understood by those skilled in the art that the file editing method provided in the embodiment of the present disclosure may also be executed by the server 105, and accordingly, a file editing apparatus may also be disposed in the server 105, which is not particularly limited in the exemplary embodiment.
In the embodiment of the present invention, users logged in on the terminal devices 101, 102, and 103 may be accessing a file in the server 105 at the same time, the terminal devices 101, 102, and 103 may send edit information of the user logged in on the terminal device to the file to the server 105, respectively, and the server 105 may store or send the processed edit information to a terminal where another user accessing the file is located after processing the edit information.
For example, the file is a video file, a plurality of users can access the video file, the server 105 can store the video file, the terminal devices 101, 102, and 103 where the plurality of users are located can access the video file in the server 105 through network connection, and the plurality of users can edit the video file at the same time. The plurality of terminal devices 101, 102, 103 may send editing information to the server 105, the server 105 may process the editing information sent by one terminal and send the processed editing information to other terminals, for example, after the terminal device 101 edits the video file, the server 105 may send the editing information to the server 105, and the server 105 may process the editing information sent by the terminal device 101 and send the processed editing information to other terminal devices 102, 103, thereby implementing data synchronization in the video file.
The plurality of terminal devices 101, 102, and 103 may access the server 105 through installed clients, or may access the server 105 through a web portal, which is not limited in the embodiment of the present invention.
The file editing method is applied to a terminal, which may be one of the plurality of terminal devices 101, 102, and 103, and the following description will take an example of a user currently logged in one terminal device. In the embodiment of the invention, a plurality of users can edit the same file at the same time, wherein for a certain terminal, the user who logs in on the terminal accesses a file, and the users who log in other terminals also access the file and edit the file area.
When any user accesses the file, the terminal can establish connection with the server. Specifically, the terminal may call a socket.io library to establish a socket channel with the server. The socket channel is used for full duplex communication with the server. The name socket.io of the socket.io library is simply explained below, in which the Chinese name of the socket in the name is socket, and the English name of io is all Input Output, which refers to Input and Output.
In one possible implementation, for a file, the server may store the correspondence of the socket communication handles of all users accessing the file to the file. For example, the server may store the socket communication handles of all users accessing the file in a HashMap object. The HashMap object typically stores data in the form of key-value pairs. Specifically, the HashMap object may use identification information of the file as a key (key), where the identification information is used to uniquely identify the file. For example, the Identification number (ID) of the file may be used as a key. When a user sends edit information to a server, the server may obtain socket communication handles of all users accessing the file according to identification information of the file, so as to process the edit information, and then send the processed edit information to all users through the obtained socket communication handles of all users.
In a specific embodiment, a user in a terminal device acquires a first file from a server, inputs an editing instruction for the first file, obtains a second file according to the first file and the editing instruction, before issuing the second file to the server, the terminal device needs to determine whether a third file can be acquired from the server, where the third file is a latest version of the first file stored in the server, and if the third file can be acquired from the server, generates an edited file according to the second file and the third file; and issuing the edited file to a server.
In a specific embodiment, after receiving a first file, a terminal device may copy the first file to obtain a copy of the first file, receive an editing instruction input by a user to the first file to obtain a second file, store an identification number of the copy of the first file, determine whether a file whose identification number is greater than the identification number of the first file can be obtained from a server according to the identification number of the copy of the first file, and determine that a third file can be obtained from the server if a file whose identification number is greater than the identification number of the first file can be obtained.
A specific flow of the file editing method is described below by using the embodiment shown in fig. 2, and referring to fig. 2, the file editing method may include the following steps:
step S210, receiving an editing instruction for a first file input by a user, and generating a second file according to the first file and the editing instruction;
step S220, before the second file is released to the server, determining whether a third file can be acquired from the server, wherein the third file is the latest version of the first file stored in the server;
step S230, if the third file can be acquired from the server, generating an edited file according to the second file and the third file;
step S240, issuing the edited file to the server.
These steps are described in detail below.
Step S210, receiving an editing instruction for a first file input by a user, and generating a second file according to the first file and the editing instruction.
In the embodiment of the present invention, the first file is a target file edited by a user logged in the terminal device, and the first file may be an online shared file, or may be locally stored by a terminal where the user is located, but based on the sharing software, a terminal where other users are located may also edit the first file, or of course, may be locally stored by a terminal where other users are located, but based on the sharing software, a terminal where the user is located may also edit the first file.
The edit instruction may be generated by a user by triggering an input module of the terminal device, where the input module may be a touch display screen, a mouse, a keyboard, and the like, and is not limited in this respect.
Understandably, the user can input an editing instruction through a mouse, a keyboard and the like according to the requirement, and the processor can receive the input editing instruction and then execute corresponding operation according to the editing instruction. Wherein the editing instructions include, but are not limited to, a first instruction for table nesting, a second instruction for element grouping, a third instruction for loading a wait animation, a fourth instruction for container volume change, a fifth instruction for element fixing, a sixth instruction for element moving, a seventh instruction for element information change, an eighth instruction for element layout switching, and the like. For example, if the user needs to perform a table nesting operation on the web page, the first instruction may be input through a mouse, a keyboard, or the like.
The second file is a file obtained by performing editing operation on the first file, and when an editing instruction is received, the first file is subjected to editing operation to obtain the second file.
Step S220, before the second file is released to the server, determining whether a third file can be acquired from the server, where the third file is the latest version of the first file stored in the server.
The third file is the latest version of the first file stored in the server, and may be a file in which a user of another terminal device sends an edited file to the server, and the server may store the received file after receiving the file sent by the other terminal device, or broadcast the received file to a terminal where another user who is accessing the file is located.
In step S210, after the user edits the first file to obtain the second file, the terminal where the user is located may send the second file to the server, but before sending the second file, the terminal may first send an obtaining request of the latest version file to the server, and determine whether the latest version of the first file can be obtained from the server.
Step S230, if the third file can be acquired from the server, generating an edited file according to the second file and the third file.
In step S230, if the terminal device can acquire the third file from the server, it indicates that the first file edited by the user is not the latest file, and therefore the terminal device does not directly issue the second file edited in step S210 to the server, but generates an edited file from the acquired latest third file and second file.
Step S240, issuing the edited file to the server.
In this embodiment, a second file is generated by receiving an edit of a first file by a user, before the second file is released to a server, it is determined whether a third file stored in the server can be acquired from the server, where the third file is a latest version of the first file stored in the server, and if the third file can be acquired, an edited file is generated according to the second file and the third file, and the edited file is released to the server. Therefore, when multiple persons edit the file, the edited file does not need to be transmitted to the server for processing, complex transmitting logic is avoided, occupation of server resources is avoided, the latest version of the file is directly obtained from the server, the edited file is generated according to the latest version of the file and the second file, and the edited files respectively submitted when the multiple persons edit the file are not mutually covered.
In one embodiment, the determination of whether the third file can be acquired from the server in step S220 may be determined by calculating hash values of the first file and the third file and comparing the hash values.
In another embodiment, the step S220 of determining whether the third file can be retrieved from the server may also be determined directly by comparing the identification numbers of the first file and the third file, and as shown in fig. 3, the step of determining whether the third file can be retrieved from the server includes the following steps:
step S310, determining whether a file with an identification number larger than that of the first file can be acquired from the server or not according to the identification number of the first file;
step S320, if a file with an identification number greater than that of the first file can be acquired from the server, determining that the third file can be acquired from the server.
In step S310, the identification number refers to a number that can be used to identify the version of the file, and may be composed of characters such as letters, symbols, numbers, and the like. The method for determining whether the file with the identification number larger than the identification number of the first file can be obtained from the server by the terminal device sending a request to the server, wherein the request carries the identification number of the first file, or by comparing the identification numbers of the files locally at the terminal device after the files are obtained by the terminal device.
In step S320, after receiving the request, the server obtains a file with an identification number greater than that of the first file according to the received identification number of the first file, and then sends the file to the terminal device. And if the identification number of the acquired file is larger than the identification number of the first file, determining that a third file can be acquired from the server, wherein the third file is the latest version of the first file, and if only the file identification number equal to the identification number of the first file exists in the server and indicates that the first file is the latest version, determining that the third file cannot be acquired from the server.
In the above embodiment, the identification number of the first file may be obtained by copying the first file to obtain a copy of the first file, storing the identification number of the copy of the first file, and obtaining the identification number of the copy of the first file as the identification number of the first file, in this embodiment, as shown in fig. 4, the file editing method includes:
s410, copying the first file to obtain a copy of the first file, and generating a second file according to the first file and the editing instruction;
step S420, storing the identification number of the copy of the first file, and determining the identification number of the first file according to the stored identification number of the copy of the first file;
step S430, determining whether a third file exists according to the identification number of the copy of the first file, wherein the identification number of the third file is greater than the identification number of the copy of the first file;
step S440, if a file with an identification number greater than that of the first file can be obtained from the server, determining that the third file can be obtained from the server;
step S450, generating an edited file according to the second file and the third file;
and step S460, publishing the edited file to the server.
In step S410, before receiving an edit instruction of a user for a first file, copying the first file and storing the copy in a local memory, where a copy is defined as a copy of the first file, and the copy of the first file is used to indicate that all edits of the first file by the user are modifications based on the version; one is defined as a first file for the user to edit, and the user's operations at the editor are based on the operations of the first file.
In step S420, after receiving the editing instruction from the user, the first file becomes the second file, and the copy of the first file is not modified by any editing of the user, so that the identification number of the copy of the first file can be used as the identification number of the first file.
In step S430, the determination of whether the third file exists in the server is performed by sending the identification number of the copy of the first file to the server, and the server determines whether a file larger than the identification number of the copy of the first file exists according to the identification number of the copy of the first file.
In step S440, after receiving the request sent by the terminal device to determine whether the third file exists, the server obtains the file with the identification number greater than the identification number of the copy of the first file according to the received identification number of the copy of the first file, and then sends the file to the terminal device. And if the identification number of the acquired file is larger than the identification number of the copy of the first file, determining that a third file can be acquired from the server, wherein the third file is the latest version of the first file, and if only the file identification number equal to the identification number of the copy of the first file exists in the server and indicates that the first file is the latest version, determining that the third file cannot be acquired from the server.
Steps S450-460 are the same as steps S230-240 in FIG. 2, and therefore are not described herein again.
There are various embodiments for generating the edited file according to the second file and the third file in step S230.
In one embodiment, as shown in fig. 5, step S230 specifically includes:
step S2301, respectively acquiring a field included in the second file and a field included in the third file;
step S2302, combining the fields included in the second file and the fields included in the third file to generate an edited file.
In step S2301, the second file and the third file are data sets with the same attribute characteristics stored in a file system, where the file system refers to a system that stores data in a mass storage in a file form, and may include various existing database systems and other file systems. The second file and the third file each include a plurality of fields, and the fields refer to data sets representing a specific attribute of the files.
In step S2302, merging refers to an operation of converting at least two independent information into one independent information by reversible combination and/or transformation means. Therefore, the fields contained in the second file and the fields contained in the third file are combined to obtain an edited file.
In one embodiment, referring to fig. 6, step S2302 specifically includes:
step S23021, merging the field identifications contained in the second file and the field identifications contained in the third file to obtain a field identification set;
step S23022, obtaining a field value corresponding to each field identifier in the field identifier set according to a field value included in the second file and a field value included in the third file;
step S23023, obtaining an edited file according to the field identifier set and the field values corresponding to the field identifiers in the field identifier set.
In step S23021, in this embodiment of the present invention, each field includes a field identifier and a field value, where the field identifier is used to identify an attribute represented by the field, and the field value is used to store specific information of the attribute represented by the field. And performing union on the field identification contained in the second file and the field identification contained in the third file to obtain a field identification set.
Step S23022, obtaining a field value corresponding to each field identifier in the field identifier set according to the field value included in the second file and the field value included in the third file.
And for each field identification in the field identification set, acquiring a field value corresponding to the field identification according to the field value contained in the second file and the field value contained in the third file.
In a specific embodiment, step S23022 specifically includes:
for a first type field identifier which is contained in the field identifier set and has a corresponding field value in the second file and does not have a corresponding field value in the third file, setting the field value of the first type field identifier as the corresponding field value in the second file;
for a second type field identifier which is contained in the field identifier set and has a corresponding field value in the third file and does not have a corresponding field value in the second file, setting the field value of the second type field identifier as the corresponding field value in the third file;
and for a third type field identifier which is contained in the field identifier set, has corresponding field values in the second file and the third file at the same time and has different corresponding field values, setting the field value of the third type field identifier as the field value corresponding to the second file.
In this embodiment, if there is a first type field identifier in the field identifier set, the first type field identifier has a corresponding field value in the second file, but there is no corresponding field value in the third file, the field value of the first type field identifier is set to the corresponding field value in the second file.
And if the second type field identification exists in the field identification set, the second type field identification exists in the third file, but the corresponding field value does not exist in the second file, setting the field value of the first type field identification as the corresponding field value in the third file.
If the third type field identification exists in the field identification set, the third type field identification simultaneously has corresponding field values in the second file and the third file, but the corresponding field values are different, the field value of the third type field identification is set as the corresponding field value in the second file.
As described above, a plurality of terminal devices may send editing information to a server, the server may process the editing information sent by one terminal and send the processed editing information to another terminal, and after a user acquires a first file from the server, before inputting an editing instruction, if a file forwarded by another terminal through the server is received, the first file needs to be updated.
In this embodiment, the file editing method further includes:
before receiving an editing instruction of a first file input by a user, if a fourth file sent by a server is received, obtaining an updated first file according to the fourth file and the first file, wherein the fourth file is an updated version of the first file.
In this step, the fourth file is a file that is forwarded to the terminal device by the server after the first file is edited by the other terminal device by the other user, and the fourth file is an updated version of the first file. In an embodiment, the method for determining whether the fourth file is an updated version of the first file may adopt an identification number comparison method, if the identification number of the received file is greater than the identification number of the first file, the file is determined to be the fourth file, and the updated first file is obtained according to the fourth file and the first file; and if the identification number of the received file is equal to the identification number of the first file, determining that the file is not the fourth file, and directly taking the first file as the latest version of file.
In an embodiment, as shown in fig. 7, obtaining the updated first file according to the fourth file and the first file includes:
step S710, respectively obtaining a field included in the first file and a field included in the fourth file;
step S720, summing the field identification contained in the first file and the field identification contained in the fourth file to obtain a field identification set;
step S730, obtaining a field value corresponding to each field identifier in the field identifier set according to the field value included in the first file and the field value included in the fourth file;
step S740, obtaining an updated first file according to the field identification set and the field values corresponding to the field identifications in the field identification set.
Step S710 is similar to step S2301 in fig. 5, and therefore will not be described again, and step S720 is similar to step S23021 in fig. 6, and therefore will not be described again.
In step S730, the manner of obtaining the field value corresponding to each field identifier in the field identifier set is obtained according to the field value included in the first file and the field value included in the fourth file.
In a specific embodiment, step S730 includes:
for a first type field identifier which is contained in the field identifier set and has a corresponding field value in the first file and has no corresponding field value in the fourth file, setting the field value of the first type field identifier as the corresponding field value in the first file;
for a second type field identifier which is contained in the field identifier set and has a corresponding field value in the fourth file and has no corresponding field value in the first file, setting the field value of the second type field identifier as the corresponding field value in the fourth file;
and for a third type field identifier which is contained in the field identifier set, has corresponding field values in the first file and the fourth file at the same time and has different corresponding field values, setting the field value of the third type field identifier as the field value corresponding to the fourth file.
In this embodiment, if a third type field identifier, which includes corresponding field values in the first file and the fourth file at the same time and has different corresponding field values, is included in the field identifier set, it indicates that the first file is edited by other user terminals, and therefore the first file is not the latest file, and the field value of the third type field identifier needs to be set as the field value corresponding to the fourth file, so as to obtain the updated first file.
In one embodiment, if a fourth file is received before an edit instruction for a first file input by a user is received, and an updated first file is obtained according to the fourth file and the first file, the receiving an edit instruction for the first file input by the user, and generating a second file according to the first file and the edit instruction includes:
and receiving an editing instruction of the updated first file input by a user, and generating a second file according to the updated first file and the editing instruction.
Fig. 8 shows an interaction flowchart of a file editing method applied in an application scenario of an interactive video according to an embodiment of the present application.
In an application scene of an interactive video, the video terminal 101 initiates a connection to the video processing server 105, and after the video terminal 101 and the video processing server 105 are successfully connected, in step S810, the video terminal 101 acquires a first video file. In step S820, the video terminal 101 receives an editing instruction input to the first video file by the user, and obtains a second video file according to the editing instruction and the first video file. Before the video terminal 101 transmits the second video file to the video processing server 105, the video terminal 101 transmits a request to the server, and in step S830, the video terminal 101 determines whether the third file, which is the latest version of the first file stored in the video processing server 105, can be acquired from the video processing server 105. In step S840, if the video terminal 101 determines that the third video file exists in the video processing server 105, the third video file is obtained from the video processing server 105, and the second video file and the third video file are merged to obtain an edited file. Finally, the video terminal 101 issues the edited video file to the video processing server.
As shown in fig. 9, according to an embodiment of the present application, there is provided a file editing apparatus, characterized by comprising:
a receiving module 910, configured to receive an editing instruction for a first file input by a user, and generate a second file according to the first file and the editing instruction;
a determining module 920, configured to determine whether a third file can be obtained from a server before the second file is released to the server, where the third file is a latest version of the first file stored in the server;
a generating module 930, configured to generate an edited file according to the second file and the third file if the third file can be acquired from the server;
a publishing module 940, configured to publish the edited file to the server.
In one embodiment, the determining module 920 includes:
the first obtaining unit is used for determining whether a file with an identification number larger than that of the first file can be obtained from the server or not according to the identification number of the first file;
and the processing unit is used for determining that the third file can be acquired from the server if the file with the identification number larger than that of the first file can be acquired from the server.
In one embodiment, the receiving module 910 includes:
the copying unit is used for copying the first file to obtain a copy of the first file and generating a second file according to the first file and the editing instruction;
the apparatus is further configured to:
storing the identification number of the copy of the first file so as to determine the identification number of the first file according to the stored identification number of the copy of the first file;
and determining whether a third file exists according to the identification number of the copy of the first file, wherein the identification number of the third file is greater than the identification number of the copy of the first file.
In one embodiment, the generating module 930 includes:
a second obtaining unit, configured to obtain a field included in the second file and a field included in the third file, respectively;
and the merging unit is used for merging the fields contained in the second file and the fields contained in the third file to generate an edited file.
In one embodiment, the field comprises a field identification and a field value, the merging unit is configured to:
merging the field identification contained in the second file and the field identification contained in the third file to obtain a field identification set;
according to the field value contained in the second file and the field value contained in the third file, acquiring the field value corresponding to each field identifier in the field identifier set;
and obtaining an edited file according to the field identification set and the field value corresponding to each field identification in the field identification set.
In an embodiment, the obtaining, according to a field value included in the second file and a field value included in the third file, a field value corresponding to each field identifier in the field identifier set includes:
for a first type field identifier which is contained in the field identifier set and has a corresponding field value in the second file and does not have a corresponding field value in the third file, setting the field value of the first type field identifier as the corresponding field value in the second file;
for a second type field identifier which is contained in the field identifier set and has a corresponding field value in the third file and does not have a corresponding field value in the second file, setting the field value of the second type field identifier as the corresponding field value in the third file;
and for a third type field identifier which is contained in the field identifier set, has corresponding field values in the second file and the third file at the same time and has different corresponding field values, setting the field value of the third type field identifier as the field value corresponding to the second file.
In one embodiment, the apparatus further comprises:
the updating module is used for obtaining an updated first file according to a fourth file and the first file if the fourth file sent by a server is received before an editing instruction of the first file input by a user is received, wherein the fourth file is an updated version of the first file.
In one embodiment, the receiving module is further configured to:
and receiving an editing instruction of the updated first file input by a user, and generating a second file according to the updated first file and the editing instruction.
In one embodiment, the update module is to:
respectively acquiring fields contained in the first file and fields contained in the fourth file;
merging the field identification contained in the first file and the field identification contained in the fourth file to obtain a field identification set;
according to the field value contained in the first file and the field value contained in the fourth file, acquiring the field value corresponding to each field identifier in the field identifier set;
and obtaining the updated first file according to the field identification set and the field value corresponding to each field identification in the field identification set.
FIG. 10 illustrates a schematic structural diagram of a computer system suitable for use in implementing an electronic device of an embodiment of the present disclosure.
It should be noted that the computer system 800 of the electronic device shown in fig. 10 is only an example, and should not bring any limitation to the functions and the scope of the application of the embodiments of the present disclosure.
As shown in fig. 10, the computer system 800 includes a Central Processing Unit (CPU)801 that can perform various appropriate actions and processes in accordance with a program stored in a Read Only Memory (ROM)808 or a program loaded from a storage section 808 into a Random Access Memory (RAM) 803. In the RAM 803, various programs and data necessary for system operation are also stored. The CPU 801, ROM 808, and RAM 803 are connected to each other via a bus 804. An input/output (I/O) interface 805 is also connected to bus 804.
The following components are connected to the I/O interface 805: an input portion 806 including a keyboard, a mouse, and the like; an output section 807 including a signal such as a Cathode Ray Tube (CRT), a Liquid Crystal Display (LCD), and the like, and a speaker; a storage portion 808 including a hard disk and the like; and a communication section 809 including a network interface card such as a LAN card, a modem, or the like. The communication section 809 performs communication processing via a network such as the internet. A drive 810 is also connected to the I/O interface 805 as necessary. A removable medium 811 such as a magnetic disk, an optical disk, a magneto-optical disk, a semiconductor memory, or the like is mounted on the drive 810 as necessary, so that a computer program read out therefrom is mounted on the storage section 808 as necessary.
In particular, the processes described below with reference to the flowcharts may be implemented as computer software programs, according to embodiments of the present disclosure. For example, embodiments of the present disclosure include a computer program product comprising a computer program embodied on a computer readable medium, the computer program comprising program code for performing the method illustrated in the flow chart. In such an embodiment, the computer program can be downloaded and installed from a network through the communication section 809 and/or installed from the removable medium 811. The computer program, when executed by a Central Processing Unit (CPU)801, performs various functions defined in the methods and apparatuses of the present application. In some embodiments, the computer system 800 may further include an AI (Artificial Intelligence) processor for processing computing operations related to machine learning.
It should be noted that the computer readable media shown in the present disclosure may be computer readable signal media or computer readable storage media or any combination of the two. A computer readable storage medium may be, for example, but not limited to, an electronic, magnetic, optical, electromagnetic, infrared, or semiconductor system, apparatus, or device, or any combination of the foregoing. More specific examples of the computer readable storage medium may include, but are not limited to: an electrical connection having one or more wires, a portable computer diskette, a hard disk, a Random Access Memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), an optical fiber, a portable compact disc read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the foregoing. In the present disclosure, a computer readable storage medium may be any tangible medium that can contain, or store a program for use by or in connection with an instruction execution system, apparatus, or device. In contrast, in the present disclosure, a computer-readable signal medium may include a propagated data signal with computer-readable program code embodied therein, for example, in baseband or as part of a carrier wave. Such a propagated data signal may take many forms, including, but not limited to, electro-magnetic, optical, or any suitable combination thereof. A computer readable signal medium may also be any computer readable medium that is not a computer readable storage medium and that can communicate, propagate, or transport a program for use by or in connection with an instruction execution system, apparatus, or device. Program code embodied on a computer readable medium may be transmitted using any appropriate medium, including but not limited to: wireless, wire, fiber optic cable, RF, etc., or any suitable combination of the foregoing.
The flowchart and block diagrams in the figures illustrate the architecture, functionality, and operation of possible implementations of systems, methods and computer program products according to various embodiments of the present disclosure. In this regard, each block in the flowchart or block diagrams may represent a module, segment, or portion of code, which comprises one or more executable instructions for implementing the specified logical function(s). It should also be noted that, in some alternative implementations, the functions noted in the block may occur out of the order noted in the figures. For example, two blocks shown in succession may, in fact, be executed substantially concurrently, or the blocks may sometimes be executed in the reverse order, depending upon the functionality involved. It will also be noted that each block of the block diagrams or flowchart illustration, and combinations of blocks in the block diagrams or flowchart illustration, can be implemented by special purpose hardware-based systems which perform the specified functions or acts, or combinations of special purpose hardware and computer instructions.
The units described in the embodiments of the present disclosure may be implemented by software, or may be implemented by hardware, and the described units may also be disposed in a processor. Wherein the names of the elements do not in some way constitute a limitation on the elements themselves.
As another aspect, the present application also provides a computer-readable medium, which may be contained in the electronic device described in the above embodiments; or may exist separately without being assembled into the electronic device. The computer readable medium carries one or more programs which, when executed by an electronic device, cause the electronic device to implement the method as described in the embodiments below. For example, the electronic device may implement the steps shown in fig. 2 to 7, and the like.

Claims (10)

1. A method of editing a file, comprising:
receiving an editing instruction of a first file input by a user, and generating a second file according to the first file and the editing instruction;
determining whether a third file can be acquired from a server before the second file is released to the server, wherein the third file is the latest version of the first file stored in the server;
if the third file can be acquired from the server, generating an edited file according to the second file and the third file;
and issuing the edited file to the server.
2. The method of claim 1, wherein determining whether the third file can be obtained from the server comprises:
determining whether a file with an identification number larger than that of the first file can be obtained from the server or not according to the identification number of the first file;
and if the file with the identification number larger than that of the first file can be acquired from the server, determining that the third file can be acquired from the server.
3. The method of claim 2, wherein generating a second file from the first file and the editing instructions comprises: copying the first file to obtain a copy of the first file, and generating a second file according to the first file and the editing instruction;
the method further comprises the following steps: storing the identification number of the copy of the first file so as to determine the identification number of the first file according to the stored identification number of the copy of the first file;
and determining whether a third file exists according to the identification number of the copy of the first file, wherein the identification number of the third file is greater than the identification number of the copy of the first file.
4. The method of claim 1, wherein generating the edited file from the second file and the third file comprises:
respectively acquiring fields contained in the second file and fields contained in the third file;
and combining the fields contained in the second file and the fields contained in the third file to generate an edited file.
5. The method of claim 4, wherein the field comprises a field identification and a field value; combining the fields contained in the second file and the fields contained in the third file to generate an edited file, including:
merging the field identification contained in the second file and the field identification contained in the third file to obtain a field identification set;
according to the field value contained in the second file and the field value contained in the third file, acquiring the field value corresponding to each field identifier in the field identifier set;
and obtaining an edited file according to the field identification set and the field value corresponding to each field identification in the field identification set.
6. The method according to claim 5, wherein the obtaining, according to the field value included in the second file and the field value included in the third file, the field value corresponding to each field identifier in the set of field identifiers includes:
for a first type field identifier which is contained in the field identifier set and has a corresponding field value in the second file and does not have a corresponding field value in the third file, setting the field value of the first type field identifier as the corresponding field value in the second file;
for a second type field identifier which is contained in the field identifier set and has a corresponding field value in the third file and does not have a corresponding field value in the second file, setting the field value of the second type field identifier as the corresponding field value in the third file;
and for a third type field identifier which is contained in the field identifier set, has corresponding field values in the second file and the third file at the same time and has different corresponding field values, setting the field value of the third type field identifier as the field value corresponding to the second file.
7. The method of claim 1, further comprising:
before receiving an editing instruction of a first file input by a user, if a fourth file sent by a server is received, obtaining an updated first file according to the fourth file and the first file, wherein the fourth file is an updated version of the first file.
8. The method of claim 7, wherein receiving a user-entered editing instruction for a first file, and generating a second file from the first file and the editing instruction comprises:
and receiving an editing instruction of the updated first file input by a user, and generating a second file according to the updated first file and the editing instruction.
9. The method of claim 7, wherein obtaining the updated first file from the fourth file and the first file comprises:
respectively acquiring fields contained in the first file and fields contained in the fourth file;
merging the field identification contained in the first file and the field identification contained in the fourth file to obtain a field identification set;
according to the field value contained in the first file and the field value contained in the fourth file, acquiring the field value corresponding to each field identifier in the field identifier set;
and obtaining the updated first file according to the field identification set and the field value corresponding to each field identification in the field identification set.
10. A file editing apparatus, comprising:
the receiving module is used for receiving an editing instruction of a first file input by a user and generating a second file according to the first file and the editing instruction;
a determining module, configured to determine whether a third file can be acquired from a server before the second file is released to the server, where the third file is a latest version of the first file stored in the server;
the generating module is used for generating an edited file according to the second file and the third file if the third file can be acquired from the server;
and the publishing module is used for publishing the edited file to the server.
CN201910906389.9A 2019-09-24 2019-09-24 File editing method and device Pending CN112632016A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201910906389.9A CN112632016A (en) 2019-09-24 2019-09-24 File editing method and device

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201910906389.9A CN112632016A (en) 2019-09-24 2019-09-24 File editing method and device

Publications (1)

Publication Number Publication Date
CN112632016A true CN112632016A (en) 2021-04-09

Family

ID=75282940

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201910906389.9A Pending CN112632016A (en) 2019-09-24 2019-09-24 File editing method and device

Country Status (1)

Country Link
CN (1) CN112632016A (en)

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN114528816A (en) * 2022-01-27 2022-05-24 北京飞书科技有限公司 Collaborative editing information display method and device, electronic equipment and readable medium

Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN104298695A (en) * 2013-07-19 2015-01-21 腾讯科技(深圳)有限公司 Data caching method and device and server
CN106663089A (en) * 2014-06-30 2017-05-10 微软技术许可有限责任公司 Intelligent conflict detection and semantic expression of document edits
US20190147048A1 (en) * 2017-11-14 2019-05-16 Microsoft Technology Licensing, Llc Responding to requests by tracking file edits
CN110110301A (en) * 2019-05-09 2019-08-09 成都终身成长科技有限公司 File editing method, device, system, client, server and storage medium

Patent Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN104298695A (en) * 2013-07-19 2015-01-21 腾讯科技(深圳)有限公司 Data caching method and device and server
CN106663089A (en) * 2014-06-30 2017-05-10 微软技术许可有限责任公司 Intelligent conflict detection and semantic expression of document edits
US20190147048A1 (en) * 2017-11-14 2019-05-16 Microsoft Technology Licensing, Llc Responding to requests by tracking file edits
CN110110301A (en) * 2019-05-09 2019-08-09 成都终身成长科技有限公司 File editing method, device, system, client, server and storage medium

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN114528816A (en) * 2022-01-27 2022-05-24 北京飞书科技有限公司 Collaborative editing information display method and device, electronic equipment and readable medium

Similar Documents

Publication Publication Date Title
CN108282529B (en) System, method and device for publishing and subscribing data
CN110019350A (en) Data query method and apparatus based on configuration information
US11310066B2 (en) Method and apparatus for pushing information
JP7397094B2 (en) Resource configuration method, resource configuration device, computer equipment, and computer program
CN112632919B (en) Document editing method and device, computer equipment and storage medium
CN109862100B (en) Method and device for pushing information
CN111478781B (en) Message broadcasting method and device
CN112818654B (en) Message storage method, message generation method, device, electronic equipment and computer readable medium
US20210377628A1 (en) Method and apparatus for outputting information
CN111857720A (en) Method and device for generating user interface state information, electronic equipment and medium
CN110188113B (en) Method, device and storage medium for comparing data by using complex expression
CN112632016A (en) File editing method and device
CN110647327B (en) Method and device for dynamic control of user interface based on card
CN109683942B (en) Script management method, script management device, script management medium and electronic equipment
CN113127430A (en) Mirror image information processing method and device, computer readable medium and electronic equipment
CN111984686A (en) Data processing method and device
CN113722007B (en) Configuration method, device and system of VPN branch equipment
CN115495658A (en) Data processing method and device
CN113742321A (en) Data updating method and device
CN111966592A (en) Front-end page testing method, device, medium and electronic equipment
CN112579615A (en) Method and device for realizing distributed lock
CN114189365B (en) Universal multi-tenant service authorization method and device based on field mapping
CN113065920B (en) Data processing method and system
CN113778387B (en) Method and device for generating code
CN113760860B (en) Data reading method and device

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
REG Reference to a national code

Ref country code: HK

Ref legal event code: DE

Ref document number: 40041975

Country of ref document: HK

SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination