Example #1
0
 void app_DeviceConnected(object sender, DeviceConnectedArgs e)
 {
     // TODO: provide better feedback
     try
     {
         _tivoName = e.Host;
         string server = DiscoveryBeacon.GetServer(_tivoName, TimeSpan.FromMinutes(1));
         GetNowPlaying(server, Properties.Settings.Default.MediaAccessKey, (Application)sender);
     }
     catch (TimeoutException)
     {
         _waitingView.DisplayFailure("Unable to connect connect back to tivo. Please be sure tivo to go is enabled");
     }
 }
Example #2
0
        static void Main(string[] args)
        {
            string videoName = null;

            if (args.Length != 0)
            {
                videoName = args[0];
            }

            DiscoveryBeacon.Start();
            string hmoServer = DiscoveryBeacon.GetServer(tivoName, TimeSpan.FromSeconds(65));

            using (TivoConnection connection = new TivoConnection(hmoServer, mak))
            {
                connection.Open();
                var query = connection.CreateContainerQuery("/NowPlaying")
                            .Recurse();
                var container = query.Execute();

                if (videoName == null) // no name, so just download the first video that can be downloaded
                {
                    var video = (from v in container.TivoItems.OfType <TivoVideo>()
                                 where v.CustomIcon == null || v.CustomIcon.Uri.AbsoluteUri != "urn:tivo:image:in-progress-recording"
                                 select v).First();
                    connection.GetDownloader(video).DownloadFile("downloaded.tivo");
                }
                else
                {
                    ContentDownloader downloader = null;
                    while (downloader == null)
                    {
                        var namedVideos = from video in container.TivoItems.OfType <TivoVideo>()
                                          where video.Name == videoName
                                          select video;
                        if (namedVideos.Any())
                        {
                            downloader = connection.GetDownloader(namedVideos.First());
                        }
                        else
                        {
                            query     = query.Skip(container.ItemStart + container.ItemCount);
                            container = query.Execute();
                        }
                    }
                    downloader.DownloadFile("downloaded.tivo");
                }
            }
        }
Example #3
0
 static DiskUsageApp()
 {
     DiscoveryBeacon.Start();
 }