Data synchronization method and apparatus, electronic device, and computer-readable storage medium
Patent Information
- Application Number
- CN202611049436.9
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2026-07-14
- Publication Date
- 2026-10-27
AI Technical Summary
该种同步方式,导致在数据解析完成前,EPG界面长时间处于无数据或空白状态,用户无法及时获取节目信息,交互响应慢,进而导致用户使用体验不佳
[0022]综上,本申请实施例中,可以在目标终端的服务信息处理模块处理电子节目指南数据的过程中,响应于目标触发事件,将当前已解析的第一电子节目指南数据同步至目标数据库;以及,每间隔预设时长确定是否存在新解析出的第二电子节目指南数据,并在确定存在第二电子节目指南数据时,将第二电子节目指南数据同步至目标数据库。本申请实施例通过在处理电子节目指南数据的过程中设置事件触发同步和定时触发同步两种机制,能够在不等待全部数据解析完成的前提下,将已解析的电子节目指南数据及时地同步至目标数据库。如此,能够显著缩短电子节目指南数据的首次显示时间,提升用户对电视节目信息获取的即时性体验。
Smart Images

Figure CN122994546A_ABST
Abstract
Description
Technical Field
[0001] This application relates to the field of television technology, specifically to a data synchronization method, apparatus, electronic device, and computer-readable storage medium. Background Technology
[0002] In digital television technology, Electronic Program Guide (EPG) data is typically obtained by parsing from the transport stream.
[0003] Currently, the synchronization strategy for EPG data is typically a one-time batch synchronization, meaning that the data is only written to the database for front-end applications to read after all EPG data has been parsed. This synchronization method results in the EPG interface remaining blank or without data for an extended period before data parsing is complete. Users cannot obtain program information in a timely manner, resulting in slow interactive response and a poor user experience. Summary of the Invention
[0004] This application provides a data synchronization method, apparatus, electronic device, and computer-readable storage medium, which can effectively shorten the display time of EPG data and improve user experience.
[0005] In a first aspect, embodiments of this application provide a data synchronization method, including: During the processing of electronic program guide data in the service information processing module of the target terminal, in response to a target trigger event, the currently parsed first electronic program guide data is synchronized to the target database; and, At preset intervals, it is determined whether there is newly parsed second electronic program guide data, and when it is determined that there is second electronic program guide data, the second electronic program guide data is synchronized to the target database.
[0006] In one embodiment, the target triggering event includes: the service information processing module receiving a current program information table, wherein the current program information table is a program information table carrying information about the currently broadcast program.
[0007] In one embodiment, determining whether newly parsed second electronic program guide data exists at each preset interval includes: In response to the service information processing module obtaining the service information index table, a timer is created or reset through the service information processing module. When the timer reaches the preset duration, it is determined whether there is newly parsed second electronic program guide data, and the timer is reset.
[0008] In one embodiment, the method further includes: In response to the service information processing module determining that all electronic program guide data parsing is complete, the timer is stopped.
[0009] In one embodiment, the target database is a television database; the step of synchronizing the currently parsed first electronic program guide data to the target database includes: The first electronic program guide data is written from the memory database of the service information processing module to the television database; The step of synchronizing the second electronic program guide data to the target database includes: The second electronic program guide data is written from the memory database of the service information processing module to the television database.
[0010] In one embodiment, the method further includes: In response to the service information processing module determining that all electronic program guide data parsing is complete, all electronic program guide data is synchronized to the target database.
[0011] In one embodiment, processing the electronic program guide data includes: Retrieve service information index table; Set the program information table filter according to the service information index table; The program information table is received through the program information table filter; The program information table is parsed to obtain electronic program guide data, and the electronic program guide data is stored in the memory database of the service information processing module.
[0012] Secondly, embodiments of this application provide a data synchronization device, the device comprising: The first synchronization module is used to synchronize the currently parsed first electronic program guide data to the target database in response to a target trigger event during the process of the electronic program guide data being processed by the service information processing module of the target terminal. The second synchronization module is used to determine at preset intervals whether there is newly parsed second electronic program guide data during the process of the electronic program guide data being processed by the service information processing module of the target terminal, and to synchronize the second electronic program guide data to the target database when it is determined that the second electronic program guide data exists.
[0013] In one embodiment, the target triggering event includes: the service information processing module receiving a current program information table, wherein the current program information table is a program information table carrying information about the currently broadcast program.
[0014] In one embodiment, the second synchronization module includes: The counter management submodule is used to create or reset a timer in response to the service information processing module obtaining the service information index table; The timing management submodule is used to determine whether there is newly parsed second electronic program guide data when the timing duration of the timer reaches the preset duration, and to reset the timer.
[0015] In one embodiment, the data synchronization device further includes: The stop module is used to stop the timer in response to the service information processing module determining that all electronic program guide data parsing is complete.
[0016] In one embodiment, the target database is a television database; the first synchronization module includes: The first synchronization submodule is used to write the first electronic program guide data from the memory database of the service information processing module into the television database; The second synchronization module includes: The second synchronization submodule is used to write the second electronic program guide data from the memory database of the service information processing module into the television database.
[0017] In one embodiment, the data synchronization device further includes: The third synchronization module is used to synchronize all electronic program guide data to the target database in response to the service information processing module determining that all electronic program guide data parsing is complete.
[0018] In one embodiment, the first synchronization module includes: The `get` submodule is used to retrieve the service information index table; The settings submodule is used to set the program information table filter according to the service information index table; A receiving submodule is used to receive a program information table through the program information table filter. The storage submodule is used to parse the program information table to obtain electronic program guide data, and store the electronic program guide data in the memory database of the service information processing module.
[0019] Thirdly, embodiments of this application also provide an electronic device, which includes a memory, a processor, and a computer program stored in the memory and executable on the processor. When the computer program is executed by the processor, it implements the steps in the data synchronization method described above.
[0020] Fourthly, embodiments of this application also provide a computer-readable storage medium storing a computer program, which, when executed by a processor, implements the steps in the data synchronization method described above.
[0021] Fifthly, embodiments of this application also provide a computer program product or computer program, which includes computer instructions stored in a computer-readable storage medium. A processor of a computer device reads the computer instructions from the computer-readable storage medium and executes the computer instructions, causing the computer device to perform the methods provided in the various optional implementations described in the embodiments of this application.
[0022] In summary, in this embodiment, during the processing of electronic program guide (EPB) data by the service information processing module of the target terminal, in response to a target trigger event, the currently parsed first EPB data is synchronized to the target database; and, at preset intervals, it is determined whether newly parsed second EPB data exists, and when the existence of second EPB data is determined, the second EPB data is synchronized to the target database. This embodiment, by setting both event-triggered synchronization and timed-triggered synchronization mechanisms during the processing of EPB data, can promptly synchronize parsed EPB data to the target database without waiting for all data parsing to be completed. This significantly shortens the initial display time of EPB data and improves the user's immediate experience of obtaining television program information. Attached Figure Description
[0023] To more clearly illustrate the technical solutions in this application, the accompanying drawings used in the description of the embodiments will be briefly introduced below. Obviously, the drawings described below are only some embodiments of the present invention. For those skilled in the art, other drawings can be obtained based on these drawings without creative effort.
[0024] Figure 1 This is a flowchart illustrating data synchronization methods in related technologies; Figure 2 This is a schematic flowchart of a data synchronization method provided in an embodiment of this application; Figure 3 This is a schematic diagram of a specific embodiment of the data synchronization method provided in this application; Figure 4 This is a schematic diagram of another specific embodiment of the data synchronization method provided in one embodiment of this application; Figure 5 This is a schematic diagram of the structure of a data synchronization device provided in an embodiment of this application; Figure 6 This is a schematic diagram of the structure of an electronic device provided in an embodiment of this application. Detailed Implementation
[0025] The technical solutions of this application will now be clearly and completely described with reference to the accompanying drawings. Obviously, the described embodiments are merely some embodiments of the present invention, and not all embodiments. All other embodiments obtained by those skilled in the art based on the embodiments of the present invention without creative effort are within the scope of protection of the present invention.
[0026] It should be noted that, referring to Figure 1 The diagram illustrates the flow chart of the EPG synchronization method in related technologies. Taking EPG synchronization in the Android system as an example, the workflow of this solution is as follows: First, the middleware's table receiver continuously receives EIT (Event Information Table) from the transport stream, and the EIT table parsing and processing module parses the received EIT table, saving the parsed EPG content to the middleware's own in-memory database. At this point, the EPG data has not yet been written to the Android system's TV database (tv.db), so Android application layer applications (such as LiveTV) cannot read it directly.
[0027] When a user opens the EPG interface through LiveTV, LiveTV first checks the reception status of the current EIT tables. Its core logic is: has all the EIT tables to be searched been received? If the result is "not all EIT tables have been received," LiveTV continues to wait without performing any synchronization operations. Only when the result is "all EIT tables have been received" will LiveTV further check whether the required time period's EPG data exists in the Android database tv.db.
[0028] If the required EPG data is not found in tv.db (for example, because synchronization has not yet been performed), LiveTV will proactively send a synchronization message, calling the external synchronization interface provided by the middleware. This interface is responsible for batch writing all the parsed EPG data from the middleware's in-memory database to the Android database tv.db. After the data synchronization is complete, LiveTV then reads the data from tv.db and finally displays the EPG interface.
[0029] In other words, traditional EPG synchronization methods typically employ a one-time update strategy. This means the middleware must wait until all EIT tables requiring searching return data or a timeout occurs before triggering a complete synchronization to write all parsed EPG data to the Android database. While an external synchronization interface is added, allowing LiveTV to proactively trigger synchronization when needed, this approach relinquishes the control of synchronization to the upper-layer application. When business logic changes, interface calls fail, or are not called, EPG data synchronization will rely entirely on the final one-time update, resulting in the persistent problem of slow EPG loading. Furthermore, since the synchronization process, controlled by LiveTV, is triggered by user actions, even successful interface calls will still lead to lengthy loading times, failing to fundamentally solve the slow EPG data loading issue.
[0030] To address the current issue of slow EPG data loading, this application aims to provide a data synchronization method. By implementing both event-triggered and timed-triggered synchronization mechanisms during the processing of Electronic Program Guide (EPG) data, the parsed EPG data can be synchronized to the target database in a timely manner without waiting for all data parsing to complete. This significantly shortens the initial display time of EPG data and enhances the user's immediate experience of obtaining television program information.
[0031] The following sections provide detailed descriptions of each example. It should be noted that the order in which the embodiments are described is not intended to limit the priority of the embodiments.
[0032] Figure 2 The illustration shows a schematic flowchart of a data synchronization method according to an embodiment of this application. The entity executing this data synchronization method can be a data synchronization device, which can be integrated into a target terminal. The target terminal is an electronic device capable of receiving, demodulating, decoding, and processing digital television signals. The target terminal can be a smart TV, set-top box, digital TV receiver, projector, mobile phone, tablet computer, laptop computer, desktop computer, wearable smart device, or in-vehicle computer, etc.
[0033] In this embodiment, the description will be from the perspective of a data synchronization device. To facilitate the explanation of the data synchronization method of this application, the following will describe the data synchronization device integrated into the target terminal in detail, that is, the target terminal will be used as the execution subject for detailed explanation.
[0034] Reference Figure 2 The diagram shows a flowchart of a data synchronization method according to this application. The method may specifically include steps S201 to S202, as follows: S201: During the process of processing electronic program guide data in the service information processing module of the target terminal, in response to the target trigger event, the currently parsed first electronic program guide data is synchronized to the target database.
[0035] In this embodiment, the executing entity can specifically be the service information processing module of the target terminal. This service information processing module is a software function module running on the target terminal. Specifically, it can run at the target terminal's operating system layer or middleware layer. The service information processing module is used to extract, parse, and manage data related to service information (SI) from the received digital television transport stream (TS), such as parsing electronic program guide (EPG) data from the digital television transport stream. The electronic program guide data refers to data describing television program information, including program name, broadcast time, program duration, and synopsis, and is usually derived from the program information table (EIT) in the transport stream.
[0036] In this embodiment, a target triggering event refers to a specific event that occurs during the processing of EPG data by the service information processing module and can trigger a data synchronization. This target triggering event can be an internal state change, the completion of receiving a specific data table, or a synchronization command issued by the system.
[0037] In this embodiment, during the processing of electronic program guide (EPB) data by the service information processing module, the module continuously monitors for the occurrence of preset target trigger events. When any target trigger event is detected, the service information processing module immediately responds to the event, acquires the EPB data that has been parsed at the current moment, and uses it as the first EPB data. Subsequently, the service information processing module synchronizes the first EPB data to the target database through a database write operation.
[0038] It should be noted that event-triggered synchronization does not erase the already synchronized First Electronic Program Guide (EPG) data, nor does it interrupt the ongoing EPG data processing flow. That is, after initiating the synchronization operation, the service information processing module can continue to perform subsequent data filtering and parsing tasks without waiting for synchronization to complete.
[0039] In the specific implementation, the service information processing module can maintain an event listener. When the parser completes parsing the key EIT table, it triggers a target trigger event. After the event listener captures this target trigger event, the service information processing module performs a data copy operation to write the first EIT data into the target database.
[0040] S202: Determine whether there is newly parsed second electronic program guide data at each preset interval, and when it is determined that there is second electronic program guide data, synchronize the second electronic program guide data to the target database.
[0041] In this embodiment, in parallel with the event triggering mechanism, the service information processing module may also initiate an independent time synchronization process. Specifically, the service information processing module can maintain a timer that triggers periodically according to a preset duration (e.g., 5 seconds). At the end of each timing period, the service information processing module checks whether there is any newly parsed data. For example, the service information processing module records the time point of the last timed synchronization. When the current period is triggered, the service information processing module determines whether there is any newly parsed second electronic program guide data that has not yet been synchronized to the target database since the last synchronization. If it is determined that there is second electronic program guide data, the service information processing module synchronizes the second electronic program guide data to the target database. After this synchronization operation is completed, the timer is reset and continues timing, waiting for the next preset duration to arrive before performing the above check again.
[0042] In this embodiment, the aforementioned timed triggering mechanism ensures that the newly parsed EPG data can still be synchronized to the target database in a timely and periodic manner between two target triggering events, or in the absence of a target triggering event, thereby preventing data from remaining in memory for a long time and being unavailable to upper-layer applications.
[0043] The technical solution of this application, by setting up both event-triggered synchronization and timed-triggered synchronization mechanisms in parallel during EPG data processing, enables timely synchronization of parsed EPG data to the target database without waiting for all data parsing to complete. This effectively reduces reliance on external synchronization interface calls while ensuring display quality. Compared to traditional one-time full synchronization schemes, this application significantly shortens the initial display time of EPG data, improving the user's real-time experience of obtaining TV program information. Simultaneously, the timed-triggered mechanism ensures continuous and periodic synchronization of new data, effectively preventing data omissions or long-term retention, achieving a good balance between EPG display response speed and data integrity. Furthermore, it does not rely on active calls from upper-layer applications, improving the reliability of EPG data synchronization.
[0044] In one feasible implementation, the target triggering event includes: the service information processing module receiving the current program information table, which is a program information table carrying information about the currently broadcast program.
[0045] In this embodiment, the current program information table refers to a program information table defined in digital television standards that is specifically used to carry program information of the currently broadcast program. For example, in the ATSC (Advanced Television Systems Committee) standard, the current program information table can specifically be EIT0 (Event Information Table for the current event); in the DVB (Digital Video Broadcasting) standard, the current program information table can be the present information in the EIT present / following table.
[0046] In this embodiment, the current program information table can contain key information such as the name, start time, duration, and content description of the program currently being broadcast on the channel. Its data volume is small and can be quickly obtained from the transport stream when the user switches channels.
[0047] In this embodiment, after the target terminal starts or the user completes channel searching, the service information processing module sets a PID (Packet Identifier) filter based on the currently selected channel and begins capturing various program information tables from the transport stream, including but not limited to EIT, SDT (Service Description Table), and TDT (Time and Date Table). For each channel, the service information processing module can set a filter to receive the current program information table (e.g., EIT0 table) for that channel. When the current program information table for a particular channel is completely received and successfully parsed, the service information processing module marks this event as a target trigger event, and then synchronizes the currently parsed first electronic program guide data to the target database.
[0048] In this implementation, when a user changes channels or opens the EPG interface, the LiveTV or EPG application can query the program information of the current channel from the target database. Since the current program information table is synchronized to the target database in real time after being received, the application can quickly read the valid data and present it to the user, avoiding long waiting times for program information.
[0049] Taking a smart TV as an example, after the user turns it on, the service information processing module begins filtering and parsing EPG data from the digital TV signal. When the module parses the EIT0 table (containing information about programs currently being broadcast on the channel), it immediately triggers a synchronization, writing data such as the current program name, start and end times, etc., into tv.db. At this time, if the LiveTV application is opened, it can instantly read the current program information from tv.db and display it, without the user having to wait.
[0050] By adopting the technical solution of this application embodiment, the service information processing module can automatically trigger synchronization at the first time by taking the received current program information table as the target trigger event, and quickly write the real-time program information of the corresponding channel into the target database, thereby significantly shortening the first display time of the EPG interface after the user changes the channel, and thus providing the user with a smooth and real-time TV program navigation experience.
[0051] In one feasible implementation, refer to Figure 3 The step in S202, which determines whether newly parsed second electronic program guide data exists at preset intervals, may specifically include steps S301 to S302, as follows: S301: In response to the service information processing module obtaining the service information index table, create or reset the timer through the service information processing module.
[0052] In this embodiment, the Service Information Index Table refers to a table defined in the digital television standard that describes metadata such as the type, packet identifier (PID), version number, quantity, and transmission location of other Service Information Tables. This Service Information Index Table serves as the entry point for the entire service information parsing process, instructing the service information processing module on how to set filters to obtain subsequent Program Information Tables (EIT), Service Description Tables (SDT), etc.
[0053] It should be noted that the specific name of the Service Information Index (SHI) table may differ across different digital television standards. For example, in the ATSC standard, the SHIPPING table may specifically be the Master Guide Table (MGT); in the DVB standard, the SHIPPING table may include the Service Description Table (SDT) and / or the Program Map Table (PMT). In this embodiment, obtaining the SHIPPING table serves as the starting point for the processing module to begin systematic EPG data filtering.
[0054] In this embodiment, when the target terminal initiates the EPG data acquisition process (e.g., the user completes a channel search or switches channels), the service information processing module first obtains the service information index table from the transport stream. For example, the service information processing module sets a filter based on the PID (Packet Identifier) value specified in the standard protocol (e.g., the PID of MGT in ATSC is 0x1FFB), and receives and parses the service information index table through the filter. Then, in response to obtaining the service information index table, the service information processing module performs a timer creation or reset operation. Specifically, if the timer has not yet been created (e.g., when EPG data processing is initiated for the first time), a new timer instance is created, and its timing period is set to a preset duration. If the timer already exists (e.g., when the user switches channels or re-acquires the service information index table), the timer is reset, the current timer is reset to zero, and the timing restarts.
[0055] S302: When the timer reaches the preset duration, determine whether there is newly parsed second electronic program guide data and reset the timer.
[0056] In this embodiment, after the timer starts, it triggers a timeout event when the timer's duration reaches a preset duration. The service information processing module responds to this timeout event by determining whether newly parsed second electronic program guide (EPG) data exists. Specifically, the service information processing module maintains a synchronization status record, such as the "last synchronization timestamp" or the "maximum synchronized EPG record ID." When the timer times out, the service information processing module queries the memory database to find all records whose last update time or record ID is greater than the last synchronization marker. If at least one such record exists, it is determined that newly parsed second EPG data exists, and it is synchronized to the target database via a database write operation. This synchronization operation can use an incremental write method, synchronizing only newly added or changed records to avoid duplicate writes. After synchronization is complete, the module updates the last synchronization timestamp or record ID so that updated data can be correctly identified during the next check. Simultaneously, the service information processing module resets the timer, that is, it resets the timer to zero and restarts the timing. Subsequently, the module repeats the time synchronization process until all EIT tables have been received or the EPG data processing process is actively terminated (e.g., the user shuts down the device or switches to a non-TV mode).
[0057] The technical solution adopted in this application creates or resets a timer in response to the service information processing module obtaining the service information index table, and checks and synchronizes the newly parsed EPG data when each preset time period is reached. This ensures that even in scenarios where the EIT table is sparsely distributed and there are no immediate events, the newly parsed EPG data can be synchronized to the target database in a timely and batch manner, thereby avoiding the long-term retention of EPG data in the service information processing module.
[0058] In one feasible implementation, the data synchronization method may further include: stopping the timer in response to the service information processing module determining that all electronic program guide data parsing is complete.
[0059] In this implementation, the service information processing module maintains a counter or status bitmap to record the completion status of various EIT tables. Initially, all EIT tables are marked as "incomplete". Whenever an EIT table (or its designated segment) is fully received and successfully parsed, the module updates the corresponding completion flag.
[0060] In practice, the total number of EIT tables to be received can be known in advance from the service information index table (for example, the number of each type of EIT table is specified in the MGT). When the number of completed tables equals this total, the service information processing module determines that all electronic program guide data parsing is complete.
[0061] In this implementation, if some EIT tables do not arrive within a reasonable time (e.g., exceeding the maximum waiting time), the service information processing module can consider them as timeouts and proactively mark them as "complete" (indicating no further waiting). When all EIT tables are marked as "received or timed out," it is determined that all Electronic Program Guide data parsing is complete.
[0062] In this implementation, once the service information processing module determines that all electronic program guide data has been parsed, it immediately executes the operation to stop the timer. For example, the timer stop function can be called to prevent the timer from generating subsequent timeout events. Alternatively, the timer pointer can be set to NULL or marked as invalid to prevent misuse.
[0063] In this embodiment, after the timer stops, if some abnormal situation (such as signal interruption and recovery, or user manual refresh of EPG) requires re-parsing of new EPG data, the service information processing module will recreate or reset the timer when re-acquiring the service information index table, thereby restoring the periodic synchronization mechanism.
[0064] By adopting the technical solution of this application embodiment, the timer can be stopped immediately after the service information processing module determines that all electronic program guide data parsing is completed. This enables the adaptive shutdown of the periodic synchronization check mechanism, timely releases the system resources occupied by the timer after EPG data acquisition, avoids unnecessary periodic checks and callbacks, thereby reducing CPU load and power consumption, and extending the battery life of the target terminal.
[0065] In one feasible implementation, the target database is a television database. The step of synchronizing the currently parsed first electronic program guide (EPB) data to the target database may specifically include: writing the first EPB data from the service information processing module's memory database to the television database. The step of synchronizing the second EPB data to the target database may specifically include: writing the second EPB data from the service information processing module's memory database to the television database.
[0066] In this embodiment, the television database refers to a persistent database instance within the target terminal's operating system specifically used to store television-related data (including electronic program guide data, channel lists, program collection information, etc.). In the Android system, the television database can be a system-level tv.db file located in the terminal's internal storage space. This database supports Structured Query Language (SQL) operations, allowing upper-layer applications (such as the LiveTV application) to read and query it through a standard interface.
[0067] In this embodiment, the in-memory database of the service information processing module refers to a volatile storage area running within the service information processing module, used for temporary storage of parsed EPG data. This in-memory database is typically implemented using data structures such as hash tables or custom structure arrays to support high-concurrency read / write operations and fast retrieval. Unlike the television database, data in the in-memory database is lost upon module restart or system power failure, but its read / write speed is far superior to that of a persistent database.
[0068] In this embodiment, the service information processing module receives tabular data such as EIT from the transport stream, parses it to obtain structured EPG records. Each parsed record is immediately stored in the in-memory database within the service information processing module.
[0069] In this embodiment, the service information processing module determines the range of data to be synchronized based on the synchronization type (event-triggered or timed). Specifically, for event-triggered synchronization, the service information processing module reads the first electronic program guide (EPB) data related to the target triggering event from the memory database. For timed-triggered synchronization, the service information processing module reads the second EPB data that has been added or changed since the last synchronization. Then, the first or second EPB data is written to the television database line by line or in batches. After synchronization is complete, the service information processing module can continue subsequent data processing or wait for the next trigger. The synchronized data in the memory database can be retained or cleared as needed.
[0070] By adopting the technical solution of this application embodiment, the first electronic program guide data and the second electronic program guide data are cached in the memory database through the service information processing module, and the corresponding electronic program guide data is written to the television database when synchronization is triggered. This enables orderly and efficient management of electronic program guide data. That is, the memory database is responsible for temporarily storing real-time parsed data, and the television database is responsible for persistence and providing it to the upper-layer application for reading, avoiding data redundancy or chaos. At the same time, the service information processing module actively performs the writing operation, no longer relying on the upper-layer application or external interface call, which improves the autonomy and reliability of synchronization.
[0071] In one feasible implementation, the data synchronization method may further include: in response to the service information processing module determining that all electronic program guide data parsing is complete, synchronizing all electronic program guide data to the target database.
[0072] In this embodiment, after determining that all Electronic Program Guide (EPG) data has been parsed, the Service Information Processing (SIP) module will initiate a full synchronization operation in response to this result. Specifically, the SIP module does not only synchronize the newly parsed data, but writes all EPG data currently stored in the in-memory database (including data that has been written through progressive synchronization and data that has not yet been synchronized) to the target database. For example, it deletes the old EPG records corresponding to the current channel or current time period in the target database, and then inserts or replaces all records in the in-memory database into the target database.
[0073] In this implementation, records related to the current EPG data in the target database can be deleted (e.g., deleting all records for all channels or a specified channel in the emg_table). Then, all EPG records in the in-memory database are traversed, and database write operations are performed one by one or in batches to write all records to the target database. Optionally, after the full synchronization operation, the service information processing module can clear some or all of the data in the in-memory database to release memory resources.
[0074] It should be noted that since full synchronization occurs after all data parsing is completed, and the event-triggered synchronization and timed-triggered synchronization prior to this have already provided users with fast program information display, this embodiment will not affect the loading speed of the EPG interface, but will silently complete the final data integrity guarantee in the background.
[0075] By adopting the technical solution of this application embodiment, after the service information processing module determines that all EPG data has been parsed, a full synchronization is performed to write all parsed Electronic Program Guide data into the target database at once. This ensures that complete and uninterrupted EPG data is obtained in the target database at the end of the EPG data acquisition phase, effectively avoiding data loss problems caused by incremental synchronization or abnormal situations.
[0076] In one feasible implementation, the steps for processing electronic program guide data may specifically include: obtaining a service information index table; setting a program information table filter based on the service information index table; receiving a program information table through the program information table filter; parsing the program information table to obtain electronic program guide data; and storing the electronic program guide data in the memory database of the service information processing module.
[0077] In this embodiment, when the service information processing module starts the EPG data acquisition process, it can first set an initial filter according to the fixed PID value specified by the digital television standard, capture and assemble the service information index table (such as the MGT table with PID 0x1FFB in the ATSC standard, or the SDT table with PID 0x0011 in the DVB standard) from the transport stream, parse the table to obtain key metadata information such as the number of various EIT tables in the current transport stream, the PID value of each EIT table, the version number, and the time range it covers, thereby providing a navigation basis for the subsequent precise setting of the EIT filter.
[0078] In this embodiment, the Program Information Table (EIT) filter is used to accurately extract data packets carrying the Program Information Table from the transport stream. After successfully obtaining the Service Information Index (SIA) table, the Service Information Processing module parses each EIT table entry listed in the table, creates an independent EIT filter for each EIT table to be received (such as EIT0, EIT1, EIT2, etc.), and sets the parameters of the EIT filter to the corresponding PID value and table identifier extracted from the index table. This ensures that the target EIT data packets can be accurately captured from the transport stream that reuses video, audio, and multiple data streams while ignoring other irrelevant data.
[0079] In this embodiment, the service information processing module enables all configured EIT filters to run simultaneously in parallel, continuously capturing data packets from the transport stream and parsing and assembling program information tables from these packets. This program information table refers to a standard table carrying electronic program guide data, containing information such as program name, start time, and duration.
[0080] In this implementation, once a complete EIT table is received, the service information processing module calls the corresponding parser to parse the program information table according to the standard protocol, obtaining EPG data. After parsing, the service information processing module immediately stores each EPG data entry into its internal memory database for subsequent synchronization.
[0081] The technical solution adopted in this application enables the service information processing module to accurately determine the type and quantity of EIT tables to be received, avoiding invalid PID scanning and resource waste. At the same time, by storing the parsed data into the memory database in advance, a unified data access interface is provided for event-triggered synchronization and timed-triggered synchronization, ensuring that the synchronization operation can be performed based on the latest and most complete parsed data, thereby improving the reliability and response efficiency of the entire EPG data synchronization.
[0082] In one feasible implementation, refer to Figure 4 The diagram illustrates a specific embodiment of the data synchronization method. This data synchronization method is executed by a service information processing module in the target terminal, which can be an EPGMonitor (Electronic Program Guide monitoring module). The data synchronization method may specifically include the following steps: Step 1: Start EPG Monitor. When the target terminal completes channel search or the user switches to TV playback mode, start EPG Monitor to begin monitoring and collecting service information in the transport stream.
[0083] Step 2: Configure the MGT filter. The EPG Monitor configures a filter for receiving the MGT (Master Guide Table) based on the fixed PID (Packet Identifier) value (0x1FFB) specified in the ATSC standard. The MGT is a service information index table used to indicate the PID, quantity, and version information of various EITs (Event Information Tables).
[0084] Step 3: Receive and parse the MGT. EPG Monitor captures MGT packets from the transport stream through the MGT filter, assembles them into a complete MGT table, and parses it. After parsing, it obtains metadata for all EIT tables in the current transport stream, including the PID of each EIT table, the table type (such as EIT0, EIT1, etc.), and the expected number of tables to be received.
[0085] Step 4: Set up the Timer. After successfully parsing the MGT, EPG Monitor creates a timer and sets a preset duration (e.g., 5 seconds). This timer is used to periodically check if there is any newly parsed EIT data that needs to be synchronized. The timer is initially inactive.
[0086] Step 5: Start the Timer. EPG Monitor starts the timer, which begins counting from zero and triggers a timeout event every preset duration (5 seconds) to drive periodic synchronization checks.
[0087] Step 6: Configure EIT Filters. EPG Monitor configures filters for each EIT table based on the EIT table information parsed from the MGT. Each EIT filter is configured according to its corresponding PID and is used to capture EIT table data of a specified type from the transport stream. EPG Monitor configures filters for the tables to be received, such as EIT0, EIT1, EIT2, etc., in sequence.
[0088] Step 7: Wait for table data. After all EIT filters are set (or during the setting process), EPG Monitor enters a waiting state, continuously monitoring whether new EIT table data arrives for each EIT filter. This step is a cyclical waiting process until all EIT tables return results or a timeout occurs.
[0089] Step 8: Receive and parse EIT data. Once any EIT filter receives complete EIT table data, EPGMonitor parses the EIT table, extracting EPG information such as program name, start time, duration, and program description, and stores the parsed data in the in-memory database. Then, it determines the type of the EIT table and whether it is the first time it has been received or if the content has been updated.
[0090] Step 9: Determine if the received EIT table is EIT0. The EPG Monitor checks if the currently received and parsed EIT table is EIT0 (i.e., the table carrying information about the programs currently being broadcast). If it is EIT0, immediately proceed to step 10 (send a synchronization message); if it is not EIT0, proceed to step 11 (determine if there is an update).
[0091] Step 10: Send a synchronization message (EIT0 triggered). When the EIT0 table is received, the EPG Monitor immediately sends a synchronization message, triggering the writing of the currently parsed EPG data in memory (including at least the current program information corresponding to EIT0) to the target database (such as tv.db in the Android system, i.e., the TV database). This synchronization operation is event-triggered, ensuring that users can quickly see the current program information after changing channels.
[0092] Step 11: Determine if the EIT table data has been updated. If the received data is not from the EIT0 table (e.g., EIT1, EIT2, etc., program information tables for future time slots), EPG Monitor further determines whether the data in this EIT table has been updated relative to the data already stored in the in-memory database (e.g., version number changes, program time or name changes, etc.). If there are updates, proceed to Step 12; if there are no updates, return to Step 7 and continue waiting for the next table.
[0093] Step 12: Send Synchronization Message (Update Triggered). When updated data is detected, the EPG Monitor sends a synchronization message, triggering the writing of the updated EPG data to the target database. This synchronization is also a form of event-triggered event, ensuring that changes to program information are reflected in the database in a timely manner.
[0094] Step 13: Timeout for 5 seconds. The timer runs independently after startup, triggering a timeout event every 5 seconds. When the timer reaches the preset duration (5 seconds), EPG Monitor will execute Step 14 (check for new data) and Step 15 (send a synchronization message) regardless of whether a new EIT table has arrived. The timer automatically resets after timeout and restarts the next 5-second cycle.
[0095] Step 14: Check for newly received EIT data. In the periodic check triggered by the timer timeout, EPGMonitor determines whether any new EIT table data has been received and parsed since the last timed synchronization (i.e., whether there is any unsynchronized new data in the in-memory database). This can be done by comparing the current record timestamp in the in-memory database with the last synchronization timestamp.
[0096] Step 15: Send Synchronization Message (Timed Trigger). If newly received EIT data is detected as having been received in Step 14, EPGMonitor sends a synchronization message to write this newly parsed EPG data into the target database. This synchronization is timed, supplementing EIT0 event triggering and update event triggering, ensuring that EPG data can be synchronized periodically and gradually even in cases of sparse EIT distribution or low event frequency.
[0097] Step 16: Determine if all EIT filters have returned results. EPG Monitor continuously monitors the status of all configured EIT filters. When each EIT filter has received its corresponding table data (or times out and stops waiting), it is considered that all EIT tables have been processed. This determination can be performed after each EIT table is received, or after each synchronization operation. If all EIT filters have returned results, proceed to Step 17; otherwise, return to Step 7 to continue waiting for the remaining EIT table data.
[0098] Step 17: Send Final Synchronization Message. Once it is determined that all EIT filters have returned results (i.e., all Electronic Program Guide data parsing is complete), EPG Monitor sends a final synchronization message, triggering a full synchronization: all EPG data in the in-memory database (including all previously synchronized and unsynchronized records) are written to the target database at once to ensure data integrity and consistency.
[0099] Step 18: Turn off the Timer. After sending all EIT table data synchronization messages, EPG Monitor stops the timer, releases the system resources occupied by the timer, and stops performing subsequent periodic synchronization checks.
[0100] Step 19: End. The EPG Monitor completes this round of EPG data synchronization and enters an idle state or waits for the next EPG data acquisition to start (e.g., the user searches for channels again or restarts the TV).
[0101] The technical solution adopted in this application embodiment starts a timer after parsing the MGT and sets multiple EIT filters in parallel. Synchronization is triggered immediately upon receiving the EIT0 table, enabling rapid display of current program information. Synchronization is also triggered when other EIT tables are received and updated, ensuring timely updates of program information. Simultaneously, the timer periodically checks and synchronizes new data every 5 seconds to avoid data loss. Finally, a full synchronization is performed and the timer is turned off after all EIT tables are collected. Compared to traditional one-time synchronization schemes, this application embodiment significantly shortens the initial EPG display time, improves user experience, and optimizes system resource usage through automatic start / stop of the timer and incremental synchronization strategies, achieving a good balance between response speed and resource consumption.
[0102] To facilitate better implementation of the data synchronization method of this application, this application also provides a data synchronization device based on the above-described data synchronization method. The meanings of the terms used are the same as in the data synchronization method described above, and specific implementation details can be found in the description of the method embodiments.
[0103] Based on the same inventive concept, and referring to Figure 5This application provides a data synchronization device 500, which includes: The first synchronization module 501 is used to synchronize the currently parsed first electronic program guide data to the target database in response to a target trigger event during the process of the electronic program guide data being processed by the service information processing module of the target terminal. The second synchronization module 502 is used to determine whether there is newly parsed second electronic program guide data at preset intervals during the process of the electronic program guide data being processed by the service information processing module of the target terminal, and to synchronize the second electronic program guide data to the target database when it is determined that there is second electronic program guide data.
[0104] In one embodiment, the target triggering event includes: the service information processing module receiving the current program information table, which is a program information table carrying information about the currently broadcast program.
[0105] In one embodiment, the second synchronization module 502 includes: The counter management submodule is used to create or reset timers in response to the service information processing module obtaining the service information index table; The timing management submodule is used to determine whether there is newly parsed second electronic program guide data when the timer reaches the preset duration, and then reset the timer.
[0106] In one embodiment, the data synchronization device 500 further includes: The stop module is used to stop the timer in response to the service information processing module determining that all electronic program guide data parsing is complete.
[0107] In one embodiment, the target database is a television database; the first synchronization module includes: The first synchronization submodule is used to write the first electronic program guide data from the memory database of the service information processing module into the television database. The second synchronization module includes: The second synchronization submodule is used to write the second electronic program guide data from the memory database of the service information processing module to the television database.
[0108] In one embodiment, the data synchronization device 500 further includes: The third synchronization module is used to synchronize all electronic program guide data to the target database in response to the service information processing module determining that all electronic program guide data parsing has been completed.
[0109] In one embodiment, the first synchronization module 501 includes: The `get` submodule is used to retrieve the service information index table; The settings submodule is used to set the program information table filter based on the service information index table; The receiving submodule is used to receive the program information table through the program information table filter. The storage submodule is used to parse the program information table, obtain electronic program guide data, and store the electronic program guide data in the memory database of the service information processing module.
[0110] The technical solution of this application, by setting up both event-triggered synchronization and timed-triggered synchronization mechanisms in parallel during EPG data processing, enables timely synchronization of parsed EPG data to the target database without waiting for all data parsing to complete. This effectively reduces reliance on external synchronization interface calls while ensuring display quality. Compared to traditional one-time full synchronization schemes, this application significantly shortens the initial display time of EPG data, improving the user's real-time experience of obtaining TV program information. Simultaneously, the timed-triggered mechanism ensures continuous and periodic synchronization of new data, effectively preventing data omissions or long-term retention, achieving a good balance between EPG display response speed and data integrity. Furthermore, it does not rely on active calls from upper-layer applications, improving the reliability of EPG data synchronization.
[0111] Specific limitations regarding the data synchronization device 500 can be found in the limitations of the data synchronization method described above, and will not be repeated here. Each module in the aforementioned data synchronization device 500 can be implemented entirely or partially through software, hardware, or a combination thereof. These modules can be embedded in or independent of the processor in the computer device in hardware form, or stored in the memory of the computer device in software form, so that the processor can call and execute the operations corresponding to each module.
[0112] In addition, this application also provides an electronic device, such as Figure 6 As shown, it illustrates the structural diagram of the electronic device involved in this application, specifically: The electronic device may include components such as a processor 601 with one or more processing cores and a memory 602 with one or more computer-readable storage media. Those skilled in the art will understand that... Figure 6 The electronic device structure shown does not constitute a limitation on the electronic device and may include more or fewer components than shown, or combine certain components, or have different component arrangements. Wherein: The processor 601 is the control center of the electronic device. It connects various parts of the electronic device via various interfaces and lines, and performs various functions and processes data by running or executing software programs and / or modules stored in the memory 602, and by calling data stored in the memory 602, thereby providing overall monitoring of the electronic device. Optionally, the processor 601 may include one or more processing cores; preferably, the processor 601 may integrate an application processor and a modem processor, wherein the application processor mainly handles the operating system, user interface, and applications, and the modem processor mainly handles wireless communication. It is understood that the modem processor may not be integrated into the processor 601.
[0113] The memory 602 can be used to store software programs and modules. The processor 601 executes various functional applications and data processing by running the software programs and modules stored in the memory 602. The memory 602 may mainly include a program storage area and a data storage area. The program storage area may store the operating system, application programs required for at least one function (such as sound playback function, image playback function, etc.), etc.; the data storage area may store data created according to the use of the electronic device, etc. In addition, the memory 602 may include high-speed random access memory, and may also include non-volatile memory, such as at least one disk storage device, flash memory device, or other volatile solid-state storage device. Accordingly, the memory 602 may also include a memory controller to provide the processor 601 with access to the memory 602.
[0114] In one feasible implementation, the electronic device further includes a power supply 603 that supplies power to the various components. Preferably, the power supply 603 can be logically connected to the processor 601 through a power management system, thereby enabling functions such as charging, discharging, and power consumption management through the power management system. The power supply 603 may also include one or more DC or AC power supplies, recharging systems, power equipment debugging circuits, power converters or inverters, power status indicators, and other arbitrary components.
[0115] In one feasible implementation, the electronic device may further include an input unit 604, which can be used to receive input digital or character information and generate keyboard, mouse, joystick, optical or trackball signal inputs related to user settings and function control.
[0116] Although not shown, the electronic device may also include a display unit, etc., which will not be described in detail here. Specifically, in this embodiment, the processor 601 in the electronic device loads the executable files corresponding to the processes of one or more applications into the memory 602 according to the following instructions, and the processor 601 runs the applications stored in the memory 602, thereby implementing the steps in any of the data synchronization methods provided in the embodiments of this application.
[0117] Those skilled in the art will understand that Figure 6 The structure shown is merely a block diagram of a portion of the structure related to the present application and does not constitute a limitation on the electronic device to which the present application is applied. The specific electronic device may include more or fewer components than shown in the figure, or combine certain components, or have different component arrangements.
[0118] In one feasible implementation, an electronic device is provided, including a memory and a processor, wherein the memory stores a computer program, and the processor executes the computer program to implement the methods described in any embodiment of this application.
[0119] In one feasible implementation, a computer-readable storage medium is provided having a computer program stored thereon, which, when executed by a processor, implements the methods described in any embodiment of this application.
[0120] In one feasible implementation, a computer program product is also proposed, comprising a computer program or instructions that, when executed by a processor, implement the methods described in any embodiment of this application.
[0121] For details on the implementation of each of the above operations, please refer to the previous examples, which will not be repeated here.
[0122] Those skilled in the art will understand that all or part of the steps in the various methods of the above embodiments can be performed by instructions, or by instructions controlling related hardware. These instructions can be stored in a computer-readable storage medium and loaded and executed by a processor.
[0123] Therefore, this application provides a computer-readable storage medium storing a computer program that can be loaded by a processor to execute the steps in any of the data synchronization methods provided in this application.
[0124] For details on the implementation of each of the above operations, please refer to the previous examples, which will not be repeated here.
[0125] The computer-readable storage medium may include: read-only memory (ROM), random access memory (RAM), disk or optical disk, etc.
[0126] Since the instructions stored in the computer-readable storage medium can execute the steps of any of the data synchronization methods provided in this application, the beneficial effects that any of the data synchronization methods provided in this application can achieve can be realized, as detailed in the preceding embodiments, and will not be repeated here.
[0127] Finally, it should be noted that in this document, relational terms such as "first" and "second" are used only to distinguish one entity or operation from another, and do not necessarily require or imply any such actual relationship or order between these entities or operations. Furthermore, the terms "comprising," "including," or any other variations thereof are intended to cover non-exclusive inclusion, such that a process, method, article, or terminal device that comprises a list of elements includes not only those elements but also other elements not expressly listed, or elements inherent to such a process, method, article, or terminal device. Without further limitations, an element defined by the phrase "comprising one..." does not exclude the presence of other identical elements in the process, method, article, or terminal device that includes said element.
[0128] The above provides a detailed description of a data synchronization method, apparatus, electronic device, and computer-readable storage medium provided in this application. Specific examples have been used to illustrate the principles and implementation methods of the present invention. The description of the above embodiments is only for the purpose of helping to understand the method and core ideas of the present invention. At the same time, those skilled in the art will recognize that there will be changes in the specific implementation methods and application scope based on the ideas of the present invention. Therefore, the content of this specification should not be construed as a limitation of the present invention.
Claims
1. A data synchronization method, characterized in that, The method includes: During the processing of electronic program guide data in the service information processing module of the target terminal, in response to a target trigger event, the currently parsed first electronic program guide data is synchronized to the target database; and, At preset intervals, it is determined whether there is newly parsed second electronic program guide data, and when it is determined that there is second electronic program guide data, the second electronic program guide data is synchronized to the target database.
2. The data synchronization method according to claim 1, characterized in that, The target triggering event includes: the service information processing module receiving the current program information table, which is a program information table carrying information about the currently broadcast program.
3. The data synchronization method according to claim 1, characterized in that, The determination of whether newly parsed second electronic program guide data exists at each preset interval includes: In response to the service information processing module obtaining the service information index table, a timer is created or reset through the service information processing module. When the timer reaches the preset duration, it is determined whether there is newly parsed second electronic program guide data, and the timer is reset.
4. The data synchronization method according to claim 3, characterized in that, The method further includes: In response to the service information processing module determining that all electronic program guide data parsing is complete, the timer is stopped.
5. The data synchronization method according to claim 1, characterized in that, The target database is a television database; The step of synchronizing the currently parsed first electronic program guide data to the target database includes: The first electronic program guide data is written from the memory database of the service information processing module to the television database; The step of synchronizing the second electronic program guide data to the target database includes: The second electronic program guide data is written from the memory database of the service information processing module to the television database.
6. The data synchronization method according to claim 1, characterized in that, The method further includes: In response to the service information processing module determining that all electronic program guide data parsing is complete, all electronic program guide data is synchronized to the target database.
7. The data synchronization method according to claim 1, characterized in that, The processing of electronic program guide data includes: Retrieve service information index table; Set the program information table filter according to the service information index table; The program information table is received through the program information table filter; The program information table is parsed to obtain electronic program guide data, and the electronic program guide data is stored in the memory database of the service information processing module.
8. A data synchronization device, characterized in that, The device includes: The first synchronization module is used to synchronize the currently parsed first electronic program guide data to the target database in response to a target trigger event during the process of the electronic program guide data being processed by the service information processing module of the target terminal. The second synchronization module is used to determine at preset intervals whether there is newly parsed second electronic program guide data during the process of the service information processing module of the target terminal processing electronic program guide data, and to synchronize the second electronic program guide data to the target database when it is determined that there is second electronic program guide data.
9. An electronic device, characterized in that, It includes a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor executes the computer program to implement the steps of the data synchronization method as described in any one of claims 1 to 7.
10. A computer-readable storage medium, characterized in that, The computer-readable storage medium stores a computer program that, when executed by a processor, implements the steps of the data synchronization method as described in any one of claims 1 to 7.