Ejemplo n.º 1
0
        public VideoTimePeriodsPacket Search(DateTime beginTime, DateTime endTime, IVideoInfo videoInfo)
        {
            string path = GlobalData.VideoPath(videoInfo.VideoId, videoInfo.StreamId);

            DateTime[] dates            = VideoStoragerManager.GetFolderPaths(videoInfo.VideoId, videoInfo.StreamId, beginTime, endTime);
            List <TimePeriodPacket> tis = new List <TimePeriodPacket>();

            Parallel.ForEach(dates, date =>
            {
                string folder = Path.Combine(path, GlobalProcess.FolderPath(date));
                var array     = FolderManager.GetTimePeriods(folder);
                if (array.Length > 0)
                {
                    lock (tis)
                        tis.AddRange(array);
                }
            });
            if (endTime > DateTime.Now.Date)
            {
                tis.AddRange(findTodayLastest(path, endTime));
            }
            var timeCombines = TimePeriodManager.Combine(tis.ToArray());
            var validArray   = TimePeriodManager.GetIntersections(timeCombines, new TimePeriodPacket(beginTime, endTime));

            return(new VideoTimePeriodsPacket(videoInfo, validArray));
        }
Ejemplo n.º 2
0
        private void hardDiskFreeSpaceCheck()
        {
            string diskName   = new DirectoryInfo(GlobalData.Path).Root.FullName;
            long   lengthDisk = HardDiskSpaceManager.GetHardDiskSpace(diskName);

            Logger.Default.Trace($"{diskName} 盘总空间: {lengthDisk}");
            while (true)
            {
                long lengthFree = HardDiskSpaceManager.GetHardDiskFreeSpace(diskName);
                if (lengthFree < GlobalData.HardDiskFreeSpaceInf)
                {
                    Logger.Default.Trace($"{diskName} 盘剩余空间: {lengthFree}, 剩余空间不足  {GlobalData.HardDiskFreeSpaceInf}");
                    VideoStoragerManager.DeleteEarliestVideo();      //删除最早的视频
                }
                else
                {
                    Thread.Sleep(TimeSpan.FromMinutes(1));
                }
                Thread.Sleep(TimeSpan.FromSeconds(1));
            }
        }
Ejemplo n.º 3
0
 public VideoStreamsPacket GetVideoPacket(string videoId, int streamId, DateTime time)
 {
     return(VideoStoragerManager.GetVideoPacket(videoId, streamId, time));
 }
Ejemplo n.º 4
0
 public VideoBasePacket GetVideoBaseInfom(string videoId, int streamId, DateTime start, DateTime end)
 {
     return(VideoStoragerManager.GetVideoBaseInfom(videoId, streamId, start, end));
 }