@@ -122,19 +122,22 @@ func (c Cache) FillPhotosInfo(album *Album) (err error) {
122122
123123 // Get photos that are in cache
124124 err = c .store .Bolt ().View (func (tx * bolt.Tx ) error {
125+ size := len (album .photosMap )
126+ count := 0
125127 for _ , photo := range album .photosMap {
126128 var data Photo
127- key := album .Name + ":" + photo .Title
129+ count ++
130+ key := album .Name + ":" + photo .Id
128131 err := c .store .TxGet (tx , key , & data )
129132 // Does not require update
130- if err == nil && data .Title == photo .Title && data .Thumb == photo .Thumb &&
133+ if err == nil && data .Id == photo .Id && data .Thumb == photo .Thumb &&
131134 len (data .Files ) == len (photo .Files ) { // Validate some fields
132135
133136 * photo = data
134137 continue
135138 }
136139
137- log .Printf ("caching photo [%s] %s " , album .Name , photo .Title )
140+ log .Printf ("Caching photo info [%s] %d/%d: %s %s \n " , album .Name , count , size , photo .Title , photo . SubAlbum )
138141 photo .FillInfo ()
139142 update = append (update , photo )
140143 }
@@ -149,7 +152,7 @@ func (c Cache) FillPhotosInfo(album *Album) (err error) {
149152 // Update missing entries
150153 return c .store .Bolt ().Update (func (tx * bolt.Tx ) error {
151154 for _ , photo := range update {
152- key := album .Name + ":" + photo .Title
155+ key := album .Name + ":" + photo .Id
153156 err := c .store .TxUpsert (tx , key , photo )
154157 if err != nil {
155158 log .Println (err )
0 commit comments