VictoriaFreSh 2024.9.15 → 2024.9.16

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (3) hide show
  1. checksums.yaml +4 -4
  2. data/lib/victoriafresh.rb +39 -35
  3. metadata +1 -1
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: d4fe7e93411178604fe5d047b7bf70b7e0d69c42a4333370a992bbf8197d2d37
4
- data.tar.gz: 5c49124a663f2c8c3f551d37acdb809485f8040de442f7230ab17821fd482fb0
3
+ metadata.gz: e1b4715d21e2d74203453ae9563d9dcfc25d5824ce9944b9272d3090197e5de8
4
+ data.tar.gz: 00322e417b47835c4d5fb516ad2f1e6798dac2639f7f621e80b324904a28519d
5
5
  SHA512:
6
- metadata.gz: 70fae2a882fc632395a8c40e5db329288fd6ec18765c4512dabffad48b1f7f79284783136c08ab1dbc1be826f4bbe14018627f37736131eb1d9ead3dc90d232b
7
- data.tar.gz: 75edb2e387d0d2a459d724124f609935dc28352d12c029608c6f85a1855b43cf2cefb85c4092e90a9d10876485d72acea7363e86a0d03328047be7e34aed1662
6
+ metadata.gz: aab347f0afeb0768e222d059e656f1232cbc4dc9b153177e165913fa6a0c92cb0343807f4c42358808aa8165d269f70abe057898fde38b0fb9ad2856278da860
7
+ data.tar.gz: bed7c8c806eb34743710e07eb37267c4caf979f900fe4716ee39a48a3f39879661c5bb98bf4bfcf6607c327b5c55822f1aee1660b92e141679fdd5b62796c7bb
data/lib/victoriafresh.rb CHANGED
@@ -499,45 +499,49 @@ class VictoriaFresh
499
499
 
500
500
  ignoreFileList=readIgnoreFileList(directoryPathName) # 读取要忽略的文件名列表。
501
501
 
502
- directoryPathName.each_child do |subFile| #一个个文件地处理。
503
- begin
504
- subFilebaseName=subFile.basename.to_s #基本文件名。
505
-
506
- if (ignoreFileList.include?(subFilebaseName)) # 是要忽略的文件
507
- puts "ignore #{subFile}" # 报告,忽略。
508
- elsif (timestampTooEarly(subFile)) # 文件时间过早。
509
- puts "ignore #{subFile} early file" # 报告,忽略。
510
- else # 不忽略
511
- realPath=subFile.expand_path #获取绝对路径。
512
-
513
- packagedSubFile,subFileContent=checkOnce(realPath,subFileStartIndex, layer+1) #打包这个子文件。
514
-
515
- packagedFile['sub_files'] << packagedSubFile #加入到子文件列表中。
516
-
517
- assessDiskFlush(layer) #考虑是否要向磁盘先输出内容
518
-
519
- subFileStartIndex+=packagedSubFile['file_length'] #记录打包的子文件的长度,更新下一个要打包的子文件的起始位置。
502
+ begin # try to list files and directories.
503
+ directoryPathName.each_child do |subFile| #一个个文件地处理。
504
+ begin
505
+ subFilebaseName=subFile.basename.to_s #基本文件名。
520
506
 
521
- packagedFile['file_length']+=packagedSubFile['file_length'] #随着子文件的打包而更新本目录的总长度。
507
+ if (ignoreFileList.include?(subFilebaseName)) # 是要忽略的文件
508
+ puts "ignore #{subFile}" # 报告,忽略。
509
+ elsif (timestampTooEarly(subFile)) # 文件时间过早。
510
+ puts "ignore #{subFile} early file" # 报告,忽略。
511
+ else # 不忽略
512
+ realPath=subFile.expand_path #获取绝对路径。
513
+
514
+ packagedSubFile,subFileContent=checkOnce(realPath,subFileStartIndex, layer+1) #打包这个子文件。
515
+
516
+ packagedFile['sub_files'] << packagedSubFile #加入到子文件列表中。
517
+
518
+ assessDiskFlush(layer) #考虑是否要向磁盘先输出内容
519
+
520
+ subFileStartIndex+=packagedSubFile['file_length'] #记录打包的子文件的长度,更新下一个要打包的子文件的起始位置。
521
+
522
+ packagedFile['file_length']+=packagedSubFile['file_length'] #随着子文件的打包而更新本目录的总长度。
523
+ end
524
+ rescue Errno::EMFILE # too many open Files in process
525
+ puts "Rescued by Errno::EMFILE statement. #{subFile}" #报告错误
522
526
  end
523
- rescue Errno::EMFILE # too many open Files in process
524
- puts "Rescued by Errno::EMFILE statement. #{subFile}" #报告错误
525
- end
526
- end #directoryPathName.each_child do |subFile| #一个个文件地处理。
527
+ end #directoryPathName.each_child do |subFile| #一个个文件地处理。
528
+ rescue Errno::EACCES => e
529
+ # 处理权限不足的情况
530
+ puts e.message
531
+ end # begin # try to list files and directories.
527
532
  end #if (isFile) #是文件,不用再列出其子文件了。
528
533
 
529
- contentToResult="" #要返回的内容
530
-
531
- if (layer==0) #是最外层
532
- assessDiskFlush(layer, true) #考虑是否要向磁盘先输出内容
533
-
534
- if (@diskFlush) #要向磁盘写入缓存内容
535
- else #不向磁盘写入缓存内容
536
- contentToResult=@contentPartArray.join #重新合并成字符串
537
-
538
- end #if (@diskFlush) #要向磁盘写入缓存内容
539
- end #if (layer==0) #是最外层
540
- return packagedFile, contentToResult #返回打包之后的对象。和文件内容字节数组。
534
+ contentToResult="" #要返回的内容
535
+
536
+ if (layer==0) #是最外层
537
+ assessDiskFlush(layer, true) #考虑是否要向磁盘先输出内容
538
+
539
+ if (@diskFlush) #要向磁盘写入缓存内容
540
+ else #不向磁盘写入缓存内容
541
+ contentToResult=@contentPartArray.join #重新合并成字符串
542
+ end #if (@diskFlush) #要向磁盘写入缓存内容
543
+ end #if (layer==0) #是最外层
544
+ return packagedFile, contentToResult #返回打包之后的对象。和文件内容字节数组。
541
545
  end #def downloadOne #下载一个视频。
542
546
  end
543
547
 
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: VictoriaFreSh
3
3
  version: !ruby/object:Gem::Version
4
- version: 2024.9.15
4
+ version: 2024.9.16
5
5
  platform: ruby
6
6
  authors:
7
7
  - Hxcan Cai