lrcat 0.0.1 → 0.0.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 1f4b3587164ec1022a8302bf7b5b148cf193a173
4
- data.tar.gz: 0cdd78f1459d4327971d0b89d613002d71cb8925
3
+ metadata.gz: 0a21e3aa672e76b1c272b69cb1f1930a9b0cac78
4
+ data.tar.gz: 64136150626a9365e5fb06f33d6ee95e16344a9b
5
5
  SHA512:
6
- metadata.gz: e8feb3fe58f6f61d2879cab7445a86bf078f658f3385f9f0ed3ad4c3c5de8baa3806f3cebcd9c4f30a69ee14bad77a693551ef49a10a33ec281ade4fcfc438a9
7
- data.tar.gz: 968c9e04e83c66457b621bdc66edc5a44a00aee127cf650d210018cecb6ce9244997f40b5ac0b23cf23d70883696707cc86170e8a1f3fe49050a0d6f957c848d
6
+ metadata.gz: 2d132139fddc6737afc003628f522242e1d485a37680a568c0945030ed781fcfcb8403c1b7f36be7650c3e74d7a87693c6f1c89459762bf366a339e8488dbd78
7
+ data.tar.gz: d3c322e675206441ed33b8d47aa9a859f503ffc00023b14095d66a09ed7156e0164c05f4c3d7429c2f1caa2f20d3e969a9b9ee482e64d16f3482255bb3d3dc06
data/.gitignore CHANGED
@@ -50,3 +50,6 @@ tmp
50
50
  .yardoc
51
51
  _yardoc
52
52
  doc/
53
+
54
+ # Lightroom previews
55
+ *.lrdata
data/.rspec ADDED
@@ -0,0 +1,2 @@
1
+ --color
2
+ --format documentation
@@ -0,0 +1,11 @@
1
+ language: ruby
2
+ rvm:
3
+ - 2.0.0
4
+ - 1.9.3
5
+ deploy:
6
+ provider: rubygems
7
+ api_key:
8
+ secure: emfzqvJLLpuWX5Es+DzVL6BoO7wdSftktZVpsHh4VkYXJ7yMr8o2KG1+ro0JH12piI5XKuyxIO9fshWFBPtCiheACHMUZyClSRRef4vONTL594wP90MgqHig12e0X+Aa48bNEo8eBjyF6+TbB0uTUkbJrpSKrPJ1H7WJjnOUcpc=
9
+ gem: lrcat
10
+ on:
11
+ repo: maxmouchet/lrcat.rb
data/README.md CHANGED
@@ -1,4 +1,7 @@
1
1
  # Lrcat.rb
2
+ [![Build Status](https://travis-ci.org/maxmouchet/lrcat.rb.png?branch=master)](https://travis-ci.org/maxmouchet/lrcat.rb)
3
+ [![Code Climate](https://codeclimate.com/github/maxmouchet/lrcat.rb.png)](https://codeclimate.com/github/maxmouchet/lrcat.rb)
4
+ [![Gem Version](https://badge.fury.io/rb/lrcat.png)](http://badge.fury.io/rb/lrcat)
2
5
 
3
6
  ActiveRecord mappings for the Lightroom Catalog.
4
7
 
data/Rakefile CHANGED
@@ -1 +1,6 @@
1
1
  require 'bundler/gem_tasks'
2
+ require 'rspec/core/rake_task'
3
+
4
+ RSpec::Core::RakeTask.new('spec')
5
+
6
+ task :default => :spec
@@ -7,6 +7,8 @@ require 'lrcat/catalog/library_root_folder'
7
7
 
8
8
  require 'lrcat/catalog/image'
9
9
  require 'lrcat/catalog/exif_metadata'
10
+ require 'lrcat/catalog/additional_metadata'
11
+
10
12
  require 'lrcat/catalog/develop_settings'
11
13
 
12
14
  require 'lrcat/catalog/lens'
@@ -0,0 +1,30 @@
1
+ module Lrcat
2
+ module Catalog
3
+
4
+ # AdditionalMetadata links to the Adobe_AdditionalMetadata table.
5
+ #
6
+ # The following columns are available in Lightroom 5:
7
+ # - id_local
8
+ # - id_global
9
+ # - additionalInfoSet
10
+ # - embeddedXmp
11
+ # - externalXmpIsDirty
12
+ # - image
13
+ # - incrementalWhiteBalance
14
+ # - internalXmpDigest
15
+ # - isRawFile
16
+ # - lastSynchronizedHash
17
+ # - lastSynchronizedTimestamp
18
+ # - metadataPresetID
19
+ # - metadataVersion
20
+ # - monochrome
21
+ # - xmp
22
+ class AdditionalMetadata < ActiveRecord::Base
23
+ self.table_name = 'Adobe_AdditionalMetadata'
24
+ self.primary_key = 'id_local'
25
+
26
+ belongs_to :image, foreign_key: 'image'
27
+ end
28
+
29
+ end
30
+ end
@@ -1,6 +1,12 @@
1
1
  module Lrcat
2
2
  module Catalog
3
3
 
4
+ # CameraModel links to the AgInternedExifCameraModel table.
5
+ #
6
+ # The following columns are available in Lightroom 5:
7
+ # - id_local
8
+ # - searchIndex
9
+ # - value
4
10
  class CameraModel < ActiveRecord::Base
5
11
  self.table_name = 'AgInternedExifCameraModel'
6
12
  self.primary_key = 'id_local'
@@ -1,6 +1,12 @@
1
1
  module Lrcat
2
2
  module Catalog
3
3
 
4
+ # CameraSerial links to the AgInternedExifCameraSN table.
5
+ #
6
+ # The following columns are available in Lightroom 5:
7
+ # - id_local
8
+ # - searchIndex
9
+ # - value
4
10
  class CameraSerial < ActiveRecord::Base
5
11
  self.table_name = 'AgInternedExifCameraSN'
6
12
  self.primary_key = 'id_local'
@@ -1,6 +1,28 @@
1
1
  module Lrcat
2
2
  module Catalog
3
3
 
4
+ # DevelopSettings links to the Adobe_imageDevelopSettings table.
5
+ #
6
+ # The following columns are available in Lightroom 5:
7
+ # - id_local
8
+ # - allowFastRender
9
+ # - beforeSettingsIDCache
10
+ # - croppedHeight
11
+ # - croppedWidth
12
+ # - digest
13
+ # - fileHeight
14
+ # - fileWidth
15
+ # - grayscale
16
+ # - hasDevelopAdjustments
17
+ # - hasDevelopAdjustmentsEx
18
+ # - historySettingsID
19
+ # - image
20
+ # - processVersion
21
+ # - settingsID
22
+ # - snapshotID
23
+ # - text
24
+ # - validatedForVersion
25
+ # - whiteBalance
4
26
  class DevelopSettings < ActiveRecord::Base
5
27
  self.table_name = 'Adobe_imageDevelopSettings'
6
28
  self.primary_key = 'id_local'
@@ -1,6 +1,26 @@
1
1
  module Lrcat
2
2
  module Catalog
3
3
 
4
+ # ExifMetadata links to the AgHarvestedExifMetadata table.
5
+ #
6
+ # The following columns are available in Lightroom 5:
7
+ # - id_local
8
+ # - image
9
+ # - aperture
10
+ # - cameraModelRef
11
+ # - cameraSNRef
12
+ # - dateDay
13
+ # - dateMonth
14
+ # - dateYear
15
+ # - flashFired
16
+ # - focalLength
17
+ # - gpsLatitude
18
+ # - gpsLongitude
19
+ # - gpsSequence
20
+ # - hasGPS
21
+ # - isoSpeedRating
22
+ # - lensRef
23
+ # - shutterSpeed
4
24
  class ExifMetadata < ActiveRecord::Base
5
25
  self.table_name = 'AgHarvestedExifMetadata'
6
26
  self.primary_key = 'id_local'
@@ -1,14 +1,49 @@
1
1
  module Lrcat
2
2
  module Catalog
3
3
 
4
+ # Image links to the Adobe_images table.
5
+ #
6
+ # The following columns are available in Lightroom 5:
7
+ # - id_local
8
+ # - id_global
9
+ # - aspectRatioCache
10
+ # - bitDepth
11
+ # - captureTime
12
+ # - colorChannels
13
+ # - colorLabels
14
+ # - colorMode
15
+ # - copyCreationTime
16
+ # - copyName
17
+ # - copyReason
18
+ # - developSettingsIDCache
19
+ # - fileFormat
20
+ # - fileHeight
21
+ # - fileWidth
22
+ # - hasMissingSidecars
23
+ # - masterImage
24
+ # - orientation
25
+ # - originalCaptureTime
26
+ # - originalRootEntity
27
+ # - panningDistanceH
28
+ # - panningDistanceV
29
+ # - pick
30
+ # - positionInFolder
31
+ # - propertiesCache
32
+ # - pyramidIDCache
33
+ # - rating
34
+ # - rootFile
35
+ # - sidecarStatus
36
+ # - touchCount
37
+ # - touchTime
4
38
  class Image < ActiveRecord::Base
5
39
  self.table_name = 'Adobe_images'
6
40
  self.primary_key = 'id_local'
7
41
 
8
42
  belongs_to :library_file, foreign_key: 'rootFile'
9
43
 
10
- has_one :develop_settings, foreign_key: 'image'
11
- has_one :exif_metadata, foreign_key: 'image'
44
+ has_one :develop_settings, foreign_key: 'image'
45
+ has_one :exif_metadata, foreign_key: 'image'
46
+ has_one :additional_metadata, foreign_key: 'image'
12
47
  end
13
48
 
14
49
  end
@@ -1,6 +1,12 @@
1
1
  module Lrcat
2
2
  module Catalog
3
3
 
4
+ # Lens links to the AgInternedExifLens table.
5
+ #
6
+ # The following columns are available in Lightroom 5:
7
+ # - id_local
8
+ # - searchIndex
9
+ # - value
4
10
  class Lens < ActiveRecord::Base
5
11
  self.table_name = 'AgInternedExifLens'
6
12
  self.primary_key = 'id_local'
@@ -1,12 +1,31 @@
1
1
  module Lrcat
2
2
  module Catalog
3
3
 
4
+ # LibraryFile links to the AgLibraryFile table.
5
+ #
6
+ # The following columns are available in Lightroom 5:
7
+ # - id_local
8
+ # - id_global
9
+ # - baseName
10
+ # - errorMessage
11
+ # - errorTime
12
+ # - extension
13
+ # - externalModTime
14
+ # - folder
15
+ # - idx_filename
16
+ # - importHash
17
+ # - lc_idx_filename
18
+ # - lc_idx_filenameEx
19
+ # - md5
20
+ # - modTime
21
+ # - originalFilename
22
+ # - sidecarExtensions
4
23
  class LibraryFile < ActiveRecord::Base
5
24
  self.table_name = 'AgLibraryFile'
6
25
  self.primary_key = 'id_local'
7
26
 
8
27
  belongs_to :library_folder, foreign_key: 'folder'
9
-
28
+
10
29
  has_one :image, foreign_key: 'rootFile'
11
30
  end
12
31
 
@@ -1,6 +1,13 @@
1
1
  module Lrcat
2
2
  module Catalog
3
3
 
4
+ # LibraryFolder links to the AgLibraryFolder table.
5
+ #
6
+ # The following columns are available in Lightroom 5:
7
+ # - id_local
8
+ # - id_global
9
+ # - pathFromRoot
10
+ # - rootFolder
4
11
  class LibraryFolder < ActiveRecord::Base
5
12
  self.table_name = 'AgLibraryFolder'
6
13
  self.primary_key = 'id_local'
@@ -1,6 +1,14 @@
1
1
  module Lrcat
2
2
  module Catalog
3
3
 
4
+ # LibraryRootFolder links to the AgLibraryRootFolder table.
5
+ #
6
+ # The following columns are available in Lightroom 5:
7
+ # - id_local
8
+ # - id_global
9
+ # - absolutePath
10
+ # - name
11
+ # - relativePathFromCatalog
4
12
  class LibraryRootFolder < ActiveRecord::Base
5
13
  self.table_name = 'AgLibraryRootFolder'
6
14
  self.primary_key = 'id_local'
@@ -1,3 +1,3 @@
1
1
  module Lrcat
2
- VERSION = "0.0.1"
2
+ VERSION = "0.0.2"
3
3
  end
@@ -20,6 +20,7 @@ Gem::Specification.new do |spec|
20
20
 
21
21
  spec.add_development_dependency 'bundler', '~> 1.3'
22
22
  spec.add_development_dependency 'rake'
23
+ spec.add_development_dependency 'rspec'
23
24
 
24
25
  spec.add_runtime_dependency 'sqlite3', '~> 1.3'
25
26
  spec.add_runtime_dependency 'activerecord', '~> 4.0'
@@ -0,0 +1,33 @@
1
+ require 'spec_helper'
2
+
3
+ require 'lrcat/catalog/image'
4
+
5
+ require 'lrcat/catalog/exif_metadata'
6
+ require 'lrcat/catalog/develop_settings'
7
+ require 'lrcat/catalog/additional_metadata'
8
+
9
+ include Lrcat
10
+
11
+ describe '#id_local' do
12
+ it 'returns an integer' do
13
+ expect(Catalog::Image.first.id_local).to be_a(Integer)
14
+ end
15
+ end
16
+
17
+ describe '#develop_settings' do
18
+ it 'returns the develop settings' do
19
+ expect(Catalog::Image.first.develop_settings).to be_an_instance_of(Catalog::DevelopSettings)
20
+ end
21
+ end
22
+
23
+ describe '#exif_metadata' do
24
+ it 'returns the exif metadatas' do
25
+ expect(Catalog::Image.first.exif_metadata).to be_an_instance_of(Catalog::ExifMetadata)
26
+ end
27
+ end
28
+
29
+ describe '#additional_metadata' do
30
+ it 'returns the additional metadatas' do
31
+ expect(Catalog::Image.first.additional_metadata).to be_an_instance_of(Catalog::AdditionalMetadata)
32
+ end
33
+ end
@@ -0,0 +1,20 @@
1
+ # This file was generated by the `rspec --init` command. Conventionally, all
2
+ # specs live under a `spec` directory, which RSpec adds to the `$LOAD_PATH`.
3
+ # Require this file using `require "spec_helper"` to ensure that it is only
4
+ # loaded once.
5
+ #
6
+ # See http://rubydoc.info/gems/rspec-core/RSpec/Core/Configuration
7
+ RSpec.configure do |config|
8
+ config.treat_symbols_as_metadata_keys_with_true_values = true
9
+ config.run_all_when_everything_filtered = true
10
+ config.filter_run :focus
11
+
12
+ # Run specs in random order to surface order dependencies. If you find an
13
+ # order dependency and want to debug it, you can fix the order by providing
14
+ # the seed, which is printed after each run.
15
+ # --seed 1234
16
+ config.order = 'random'
17
+ end
18
+
19
+ require 'lrcat'
20
+ Lrcat::Catalog.open('spec/test_catalog_1/test_catalog_1.lrcat')
@@ -0,0 +1,74 @@
1
+ require 'sqlite3'
2
+ require 'awesome_print'
3
+
4
+ class String
5
+ def underscore
6
+ word = self.dup
7
+ word.gsub!(/::/, '/')
8
+ word.gsub!(/([A-Z]+)([A-Z][a-z])/,'\1_\2')
9
+ word.gsub!(/([a-z\d])([A-Z])/,'\1_\2')
10
+ word.tr!("-", "_")
11
+ word.downcase!
12
+ word
13
+ end
14
+ end
15
+
16
+ db = SQLite3::Database.new('/Users/maxmouchet/max.lrcat')
17
+
18
+ tables = {}
19
+
20
+ db.execute("SELECT name FROM sqlite_master WHERE type='table'") do |table_name|
21
+ table_columns = []
22
+ db.execute("PRAGMA table_info(#{ table_name[0] })") do |column_info|
23
+ table_columns << {
24
+ name: column_info[1],
25
+ type: column_info[2],
26
+ null: column_info[3],
27
+ default: column_info[4],
28
+ primary_key?: column_info[5]
29
+ }
30
+ end
31
+ tables[table_name[0]] = table_columns
32
+ end
33
+
34
+
35
+ def gen_file(table_name, table_columns)
36
+ output = ""
37
+
38
+ puts "Table name: #{ table_name }"
39
+ print "Class name: "
40
+ class_name = gets.strip
41
+
42
+ return 0 if (class_name.strip == "")
43
+
44
+ filename = class_name.underscore + ".rb"
45
+ puts "Filename will be: #{ filename }"
46
+
47
+ primary_key = 'id_local'
48
+ # table_columns.each do |table_column|
49
+ # if table_column[:primary_key?]
50
+ # primary_key = table_column[:name]
51
+ # end
52
+ # end
53
+
54
+ output += "module Lrcat\n"
55
+ output += " module Catalog\n\n"
56
+ output += " # #{ class_name } links to the #{ table_name } table.\n"
57
+ output += " #\n"
58
+ output += " # The following columns are available in Lightroom 5:\n"
59
+ table_columns.each do |table_column|
60
+ output += " # - #{ table_column[:name] }\n"
61
+ end
62
+ output += " class #{ class_name } < ActiveRecord::Base\n"
63
+ output += " self.table_name = '#{ table_name }'\n"
64
+ output += " self.primary_key = '#{ primary_key }'\n"
65
+ output += " end\n\n"
66
+ output += " end\n"
67
+ output += "end\n"
68
+
69
+ File.open("tmp/#{ filename }", "w") { |file| file.puts(output) }
70
+ end
71
+
72
+ tables.each do |k,v|
73
+ gen_file(k, v)
74
+ end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: lrcat
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.1
4
+ version: 0.0.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Maxime Mouchet
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2013-12-10 00:00:00.000000000 Z
11
+ date: 2013-12-12 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -38,6 +38,20 @@ dependencies:
38
38
  - - '>='
39
39
  - !ruby/object:Gem::Version
40
40
  version: '0'
41
+ - !ruby/object:Gem::Dependency
42
+ name: rspec
43
+ requirement: !ruby/object:Gem::Requirement
44
+ requirements:
45
+ - - '>='
46
+ - !ruby/object:Gem::Version
47
+ version: '0'
48
+ type: :development
49
+ prerelease: false
50
+ version_requirements: !ruby/object:Gem::Requirement
51
+ requirements:
52
+ - - '>='
53
+ - !ruby/object:Gem::Version
54
+ version: '0'
41
55
  - !ruby/object:Gem::Dependency
42
56
  name: sqlite3
43
57
  requirement: !ruby/object:Gem::Requirement
@@ -74,12 +88,15 @@ extensions: []
74
88
  extra_rdoc_files: []
75
89
  files:
76
90
  - .gitignore
91
+ - .rspec
92
+ - .travis.yml
77
93
  - Gemfile
78
94
  - LICENSE.txt
79
95
  - README.md
80
96
  - Rakefile
81
97
  - lib/lrcat.rb
82
98
  - lib/lrcat/catalog.rb
99
+ - lib/lrcat/catalog/additional_metadata.rb
83
100
  - lib/lrcat/catalog/camera_model.rb
84
101
  - lib/lrcat/catalog/camera_serial.rb
85
102
  - lib/lrcat/catalog/develop_settings.rb
@@ -91,6 +108,10 @@ files:
91
108
  - lib/lrcat/catalog/library_root_folder.rb
92
109
  - lib/lrcat/version.rb
93
110
  - lrcat.gemspec
111
+ - spec/lrcat/catalog/image_spec.rb
112
+ - spec/spec_helper.rb
113
+ - spec/test_catalog_1/test_catalog_1.lrcat
114
+ - tools/generate_class.rb
94
115
  homepage: https://github.com/maxmouchet/lrcat.rb
95
116
  licenses:
96
117
  - MIT
@@ -115,5 +136,8 @@ rubygems_version: 2.0.3
115
136
  signing_key:
116
137
  specification_version: 4
117
138
  summary: ActiveRecord mappings for the Lightroom Catalog.
118
- test_files: []
139
+ test_files:
140
+ - spec/lrcat/catalog/image_spec.rb
141
+ - spec/spec_helper.rb
142
+ - spec/test_catalog_1/test_catalog_1.lrcat
119
143
  has_rdoc: