@@ -220,19 +220,23 @@ def initialize(_parent,_path)
220
220
Image . new ( self , child )
221
221
end
222
222
223
- @images . each_with_index do |image , i |
224
- # Gah. arr[-1] gives the last, not nil. arr[BIG] gives nil.
225
- image . previous = @images [ i -1 ] unless i ==0
226
- image . next = @images [ i +1 ]
227
- end
228
-
229
223
@movies = files . find_all do |child |
230
224
Movie . known_type? ( child )
231
225
end . map do |child |
232
226
Log . debug "Movie! #{ child } "
233
227
Movie . new ( self , child )
234
228
end
235
229
230
+ @galleries = @galleries . sort_by { |g | g . path . to_s . downcase }
231
+ @images = @images . sort_by { |i | i . path . to_s . downcase }
232
+ @movies = @movies . sort_by { |m | m . path . to_s . downcase }
233
+
234
+ @images . each_with_index do |image , i |
235
+ # Gah. arr[-1] gives the last, not nil. arr[BIG] gives nil.
236
+ image . previous = @images [ i -1 ] unless i ==0
237
+ image . next = @images [ i +1 ]
238
+ end
239
+
236
240
@movies . each_with_index do |movie , i |
237
241
# Gah. arr[-1] gives the last, not nil. arr[BIG] gives nil.
238
242
movie . previous = @movies [ i -1 ] unless i ==0
@@ -246,10 +250,6 @@ def initialize(_parent,_path)
246
250
end
247
251
end
248
252
end
249
-
250
- @galleries = @galleries . sort_by { |g | g . path . to_s . downcase }
251
- @images = @images . sort_by { |i | i . path . to_s . downcase }
252
- @movies = @movies . sort_by { |m | m . path . to_s . downcase }
253
253
end
254
254
255
255
def children? ( )
@@ -489,10 +489,11 @@ class GallRB
489
489
490
490
attr_accessor :gallery
491
491
492
- def initialize ( _base_path , _base_url )
492
+ def initialize ( _base_path , _base_url , _force )
493
493
@base_path = _base_path
494
494
@base_url = _base_url
495
- @rowsize = 5
495
+ @force = _force
496
+ @rowsize = 5
496
497
497
498
@templates = { }
498
499
@urls = { }
@@ -566,7 +567,7 @@ def make_media_derivation(name,o)
566
567
# BUG: Re-generate only when necessary (if settings change?)
567
568
derivation = o . send ( name )
568
569
if derivation . image?
569
- unless derivation . path . exist?
570
+ unless derivation . path . exist? or @force
570
571
FileUtils . mkdir_p ( derivation . path . dirname )
571
572
derivation . resize
572
573
end
@@ -819,6 +820,7 @@ def do_rubyprof()
819
820
[ '--debug' , '-d' , GetoptLong ::NO_ARGUMENT ] ,
820
821
[ '--profile' , '-p' , GetoptLong ::NO_ARGUMENT ] ,
821
822
[ '--rubyprof' , '-r' , GetoptLong ::NO_ARGUMENT ] ,
823
+ [ '--force' , '-f' , GetoptLong ::NO_ARGUMENT ] ,
822
824
[ '--url' , '-u' , GetoptLong ::REQUIRED_ARGUMENT ]
823
825
)
824
826
@@ -827,6 +829,8 @@ def do_rubyprof()
827
829
base_url = "/photos"
828
830
# How do we kickoff album generation?
829
831
wrapper = :do_yield
832
+ # Should we regenerate all thumb/medium images?
833
+ force = false
830
834
831
835
opts . each do |opt , arg |
832
836
case opt
@@ -840,6 +844,9 @@ def do_rubyprof()
840
844
when '--rubyprof'
841
845
Log . info ( "Using ruby-prof." )
842
846
wrapper = :do_rubyprof
847
+ when '--force'
848
+ Log . info ( "Force image regeneration." )
849
+ force = true
843
850
when '--url'
844
851
base_url = arg
845
852
end
@@ -851,7 +858,7 @@ def do_rubyprof()
851
858
url = cleanpath ( File . join ( base_url , scan_dir ) )
852
859
853
860
Log . info "Base URL: #{ url . to_s } "
854
- send ( wrapper ) { GallRB . new ( scan_dir , url ) . build }
861
+ send ( wrapper ) { GallRB . new ( scan_dir , url , force ) . build }
855
862
Log . info ( "Done" )
856
863
end
857
864
@@ -869,3 +876,4 @@ def do_rubyprof()
869
876
# ** Latest is down to about 11M, 42s
870
877
# Write my own pathname?
871
878
# Tried using yaml for config file; required >5M!
879
+ # better use of multiple cpus? parallel index generation? what about images?
0 commit comments