Exemplo n.º 1
0
        public async void RecyclerDeleteAsync(int days)
        {
            var videoDb = new VideoDb(DbConnection);
            await videoDb.Connection.OpenAsync();

            var query   = new VideoQuery(videoDb);
            var results = await query.ReadAllVideosByDaysAsync(days);

            if (results is null || results.Count == 0)
            {
                return;
            }

            Status = "running";
            // Thread.Sleep(10000);
            foreach (var result in results)
            {
                var filePath = "videos/" + result.ServerId + "/" + result.Id;
                //Remove video from Db
                Thread threadDb = new Thread(() => result.ThreadDeleteAsync());
                //Delete physical binary
                Thread threadIO = new Thread(() => System.IO.File.Delete(filePath));

                threadDb.Start();
                threadIO.Start();
                threadDb.Join();
                threadIO.Join();
            }
            Status = "not running";
        }
Exemplo n.º 2
0
 internal Video(VideoDb db)
 {
     Db = db;
 }
 public VideoQuery(VideoDb db)
 {
     Db = db;
 }