Esempio n. 1
0
        static bool DetermineUpdateMethod()
        {
            // find all HDHomeRun tuning devices on the network
            var homeruns = Common.api.DiscoverDevices();

            if (homeruns == null || homeruns.Count() == 0)
            {
                Console.WriteLine("No HDHomeRun devices were found.");
                return(false);
            }

            // determine if DVR Service is active
            bool dvrActive = false;

            foreach (HDHRDiscover homerun in homeruns)
            {
                HDHRDevice device = Common.api.ConnectDevice(homerun.DiscoverURL);
                if (device == null)
                {
                    continue;
                }
                else
                {
                    Console.WriteLine(string.Format("Found {0} {1} ({2}) with firmware {3}.", device.FriendlyName, device.ModelNumber, device.DeviceID, device.FirmwareVersion));
                }

                dvrActive |= Common.api.IsDvrActive(device.DeviceAuth);
            }
            Console.WriteLine(string.Format("HDHomeRun DVR Service is {0}active.", dvrActive ? string.Empty : "not "));

            // if DVR Service is active, use XMLTV; otherwise use iterative load from slice guide
            if (dvrActive)
            {
                Console.WriteLine("Using available 14-day XMLTV file from SiliconDust.");
                return(XmltvMxf.BuildMxfFromXmltvGuide(homeruns.ToList()));
            }
            else if (false)// (!xmltvOnly)
            {
                Console.WriteLine("Using available 24-hour slice guide data from SiliconDust.");
                return(SliceMxf.BuildMxfFromSliceGuide(homeruns.ToList()));
            }
            else
            {
                Console.WriteLine("HDHR2MXF is not configured to download guide data using JSON from SiliconDust.");
                return(false);
            }
        }
Esempio n. 2
0
        private static bool DetermineUpdateMethod()
        {
            // find all HDHomeRun tuning devices on the network
            var homeruns = Common.Api.DiscoverDevices();

            if (homeruns == null || !homeruns.Any())
            {
                Logger.WriteError("No HDHomeRun devices were found.");
                return(false);
            }

            // determine if DVR Service is active
            var dvrActive = false;

            foreach (var device in homeruns.Select(homerun => Common.Api.ConnectDevice(homerun.DiscoverUrl)))
            {
                if (device == null)
                {
                    continue;
                }
                Logger.WriteInformation($"Found {device.FriendlyName} {device.ModelNumber} ({device.DeviceId}) with firmware {device.FirmwareVersion}.");
                dvrActive |= Common.Api.IsDvrActive(device.DeviceAuth);
            }
            Logger.WriteInformation($"HDHomeRun DVR Service is {(dvrActive ? string.Empty : "not ")}active.");

            // if DVR Service is active, use XMLTV; otherwise use iterative load from slice guide
            if (dvrActive)
            {
                Logger.WriteInformation("Downloading available 14-day XMLTV file from SiliconDust.");
                Helper.SendPipeMessage("Downloading|Building and saving MXF file...");
                return(XmltvMxf.BuildMxfFromXmltvGuide(homeruns.ToList()));
            }
            //else
            //{
            //    Console.WriteLine("Using available 24-hour slice guide data from SiliconDust.");
            //    return SliceMxf.BuildMxfFromSliceGuide(homeruns.ToList());
            //}

            Logger.WriteError("HDHR2MXF is not configured to download guide data using JSON from SiliconDust.");
            return(false);
        }