-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy paththe_merging_script
247 lines (180 loc) · 6.46 KB
/
the_merging_script
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
Remove-Variable * -ErrorAction SilentlyContinue
$Newlocation = "C005"
$Oldlocation = "Master-backup"
# Manually enter the zoom-levels
# handling level 5 to 13 with one foreach-statement
5, 6, 7, 8, 9, 10, 11, 12 | foreach {
if (Test-Path -Path D:\Export\$Oldlocation\$_\) {
$New_folder = "D:\Export\$Newlocation\$_\"
$Old_folder = "D:\Export\$Oldlocation\$_\"
Write-Output "--Level $_ started--
"
Write-Output "Time is now $(Get-Date)"
$New = Get-ChildItem -Recurse -File -Name $New_folder
Write-Output "--New folder listed--"
# Write-Output -InputObject $New
# $New | Out-File D:\temp\debug_new.txt
$Old = Get-ChildItem -Recurse -File -Name $Old_folder
Write-Output "--old folder listed--"
# Write-Output -InputObject $Old
# $Old | Out-File D:\temp\debug_old.txt
$Diff = Compare-Object $New $Old -ExcludeDifferent -IncludeEqual -PassThru
Write-Output "--Comparison done--"
# Write-Output -InputObject --Compare--
# Write-Output -InputObject $Diff
# $Diff | Out-File D:\temp\debug_diff.txt
# for all images that exist in both structure, make one transparent and then overlay it ontop of the other, and save it in the nes folder structure
$nbrimages = 0
$Diff | foreach {
$NewImage = "$New_folder$_"
$OldImage = "$Old_folder$_"
magick $NewImage -fuzz 10% -transparent white $NewImage
# magick $OldImage -fuzz 10% -transparent white $OldImage #do not need to make both transparent
magick composite $NewImage $OldImage $NewImage
$nbrimages = $nbrimages +1
}
Write-Output "-- $nbrimages images merged --
--Level $_ Ended--
"
}
}
# treat level 13 to 15 separately
$folder13 = Get-ChildItem -Recurse -Directory -Name D:\Export\$Newlocation\13\
$folder13 | foreach {
if (Test-Path -Path D:\Export\$Oldlocation\13\$_\) {
$New_folder13 = "D:\Export\$Newlocation\13\$_\"
$Old_folder13 = "D:\Export\$Oldlocation\13\$_\"
Write-Output "--Level 13-$_ started--
"
Write-Output "Time is now $(Get-Date)"
$New13 = Get-ChildItem -Recurse -File -Name $New_folder13
# Write-Output "--New folder listed--"
# Write-Output -InputObject $New13
# $New13 | Out-File D:\temp\script-mappar\debug_new.txt
$Old13 = Get-ChildItem -Recurse -File -Name $Old_folder13
# Write-Output "--old folder listed--"
# Write-Output -InputObject $Old13
# $Old13 | Out-File D:\temp\script-mappar\debug_old.txt
$Diff13 = Compare-Object $New13 $Old13 -ExcludeDifferent -IncludeEqual -PassThru
# Write-Output "--Comparison done--
#
# This is the diff
# --
# $Diff13
# --
# "
# Write-Output -InputObject --Compare--
# Write-Output -InputObject $Diff13
# $Diff13 | Out-File D:\temp\script-mappar\debug_diff.txt
$nbrimages13 = 0
$Diff13 | foreach {
$NewImage13 = "$New_folder13$_"
$OldImage13 = "$Old_folder13$_"
# Write-Output "-- $NewImage13 merged with -- "
# Write-Output "-- $OldImage13 --
# "
magick $NewImage13 -fuzz 10% -transparent white $NewImage13
# magick $OldImage13 -fuzz 10% -transparent white $OldImage13 #do not need to make both transparent
magick composite $NewImage13 $OldImage13 $NewImage13
$nbrimages15 = $nbrimages13 +1
}
Write-Output "-- $nbrimages13 images merged --
--Level 13-$_ Ended--
"
}
}
$folder14 = Get-ChildItem -Recurse -Directory -Name D:\Export\$Newlocation\14\
$folder14 | foreach {
if (Test-Path -Path D:\Export\$Oldlocation\14\$_\) {
$New_folder14 = "D:\Export\$Newlocation\14\$_\"
$Old_folder14 = "D:\Export\$Oldlocation\14\$_\"
Write-Output "--Level 14-$_ started--
"
Write-Output "Time is now $(Get-Date)"
$New14 = Get-ChildItem -Recurse -File -Name $New_folder14
# Write-Output "--New folder listed--"
# Write-Output -InputObject $New14
# $New14 | Out-File D:\temp\script-mappar\debug_new.txt
$Old14 = Get-ChildItem -Recurse -File -Name $Old_folder14
# Write-Output "--old folder listed--"
# Write-Output -InputObject $Old14
# $Old14 | Out-File D:\temp\script-mappar\debug_old.txt
$Diff14 = Compare-Object $New14 $Old14 -ExcludeDifferent -IncludeEqual -PassThru
# Write-Output "--Comparison done--
#
# This is the diff
# --
# $Diff14
# --
# "
# Write-Output -InputObject --Compare--
# Write-Output -InputObject $Diff14
# $Diff14 | Out-File D:\temp\script-mappar\debug_diff.txt
$nbrimages14 = 0
$Diff14 | foreach {
$NewImage14 = "$New_folder14$_"
$OldImage14 = "$Old_folder14$_"
# Write-Output "-- $NewImage14 merged with -- "
# Write-Output "-- $OldImage14 --
# "
magick $NewImage14 -fuzz 10% -transparent white $NewImage14
# magick $OldImage14 -fuzz 10% -transparent white $OldImage14 #do not need to make both transparent
magick composite $NewImage14 $OldImage14 $NewImage14
$nbrimages14 = $nbrimages14 +1
}
Write-Output "-- $nbrimages14 images merged --
--Level 14-$_ Ended--
"
}
}
$folder15 = Get-ChildItem -Recurse -Directory -Name D:\Export\$Newlocation\15\
$folder15 | foreach {
if (Test-Path -Path D:\Export\$Oldlocation\15\$_\) {
$New_folder15 = "D:\Export\$Newlocation\15\$_\"
$Old_folder15 = "D:\Export\$Oldlocation\15\$_\"
Write-Output "--Level 15-$_ started--
"
Write-Output "Time is now $(Get-Date)"
$New15 = Get-ChildItem -Recurse -File -Name $New_folder15
# Write-Output "--New folder listed--"
# Write-Output -InputObject $New15
# $New14 | Out-File D:\temp\script-mappar\debug_new.txt
$Old15 = Get-ChildItem -Recurse -File -Name $Old_folder15
# Write-Output "--old folder listed--"
# Write-Output -InputObject $Old15
# $Old15 | Out-File D:\temp\script-mappar\debug_old.txt
$Diff15 = Compare-Object $New15 $Old15 -ExcludeDifferent -IncludeEqual -PassThru
# Write-Output "--Comparison done--
#
# This is the diff
# --
# $Diff15
# --
# "
# Write-Output -InputObject --Compare--
# Write-Output -InputObject $Diff15
# $Diff15 | Out-File D:\temp\script-mappar\debug_diff.txt
$nbrimages15 = 0
$Diff15 | foreach {
$NewImage15 = "$New_folder15$_"
$OldImage15 = "$Old_folder15$_"
# Write-Output "-- $NewImage15 merged with -- "
# Write-Output "-- $OldImage15 --
# "
magick $NewImage15 -fuzz 10% -transparent white $NewImage15
# magick $OldImage15 -fuzz 10% -transparent white $OldImage15 #do not need to make both transparent
magick composite $NewImage15 $OldImage15 $NewImage15
$nbrimages15 = $nbrimages15 +1
}
Write-Output "-- $nbrimages15 images merged --
--Level 15-$_ Ended--
"
}
}
Write-Output "
----------------------------------------------------------------------------
--- Comparison and merger between $Newlocation and $Oldlocation finished ---
----------------------------------------------------------------------------
"
[system.media.systemsounds]::Hand.play()
[system.media.systemsounds]::Asterisk.play()