Railway video client periodic task execution method
Through the use of lightweight language scripts and thread execution cycle tasks in the railway video client, combined with the thermal update characteristics of the LUA script, solve the problem of high -cycle tasks in the existing technology and the influence of automatic tasks. , Stable cycle task execution.
Patent Information
- Application Number
- CN202411591072.8
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-11-08
- Publication Date
- 2025-01-24
AI Technical Summary
The execution of cycle tasks of existing railway video clients requires a lot of personnel costs and energy, and hot updates will affect the execution of automatic cycle tasks written by users.
Obtain lightweight language scripts through the user's predefined operations on the page, start the corresponding threads to perform periodic tasks, and use the hot update feature of Lua scripts to achieve non-stop client updates.
It reduces the work cost of technicians, improves the efficiency of automatic operation of periodic tasks related to video surveillance, and ensures the stability of the program.
Smart Images

Figure CN119356720A_ABST
Abstract
Description
Technical Field
[0001] The invention relates to the field of computer technology, and in particular to a method for executing periodic tasks of a railway video client. Background Art
[0002] Railway transportation undertakes a large number of passenger and freight transportation tasks. Due to the complexity of the railway system and the diversity of its operating environment, in order to ensure the safety of railway transportation, it is necessary to use a video surveillance system to monitor the operating conditions of railway lines, stations or surrounding environments in real time.
[0003] At present, the video surveillance system in railway transportation scenarios adopts a server-client architecture. The client provides a functional operation method to railway managers based on pages or programs. For example, railway managers can customize video-related periodic tasks.
[0004] Research has found that the execution of periodic tasks of the railway video client in the prior art requires a lot of personnel costs and efforts, such as the need for personnel to write and compile a large number of script programs related to the task, and also requires personnel monitoring, etc. In addition, from the perspective of railway transportation safety needs, the railway video client often needs to be hot-updated, and in the prior art, the business upgrade brought about by the hot update will affect the execution of the automatic periodic tasks written by the user. Summary of the invention
[0005] The present invention provides a railway video client periodic task execution method, which can at least reduce the work cost of technical personnel and improve the automatic operation efficiency of video monitoring related periodic tasks.
[0006] To achieve the above object, the present invention adopts the following technical solutions:
[0007] In a first aspect, the present application provides a railway video client periodic task execution method, the method comprising:
[0008] S1, the railway video client obtains the lightweight language script of the periodic task to be customized through the user's predefined operation on the page;
[0009] S2, when the main program of the railway video client detects that the lightweight language script has been customized, it starts a thread corresponding to the periodic task;
[0010] S3, implementing the periodic task through the execution of the thread according to the content of the lightweight language script.
[0011] In one implementation, the S1 includes:
[0012] Generate a corresponding script macro generation instruction through a first operation of the user on a preset component on the page;
[0013] In response to the script macro generation instruction, start the capture process of the user page operation;
[0014] Identify the captured user operations on the page as corresponding function codes;
[0015] Through the second operation of the user's preset component on the page, the capture of the user's page operation is stopped, and the recognized function code is converted into a preset lightweight script.
[0016] In one implementation, the preset lightweight script is a Lua script.
[0017] In one implementation, the first operation and the second operation are both click operations on a macro button on a railway video client page.
[0018] In one implementation, the content of the lightweight language script carries the execution frequency of the periodic task.
[0019] In one implementation, in S3, the thread enters a dormant state after completing a task according to the execution frequency of the periodic task.
[0020] In one implementation, the method further includes: the railway video client compares the file difference with the server, and when the server file is updated, obtains the updated file of the server to implement hot update.
[0021] In one implementation, after the railway video client completes the user login operation, a file comparison between the client and the server is performed.
[0022] The technical solution of the present invention has achieved the following beneficial effects:
[0023] Users can customize periodic tasks through Lua scripts to reduce workload, and can also generate scripts faster through script macro generation modules to reduce learning costs. The hot update module can achieve non-stop client updates, ensuring the stability of the program. BRIEF DESCRIPTION OF THE DRAWINGS
[0024] Figure 1 is a flowchart of a method for executing a periodic task in an embodiment of the present invention;
[0025] Figure 2 A schematic diagram of a flow chart of script generation in an embodiment of the present invention;
[0026] Figure 3 Schematic diagram of hot update in an embodiment of the present invention. DETAILED DESCRIPTION
[0027] In order to make the purpose, technical solution and advantages of the embodiment of the present invention clearer, the technical solution of the embodiment of the present invention will be clearly and completely described below in conjunction with the drawings of the embodiment of the present invention. Obviously, the described embodiment is a part of the embodiment of the present invention, not all of the embodiments. Based on the described embodiment of the present invention, all other embodiments obtained by ordinary technicians in this field belong to the scope of protection of the present invention.
[0028] In view of the defects and problems of the prior art, the present application provides a method for executing periodic tasks of a railway video client, the method comprising:
[0029] S1, the railway video client obtains the lightweight language script of the periodic task to be customized through the user's predefined operation on the page;
[0030] S2, when the main program of the railway video client detects that the lightweight language script has been customized, it starts a corresponding A thread for the periodic task;
[0031] S3, implementing the periodic task through the execution of the thread according to the content of the lightweight language script.
[0032] The above method is described below in a more detailed embodiment of the present invention in conjunction with more drawings.
[0033] In a more detailed embodiment of the present invention, the lightweight language script specifically adopts Lua code. Written in standard C language and open in source code form, it has been successfully applied to games, simulations, embedded development and other fields. Its embeddability and scalability can be well integrated with the current program. At the same time, Lua is a dynamic scripting language. Its code will be executed line by line by the interpreter at runtime without static compilation, and can be used to achieve hot update.
[0034] In the embodiment of the present application, it is the Lua script execution interface of the current client main program, and the user can write a Lua script to enable the software to perform periodic tasks.
[0035] Figure 1 It shows how periodic tasks are executed.
[0036] The railway video client obtains the lightweight language script of the periodic task to be customized through the user's predefined operations on the page. The user's predefined operations can be directly written in code, or the user's operations can be obtained based on static reflection technology and converted into code.
[0037] For example, if a user needs to download the recordings of four cameras from 16:00 to 17:00 every day at 18:00, the user needs to write a script first. The script content includes the execution frequency of the task, the information of the relevant cameras, the calling of the business interface function, etc. The user clicks the scheduled task execution button on the client to import the script.
[0038] When the client detects the script imported by the user, it will start a new thread, which is used to execute scheduled tasks. When a scheduled task is completed, the thread will output the task completion log and go into sleep mode until the next task execution time comes.
[0039] exist Figure 2 , a schematic diagram of capturing user actions to generate codes is shown.
[0040] The Lua script macro generation module can generate corresponding Lua codes according to user operations, reducing the difficulty of writing Lua scripts. When using this module, the user clicks the macro generation button, operates the video surveillance program normally, and clicks the macro generation button again at the end. At this time, the Lua script of the corresponding operation can be generated. After that, the user only needs to write the corresponding execution cycle.
[0041] Figure 3 The hot update implemented in the embodiment of the present invention is illustrated.
[0042] Specifically, hot updates are achieved by comparing files on the server. Developers can copy updated files to a fixed file path on the server. When the user logs in to the client software, the client compares files with the server and performs update operations. When the server finds that the file has been updated, it sends an update request to the client and transmits the updated file to the client. This module utilizes the hot update feature of Lua.
[0043] In summary, users can customize periodic tasks through Lua scripts to reduce workload, and can also generate scripts faster through script macro generation modules to reduce learning costs. The hot update module can realize client non-stop update. new, guaranteed The stability of the program.
[0044] In the several embodiments provided by the present invention, it should be understood that the disclosed method can be implemented in other ways. For example, the device embodiments described above are only schematic. For example, the division of the above units is only a logical function division. There may be other division methods in actual implementation. For example, multiple units or components can be combined or integrated into another system, or some features can be ignored or not executed. Another point is that the mutual coupling or direct coupling or communication connection shown or discussed can be through some interfaces, indirect coupling or communication connection of devices or units, which can be electrical, mechanical or other forms.
[0045] The above-mentioned integrated unit implemented in the form of a software functional unit can be stored in a computer-readable storage medium. The above-mentioned software functional unit is stored in a storage medium, including a number of instructions for a computer device (which can be a personal computer, a server, or a network device, etc.) or a processor (Processor) to perform some steps of the above-mentioned method of each embodiment of the present invention. The aforementioned storage medium includes: U disk, mobile hard disk, read-only memory (Read-Only Memory, ROM), random access memory (Random Access Memory, RAM), disk or optical disk and other media that can store program codes.
[0046] The above are only preferred embodiments of the present invention and are not intended to limit the present invention. Any modifications, equivalent substitutions, improvements, etc. made within the spirit and principles of the present invention should be included in the scope of protection of the present invention.
Claims
1. A railway video client periodic task execution method, characterized in that: The method comprises: S1, the railway video client obtains the lightweight language script of the periodic task to be customized through the user's predefined operation on the page; S2, when the main program of the railway video client detects that the lightweight language script has been customized, it starts a thread corresponding to the periodic task; S3, implementing the periodic task through the execution of the thread according to the content of the lightweight language script.
2. The railway video client periodic task execution method according to claim 1 is characterized in that: The S1 includes: Generate a corresponding script macro generation instruction through a first operation of the user on a preset component on the page; In response to the script macro generation instruction, start the capture process of the user page operation; Identify the captured user operations on the page as corresponding function codes; Through the second operation of the user's preset component on the page, the capture of the user's page operation is stopped, and the recognized function code is converted into a preset lightweight script.
3. The railway video client periodic task execution method according to claim 2 is characterized in that: The preset lightweight script is a Lua script.
4. The railway video client periodic task execution method according to claim 2 is characterized in that: The first operation and the second operation are both click operations on the macro button on the railway video client page.
5. The railway video client periodic task execution method according to claim 1 is characterized in that: The content of the lightweight language script carries the execution frequency of the periodic task.
6. The railway video client periodic task execution method according to claim 5 is characterized in that: In S3, the thread enters a dormant state after completing a task according to the execution frequency of the periodic task.
7. The railway video client periodic task execution method according to claim 1 is characterized in that: The method further includes: the railway video client compares the file difference with the server, and when the server file is updated, obtains the updated file of the server to achieve hot update.
8. The railway video client periodic task execution method according to claim 7 is characterized in that: After the railway video client completes the user login operation, a file comparison is performed between the client and the server.