home
products
contribute
download
documentation
forum
Home
Forums
New posts
Search forums
What's new
New posts
All posts
Latest activity
Members
Registered members
Current visitors
Donate
Log in
Register
What's new
Search
Search
Search titles only
By:
New posts
Search forums
Search titles only
By:
Menu
Log in
Register
Navigation
Install the app
Install
More options
Contact us
Close Menu
Forums
Products
TV-Server
Need advice on writing plugin that modifies EPG database
Contact us
RSS
JavaScript is disabled. For a better experience, please enable JavaScript in your browser before proceeding.
You are using an out of date browser. It may not display this or other websites correctly.
You should upgrade or use an
alternative browser
.
Reply to thread
Message
<blockquote data-quote="Markos" data-source="post: 1242356" data-attributes="member: 82319"><p>Hi,</p><p></p><p>I know this post is very long, so I have highlighted some parts of the text as a <span style="color: #ff0000">TL;DR version</span>.</p><p></p><p>I have been using MP 1 since beta. Originally I had an issue with basically <span style="color: rgb(255, 0, 0)">useless EPG</span> data that was grabbed from DVB-T. The providers were not sending really useful information, e.g. no season and episode number, yet the <span style="color: rgb(255, 0, 0)">title was for example "Friends III (3)"</span>. This prevented me to use periodic recordings in MP, <span style="color: rgb(255, 0, 0)">so I have written small utility that connected to SQL, parsed the titles to episode info and updated the database directly</span>. I was running this task once a day using a scheduler in windows and it worked fine.</p><p></p><p>Recently <span style="color: #ff0000">I have moved to MP2</span>. I have noticed that it uses SQLite for the database, which basically breaks my tools. I'd like to rewrite it and <span style="color: #ff0000">I have some ideas and I'd like to hear your opinion</span>.</p><p></p><p><strong>Modify the old tool</strong></p><p>The easiest way would be to <span style="color: #ff0000">reuse the existing tool and modify the DB directly</span>, however this is quite tricky with SQLite. Perhaps stopping TV Service, running the task and starting it again would work.</p><p>The original SQL script was really fast, it processed the whole database in 1 second and was not memory hungry as it always had only 1 program in memory.</p><p>I'd like to keep this as a backup plan.</p><p></p><p><strong>Write TV Server plugin</strong></p><p>A <span style="color: #ff0000">plugin that updates the database using the TvDatabase assembly</span>.</p><p>The procedure would be:</p><ol> <li data-xf-list-type="ol">Get all programs using Program.ListAll()<br /> </li> <li data-xf-list-type="ol">Parse each program's title and update episode info</li> <li data-xf-list-type="ol">Call Program.Persist() to save each program to database one by one</li> <li data-xf-list-type="ol">(optional) Somehow hook on "EPG grabbing finished" event, it such even exists, so I can modify the data as soon as possible.</li> </ol><p>This way of writing a plugin looks like a way to go, however I think there are major drawbacks:</p><ol> <li data-xf-list-type="ol">Program.ListAll() takes everything in memory at once - there does not seem to be any way to stream the data as needed. I am worried about the plugin taking too much memory during it's maintenance.<br /> </li> <li data-xf-list-type="ol">I have read in some thread that saving too many things to the DB is really slow, in terms of minutes or even hours. Perhaps I misunderstood the other thread, can somebody prove me wrong?</li> </ol><p><strong>Tweak TvDatabase.Program source code</strong></p><p>Download the <span style="color: #ff0000">sources of TvDatabase assembly and edit the "Program.Title" property setter to do the parsing in-place</span>. Then build this assembly and replace the original one.</p><p></p><p>This solution actually looks really elegant, easily implemented, without any performance overheads, and each program would be modified immediately - no need to wait for the once-per-day task to run.</p><p></p><p>Do you see any disadvantage of this solution?</p><p></p><p><strong>Tweak EPG grabber direclty</strong></p><p>Perhaps changing how the grabber parses the data and saves it to DB is the way to go. I have not investigated how that might work or if it is overkill for this task. It is just another idea on top of my head.</p><p></p><p></p><p>Perhaps you have another idea what could I do?</p></blockquote><p></p>
[QUOTE="Markos, post: 1242356, member: 82319"] Hi, I know this post is very long, so I have highlighted some parts of the text as a [COLOR=#ff0000]TL;DR version[/COLOR]. I have been using MP 1 since beta. Originally I had an issue with basically [COLOR=rgb(255, 0, 0)]useless EPG[/COLOR] data that was grabbed from DVB-T. The providers were not sending really useful information, e.g. no season and episode number, yet the [COLOR=rgb(255, 0, 0)]title was for example "Friends III (3)"[/COLOR]. This prevented me to use periodic recordings in MP, [COLOR=rgb(255, 0, 0)]so I have written small utility that connected to SQL, parsed the titles to episode info and updated the database directly[/COLOR]. I was running this task once a day using a scheduler in windows and it worked fine. Recently [COLOR=#ff0000]I have moved to MP2[/COLOR]. I have noticed that it uses SQLite for the database, which basically breaks my tools. I'd like to rewrite it and [COLOR=#ff0000]I have some ideas and I'd like to hear your opinion[/COLOR]. [B]Modify the old tool[/B] The easiest way would be to [COLOR=#ff0000]reuse the existing tool and modify the DB directly[/COLOR], however this is quite tricky with SQLite. Perhaps stopping TV Service, running the task and starting it again would work. The original SQL script was really fast, it processed the whole database in 1 second and was not memory hungry as it always had only 1 program in memory. I'd like to keep this as a backup plan. [B]Write TV Server plugin[/B] A [COLOR=#ff0000]plugin that updates the database using the TvDatabase assembly[/COLOR]. The procedure would be: [LIST=1] [*]Get all programs using Program.ListAll() [*]Parse each program's title and update episode info [*]Call Program.Persist() to save each program to database one by one [*](optional) Somehow hook on "EPG grabbing finished" event, it such even exists, so I can modify the data as soon as possible. [/LIST] This way of writing a plugin looks like a way to go, however I think there are major drawbacks: [LIST=1] [*]Program.ListAll() takes everything in memory at once - there does not seem to be any way to stream the data as needed. I am worried about the plugin taking too much memory during it's maintenance. [*]I have read in some thread that saving too many things to the DB is really slow, in terms of minutes or even hours. Perhaps I misunderstood the other thread, can somebody prove me wrong? [/LIST] [B]Tweak TvDatabase.Program source code[/B] Download the [COLOR=#ff0000]sources of TvDatabase assembly and edit the "Program.Title" property setter to do the parsing in-place[/COLOR]. Then build this assembly and replace the original one. This solution actually looks really elegant, easily implemented, without any performance overheads, and each program would be modified immediately - no need to wait for the once-per-day task to run. Do you see any disadvantage of this solution? [B]Tweak EPG grabber direclty[/B] Perhaps changing how the grabber parses the data and saves it to DB is the way to go. I have not investigated how that might work or if it is overkill for this task. It is just another idea on top of my head. Perhaps you have another idea what could I do? [/QUOTE]
Insert quotes…
Verification
Post reply
Forums
Products
TV-Server
Need advice on writing plugin that modifies EPG database
Contact us
RSS
Top
Bottom