Esempio n. 1
0
        public static LocalProgram LocalProgramFromRemoteProgram(RemoteProgram remoteProgram)
        {
            LocalProgram program = new LocalProgram();
            program.ProgramId = remoteProgram.ProgramId;
            program.Name = remoteProgram.Name;
            program.Description = remoteProgram.Description;
            program.ThumbnailPath = remoteProgram.ThumbnailPath;
            program.MoviePath = remoteProgram.MoviePath;
            program.State = "D";
            program.Downloaded = DateTime.Now;
            program.Expires = DateTime.Now.AddDays(14);
            program.StreamingUrl = remoteProgram.StreamingUrl;
            program.ThumbnailUrl = remoteProgram.ThumbnailUrl;

            return program;
        }
Esempio n. 2
0
        public static LocalProgram LocalProgramFromRemoteProgram(RemoteProgram remoteProgram)
        {
            LocalProgram program = new LocalProgram();

            program.ProgramId     = remoteProgram.ProgramId;
            program.Name          = remoteProgram.Name;
            program.Description   = remoteProgram.Description;
            program.ThumbnailPath = remoteProgram.ThumbnailPath;
            program.MoviePath     = remoteProgram.MoviePath;
            program.State         = "D";
            program.Downloaded    = DateTime.Now;
            program.Expires       = DateTime.Now.AddDays(14);
            program.StreamingUrl  = remoteProgram.StreamingUrl;
            program.ThumbnailUrl  = remoteProgram.ThumbnailUrl;


            return(program);
        }
Esempio n. 3
0
        /// <summary>
        /// Downloads a program - does not use threads, so should be called from in a off-main-ui thread.
        ///
        /// Called from the QueueDownloader, usually.
        /// </summary>
        /// <param name="program">
        /// A <see cref="LocalProgram"/>
        /// </param>
        public void DownloadLocalProgram(LocalProgram program)
        {
            Program               = new RemoteProgram();
            Program.ProgramId     = program.ProgramId;
            Program.Name          = program.Name;
            Program.Description   = program.Description;
            Program.ThumbnailPath = program.ThumbnailPath;
            Program.MoviePath     = program.MoviePath;
            Program.StreamingUrl  = program.StreamingUrl;
            Program.ThumbnailUrl  = program.ThumbnailUrl;


            if (!DownloadPathExists)
            {
                Directory.CreateDirectory(Path.Combine(BasePath, DownloadFilepath));
            }


            string imageUrl = Program.ThumbnailUrl;

            if (!string.IsNullOrEmpty(FullsizeImageUrl))
            {
                imageUrl = FullsizeImageUrl;
            }

            Program.ThumbnailPath = DownloadImageToFile(Path.Combine(BasePath, DownloadFilepath), Program.ProgramId, imageUrl);
            Program.ThumbnailPath = Program.ProgramId + "/" + Program.ThumbnailPath;

            Program.MoviePath = OutputFilename;

            if (string.IsNullOrEmpty(StreamingUrl))
            {
                OnDownloadFinished();
            }
            else
            {
                DownloadToFile(StreamingUrl, Path.Combine(BasePath, Program.MoviePath), OnDownloadProgress, OnDownloadFinished);
            }
        }
Esempio n. 4
0
 public RemoteProgramHelper(RemoteProgram theProgram)
 {
     Program = theProgram;
 }
Esempio n. 5
0
        /// <summary>
        /// Downloads a program - does not use threads, so should be called from in a off-main-ui thread.
        /// 
        /// Called from the QueueDownloader, usually.
        /// </summary>
        /// <param name="program">
        /// A <see cref="LocalProgram"/>
        /// </param>
        public void DownloadLocalProgram(LocalProgram program)
        {
            Program = new RemoteProgram();
            Program.ProgramId = program.ProgramId;
            Program.Name = program.Name;
            Program.Description = program.Description;
            Program.ThumbnailPath = program.ThumbnailPath;
            Program.MoviePath = program.MoviePath;
            Program.StreamingUrl = program.StreamingUrl;
            Program.ThumbnailUrl = program.ThumbnailUrl;

            if (!DownloadPathExists)
            {
                Directory.CreateDirectory(Path.Combine(BasePath,DownloadFilepath));
            }

            string imageUrl = Program.ThumbnailUrl;
            if (!string.IsNullOrEmpty(FullsizeImageUrl)) imageUrl = FullsizeImageUrl;

            Program.ThumbnailPath = DownloadImageToFile(Path.Combine(BasePath,DownloadFilepath), Program.ProgramId, imageUrl);
            Program.ThumbnailPath = Program.ProgramId + "/" + Program.ThumbnailPath;

            Program.MoviePath = OutputFilename;

            if (string.IsNullOrEmpty(StreamingUrl))
            {
                OnDownloadFinished();
            } else {
                DownloadToFile(StreamingUrl, Path.Combine(BasePath,Program.MoviePath), OnDownloadProgress, OnDownloadFinished);
            }
        }
Esempio n. 6
0
 public RemoteProgramHelper(RemoteProgram theProgram)
 {
     Program = theProgram;
 }