MediaPortal Forums HTPC/MediaCenter

Go Back   MediaPortal Forum » MediaPortal 1 » Main Features (talk, share your ideas, get support) » Electronic Program Guide » WebEPG


WebEPG everything related to WebEPG in here

Reply
 
LinkBack Thread Tools Display Modes
Old 2006-07-18, 00:43   #1 (permalink)
Portal Member
 
Join Date: Mar 2005
Location: Netherlands, Wageningen
Age: 48
Posts: 10
Thanks: 0
Thanked 0 Times in 0 Posts

Country:


Default Overlapping programs cleanup script for TVGuide

Being an database adminstrator myself, I have written a sql script that removes overlapping programs and leaves the smaller ones. For instance things like 'Nederland 3' and 'Z@pp', CNBC, Jetix,
or 'Science Fiction week' are automatically removed.

I have made 2 sqlscripts;
This first sqlscript only shows the results,
the second one really removes them.

The scripts can be started within 'SQLite Database Browser' found in the Docs directory of mediaportal, use the execute SQL tab.
You need to open the file TVDatabaseV21.db3
in the subdirectory database of mediaportal
Don't forget to save it before exitting SQLite Database Browser.

This is also exactly my present problem: how can I automate this?
Or can it be incorporated in mediaportal tvguide import routine itself?

The first/(show) script:
The name of the overlapping program, the names of the first and the last program within the timeframe of the overlapping program are shown.
Followed by the times:
starttime of the overlapping show,
startime of first show,
endtime of last show and the
endtime of the overlapping show

Code:
Select p1.strTitle
,      p2.strTitle
,      p3.strTitle
,      p1.iStartTime
,      p2.iStartTime
,      p3.iEndTime
,      p1.iEndTime
From   tblPrograms p1
,      tblPrograms p2
,      tblPrograms p3
where  p2.iStartTime >=  p1.iStartTime
and    p2.iEndTime   <   p1.iEndTime
and    p2.idChannel  =   p1.idChannel
and    p3.iStartTime >   p1.iStartTime
and    p3.iEndTime   <=  p1.iEndTime
and    p3.idChannel  =   p1.idChannel
The second/(delete) script:
Code:
Delete tblPrograms p1
where exists (Select 0 
              from tblPrograms p2
              where p2.iStartTime >=  p1.iStartTime
              and   p2.iEndTime   <   p1.iEndTime
              and   p2.idChannel  =   p1.idChannel)
              and  exists (Select 0 
                           from tblPrograms p3
                           where p3.iStartTime >  p1.iStartTime
                           and   p3.iEndTime   <= p1.iEndTime
                           and   p3.idChannel  =  p1.idChannel)
I hope you like it!
Dirk is offline   Reply With Quote
Old 2006-07-18, 00:48   #2 (permalink)
Portal Member
 
Join Date: Mar 2005
Location: Netherlands, Wageningen
Age: 48
Posts: 10
Thanks: 0
Thanked 0 Times in 0 Posts

Country:


Default

Both scripts are bound to the same conditions when finding overlapping programs.
The first script is only there to show you what overlapping programs are found in your tvguide.
The second script will remove them, if you save the file in sqlite browser.
Dirk is offline   Reply With Quote
Old 2006-07-18, 00:56   #3 (permalink)
Portal Member
 
Lyxalig's Avatar
 
Join Date: Jan 2005
Location: Norway
Age: 24
Posts: 268
Thanks: 0
Thanked 0 Times in 0 Posts

Country:

My System

Send a message via MSN to Lyxalig
Default

Ehm.. does not work
__________________
If the MP community isn't able to do it... Who are?
Lyxalig is offline   Reply With Quote
Old 2006-07-18, 00:56   #4 (permalink)
Portal Member
 
Join Date: Mar 2005
Location: Netherlands, Wageningen
Age: 48
Posts: 10
Thanks: 0
Thanked 0 Times in 0 Posts

Country:


Default

The sql-scripts above are versions with a nice layout.
These here are the raw versions. (less spaces)
The first (show) script:
Code:
Select p1.strTitle,p2.strTitle,p3.strTitle, p1.iStartTime, p2.iStartTime,p3.iEndTime, p1.iEndTime
From tblPrograms p1
,    tblPrograms p2
,    tblPrograms p3
where p2.iStartTime >= p1.iStartTime
       and   p2.iEndTime   <  p1.iEndTime
       and   p2.idChannel  =  p1.idChannel
and   p3.iStartTime > p1.iStartTime
       and   p3.iEndTime   <= p1.iEndTime
       and   p3.idChannel  =  p1.idChannel
The second (delete) script
Code:
Delete tblPrograms p1
where exists (Select 0 from tblPrograms p2
       where p2.iStartTime >= p1.iStartTime
       and   p2.iEndTime   <  p1.iEndTime
       and   p2.idChannel  =  p1.idChannel)
and   exists (Select 0 from tblPrograms p3
       where p3.iStartTime >  p1.iStartTime
       and   p3.iEndTime   <= p1.iEndTime
       and   p3.idChannel  =  p1.idChannel)
This time I used the preview option!
:idea:
Dirk is offline   Reply With Quote
Old 2006-07-18, 00:59   #5 (permalink)
Portal Member
 
Lyxalig's Avatar
 
Join Date: Jan 2005
Location: Norway
Age: 24
Posts: 268
Thanks: 0
Thanked 0 Times in 0 Posts

Country:

My System

Send a message via MSN to Lyxalig
Default

Got it.. but it does not return ny data.
__________________
If the MP community isn't able to do it... Who are?
Lyxalig is offline   Reply With Quote
Old 2006-07-18, 01:18   #6 (permalink)
Portal Member
 
Join Date: Mar 2005
Location: Netherlands, Wageningen
Age: 48
Posts: 10
Thanks: 0
Thanked 0 Times in 0 Posts

Country:


Default

The first script should show you the data.
If it shows nothing, then you don't have any overlapping programs.

In this case there is no need to run the second script wich removes the overlappers.

You need to run this second script each day.

If you are sure you have overlapping programs.
Check if you have opened the correct file 'TVDatabaseV21.db3'
Or look for error messages.
Dirk is offline   Reply With Quote
Reply

Bookmarks

Tags
cleanup, overlapping, programs, script, tvguide

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On
Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
Ending Programs with GamePad fredrogers General 6 2007-10-11 16:48
Quickly adding and organizing programs to My Programs GenesisFactor Tips and Tricks 1 2006-08-31 17:00


All times are GMT +1. The time now is 04:42.


Powered by vBulletin® Version 3.7.3
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Search Engine Optimization by vBSEO 3.2.0 Protected by Akismet Blog with WordPress