Advertisement
Kurobeats

Australian FreeView

Apr 29th, 2017
88
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. showsVIC = {};
  2. showsNSW = {};
  3. showsQLD = {};
  4. showsSA = {};
  5. showsWA = {};
  6.  
  7. //ORDER:
  8. // 1. Load page
  9. // 2. Create channel objects
  10. // 3. Load guide data
  11. // 4. Display guide/channels
  12.  
  13. //  Channel Class  //
  14. function Channel(name, URLs) {
  15.     this.name = name;
  16.     this.URLs = URLs;
  17.     this.currentShows = {VIC:"", NSW:"", QLD:"", SA:"", WA:""};
  18.     this.onNow;
  19. }
  20.  
  21. Channel.prototype = {
  22.   getName:function () {
  23.     return this.name;
  24.   },
  25.  
  26.   getIconName:function () {
  27.     return this.name + ".png";
  28.   },
  29.  
  30.   getURLForState:function (state) {
  31.     return this.URLs[state];
  32.   },
  33.  
  34.   setCurrentShowsForState:function (currentShows, state) {
  35.     this.currentShows[state] = currentShows;
  36.   },
  37.  
  38.   getCurrentShowsForState:function (state) {
  39.     return this.currentShows[state];
  40.   },
  41.  
  42.   setOnNow:function (onNow) {
  43.     this.onNow = onNow;
  44.   },
  45.  
  46.   getOnNow:function () {
  47.     return this.onNow;
  48.   }
  49. }
  50.  
  51.  
  52. //  Function to initalise all channels  //
  53.  
  54. function createChannels() {
  55.   chABC = new Channel("ABC", {
  56.     VIC:"https://abctvlivehls-lh.akamaihd.net/i/abc1_1@360323/master.m3u8",
  57.     NSW:"https://abctvlivehls-lh.akamaihd.net/i/abc1_1@360323/master.m3u8",
  58.     QLD:"https://abctvlivehls-lh.akamaihd.net/i/abc1_1@360323/master.m3u8",
  59.     SA:"https://abctvlivehls-lh.akamaihd.net/i/abc1_1@360323/master.m3u8",
  60.     WA:"https://abctvlivehls-lh.akamaihd.net/i/abc1_1@360323/master.m3u8"
  61.   });
  62.   chSBS = new Channel("SBS", {
  63.     VIC:"http://sbslivefvstreaming.sbs.com.au/out/u/sbs1-mo-000-c3093-delpkg1-delpkg1-abr/index-root-ipad.m3u8",
  64.     NSW:"http://sbslivefvstreaming.sbs.com.au/out/u/sbs1-mo-000-c3093-delpkg1-delpkg1-abr/index-root-ipad.m3u8",
  65.     QLD:"http://sbslivefvstreaming.sbs.com.au/out/u/sbs1-mo-000-c3093-delpkg1-delpkg1-abr/index-root-ipad.m3u8",
  66.     SA:"http://sbslivefvstreaming.sbs.com.au/out/u/sbs1-mo-000-c3093-delpkg1-delpkg1-abr/index-root-ipad.m3u8",
  67.     WA:"http://sbslivefvstreaming.sbs.com.au/out/u/sbs1-mo-000-c3093-delpkg1-delpkg1-abr/index-root-ipad.m3u8"
  68.   });
  69.   ch7 = new Channel("7", {
  70.     VIC:"https://melbourneseven-i.akamaihd.net/hls/live/263658/MEL1/master.m3u8",
  71.     NSW:"https://sydneyseven-i.akamaihd.net/hls/live/263630/SYD1/master.m3u8",
  72.     QLD:"https://brisbaneseven-i.akamaihd.net/hls/live/263663/BRI1/master.m3u8",
  73.     SA:"https://adelaideseven-i.akamaihd.net/hls/live/263667/ADE1/master.m3u8",
  74.     WA:"https://perthseven-i.akamaihd.net/hls/live/263674/PER1/master.m3u8"
  75.   });
  76.     ch9 = new Channel("9", {
  77.     VIC:"https://9nowch9livehls-i.akamaihd.net/hls/live/250962/melbourne/master.m3u8",
  78.     NSW:"https://9nowch9livehls-i.akamaihd.net/hls/live/250964/sydney/master.m3u8",
  79.     QLD:"https://9nowch9livehls-i.akamaihd.net/hls/live/250961/brisbane/master.m3u8",
  80.     SA:"https://9nowch9livehls-i.akamaihd.net/hls/live/250960/adelaide/master.m3u8",
  81.     WA:"https://9nowch9livehls-i.akamaihd.net/hls/live/250963/perth/master.m3u8"
  82.   });
  83.   ch10 = new Channel("10", {
  84.     VIC:"http://csm-e.cds1.yospace.com/csm/extlive/networkten01,SDATV.m3u8",
  85.     NSW:"http://csm-e.cds1.yospace.com/csm/extlive/networkten01,SDTEN.m3u8",
  86.     QLD:"http://csm-e.cds1.yospace.com/csm/extlive/networkten01,SDTVQ.m3u8",
  87.     SA:"http://csm-e.cds1.yospace.com/csm/extlive/networkten01,SDADS.m3u8",
  88.     WA:"http://csm-e.cds1.yospace.com/csm/extlive/networkten01,SDNEW.m3u8"
  89.   });
  90.   chABC2 = new Channel("ABC2", {
  91.     VIC:"https://abctvlivehls-lh.akamaihd.net/i/abckids_1@327097/master.m3u8",
  92.     NSW:"https://abctvlivehls-lh.akamaihd.net/i/abckids_1@327097/master.m3u8",
  93.     QLD:"https://abctvlivehls-lh.akamaihd.net/i/abckids_1@327097/master.m3u8",
  94.     SA:"https://abctvlivehls-lh.akamaihd.net/i/abckids_1@327097/master.m3u8",
  95.     WA:"https://abctvlivehls-lh.akamaihd.net/i/abckids_1@327097/master.m3u8"
  96.   });
  97.   chABCME = new Channel("ABCME", {
  98.     VIC:"https://abctvlivehls-lh.akamaihd.net/i/abc3_1@332134/master.m3u8",
  99.     NSW:"https://abctvlivehls-lh.akamaihd.net/i/abc3_1@332134/master.m3u8",
  100.     QLD:"https://abctvlivehls-lh.akamaihd.net/i/abc3_1@332134/master.m3u8",
  101.     SA:"https://abctvlivehls-lh.akamaihd.net/i/abc3_1@332134/master.m3u8",
  102.     WA:"https://abctvlivehls-lh.akamaihd.net/i/abc3_1@332134/master.m3u8"
  103.   });
  104.   chABCNews = new Channel("ABCNews", {
  105.     VIC:"https://abcnews24hls-lh.akamaihd.net/i/news24_1@3259/master.m3u8",
  106.     NSW:"https://abcnews24hls-lh.akamaihd.net/i/news24_1@3259/master.m3u8",
  107.     QLD:"https://abcnews24hls-lh.akamaihd.net/i/news24_1@3259/master.m3u8",
  108.     SA:"https://abcnews24hls-lh.akamaihd.net/i/news24_1@3259/master.m3u8",
  109.     WA:"https://abcnews24hls-lh.akamaihd.net/i/news24_1@3259/master.m3u8"
  110.   });
  111.   chSBSViceland = new Channel("SBSViceland", {
  112.     VIC:"http://sbslivefvstreaming.sbs.com.au/out/u/sbs2-mo-000-c3093-delpkg1-delpkg1-abr/index-root-ipad.m3u8",
  113.     NSW:"http://sbslivefvstreaming.sbs.com.au/out/u/sbs2-mo-000-c3093-delpkg1-delpkg1-abr/index-root-ipad.m3u8",
  114.     QLD:"http://sbslivefvstreaming.sbs.com.au/out/u/sbs2-mo-000-c3093-delpkg1-delpkg1-abr/index-root-ipad.m3u8",
  115.     SA:"http://sbslivefvstreaming.sbs.com.au/out/u/sbs2-mo-000-c3093-delpkg1-delpkg1-abr/index-root-ipad.m3u8",
  116.     WA:"http://sbslivefvstreaming.sbs.com.au/out/u/sbs2-mo-000-c3093-delpkg1-delpkg1-abr/index-root-ipad.m3u8"
  117.   });
  118.   chSBSFood = new Channel("SBSFood", {
  119.     VIC:"http://sbslivefvstreaming.sbs.com.au/out/u/fdnet-mo-000-c3094-delpkg1-delpkg1-abr/index-root-ipad.m3u8",
  120.     NSW:"http://sbslivefvstreaming.sbs.com.au/out/u/fdnet-mo-000-c3094-delpkg1-delpkg1-abr/index-root-ipad.m3u8",
  121.     QLD:"http://sbslivefvstreaming.sbs.com.au/out/u/fdnet-mo-000-c3094-delpkg1-delpkg1-abr/index-root-ipad.m3u8",
  122.     SA:"http://sbslivefvstreaming.sbs.com.au/out/u/fdnet-mo-000-c3094-delpkg1-delpkg1-abr/index-root-ipad.m3u8",
  123.     WA:"http://sbslivefvstreaming.sbs.com.au/out/u/fdnet-mo-000-c3094-delpkg1-delpkg1-abr/index-root-ipad.m3u8"
  124.   });
  125.   chNITV = new Channel("NITV", {
  126.     VIC:"http://sbslivefvstreaming.sbs.com.au/out/u/nitv-mo-000-c3094-delpkg1-delpkg1-abr/index-root-ipad.m3u8",
  127.     NSW:"http://sbslivefvstreaming.sbs.com.au/out/u/nitv-mo-000-c3094-delpkg1-delpkg1-abr/index-root-ipad.m3u8",
  128.     QLD:"http://sbslivefvstreaming.sbs.com.au/out/u/nitv-mo-000-c3094-delpkg1-delpkg1-abr/index-root-ipad.m3u8",
  129.     SA:"http://sbslivefvstreaming.sbs.com.au/out/u/nitv-mo-000-c3094-delpkg1-delpkg1-abr/index-root-ipad.m3u8",
  130.     WA:"http://sbslivefvstreaming.sbs.com.au/out/u/nitv-mo-000-c3094-delpkg1-delpkg1-abr/index-root-ipad.m3u8"
  131.   });
  132.   ch7TWO = new Channel("7TWO", {
  133.     VIC:"https://melbourneseven-i.akamaihd.net/hls/live/263659/MEL2/master.m3u8",
  134.     NSW:"https://sydneyseven-i.akamaihd.net/hls/live/263631/SYD2/master.m3u8",
  135.     QLD:"https://brisbaneseven-i.akamaihd.net/hls/live/263664/BRI2/master.m3u8",
  136.     SA:"https://adelaideseven-i.akamaihd.net/hls/live/263668/ADE2/master.m3u8",
  137.     WA:"https://perthseven-i.akamaihd.net/hls/live/263675/PER2/master.m3u8"
  138.   });
  139.   ch7mate = new Channel("7mate", {
  140.     VIC:"https://melbourneseven-i.akamaihd.net/hls/live/263661/MEL3/master.m3u8",
  141.     NSW:"https://sydneyseven-i.akamaihd.net/hls/live/263632/SYD3/master.m3u8",
  142.     QLD:"https://brisbaneseven-i.akamaihd.net/hls/live/263665/BRI3/master.m3u8",
  143.     SA:"https://adelaideseven-i.akamaihd.net/hls/live/263669/ADE3/master.m3u8",
  144.     WA:"https://perthseven-i.akamaihd.net/hls/live/263676/PER3/master.m3u8"
  145.   });
  146.   ch7flix = new Channel("7flix", {
  147.     VIC:"https://melbourneseven-i.akamaihd.net/hls/live/263662/MEL6/master.m3u8",
  148.     NSW:"https://sydneyseven-i.akamaihd.net/hls/live/263634/SYD6/master.m3u8",
  149.     QLD:"https://brisbaneseven-i.akamaihd.net/hls/live/263666/BRI6/master.m3u8",
  150.     SA:"https://adelaideseven-i.akamaihd.net/hls/live/263670/ADE6/master.m3u8",
  151.     WA:"https://perthseven-i.akamaihd.net/hls/live/263677/PER6/master.m3u8"
  152.   });
  153.   ch9Gem = new Channel("9Gem", {
  154.     VIC:"https://9nowgemlivehls-i.akamaihd.net/hls/live/250972/melbourne/master.m3u8",
  155.     NSW:"https://9nowgemlivehls-i.akamaihd.net/hls/live/250974/sydney/master.m3u8",
  156.     QLD:"https://9nowgemlivehls-i.akamaihd.net/hls/live/250971/brisbane/master.m3u8",
  157.     SA:"https://9nowgemlivehls-i.akamaihd.net/hls/live/250970/adelaide/master.m3u8",
  158.     WA:"https://9nowgemlivehls-i.akamaihd.net/hls/live/250973/perth/master.m3u8"
  159.   });
  160.   ch9Go = new Channel("9Go", {
  161.     VIC:"https://9nowgolivehls-i.akamaihd.net/hls/live/250977/melbourne/master.m3u8",
  162.     NSW:"https://9nowgolivehls-i.akamaihd.net/hls/live/250987/sydney/master.m3u8",
  163.     QLD:"https://9nowgolivehls-i.akamaihd.net/hls/live/250976/brisbane/master.m3u8",
  164.     SA:"https://9nowgolivehls-i.akamaihd.net/hls/live/250975/adelaide/master.m3u8",
  165.     WA:"https://9nowgolivehls-i.akamaihd.net/hls/live/250978/perth/master.m3u8"
  166.   });
  167.   ch9Life = new Channel("9Life", {
  168.     VIC:"https://9nowlifelivehls-i.akamaihd.net/hls/live/250992/melbourne/master.m3u8",
  169.     NSW:"https://9nowlifelivehls-i.akamaihd.net/hls/live/250994/sydney/master.m3u8",
  170.     QLD:"https://9nowlifelivehls-i.akamaihd.net/hls/live/250991/brisbane/master.m3u8",
  171.     SA:"https://9nowlifelivehls-i.akamaihd.net/hls/live/250990/adelaide/master.m3u8",
  172.     WA:"https://9nowlifelivehls-i.akamaihd.net/hls/live/250993/perth/master.m3u8"
  173.   });
  174.   chRacing = new Channel("Racing", {
  175.     VIC:"https://melbourneseven-i.akamaihd.net/hls/live/263815/RAC/master.m3u8",
  176.     NSW:"https://melbourneseven-i.akamaihd.net/hls/live/263815/RAC/master.m3u8",
  177.     QLD:"https://melbourneseven-i.akamaihd.net/hls/live/263815/RAC/master.m3u8",
  178.     SA:"https://melbourneseven-i.akamaihd.net/hls/live/263815/RAC/master.m3u8",
  179.     WA:"https://melbourneseven-i.akamaihd.net/hls/live/263815/RAC/master.m3u8"
  180.   });
  181.  
  182.   channels = [chABC, chSBS, ch7, ch9, ch10, chABC2, chABCME, chABCNews, chSBSViceland, chSBSFood, chNITV, ch7TWO, ch7mate, ch7flix, ch9Gem, ch9Go, ch9Life, chRacing];
  183.   console.log("Successfully created channels");
  184.   return channels;
  185.  
  186. }
  187.  
  188. //  Create guide divs  //
  189.  
  190. function createGuideDivs() {
  191.   for (channel in channels) {
  192.     //var newGuideChannel = $(".guide").clone();
  193.     //newGuideChannel.attr("id", "ch" + channels[channel].getName())
  194.  
  195.     var template = [
  196.       '<li class="container guide" id="' + channels[channel].getName() + '">',
  197.         '<div class="logoCol">',
  198.           '<img class="channelLogo" src="Icons/' + channels[channel].getIconName() + '" alt="' + channels[channel].getName() + '">',
  199.         '</div>',
  200.         '<div class="currentShowCol">',
  201.           '<div class="showTime"></div>',
  202.           '<div class="showTitle">' + channels[channel].getName() + '</div>',
  203.           '<div class="showSubtitle"></div>',
  204.         '</div>',
  205.         '<div class="nextShowCol">',
  206.           '<div class="showTime"></div>',
  207.           '<div class="showTitle"></div>',
  208.           '<div class="showSubtitle"></div>',
  209.         '</div>',
  210.       '</li>'
  211.     ].join("\n");
  212.     $(".guideList").append(template);
  213.   }
  214. }
  215.  
  216.  
  217. jQuery(document).ready(function($) {
  218.  
  219.   currentHeader = Math.floor(Math.random() * (2 - 0)) - 1;
  220.   randomHeader();
  221.   channels = createChannels();
  222.   createGuideDivs();
  223.   loadGuide();
  224.  
  225.   try {
  226.     if (localStorage["state"]) {
  227.         var state = localStorage["state"];
  228.         $(".current-state").text(state);
  229.     } else {
  230.         localStorage["state"] = "VIC";
  231.         $(".current-state").text(localStorage["state"]);
  232.     }
  233.  
  234.     if (localStorage["channel"]) {
  235.       if (localStorage["channel"].slice(0,2) != "ch") {
  236.         localStorage["channel"] = "ch" + localStorage["channel"]
  237.       }
  238.  
  239.     } else {
  240.         localStorage["channel"] = "ch7";
  241.     }
  242.  
  243.     channel = window[localStorage["channel"]];
  244.     loadVideo(channel);
  245.     updateVideoInfo();
  246.  
  247.   } catch (e) {
  248.       console.log("Error when reading from local storage. Probably in private mode.\n" + e);
  249.   }
  250.  
  251.   //When the user clicks on a state, change the saved state and load the stream for that state
  252.     $(".state").click(function() {
  253.         var state = $(this).text();
  254.         localStorage["state"] = state;
  255.         $(".current-state").text(state);
  256.  
  257.     var channelToLoad = window[localStorage["channel"]];
  258.     loadVideo(channelToLoad);
  259.     loadGuide();
  260.     });
  261.  
  262.   //When the user clicks on the guide, load the selected channel
  263.   $(".guide").click(function() {
  264.     channelName = "ch" + $(this).attr("id");
  265.     localStorage["channel"] = channelName;
  266.  
  267.     var channelToLoad = window[localStorage["channel"]];
  268.     loadVideo(channelToLoad);
  269.  
  270.     updateVideoInfo();
  271.  
  272.   });
  273.  
  274.   //When the user clicks on the header, change the font
  275.   $(".title").click(function() {
  276.     randomHeader();
  277.  
  278.   });
  279.  
  280.   window.onclick = function(event) {
  281.     if (!event.target.matches('.current-state')) {
  282.  
  283.       var dropdowns = document.getElementsByClassName("dropdown-content");
  284.       var i;
  285.       for (i = 0; i < dropdowns.length; i++) {
  286.         var openDropdown = dropdowns[i];
  287.         if (openDropdown.classList.contains('show')) {
  288.           openDropdown.classList.remove('show');
  289.         }
  290.       }
  291.     }
  292.   }
  293.  
  294.   loadGuide();
  295.  
  296. });
  297.  
  298. function randomHeader() {
  299.   headers = ["headerOriginal", "headerBlond", "headerTLOP"];
  300.   if (currentHeader < 2) {
  301.     currentHeader ++;
  302.   } else {
  303.     currentHeader = 0;
  304.   }
  305.   if (currentHeader < 2) {
  306.     $(".title").html("<h1 id='" + headers[currentHeader] + "'>Streamee</h1>");
  307.   } else {
  308.     $(".title").html("<img src='/Fonts/TLOP.png' class='headerLogo'>");
  309.   }
  310.  
  311. }
  312.  
  313. function updateVideoInfo() {
  314.   currentChannel = localStorage["channel"];
  315.   currentShow = window[currentChannel].getOnNow();
  316.   try {
  317.     $(".iShowTitle").text(currentShow.name);
  318.     $(".iShowSubtitle").text(currentShow.subtitle);
  319.     $(".iShowDesc").text(currentShow.description);
  320.   } catch (e) {
  321.     $(".iShowTitle").text(window[currentChannel].getName());
  322.     $(".iShowSubtitle").text("");
  323.     $(".iShowDesc").text("");
  324.   }
  325. }
  326.  
  327. function getCurrentStream() {
  328.     var player = videojs('video');
  329. }
  330.  
  331.  
  332. function playStream(stream) {
  333.   $('.videocontent video source').attr('src', stream);
  334.   $(".videocontent video")[0].load();
  335.   var player = videojs('video');
  336.   player.pause();
  337.   player.src({ type: "application/x-mpegURL", src: stream });
  338.   player.load();
  339.   player.play();
  340. }
  341.  
  342.  
  343. function loadVideo(channelToLoad) {
  344.  
  345.     if (channelToLoad) {
  346.     var stream = channelToLoad.getURLForState(localStorage["state"]);
  347.  
  348.     if (channelToLoad.name.includes("ABC")) {
  349.       var player = videojs('video');
  350.       player.pause();
  351.       //need to get token - ugh
  352.       var token = 'L$#_rR7}K3IaB';
  353.       var tokenURL = 'https://freeview-fv.global.ssl.fastly.net/288/epgApi/getToken?region=Melbourne&network=ABC&channel_id=101002210221&format=html&token=L$%23_rR7}K3IaB';
  354.  
  355.       var xmlHttp = new XMLHttpRequest();
  356.       xmlHttp.onreadystatechange = function() {
  357.           if (xmlHttp.readyState == 4 && xmlHttp.status == 200) {
  358.             playStream(stream + '?' + xmlHttp.responseText);
  359.           }
  360.       }
  361.       xmlHttp.open("GET", tokenURL, true); // true for asynchronous
  362.       xmlHttp.send(null);
  363.     } else {
  364.       playStream(stream);
  365.     }
  366.     }
  367. }
  368.  
  369. function toggleDropdown() {
  370.   document.getElementById("myDropdown").classList.toggle("show");
  371. }
  372.  
  373. function loadGuide() {
  374.   date = new Date($.now()); //get current time/date
  375.   JSONfile = "Guide/" + getDate() + ".json"
  376.  
  377.   $.getJSON(JSONfile, function( data ) {
  378.     $.each( data, function( key, val ) {
  379.  
  380.       if (key == "VIC") {
  381.         showsVIC = val;
  382.       } else if (key == "NSW") {
  383.         showsNSW = val;
  384.       } else if (key == "QLD") {
  385.         showsQLD = val;
  386.       } else if (key == "SA") {
  387.         showsSA = val;
  388.       } else if (key == "WA") {
  389.         showsWA = val;
  390.       }
  391.  
  392.     });
  393.     saveGuideData();
  394.     getCurrentShows();
  395.     setInterval(getCurrentShows, 60*1000);
  396.  
  397.   });
  398.  
  399. }
  400.  
  401. function saveGuideData() {
  402.   for (channel in channels) {
  403.     channels[channel].setCurrentShowsForState(showsVIC[channels[channel].getName()], "VIC");
  404.     channels[channel].setCurrentShowsForState(showsNSW[channels[channel].getName()], "NSW");
  405.     channels[channel].setCurrentShowsForState(showsQLD[channels[channel].getName()], "QLD");
  406.     channels[channel].setCurrentShowsForState(showsSA[channels[channel].getName()], "SA");
  407.     channels[channel].setCurrentShowsForState(showsWA[channels[channel].getName()], "WA");
  408.   }
  409.   console.log("Guide data saved to channels");
  410. }
  411.  
  412. function convertDate(date) {
  413.   //var myDate = "20161029140000";
  414.   year = date.slice(0,4);
  415.   month = parseInt(date.slice(4,6));
  416.   day = date.slice(6,8);
  417.   hour = date.slice(8,10);
  418.   minutes = date.slice(10,12);
  419.   tz = date.slice(15,20);
  420.   //date = new Date(year, month, day, hour, minutes);
  421.   newDate = new Date(month + '/' + day + '/' + year + ' ' + hour + ':' + minutes + ':00 UTC')
  422.  
  423.   return newDate;
  424. }
  425.  
  426.  
  427. function getCurrentShows() {
  428.   console.log("Getting current shows");
  429.   currentDate = new Date($.now()); //get current time/date
  430.   var state = localStorage["state"];
  431.   for (channel in channels) {
  432.     showList = channels[channel].getCurrentShowsForState(state);
  433.  
  434.     for (show in showList) {
  435.       showDate = convertDate(showList[show].start_time);
  436.       if (showDate > currentDate) {
  437.         channels[channel].setOnNow(showList[show-1]);
  438.  
  439.         channelName = channels[channel].getName();
  440.         currentShow = showList[show-1];
  441.         nextShow = showList[show];
  442.  
  443.         //Convert the start/end times to readable HH:MM am/pm format
  444.         cShowStart = convertDate(showList[show-1].start_time).toLocaleTimeString([], {hour: '2-digit', minute: '2-digit'});
  445.         cShowEnd = convertDate(showList[show-1].end_time).toLocaleTimeString([], {hour: '2-digit', minute: '2-digit'});
  446.         nShowStart = showDate.toLocaleTimeString([], {hour: '2-digit', minute: '2-digit'});
  447.         nShowEnd = convertDate(showList[show].end_time).toLocaleTimeString([], {hour: '2-digit', minute: '2-digit'});
  448.  
  449.         //Create the show time strings
  450.         cShowTime = cShowStart + " - " + cShowEnd;
  451.         nShowTime = nShowStart + " - " + nShowEnd;
  452.  
  453.         $("#" + channelName + " > .currentShowCol > .showTitle").text(currentShow.name);
  454.         $("#" + channelName + " > .currentShowCol > .showTime").text(cShowTime);
  455.         $("#" + channelName + " > .nextShowCol > .showTitle").text(nextShow.name);
  456.         $("#" + channelName + " > .nextShowCol > .showTime").text(nShowTime);
  457.  
  458.         if (currentShow.subtitle == "") {
  459.           $("#" + channelName + " > .currentShowCol > .showSubtitle").html("&nbsp;");
  460.           //$("tr.clickable-row#" + channels[channel] + " > td.currentShow > ul > li.showSubtitle").html("");
  461.         } else {
  462.           $("#" + channelName + " > .currentShowCol > .showSubtitle").text(currentShow.subtitle);
  463.           //$("tr.clickable-row#" + channels[channel] + " > td.currentShow > ul > li.showSubtitle").text(currentShow.subtitle);
  464.         }
  465.         if (nextShow.subtitle == "") {
  466.           $("#" + channelName + " > .nextShowCol > .showSubtitle").html("&nbsp;");
  467.  
  468.           //$("tr.clickable-row#" + channels[channel] + " > td.nextShow > ul > li.showSubtitle").html("&nbsp;");
  469.         } else {
  470.           $("#" + channelName + " > .nextShowCol > .showSubtitle").text(nextShow.subtitle);
  471.  
  472.           //$("tr.clickable-row#" + channels[channel] + " > td.nextShow > ul > li.showSubtitle").text(nextShow.subtitle);
  473.         }
  474.         break;
  475.  
  476.       }
  477.     }
  478.  
  479.   }
  480.   updateVideoInfo();
  481.  
  482. }
  483.  
  484. function getDate() {
  485.   var date = new Date();
  486.   var year = date.getFullYear();
  487.   var month = String(date.getMonth() + 1);
  488.   var day = String(date.getDate());
  489.   if (month.length < 2) {
  490.     month = "0".concat(month);
  491.   }
  492.   if (day.length < 2) {
  493.     day = "0".concat(day);
  494.   }
  495.   return [year, month, day].join('-');
  496. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement