File tree 2 files changed +16
-2
lines changed
Slack.Backup/Private/backup
2 files changed +16
-2
lines changed Original file line number Diff line number Diff line change @@ -20,6 +20,7 @@ function Invoke-ChannelBackup {
20
20
$start = $last.ts
21
21
}
22
22
Write-Verbose " Get-ChannelNewMessages [$ChannelId ][$ ( Convert-EpochToDate $Start ) ]"
23
+ Write-Progress - Activity " Get-ChannelNewMessages [$ChannelId ][$ ( Convert-EpochToDate $Start ) ]" - Status ' Get-FullHistory'
23
24
[array ]$newMessages = Get-FullHistory - Token $Token - ChannelId $ChannelId - Start $start
24
25
25
26
$ids = $messages.ts
@@ -49,7 +50,12 @@ function Invoke-ChannelBackup {
49
50
}
50
51
51
52
if ($newMessages.Count -gt 0 ) {
52
- $messages += $newMessages | % { Invoke-MessageProcessingPipeline - SlackMessage $_ }
53
+ $cur = 0
54
+ $messages += $newMessages | % {
55
+ $perc = ((100.0 * $cur ++ ) / $newMessages.Count )
56
+ Write-Progress - Activity " Message $ ( $_.ts ) FROM $ChannelID " - PercentComplete $perc - Status " Running MessageProcessingPipeline"
57
+ Invoke-MessageProcessingPipeline - SlackMessage $_
58
+ }
53
59
$messages | Sort-Object - Property @ {Expression = { [double ]$_.ts } } | ConvertTo-Json - Depth 100 | Set-Content - Path $Location
54
60
}
55
61
}
Original file line number Diff line number Diff line change @@ -25,13 +25,21 @@ function Invoke-FilesBackup {
25
25
26
26
$files = Get-FilesList - Token $Token - TsFrom $start
27
27
if ($files.ok ) {
28
- foreach ($f in $files | Select-Object - ExpandProperty files) {
28
+ $cur = 0
29
+ $files = $files | Select-Object - ExpandProperty files
30
+ foreach ($f in $files ) {
29
31
$ext = $f.filetype
30
32
$path = " $backupLoc /$ ( $f.id ) "
33
+ $perc = ((100.0 * $cur ++ ) / $files.Count )
34
+ Write-Progress - Activity " File $ ( $f.id ) " - PercentComplete $perc - Status " Downloading"
31
35
$slackFile = Get-SlackFile - Token $Token - Uri $f.url_private
36
+
37
+ Write-Progress - Activity " File $ ( $f.id ) " - PercentComplete $perc - Status " Running FileDataProcessingPipeline"
32
38
$slackFile = Invoke-FileDataProcessingPipeline - SlackFile $slackFile - Metadata $f
33
39
[System.IO.File ]::WriteAllBytes(" $path .$ext " , $slackFile )
34
40
Remove-Variable - Name slackFile
41
+
42
+ Write-Progress - Activity " File $ ( $f.id ) " - PercentComplete $perc - Status " Running FileProcessingPipeline"
35
43
$f | Invoke-FileProcessingPipeline | ConvertTo-Json - Depth 10 | Set-Content - Path " $path .json"
36
44
}
37
45
}
You can’t perform that action at this time.
0 commit comments