aperture 0.3.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (153) hide show
  1. data/.document +5 -0
  2. data/.gitignore +22 -0
  3. data/LICENSE +20 -0
  4. data/README.rdoc +20 -0
  5. data/Rakefile +69 -0
  6. data/VERSION +1 -0
  7. data/aperture.gemspec +198 -0
  8. data/lib/aperture.rb +20 -0
  9. data/lib/aperture/album.rb +17 -0
  10. data/lib/aperture/library.rb +95 -0
  11. data/lib/aperture/photo.rb +27 -0
  12. data/lib/aperture/photo_set.rb +88 -0
  13. data/lib/aperture/project.rb +16 -0
  14. data/lib/aperture/version.rb +20 -0
  15. data/test/data/ Built-in Smart Albums/.implicitAlbum +123 -0
  16. data/test/data/ Built-in Smart Albums/090-entireLibraryQuery.apsmartalbum +159 -0
  17. data/test/data/ Built-in Smart Albums/100-selectsQuery.apsmartalbum +159 -0
  18. data/test/data/ Built-in Smart Albums/200-oneStarQuery.apsmartalbum +159 -0
  19. data/test/data/ Built-in Smart Albums/300-rejectedQuery.apsmartalbum +159 -0
  20. data/test/data/ Built-in Smart Albums/400-inTheLastWeekQuery.apsmartalbum +159 -0
  21. data/test/data/ Built-in Smart Albums/500-inTheLastMonthQuery.apsmartalbum +159 -0
  22. data/test/data/ Built-in Smart Albums/Info.apfolder +26 -0
  23. data/test/data/.implicitAlbum +123 -0
  24. data/test/data/DSLR.approject/2009-12-11 @ 10:09:42 AM - 1.apimportgroup/CRW_0001 - 2008-07-04 at 11-34-52/CRW_0001 - 2008-07-04 at 11-34-52.CRW.apfile +40 -0
  25. data/test/data/DSLR.approject/2009-12-11 @ 10:09:42 AM - 1.apimportgroup/CRW_0001 - 2008-07-04 at 11-34-52/Info.apmaster +18 -0
  26. data/test/data/DSLR.approject/2009-12-11 @ 10:09:42 AM - 1.apimportgroup/CRW_0001 - 2008-07-04 at 11-34-52/OriginalVersionInfo.apversion +162 -0
  27. data/test/data/DSLR.approject/2009-12-11 @ 10:09:42 AM - 1.apimportgroup/CRW_0001 - 2008-07-04 at 11-34-52/Version-1.apversion +215 -0
  28. data/test/data/DSLR.approject/2009-12-11 @ 10:09:52 AM - 2.apimportgroup/CRW_0002 - 2008-07-04 at 11-36-00/CRW_0002 - 2008-07-04 at 11-36-00.CRW.apfile +40 -0
  29. data/test/data/DSLR.approject/2009-12-11 @ 10:09:52 AM - 2.apimportgroup/CRW_0002 - 2008-07-04 at 11-36-00/Info.apmaster +18 -0
  30. data/test/data/DSLR.approject/2009-12-11 @ 10:09:52 AM - 2.apimportgroup/CRW_0002 - 2008-07-04 at 11-36-00/OriginalVersionInfo.apversion +162 -0
  31. data/test/data/DSLR.approject/2009-12-11 @ 10:09:52 AM - 2.apimportgroup/CRW_0002 - 2008-07-04 at 11-36-00/Version-1.apversion +215 -0
  32. data/test/data/DSLR.approject/2009-12-11 @ 10:10:03 AM - 3.apimportgroup/CRW_0003 - 2008-07-04 at 11-36-00/CRW_0003 - 2008-07-04 at 11-36-00.CRW.apfile +40 -0
  33. data/test/data/DSLR.approject/2009-12-11 @ 10:10:03 AM - 3.apimportgroup/CRW_0003 - 2008-07-04 at 11-36-00/Info.apmaster +18 -0
  34. data/test/data/DSLR.approject/2009-12-11 @ 10:10:03 AM - 3.apimportgroup/CRW_0003 - 2008-07-04 at 11-36-00/OriginalVersionInfo.apversion +162 -0
  35. data/test/data/DSLR.approject/2009-12-11 @ 10:10:03 AM - 3.apimportgroup/CRW_0003 - 2008-07-04 at 11-36-00/Version-1.apversion +215 -0
  36. data/test/data/DSLR.approject/2009-12-11 @ 10:10:11 AM - 4.apimportgroup/CRW_0004 - 2008-07-04 at 11-36-02/CRW_0004 - 2008-07-04 at 11-36-02.CRW.apfile +40 -0
  37. data/test/data/DSLR.approject/2009-12-11 @ 10:10:11 AM - 4.apimportgroup/CRW_0004 - 2008-07-04 at 11-36-02/Info.apmaster +18 -0
  38. data/test/data/DSLR.approject/2009-12-11 @ 10:10:11 AM - 4.apimportgroup/CRW_0004 - 2008-07-04 at 11-36-02/OriginalVersionInfo.apversion +162 -0
  39. data/test/data/DSLR.approject/2009-12-11 @ 10:10:11 AM - 4.apimportgroup/CRW_0004 - 2008-07-04 at 11-36-02/Version-1.apversion +215 -0
  40. data/test/data/DSLR.approject/2009-12-11 @ 10:10:21 AM - 5.apimportgroup/CRW_0005 - 2008-07-04 at 11-36-38/CRW_0005 - 2008-07-04 at 11-36-38.CRW.apfile +40 -0
  41. data/test/data/DSLR.approject/2009-12-11 @ 10:10:21 AM - 5.apimportgroup/CRW_0005 - 2008-07-04 at 11-36-38/Info.apmaster +18 -0
  42. data/test/data/DSLR.approject/2009-12-11 @ 10:10:21 AM - 5.apimportgroup/CRW_0005 - 2008-07-04 at 11-36-38/OriginalVersionInfo.apversion +162 -0
  43. data/test/data/DSLR.approject/2009-12-11 @ 10:10:21 AM - 5.apimportgroup/CRW_0005 - 2008-07-04 at 11-36-38/Version-1.apversion +215 -0
  44. data/test/data/DSLR.approject/2009-12-11 @ 10:10:30 AM - 6.apimportgroup/CRW_0006 - 2008-07-04 at 11-40-50/CRW_0006 - 2008-07-04 at 11-40-50.CRW.apfile +40 -0
  45. data/test/data/DSLR.approject/2009-12-11 @ 10:10:30 AM - 6.apimportgroup/CRW_0006 - 2008-07-04 at 11-40-50/Info.apmaster +18 -0
  46. data/test/data/DSLR.approject/2009-12-11 @ 10:10:30 AM - 6.apimportgroup/CRW_0006 - 2008-07-04 at 11-40-50/OriginalVersionInfo.apversion +162 -0
  47. data/test/data/DSLR.approject/2009-12-11 @ 10:10:30 AM - 6.apimportgroup/CRW_0006 - 2008-07-04 at 11-40-50/Version-1.apversion +215 -0
  48. data/test/data/DSLR.approject/2009-12-11 @ 10:10:39 AM - 7.apimportgroup/CRW_0007 - 2008-07-04 at 11-54-00/CRW_0007 - 2008-07-04 at 11-54-00.CRW.apfile +40 -0
  49. data/test/data/DSLR.approject/2009-12-11 @ 10:10:39 AM - 7.apimportgroup/CRW_0007 - 2008-07-04 at 11-54-00/Info.apmaster +18 -0
  50. data/test/data/DSLR.approject/2009-12-11 @ 10:10:39 AM - 7.apimportgroup/CRW_0007 - 2008-07-04 at 11-54-00/OriginalVersionInfo.apversion +162 -0
  51. data/test/data/DSLR.approject/2009-12-11 @ 10:10:39 AM - 7.apimportgroup/CRW_0007 - 2008-07-04 at 11-54-00/Version-1.apversion +215 -0
  52. data/test/data/DSLR.approject/2009-12-11 @ 10:10:51 AM - 8.apimportgroup/CRW_0008 - 2008-07-04 at 11-54-02/CRW_0008 - 2008-07-04 at 11-54-02.CRW.apfile +40 -0
  53. data/test/data/DSLR.approject/2009-12-11 @ 10:10:51 AM - 8.apimportgroup/CRW_0008 - 2008-07-04 at 11-54-02/Info.apmaster +18 -0
  54. data/test/data/DSLR.approject/2009-12-11 @ 10:10:51 AM - 8.apimportgroup/CRW_0008 - 2008-07-04 at 11-54-02/OriginalVersionInfo.apversion +162 -0
  55. data/test/data/DSLR.approject/2009-12-11 @ 10:10:51 AM - 8.apimportgroup/CRW_0008 - 2008-07-04 at 11-54-02/Version-1.apversion +215 -0
  56. data/test/data/DSLR.approject/2009-12-11 @ 10:10:59 AM - 9.apimportgroup/CRW_0009 - 2008-07-04 at 11-54-48/CRW_0009 - 2008-07-04 at 11-54-48.CRW.apfile +40 -0
  57. data/test/data/DSLR.approject/2009-12-11 @ 10:10:59 AM - 9.apimportgroup/CRW_0009 - 2008-07-04 at 11-54-48/Info.apmaster +18 -0
  58. data/test/data/DSLR.approject/2009-12-11 @ 10:10:59 AM - 9.apimportgroup/CRW_0009 - 2008-07-04 at 11-54-48/OriginalVersionInfo.apversion +162 -0
  59. data/test/data/DSLR.approject/2009-12-11 @ 10:10:59 AM - 9.apimportgroup/CRW_0009 - 2008-07-04 at 11-54-48/Version-1.apversion +215 -0
  60. data/test/data/DSLR.approject/Album.implicitAlbum +123 -0
  61. data/test/data/DSLR.approject/Info.apfolder +36 -0
  62. data/test/data/Info.apfolder +24 -0
  63. data/test/data/Misc.approject/2009-12-10 @ 04:09:41 PM - 1.apimportgroup/IMG_0459/IMG_0459 - 2009-12-01 at 22-51-38.PNG.apfile +40 -0
  64. data/test/data/Misc.approject/2009-12-10 @ 04:09:41 PM - 1.apimportgroup/IMG_0459/Info.apmaster +18 -0
  65. data/test/data/Misc.approject/2009-12-10 @ 04:09:41 PM - 1.apimportgroup/IMG_0459/OriginalVersionInfo.apversion +95 -0
  66. data/test/data/Misc.approject/2009-12-10 @ 04:09:41 PM - 1.apimportgroup/IMG_0459/Version-1.apversion +107 -0
  67. data/test/data/Misc.approject/2009-12-10 @ 04:11:58 PM - 2.apimportgroup/2008-Costume Contest 030/2008-Costume Contest 030.jpg.apfile +40 -0
  68. data/test/data/Misc.approject/2009-12-10 @ 04:11:58 PM - 2.apimportgroup/2008-Costume Contest 030/Info.apmaster +18 -0
  69. data/test/data/Misc.approject/2009-12-10 @ 04:11:58 PM - 2.apimportgroup/2008-Costume Contest 030/OriginalVersionInfo.apversion +137 -0
  70. data/test/data/Misc.approject/2009-12-10 @ 04:11:58 PM - 2.apimportgroup/2008-Costume Contest 030/Version-1.apversion +164 -0
  71. data/test/data/Misc.approject/2009-12-10 @ 04:11:58 PM - 2.apimportgroup/2008-Costume Contest 030/Version-10.apversion +162 -0
  72. data/test/data/Misc.approject/2009-12-10 @ 04:11:58 PM - 2.apimportgroup/2008-Costume Contest 030/Version-11.apversion +162 -0
  73. data/test/data/Misc.approject/2009-12-10 @ 04:11:58 PM - 2.apimportgroup/2008-Costume Contest 030/Version-2.apversion +162 -0
  74. data/test/data/Misc.approject/2009-12-10 @ 04:11:58 PM - 2.apimportgroup/2008-Costume Contest 030/Version-3.apversion +162 -0
  75. data/test/data/Misc.approject/2009-12-10 @ 04:11:58 PM - 2.apimportgroup/2008-Costume Contest 030/Version-4.apversion +162 -0
  76. data/test/data/Misc.approject/2009-12-10 @ 04:11:58 PM - 2.apimportgroup/2008-Costume Contest 030/Version-5.apversion +162 -0
  77. data/test/data/Misc.approject/2009-12-10 @ 04:11:58 PM - 2.apimportgroup/2008-Costume Contest 030/Version-6.apversion +162 -0
  78. data/test/data/Misc.approject/2009-12-10 @ 04:11:58 PM - 2.apimportgroup/2008-Costume Contest 030/Version-7.apversion +162 -0
  79. data/test/data/Misc.approject/2009-12-10 @ 04:11:58 PM - 2.apimportgroup/2008-Costume Contest 030/Version-8.apversion +162 -0
  80. data/test/data/Misc.approject/2009-12-10 @ 04:11:58 PM - 2.apimportgroup/2008-Costume Contest 030/Version-9.apversion +162 -0
  81. data/test/data/Misc.approject/2009-12-10 @ 04:11:58 PM - 2.apimportgroup/IMG_3690/IMG_3690.jpg.apfile +40 -0
  82. data/test/data/Misc.approject/2009-12-10 @ 04:11:58 PM - 2.apimportgroup/IMG_3690/Info.apmaster +18 -0
  83. data/test/data/Misc.approject/2009-12-10 @ 04:11:58 PM - 2.apimportgroup/IMG_3690/OriginalVersionInfo.apversion +131 -0
  84. data/test/data/Misc.approject/2009-12-10 @ 04:11:58 PM - 2.apimportgroup/IMG_3690/Version-1.apversion +152 -0
  85. data/test/data/Misc.approject/Album.implicitAlbum +132 -0
  86. data/test/data/Misc.approject/Halloween.apalbum +145 -0
  87. data/test/data/Misc.approject/Info.apfolder +36 -0
  88. data/test/data/TestFolder/.implicitAlbum +123 -0
  89. data/test/data/TestFolder/Fireworks.approject/2009-12-10 @ 04:13:45 PM - 1.apimportgroup/IMG_1753/IMG_1753.JPG.apfile +40 -0
  90. data/test/data/TestFolder/Fireworks.approject/2009-12-10 @ 04:13:45 PM - 1.apimportgroup/IMG_1753/Info.apmaster +18 -0
  91. data/test/data/TestFolder/Fireworks.approject/2009-12-10 @ 04:13:45 PM - 1.apimportgroup/IMG_1753/OriginalVersionInfo.apversion +139 -0
  92. data/test/data/TestFolder/Fireworks.approject/2009-12-10 @ 04:13:45 PM - 1.apimportgroup/IMG_1753/Version-1.apversion +160 -0
  93. data/test/data/TestFolder/Fireworks.approject/2009-12-10 @ 04:13:45 PM - 1.apimportgroup/IMG_1754/IMG_1754.JPG.apfile +40 -0
  94. data/test/data/TestFolder/Fireworks.approject/2009-12-10 @ 04:13:45 PM - 1.apimportgroup/IMG_1754/Info.apmaster +18 -0
  95. data/test/data/TestFolder/Fireworks.approject/2009-12-10 @ 04:13:45 PM - 1.apimportgroup/IMG_1754/OriginalVersionInfo.apversion +139 -0
  96. data/test/data/TestFolder/Fireworks.approject/2009-12-10 @ 04:13:45 PM - 1.apimportgroup/IMG_1754/Version-1.apversion +160 -0
  97. data/test/data/TestFolder/Fireworks.approject/2009-12-10 @ 04:13:45 PM - 1.apimportgroup/IMG_1755/IMG_1755.JPG.apfile +40 -0
  98. data/test/data/TestFolder/Fireworks.approject/2009-12-10 @ 04:13:45 PM - 1.apimportgroup/IMG_1755/Info.apmaster +18 -0
  99. data/test/data/TestFolder/Fireworks.approject/2009-12-10 @ 04:13:45 PM - 1.apimportgroup/IMG_1755/OriginalVersionInfo.apversion +139 -0
  100. data/test/data/TestFolder/Fireworks.approject/2009-12-10 @ 04:13:45 PM - 1.apimportgroup/IMG_1755/Version-1.apversion +160 -0
  101. data/test/data/TestFolder/Fireworks.approject/2009-12-10 @ 04:13:45 PM - 1.apimportgroup/IMG_1756/IMG_1756.JPG.apfile +40 -0
  102. data/test/data/TestFolder/Fireworks.approject/2009-12-10 @ 04:13:45 PM - 1.apimportgroup/IMG_1756/Info.apmaster +18 -0
  103. data/test/data/TestFolder/Fireworks.approject/2009-12-10 @ 04:13:45 PM - 1.apimportgroup/IMG_1756/OriginalVersionInfo.apversion +139 -0
  104. data/test/data/TestFolder/Fireworks.approject/2009-12-10 @ 04:13:45 PM - 1.apimportgroup/IMG_1756/Version-1.apversion +160 -0
  105. data/test/data/TestFolder/Fireworks.approject/2009-12-10 @ 04:13:45 PM - 1.apimportgroup/IMG_1757/IMG_1757.JPG.apfile +40 -0
  106. data/test/data/TestFolder/Fireworks.approject/2009-12-10 @ 04:13:45 PM - 1.apimportgroup/IMG_1757/Info.apmaster +18 -0
  107. data/test/data/TestFolder/Fireworks.approject/2009-12-10 @ 04:13:45 PM - 1.apimportgroup/IMG_1757/OriginalVersionInfo.apversion +139 -0
  108. data/test/data/TestFolder/Fireworks.approject/2009-12-10 @ 04:13:45 PM - 1.apimportgroup/IMG_1757/Version-1.apversion +160 -0
  109. data/test/data/TestFolder/Fireworks.approject/2009-12-10 @ 04:13:45 PM - 1.apimportgroup/IMG_1758/IMG_1758.JPG.apfile +40 -0
  110. data/test/data/TestFolder/Fireworks.approject/2009-12-10 @ 04:13:45 PM - 1.apimportgroup/IMG_1758/Info.apmaster +18 -0
  111. data/test/data/TestFolder/Fireworks.approject/2009-12-10 @ 04:13:45 PM - 1.apimportgroup/IMG_1758/OriginalVersionInfo.apversion +139 -0
  112. data/test/data/TestFolder/Fireworks.approject/2009-12-10 @ 04:13:45 PM - 1.apimportgroup/IMG_1758/Version-1.apversion +160 -0
  113. data/test/data/TestFolder/Fireworks.approject/Album.implicitAlbum +123 -0
  114. data/test/data/TestFolder/Fireworks.approject/Info.apfolder +36 -0
  115. data/test/data/TestFolder/Info.apfolder +26 -0
  116. data/test/data/TestFolder/PAX.approject/2009-12-10 @ 04:19:15 PM - 1.apimportgroup/IMG_1943/IMG_1943.JPG.apfile +40 -0
  117. data/test/data/TestFolder/PAX.approject/2009-12-10 @ 04:19:15 PM - 1.apimportgroup/IMG_1943/Info.apmaster +18 -0
  118. data/test/data/TestFolder/PAX.approject/2009-12-10 @ 04:19:15 PM - 1.apimportgroup/IMG_1943/OriginalVersionInfo.apversion +139 -0
  119. data/test/data/TestFolder/PAX.approject/2009-12-10 @ 04:19:15 PM - 1.apimportgroup/IMG_1943/Version-1.apversion +162 -0
  120. data/test/data/TestFolder/PAX.approject/2009-12-10 @ 04:19:15 PM - 1.apimportgroup/IMG_1944/IMG_1944.JPG.apfile +40 -0
  121. data/test/data/TestFolder/PAX.approject/2009-12-10 @ 04:19:15 PM - 1.apimportgroup/IMG_1944/Info.apmaster +18 -0
  122. data/test/data/TestFolder/PAX.approject/2009-12-10 @ 04:19:15 PM - 1.apimportgroup/IMG_1944/OriginalVersionInfo.apversion +139 -0
  123. data/test/data/TestFolder/PAX.approject/2009-12-10 @ 04:19:15 PM - 1.apimportgroup/IMG_1944/Version-1.apversion +162 -0
  124. data/test/data/TestFolder/PAX.approject/2009-12-10 @ 04:19:15 PM - 1.apimportgroup/IMG_1945/IMG_1945.JPG.apfile +40 -0
  125. data/test/data/TestFolder/PAX.approject/2009-12-10 @ 04:19:15 PM - 1.apimportgroup/IMG_1945/Info.apmaster +18 -0
  126. data/test/data/TestFolder/PAX.approject/2009-12-10 @ 04:19:15 PM - 1.apimportgroup/IMG_1945/OriginalVersionInfo.apversion +139 -0
  127. data/test/data/TestFolder/PAX.approject/2009-12-10 @ 04:19:15 PM - 1.apimportgroup/IMG_1945/Version-1.apversion +162 -0
  128. data/test/data/TestFolder/PAX.approject/2009-12-10 @ 04:19:15 PM - 1.apimportgroup/IMG_1946/IMG_1946.JPG.apfile +40 -0
  129. data/test/data/TestFolder/PAX.approject/2009-12-10 @ 04:19:15 PM - 1.apimportgroup/IMG_1946/Info.apmaster +18 -0
  130. data/test/data/TestFolder/PAX.approject/2009-12-10 @ 04:19:15 PM - 1.apimportgroup/IMG_1946/OriginalVersionInfo.apversion +139 -0
  131. data/test/data/TestFolder/PAX.approject/2009-12-10 @ 04:19:15 PM - 1.apimportgroup/IMG_1946/Version-1.apversion +162 -0
  132. data/test/data/TestFolder/PAX.approject/2009-12-10 @ 04:19:15 PM - 1.apimportgroup/IMG_1947/IMG_1947.JPG.apfile +40 -0
  133. data/test/data/TestFolder/PAX.approject/2009-12-10 @ 04:19:15 PM - 1.apimportgroup/IMG_1947/Info.apmaster +18 -0
  134. data/test/data/TestFolder/PAX.approject/2009-12-10 @ 04:19:15 PM - 1.apimportgroup/IMG_1947/OriginalVersionInfo.apversion +139 -0
  135. data/test/data/TestFolder/PAX.approject/2009-12-10 @ 04:19:15 PM - 1.apimportgroup/IMG_1947/Version-1.apversion +162 -0
  136. data/test/data/TestFolder/PAX.approject/2009-12-10 @ 04:19:15 PM - 1.apimportgroup/IMG_1948/IMG_1948.JPG.apfile +40 -0
  137. data/test/data/TestFolder/PAX.approject/2009-12-10 @ 04:19:15 PM - 1.apimportgroup/IMG_1948/Info.apmaster +18 -0
  138. data/test/data/TestFolder/PAX.approject/2009-12-10 @ 04:19:15 PM - 1.apimportgroup/IMG_1948/OriginalVersionInfo.apversion +139 -0
  139. data/test/data/TestFolder/PAX.approject/2009-12-10 @ 04:19:15 PM - 1.apimportgroup/IMG_1948/Version-1.apversion +162 -0
  140. data/test/data/TestFolder/PAX.approject/Album.implicitAlbum +123 -0
  141. data/test/data/TestFolder/PAX.approject/Info.apfolder +36 -0
  142. data/test/data/TestRootAlbum.apalbum +135 -0
  143. data/test/data/dotMacWebGalleryProject.approject/Album.implicitAlbum +123 -0
  144. data/test/data/dotMacWebGalleryProject.approject/Info.apfolder +34 -0
  145. data/test/data/iPhone.apsmartalbum +280 -0
  146. data/test/helper.rb +20 -0
  147. data/test/test_album.rb +18 -0
  148. data/test/test_library.rb +85 -0
  149. data/test/test_photo.rb +48 -0
  150. data/test/test_photo_set.rb +92 -0
  151. data/test/test_project.rb +19 -0
  152. data/test/test_version.rb +39 -0
  153. metadata +213 -0
@@ -0,0 +1,27 @@
1
+
2
+ module Aperture
3
+ # = Overview
4
+ # The Photo object is built from two files (.apmaster and .apfile) for each file imported
5
+ # into an Aperture Library. Photo objects have attributes for the path it was found at. It's
6
+ # associated Version objects. As well as any Album objects it belongs to and the Project it's
7
+ # inside. Also it has twxo sets of attribute hashs one from the .apmaster file and the other
8
+ # from the .apfile file.
9
+ class Photo
10
+ attr_accessor :path, :versions, :albums, :project, :file_attributes, :master_attributes
11
+
12
+ # creates a new Photo object give a +path+ which is where the directory for the photo and
13
+ # it's metadata are found on disk.
14
+ def initialize(path)
15
+ @path = path
16
+ raise ArgumentError, "Requires valid directory path" unless File.directory?(@path)
17
+ @versions = []
18
+ @albums = []
19
+ end
20
+
21
+ # Takes a interger and returns back the Version object that matches the number
22
+ def version(n)
23
+ return @versions.select {|v| v.filename == "Version-#{n}.apversion"}.first
24
+ end
25
+
26
+ end
27
+ end
@@ -0,0 +1,88 @@
1
+
2
+ module Aperture
3
+
4
+ # = Overview
5
+ # The PhotoSet object that contains a series of Photo objects in a hash. This object is used
6
+ # by the Library, Album and Project objects cotain photos. This object also contains methods
7
+ # to look up interest statistics across the set.
8
+ #
9
+ # = Statistic gathering methods
10
+ # * photo_count - number of photos in set
11
+ # * version_count - number of versions across all photos in set
12
+ # * camera_model_count_hash - count of how many times each camera used in the set
13
+ # * lens_model_count_hash - count of how many times each lens used in the set
14
+ #
15
+ # *Note* This object can be directly treated like an array using each or any method from
16
+ # the Enumerable module. These will access the the values, the Photo objects, contained
17
+ # within the hash.
18
+ class PhotoSet
19
+ include Enumerable
20
+ attr_accessor :photos
21
+
22
+ # Creates a new PhotoSet, can be passed an array of Photo objects
23
+ def initialize(photos = {})
24
+ @photos = photos
25
+ end
26
+
27
+ # Adds a Photo to the hash PhotoSet uses to track Photo's using the photo's UUID. This UUID
28
+ # matches up to the masterUuid found in Version#attributes
29
+ def <<(photo)
30
+ @photos[ photo.master_attributes['uuid'] ] = photo
31
+ end
32
+
33
+ # Iterates over the hash's values, ie the photos, the PhotoSet is tracking
34
+ def each &blk
35
+ @photos.values.each &blk
36
+ end
37
+
38
+ # This method passes any unknown method calls onto the hash of photos, allowing you to
39
+ # treat the PhotoSet object as the Hash of photos it holds.
40
+ def method_missing(sym, *args, &block)
41
+ @photos.send(sym, *args, &block) if @photos.respond_to?(sym)
42
+ end
43
+
44
+
45
+ # Returns the number of photos tracked by the PhotoSet
46
+ def photo_count
47
+ return size
48
+ end
49
+
50
+ # Returns the number of versions across all the photos tracked by the PhotoSet
51
+ def version_count
52
+ return inject(0) {|sum, photo| sum += photo.versions.size}
53
+ end
54
+
55
+ # Returns a hash in the following format
56
+ # * The keys are the camera model for the photo parsed from the EXIF information
57
+ # * The value is the number of times that camera model shows up across all the photos in
58
+ # the set
59
+ def camera_model_count_hash
60
+ hash = Hash.new(0)
61
+ self.each do |photo|
62
+ model = photo.version(1).attributes['exifProperties']['Model']
63
+ hash[model] += 1
64
+ end
65
+
66
+ return hash
67
+ end
68
+
69
+ # Returns a hash in the following format
70
+ # * The keys are the lens model for the photo parsed from the EXIF information
71
+ # * The value is the number of times that lens model shows up across all the photos in
72
+ # the set
73
+ def lens_model_count_hash
74
+ hash = Hash.new(0)
75
+ self.each do |photo|
76
+ model = photo.version(1).attributes['exifProperties']['LensModel']
77
+ hash[model] += 1
78
+ end
79
+
80
+ return hash
81
+ end
82
+
83
+ # def find_photos_by_keyword
84
+
85
+ # def find_photos_by_rating
86
+
87
+ end
88
+ end
@@ -0,0 +1,16 @@
1
+
2
+ module Aperture
3
+ # = Overview
4
+ # The Project object matches up with Projects entries from an Aperture Library. Projects cotain
5
+ # Aperture::Photo objects through an Aperture::PhotoSet.
6
+ class Project
7
+ attr_accessor :photos, :attributes
8
+
9
+ # Creates a new Project object given a hash of attributes, this should be the hash returned
10
+ # from parsing the .approject/Info.apfolder file by the plist gem.
11
+ def initialize(attributes = {})
12
+ @attributes = attributes
13
+ @photos = PhotoSet.new
14
+ end
15
+ end
16
+ end
@@ -0,0 +1,20 @@
1
+
2
+ module Aperture
3
+ # = Overview
4
+ # The Version object matches up with Version entries from an Aperture Library. Version
5
+ # objects are linked an Aperture::Photo
6
+ class Version
7
+ attr_accessor :photo, :attributes, :filename
8
+
9
+ # Creates a new Version object given the following required arugments:
10
+ # * the filename for the .apversion file as found on the disk
11
+ # * a hash of attributes, this should be the hash returned from parsing the .apversion
12
+ # file by the plist gem.
13
+ # * the Photo object that the version is associated with
14
+ def initialize(filename, attributes, photo)
15
+ @attributes = attributes
16
+ @filename = filename
17
+ @photo = photo
18
+ end
19
+ end
20
+ end
@@ -0,0 +1,123 @@
1
+ <?xml version="1.0" encoding="UTF-8"?>
2
+ <!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
3
+ <plist version="1.0">
4
+ <dict>
5
+ <key>FilterInfo</key>
6
+ <dict>
7
+ <key>queryClassName</key>
8
+ <string>RKMultiItemQuery</string>
9
+ <key>queryIsEnabled</key>
10
+ <true/>
11
+ <key>queryMatchType</key>
12
+ <integer>1</integer>
13
+ <key>queryPredicateComponents</key>
14
+ <integer>1</integer>
15
+ <key>queryStackPicksOnly</key>
16
+ <false/>
17
+ <key>querySubqueries</key>
18
+ <array>
19
+ <dict>
20
+ <key>queryClassName</key>
21
+ <string>RKSingleItemQuery</string>
22
+ <key>queryIsEnabled</key>
23
+ <false/>
24
+ <key>queryPropertyKey</key>
25
+ <string>properties.any</string>
26
+ <key>queryQualifier</key>
27
+ <integer>23</integer>
28
+ <key>queryTimeValue</key>
29
+ <integer>1</integer>
30
+ <key>queryType</key>
31
+ <integer>14</integer>
32
+ </dict>
33
+ <dict>
34
+ <key>queryClassName</key>
35
+ <string>RKSingleItemQuery</string>
36
+ <key>queryFirstValue</key>
37
+ <integer>0</integer>
38
+ <key>queryIsEnabled</key>
39
+ <true/>
40
+ <key>queryPropertyKey</key>
41
+ <string>basicProperties.MainRating</string>
42
+ <key>queryQualifier</key>
43
+ <integer>8</integer>
44
+ <key>queryTimeValue</key>
45
+ <integer>1</integer>
46
+ <key>queryType</key>
47
+ <integer>5</integer>
48
+ </dict>
49
+ <dict>
50
+ <key>queryClassName</key>
51
+ <string>RKMultiItemQuery</string>
52
+ <key>queryIsEnabled</key>
53
+ <false/>
54
+ <key>queryMatchType</key>
55
+ <integer>0</integer>
56
+ <key>queryStackPicksOnly</key>
57
+ <false/>
58
+ <key>querySubqueries</key>
59
+ <array/>
60
+ <key>queryType</key>
61
+ <integer>2</integer>
62
+ </dict>
63
+ <dict>
64
+ <key>queryClassName</key>
65
+ <string>RKMultiItemQuery</string>
66
+ <key>queryIsEnabled</key>
67
+ <false/>
68
+ <key>queryMatchType</key>
69
+ <integer>0</integer>
70
+ <key>queryStackPicksOnly</key>
71
+ <false/>
72
+ <key>querySubqueries</key>
73
+ <array/>
74
+ <key>queryType</key>
75
+ <integer>4</integer>
76
+ </dict>
77
+ <dict>
78
+ <key>queryClassName</key>
79
+ <string>RKMultiItemQuery</string>
80
+ <key>queryIsEnabled</key>
81
+ <false/>
82
+ <key>queryMatchType</key>
83
+ <integer>0</integer>
84
+ <key>queryStackPicksOnly</key>
85
+ <false/>
86
+ <key>querySubqueries</key>
87
+ <array/>
88
+ <key>queryType</key>
89
+ <integer>3</integer>
90
+ </dict>
91
+ </array>
92
+ <key>queryType</key>
93
+ <integer>1</integer>
94
+ </dict>
95
+ <key>InfoDictionary</key>
96
+ <dict>
97
+ <key>albumSubclass</key>
98
+ <integer>1</integer>
99
+ <key>albumType</key>
100
+ <integer>1</integer>
101
+ <key>createDate</key>
102
+ <date>2009-12-11T00:08:24Z</date>
103
+ <key>dateLastSavedInDatabase</key>
104
+ <date>2009-12-11T00:08:24Z</date>
105
+ <key>folderUuid</key>
106
+ <string>05ejET0+QEyCLf0w96BQqA</string>
107
+ <key>metadataChangeDate</key>
108
+ <date>2009-12-11T00:08:24Z</date>
109
+ <key>name</key>
110
+ <string>.implicitAlbum</string>
111
+ <key>queryFolderUuid</key>
112
+ <string>05ejET0+QEyCLf0w96BQqA</string>
113
+ <key>sortAscending</key>
114
+ <true/>
115
+ <key>sortKeyPath</key>
116
+ <string>exifProperties.ImageDate</string>
117
+ <key>uuid</key>
118
+ <string>nceApmRuSti/y2P9fW3zPw</string>
119
+ <key>version</key>
120
+ <integer>74</integer>
121
+ </dict>
122
+ </dict>
123
+ </plist>
@@ -0,0 +1,159 @@
1
+ <?xml version="1.0" encoding="UTF-8"?>
2
+ <!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
3
+ <plist version="1.0">
4
+ <dict>
5
+ <key>FilterInfo</key>
6
+ <dict>
7
+ <key>queryClassName</key>
8
+ <string>RKMultiItemQuery</string>
9
+ <key>queryIsEnabled</key>
10
+ <true/>
11
+ <key>queryMatchType</key>
12
+ <integer>0</integer>
13
+ <key>queryPredicateComponents</key>
14
+ <integer>1</integer>
15
+ <key>queryStackPicksOnly</key>
16
+ <false/>
17
+ <key>querySubqueries</key>
18
+ <array>
19
+ <dict>
20
+ <key>queryClassName</key>
21
+ <string>RKSingleItemQuery</string>
22
+ <key>queryFirstValue</key>
23
+ <string></string>
24
+ <key>queryIsEnabled</key>
25
+ <false/>
26
+ <key>queryPropertyKey</key>
27
+ <string>properties.any</string>
28
+ <key>queryQualifier</key>
29
+ <integer>23</integer>
30
+ <key>queryTimeValue</key>
31
+ <integer>1</integer>
32
+ <key>queryType</key>
33
+ <integer>14</integer>
34
+ </dict>
35
+ <dict>
36
+ <key>queryClassName</key>
37
+ <string>RKSingleItemQuery</string>
38
+ <key>queryFirstValue</key>
39
+ <integer>0</integer>
40
+ <key>queryIsEnabled</key>
41
+ <true/>
42
+ <key>queryPropertyKey</key>
43
+ <string>basicProperties.MainRating</string>
44
+ <key>queryQualifier</key>
45
+ <integer>8</integer>
46
+ <key>queryTimeValue</key>
47
+ <integer>1</integer>
48
+ <key>queryType</key>
49
+ <integer>5</integer>
50
+ </dict>
51
+ <dict>
52
+ <key>queryClassName</key>
53
+ <string>RKMultiItemQuery</string>
54
+ <key>queryIsEnabled</key>
55
+ <false/>
56
+ <key>queryMatchType</key>
57
+ <integer>0</integer>
58
+ <key>queryStackPicksOnly</key>
59
+ <false/>
60
+ <key>querySubqueries</key>
61
+ <array/>
62
+ <key>queryType</key>
63
+ <integer>2</integer>
64
+ </dict>
65
+ <dict>
66
+ <key>queryClassName</key>
67
+ <string>RKMultiItemQuery</string>
68
+ <key>queryIsEnabled</key>
69
+ <false/>
70
+ <key>queryMatchType</key>
71
+ <integer>0</integer>
72
+ <key>queryStackPicksOnly</key>
73
+ <false/>
74
+ <key>querySubqueries</key>
75
+ <array/>
76
+ <key>queryType</key>
77
+ <integer>4</integer>
78
+ </dict>
79
+ <dict>
80
+ <key>queryClassName</key>
81
+ <string>RKMultiItemQuery</string>
82
+ <key>queryIsEnabled</key>
83
+ <false/>
84
+ <key>queryMatchType</key>
85
+ <integer>0</integer>
86
+ <key>queryStackPicksOnly</key>
87
+ <false/>
88
+ <key>querySubqueries</key>
89
+ <array/>
90
+ <key>queryType</key>
91
+ <integer>3</integer>
92
+ </dict>
93
+ </array>
94
+ <key>queryType</key>
95
+ <integer>1</integer>
96
+ </dict>
97
+ <key>InfoDictionary</key>
98
+ <dict>
99
+ <key>albumSubclass</key>
100
+ <integer>2</integer>
101
+ <key>albumType</key>
102
+ <integer>1</integer>
103
+ <key>createDate</key>
104
+ <date>2009-12-11T00:08:24Z</date>
105
+ <key>dateLastSavedInDatabase</key>
106
+ <date>2009-12-11T00:08:24Z</date>
107
+ <key>folderUuid</key>
108
+ <string>05ejET0+QEyCLf0w96BQqA</string>
109
+ <key>metadataChangeDate</key>
110
+ <date>2009-12-11T00:08:24Z</date>
111
+ <key>name</key>
112
+ <string>090-entireLibraryQuery.apsmartalbum</string>
113
+ <key>queryFolderUuid</key>
114
+ <string>Kj1eGir7SyiZ1B/uQrgfcQ</string>
115
+ <key>sortAscending</key>
116
+ <true/>
117
+ <key>sortKeyPath</key>
118
+ <string>exifProperties.ImageDate</string>
119
+ <key>uuid</key>
120
+ <string>USH4MRvhSfCxGw+WHVXzIg</string>
121
+ <key>version</key>
122
+ <integer>74</integer>
123
+ </dict>
124
+ <key>UserQueryInfo</key>
125
+ <dict>
126
+ <key>queryClassName</key>
127
+ <string>RKMultiItemQuery</string>
128
+ <key>queryIsEnabled</key>
129
+ <true/>
130
+ <key>queryMatchType</key>
131
+ <integer>0</integer>
132
+ <key>queryPredicateComponents</key>
133
+ <integer>1</integer>
134
+ <key>queryStackPicksOnly</key>
135
+ <false/>
136
+ <key>querySubqueries</key>
137
+ <array>
138
+ <dict>
139
+ <key>queryClassName</key>
140
+ <string>RKSingleItemQuery</string>
141
+ <key>queryFirstValue</key>
142
+ <real>-1</real>
143
+ <key>queryIsEnabled</key>
144
+ <true/>
145
+ <key>queryPropertyKey</key>
146
+ <string>basicProperties.MainRating</string>
147
+ <key>queryQualifier</key>
148
+ <integer>8</integer>
149
+ <key>queryTimeValue</key>
150
+ <integer>1</integer>
151
+ <key>queryType</key>
152
+ <integer>5</integer>
153
+ </dict>
154
+ </array>
155
+ <key>queryType</key>
156
+ <integer>1</integer>
157
+ </dict>
158
+ </dict>
159
+ </plist>
@@ -0,0 +1,159 @@
1
+ <?xml version="1.0" encoding="UTF-8"?>
2
+ <!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
3
+ <plist version="1.0">
4
+ <dict>
5
+ <key>FilterInfo</key>
6
+ <dict>
7
+ <key>queryClassName</key>
8
+ <string>RKMultiItemQuery</string>
9
+ <key>queryIsEnabled</key>
10
+ <true/>
11
+ <key>queryMatchType</key>
12
+ <integer>0</integer>
13
+ <key>queryPredicateComponents</key>
14
+ <integer>1</integer>
15
+ <key>queryStackPicksOnly</key>
16
+ <false/>
17
+ <key>querySubqueries</key>
18
+ <array>
19
+ <dict>
20
+ <key>queryClassName</key>
21
+ <string>RKSingleItemQuery</string>
22
+ <key>queryFirstValue</key>
23
+ <string></string>
24
+ <key>queryIsEnabled</key>
25
+ <false/>
26
+ <key>queryPropertyKey</key>
27
+ <string>properties.any</string>
28
+ <key>queryQualifier</key>
29
+ <integer>23</integer>
30
+ <key>queryTimeValue</key>
31
+ <integer>1</integer>
32
+ <key>queryType</key>
33
+ <integer>14</integer>
34
+ </dict>
35
+ <dict>
36
+ <key>queryClassName</key>
37
+ <string>RKSingleItemQuery</string>
38
+ <key>queryFirstValue</key>
39
+ <integer>0</integer>
40
+ <key>queryIsEnabled</key>
41
+ <false/>
42
+ <key>queryPropertyKey</key>
43
+ <string>basicProperties.MainRating</string>
44
+ <key>queryQualifier</key>
45
+ <integer>8</integer>
46
+ <key>queryTimeValue</key>
47
+ <integer>1</integer>
48
+ <key>queryType</key>
49
+ <integer>5</integer>
50
+ </dict>
51
+ <dict>
52
+ <key>queryClassName</key>
53
+ <string>RKMultiItemQuery</string>
54
+ <key>queryIsEnabled</key>
55
+ <false/>
56
+ <key>queryMatchType</key>
57
+ <integer>0</integer>
58
+ <key>queryStackPicksOnly</key>
59
+ <false/>
60
+ <key>querySubqueries</key>
61
+ <array/>
62
+ <key>queryType</key>
63
+ <integer>2</integer>
64
+ </dict>
65
+ <dict>
66
+ <key>queryClassName</key>
67
+ <string>RKMultiItemQuery</string>
68
+ <key>queryIsEnabled</key>
69
+ <false/>
70
+ <key>queryMatchType</key>
71
+ <integer>0</integer>
72
+ <key>queryStackPicksOnly</key>
73
+ <false/>
74
+ <key>querySubqueries</key>
75
+ <array/>
76
+ <key>queryType</key>
77
+ <integer>4</integer>
78
+ </dict>
79
+ <dict>
80
+ <key>queryClassName</key>
81
+ <string>RKMultiItemQuery</string>
82
+ <key>queryIsEnabled</key>
83
+ <false/>
84
+ <key>queryMatchType</key>
85
+ <integer>0</integer>
86
+ <key>queryStackPicksOnly</key>
87
+ <false/>
88
+ <key>querySubqueries</key>
89
+ <array/>
90
+ <key>queryType</key>
91
+ <integer>3</integer>
92
+ </dict>
93
+ </array>
94
+ <key>queryType</key>
95
+ <integer>1</integer>
96
+ </dict>
97
+ <key>InfoDictionary</key>
98
+ <dict>
99
+ <key>albumSubclass</key>
100
+ <integer>2</integer>
101
+ <key>albumType</key>
102
+ <integer>1</integer>
103
+ <key>createDate</key>
104
+ <date>2009-12-11T00:08:24Z</date>
105
+ <key>dateLastSavedInDatabase</key>
106
+ <date>2009-12-11T00:08:24Z</date>
107
+ <key>folderUuid</key>
108
+ <string>05ejET0+QEyCLf0w96BQqA</string>
109
+ <key>metadataChangeDate</key>
110
+ <date>2009-12-11T00:08:24Z</date>
111
+ <key>name</key>
112
+ <string>100-selectsQuery.apsmartalbum</string>
113
+ <key>queryFolderUuid</key>
114
+ <string>Kj1eGir7SyiZ1B/uQrgfcQ</string>
115
+ <key>sortAscending</key>
116
+ <true/>
117
+ <key>sortKeyPath</key>
118
+ <string>exifProperties.ImageDate</string>
119
+ <key>uuid</key>
120
+ <string>vjnMZlvcRHGR6i0eYm4QPA</string>
121
+ <key>version</key>
122
+ <integer>74</integer>
123
+ </dict>
124
+ <key>UserQueryInfo</key>
125
+ <dict>
126
+ <key>queryClassName</key>
127
+ <string>RKMultiItemQuery</string>
128
+ <key>queryIsEnabled</key>
129
+ <true/>
130
+ <key>queryMatchType</key>
131
+ <integer>0</integer>
132
+ <key>queryPredicateComponents</key>
133
+ <integer>1</integer>
134
+ <key>queryStackPicksOnly</key>
135
+ <false/>
136
+ <key>querySubqueries</key>
137
+ <array>
138
+ <dict>
139
+ <key>queryClassName</key>
140
+ <string>RKSingleItemQuery</string>
141
+ <key>queryFirstValue</key>
142
+ <real>5</real>
143
+ <key>queryIsEnabled</key>
144
+ <true/>
145
+ <key>queryPropertyKey</key>
146
+ <string>basicProperties.MainRating</string>
147
+ <key>queryQualifier</key>
148
+ <integer>8</integer>
149
+ <key>queryTimeValue</key>
150
+ <integer>1</integer>
151
+ <key>queryType</key>
152
+ <integer>5</integer>
153
+ </dict>
154
+ </array>
155
+ <key>queryType</key>
156
+ <integer>1</integer>
157
+ </dict>
158
+ </dict>
159
+ </plist>