Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 13 of 13
Like Tree2Likes
  • 1 Post By sunfighter
  • 1 Post By sunfighter

Thread: epg with javascript... Anyone know how to make it?

  1. #1
    New to the CF scene
    Join Date
    Mar 2014
    Posts
    8
    Thanks
    5
    Thanked 0 Times in 0 Posts

    epg with javascript... Anyone know how to make it?

    Hello, i have website and i would like to put a javascript on it which will show the actual program for the channel i would like to select. I mean EPG.

    There are xml config files, which contain the requied data, but i don't know how should look the script.. Anyone have one or have idea how to make it?

    This is the file i am talking about:

    http://sd-xbmc.org/xbmc/epg/epg.xml


    it works great with applications like xbmc or simpleTV...

    For example simpleTV screenshoot:

    http://zapodaj.net/f4f304f1c16b1.png.html

    the simpleTV download:

    SimpleTV 0.4.7 r2 setup (VLC 2.0.5).exe — RGhost — udostępnianie plików

    Of corse not infected, i checked it.

    Anyone have time to figure it out? It would be nice!
    Regards

  • #2
    Senior Coder
    Join Date
    Jan 2011
    Location
    Missouri
    Posts
    4,486
    Thanks
    23
    Thanked 636 Times in 635 Posts
    @jasiek07, This is a simple xml file. I would use php to get the file, save it, and process it. It is very big; 20,667,160 that's ~20.7Mb. I would load the four smaller files
    epg_weebtv_CST.xml
    epg_weebtv_EST.xml
    epg_weebtv_GMT.xml
    epg_weebtv_PST.xml

    This is php to down load and save a file:
    PHP Code:
    set_time_limit(45);  // THIS MIGHT BE SET HIGHER FOR BIGGER FILES
    $dom = new DOMDocument();
    $dom->load('http://sd-xbmc.org/xbmc/epg/epg_weebtv_CST.xml');
    $dom->save('TV.xml'); 
    Once saved as file TV.xml you can read it :
    PHP Code:
    $xml=simplexml_load_file("TV.xml");
    $me "sub-title";
    foreach(
    $xml->programme as $item){
        echo 
    "Start time : ".$item["start"]. "<br>";
        echo 
    "End time : ".$item["stop"]. "<br>";
        echo 
    "Channel : ".$item["channel"]. "<br>";
        echo 
    "Title : ".$item->title"<br>";
        echo 
    "Sub Title : ".$item->$me"<br>";
        echo 
    "Description : ".$item->desc"<br>";
        echo 
    "<br>";

    I leave it up to you to style it. You might want to do some reading on xml. XML Tutorial
    jasiek07 likes this.
    Evolution - The non-random survival of random variants.

    "If you leave hydrogen alone, for long enough, it begins to think about itself."

  • Users who have thanked sunfighter for this post:

    jasiek07 (03-30-2014)

  • #3
    New to the CF scene
    Join Date
    Mar 2014
    Posts
    8
    Thanks
    5
    Thanked 0 Times in 0 Posts
    Thank you very much! But still one problem to solve..
    It somehow must show the program which actually run on the specific channel. So i tried to make something like that:

    <?php
    $xml = simplexml_load_file('xml.xml');
    $channel = 'TVP2.pl';
    $key = 0;
    foreach ($xml->programme as $index) {
    $id = $xml -> programme[$key] -> attributes();
    if ($id['channel'] == $channel) {
    echo 'Leci: '.$xml -> programme[$key] -> title;
    echo '<br>Opis: '.$xml -> programme[$key] -> desc;
    break;
    }
    $key++;
    }
    ?>
    It shows the 1st program in the row for the specific channel. But it realized me, that the 1st one is not the one which actually runs... It looks like, some javascript would read the actual date and time and compare it with the one from this php file, then it will show the program which is already running now. Someone have idea how to achieve that?
    Sorry for my eng. Thank for help!

  • #4
    New to the CF scene
    Join Date
    Mar 2014
    Posts
    8
    Thanks
    5
    Thanked 0 Times in 0 Posts
    The date is something like that: 20140328215000 -0500, where:
    2014 - year
    03- month
    28- day
    21- hour
    50- min
    00- sec

    but that -0500 i don't know what means.

  • #5
    Senior Coder
    Join Date
    Jan 2011
    Location
    Missouri
    Posts
    4,486
    Thanks
    23
    Thanked 636 Times in 635 Posts
    The time that is given in the xml is funny. 20140328215000 -0500 tells me that the program for the 28th of March 2014 starts at 10 minutes before 10 O'clock. Does that sound right; 10 minutes before the hour? And I have no idea what the -0500 means.
    jasiek07 likes this.
    Evolution - The non-random survival of random variants.

    "If you leave hydrogen alone, for long enough, it begins to think about itself."

  • Users who have thanked sunfighter for this post:

    jasiek07 (03-31-2014)

  • #6
    Senior Coder xelawho's Avatar
    Join Date
    Nov 2010
    Posts
    2,984
    Thanks
    56
    Thanked 557 Times in 554 Posts
    I'm guessing that the -0500 would be the time zone, GMT -0500 being Eastern Daylight Time (east coast USA)

  • Users who have thanked xelawho for this post:

    jasiek07 (03-31-2014)

  • #7
    New to the CF scene
    Join Date
    Mar 2014
    Posts
    8
    Thanks
    5
    Thanked 0 Times in 0 Posts
    Quote Originally Posted by sunfighter View Post
    The time that is given in the xml is funny. 20140328215000 -0500 tells me that the program for the 28th of March 2014 starts at 10 minutes before 10 O'clock. Does that sound right; 10 minutes before the hour? And I have no idea what the -0500 means.
    yees, 28th march at 22:50 - program start

  • #8
    New to the CF scene
    Join Date
    Mar 2014
    Posts
    8
    Thanks
    5
    Thanked 0 Times in 0 Posts
    Quote Originally Posted by sunfighter View Post
    The time that is given in the xml is funny. 20140328215000 -0500 tells me that the program for the 28th of March 2014 starts at 10 minutes before 10 O'clock. Does that sound right; 10 minutes before the hour? And I have no idea what the -0500 means.
    yees, 28th march at 22:50 - program start

  • #9
    Senior Coder
    Join Date
    Jan 2011
    Location
    Missouri
    Posts
    4,486
    Thanks
    23
    Thanked 636 Times in 635 Posts
    Thanks for that xelawho
    Try this jasiek07 Do you need to do anything else?
    PHP Code:
    <?php
    $xml
    =simplexml_load_file("TV.xml");
    $me "sub-title";
    foreach(
    $xml->programme as $item){
        echo 
    "Start time : " .date("g:i A"strtotime(substr($item["start"], 0,  -6))) . '<br>';
        echo 
    "End time : " .date("g:i A"strtotime(substr($item["stop"], 0,  -6))) . '<br>';
        echo 
    "Channel : ".$item["channel"]. "<br>";
        echo 
    "Title : ".$item->title"<br>";
        echo 
    "Sub Title : ".$item->$me"<br>";
        echo 
    "Description : ".$item->desc"<br>";
        echo 
    "<br>";
    }
    ?>
    Evolution - The non-random survival of random variants.

    "If you leave hydrogen alone, for long enough, it begins to think about itself."

  • Users who have thanked sunfighter for this post:

    jasiek07 (04-01-2014)

  • #10
    New to the CF scene
    Join Date
    Mar 2014
    Posts
    8
    Thanks
    5
    Thanked 0 Times in 0 Posts
    Quote Originally Posted by sunfighter View Post
    Thanks for that xelawho
    Try this jasiek07 Do you need to do anything else?
    PHP Code:
    <?php
    $xml
    =simplexml_load_file("TV.xml");
    $me "sub-title";
    foreach(
    $xml->programme as $item){
        echo 
    "Start time : " .date("g:i A"strtotime(substr($item["start"], 0,  -6))) . '<br>';
        echo 
    "End time : " .date("g:i A"strtotime(substr($item["stop"], 0,  -6))) . '<br>';
        echo 
    "Channel : ".$item["channel"]. "<br>";
        echo 
    "Title : ".$item->title"<br>";
        echo 
    "Sub Title : ".$item->$me"<br>";
        echo 
    "Description : ".$item->desc"<br>";
        echo 
    "<br>";
    }
    ?>
    it's nice, but there is no date as well. only the time.
    And in addition is there any tool which could read My date and time, then compare them to this script to find the program which is already running?
    My achievement is to get the info about the program which is running now, when i use the script.
    I mean something like that:

    I run the script called TVPuls.php and it shows the info what is running now on this channel (+ the time: start, end time) with those informations like Title, subtitle, etc you provided. It is possible? Thanks and regards,

  • #11
    New to the CF scene
    Join Date
    Mar 2014
    Posts
    8
    Thanks
    5
    Thanked 0 Times in 0 Posts
    Quote Originally Posted by sunfighter View Post
    Thanks for that xelawho
    Try this jasiek07 Do you need to do anything else?
    PHP Code:
    <?php
    $xml
    =simplexml_load_file("TV.xml");
    $me "sub-title";
    foreach(
    $xml->programme as $item){
        echo 
    "Start time : " .date("g:i A"strtotime(substr($item["start"], 0,  -6))) . '<br>';
        echo 
    "End time : " .date("g:i A"strtotime(substr($item["stop"], 0,  -6))) . '<br>';
        echo 
    "Channel : ".$item["channel"]. "<br>";
        echo 
    "Title : ".$item->title"<br>";
        echo 
    "Sub Title : ".$item->$me"<br>";
        echo 
    "Description : ".$item->desc"<br>";
        echo 
    "<br>";
    }
    ?>
    it's nice, but there is no date as well. only the time.
    And in addition is there any tool which could read My date and time, then compare them to this script to find the program which is already running?
    My achievement is to get the info about the program which is running now, when i use the script.
    I mean something like that:

    I run the script called TVPuls.php and it shows the info what is running now on this channel (+ the time: start, end time) with those informations like Title, subtitle, etc you provided. It is possible? Thanks and regards,

  • #12
    Senior Coder
    Join Date
    Jan 2011
    Location
    Missouri
    Posts
    4,486
    Thanks
    23
    Thanked 636 Times in 635 Posts
    And what? Can't you use the manual and do this yourself?
    Manual page: PHP: date - Manual
    Your going to style this yourself anyway.
    I wouldn't put the date for every program. I'd have it on the top of the page.
    Evolution - The non-random survival of random variants.

    "If you leave hydrogen alone, for long enough, it begins to think about itself."

  • Users who have thanked sunfighter for this post:

    jasiek07 (04-01-2014)

  • #13
    New to the CF scene
    Join Date
    Mar 2014
    Posts
    8
    Thanks
    5
    Thanked 0 Times in 0 Posts
    Thank you, i will try with that, and post the results, regards!


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •