1 // Copyright 2013 The Chromium Authors. All rights reserved. 2 // Use of this source code is governed by a BSD-style license that can be 3 // found in the LICENSE file. 4 5 #ifndef CHROME_UTILITY_MEDIA_GALLERIES_PICASA_ALBUMS_INDEXER_H_ 6 #define CHROME_UTILITY_MEDIA_GALLERIES_PICASA_ALBUMS_INDEXER_H_ 7 8 #include <map> 9 #include <set> 10 #include <string> 11 12 #include "base/files/file_path.h" 13 #include "chrome/common/media_galleries/picasa_types.h" 14 15 namespace picasa { 16 17 // Parses a series of INI files and builds up the set of files contained within 18 // the albums passed in through |album_uids|. 19 // 20 // Each INI file only describes the images contained within a single directory. 21 // To build the contents of all the albums, we read in all the INI files 22 // in all the Picasa folders. 23 // 24 // The INI albums also contain ".album*" sections describing the albums that 25 // have pictures in the same directory as the INI. However, we use the PMP 26 // database as the authoritative source on Album metadata, so we ignore those 27 // sections. The PMP derived |album_uids| are passed in by the constructor. 28 // 29 // Example INI File: 30 // 31 // [.album:e66fb059001aabcc69b262b7009fad90] 32 // name=CustomAlbum1 33 // token=e66fb059001aabcc69b262b7009fad90 34 // date=2013-03-15T14:53:21-07:00 35 // [InBoth.jpg] 36 // albums=e66fb059001aabcc69b262b7009fad90,18cb2df48aaa98e1c276b45cfcd81c95 37 // [.album:18cb2df48aaa98e1c276b45cfcd81c95] 38 // name=CustomAlbum1 39 // token=18cb2df48aaa98e1c276b45cfcd81c95 40 // date=2013-04-01T16:37:34-07:00 41 // [InFirst.jpg] 42 // albums=e66fb059001aabcc69b262b7009fad90 43 // [InSecond.jpg] 44 // albums=18cb2df48aaa98e1c276b45cfcd81c95 45 class PicasaAlbumsIndexer { 46 public: 47 explicit PicasaAlbumsIndexer(const AlbumUIDSet& album_uids); 48 ~PicasaAlbumsIndexer(); 49 50 // This method should be called once for each Folder in the PMP database. 51 void ParseFolderINI( 52 const std::vector<picasa::FolderINIContents>& folders_inis); 53 54 const AlbumImagesMap& albums_images() const { return albums_images_; } 55 56 private: 57 AlbumImagesMap albums_images_; 58 59 DISALLOW_COPY_AND_ASSIGN(PicasaAlbumsIndexer); 60 }; 61 62 } // namespace picasa 63 64 #endif // CHROME_UTILITY_MEDIA_GALLERIES_PICASA_ALBUMS_INDEXER_H_ 65