chronicle-imessage 0.2.3 → 0.2.6

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 2be4dbec8ee2945136d579ab8d42d8580160c6eacc839d92a55a5a462f749385
4
- data.tar.gz: c9a229903ebaffcc63fd52a480237e47f119142d3036c6a0c32513f7891ba114
3
+ metadata.gz: 487662c0e1aa17dde6c9463a21e7c47ff154680b56b1b4b0bafe90f0697300fa
4
+ data.tar.gz: 66a2ac859488c93b9a56a0cd0a1d57dfa603fad53deced6d569f2e9da575b09f
5
5
  SHA512:
6
- metadata.gz: 86dd00967c9a1a689bd575d399c0869db3b42152f7043386362caf84eaccb13a5f4c865c38546c4d6f30692629e37132687266ed284d90f2ac0141d021cba330
7
- data.tar.gz: f3de0abf901aa6f9a2c3484f6414bd8f9d9d566c57f2ebaf4e2e3a6c74f465a1efedf6e69d88567a903c9c090a51a0e685a6c9bbeb31ad37a0c40a677c17daba
6
+ metadata.gz: 1eedfca866b70d9711b54078b52086b578d1fa90c1f444d1f6df3af52245cec1960b461d22d0e39a009a56b7b3063e5c725c848f5cfddced5e5dd0be3e4bb057
7
+ data.tar.gz: bbad7a7002e5806eb81076e1360794dea1cbf75392700dd88496b447a516e23bacb170ca165dc18ad3a61f7fbf5c5a1360b5263dd9402820ea728b946ac2a430
data/README.md CHANGED
@@ -1,18 +1,42 @@
1
1
  # Chronicle::Imessage
2
+ [![Gem Version](https://badge.fury.io/rb/chronicle-imessage.svg)](https://badge.fury.io/rb/chronicle-imessage)
2
3
 
3
- IMessage importer for [chronicle-etl](https://github.com/chronicle-app/chronicle-etl)
4
+ Access your iMessage messages and attachments using the command line with this plugin for [chronicle-etl](https://github.com/chronicle-app/chronicle-etl).
5
+
6
+ ## Usage
7
+
8
+ ```sh
9
+ # Install chronicle-etl and this plugin
10
+ $ gem install chronicle-etl
11
+ $ chronicle-etl plugins:install imessage
12
+
13
+ # Load messages since February 7
14
+ $ chronicle-etl --extractor imessage --transformer imessage --since "2022-02-07"
15
+
16
+ # Of the latest 1000 messages received, who were the top senders?
17
+ $ chronicle-etl -e imessage -t imessage --limit 1000 --no-header-row --fields actor.title | sort | uniq -c | sort -nr
18
+
19
+ # Get the raw query results for the latest 10 messages and save as a CSV
20
+ $ chronicle-etl -e imessage --loader csv --limit 10 -o imessages.csv
21
+ ```
4
22
 
5
23
  ## Available Connectors
6
24
  ### Extractors
7
- - `imessage` - Extractor for importing messages and attachments from local macOS iMessage install (`~/Library/Messages/chat.db`)
8
25
 
9
- ### Transformers
10
- - `imessage` - Transformer for processing messages into Chronicle Schema
26
+ #### `imessage`
27
+ Extractor for importing messages and attachments from local macOS iMessage install (`~/Library/Messages/chat.db`)
11
28
 
12
- ## Usage
29
+ ##### Settings
30
+ - `load_attachments`: (default: false) Whether to load message attachments
31
+ - `only_attachments`: (default: false) Whether to load only messages with attachments
13
32
 
14
- ```bash
15
- gem install chronicle-etl
16
- chronicle-etl plugins:install imessage
17
- chronicle-etl --extractor imessage --since "2022-02-07" --transformer imessage
18
- ```
33
+ We want messages to have sender/receiver information set properly so we try to infer your iCloud information and phone number automatically. If these fail, you can provide the necessary information with:
34
+ - `my_phone_number`: Your phone number (for setting messages's actor fields properly)
35
+ - `my_name`: Your name (for setting messages's actor fields properly)
36
+ - `icloud_account_id`: Specify an email address that represents your iCloud account ID
37
+ - `icloud_account_dsid`: Specify iCloud DSID
38
+ - Can find in Keychain or by running `$ defaults read MobileMeAccounts Accounts`
39
+ ### Transformers
40
+
41
+ #### `imessage`
42
+ Transform an iMessage message into Chronicle Schema
@@ -35,7 +35,7 @@ Gem::Specification.new do |spec|
35
35
  spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
36
36
  spec.require_paths = ["lib"]
37
37
 
38
- spec.add_dependency "chronicle-etl", "~> 0.4.2"
38
+ spec.add_dependency "chronicle-etl", "~> 0.5"
39
39
  spec.add_dependency "sqlite3", "~> 1.4"
40
40
  spec.add_dependency "phonelib", "~> 0.6"
41
41
 
@@ -27,8 +27,8 @@ module Chronicle
27
27
  meta = {}
28
28
  meta[:participants] = @chats[message['chat_id']]
29
29
  meta[:attachments] = @attachments[message['message_id']] if @attachments
30
- meta[:my_phone_contact] = @my_phone_contact
31
- meta[:my_icloud_account] = @my_icloud_account
30
+ meta[:my_phone_contact] = @my_phone_contact if @my_phone_contact.values.all?
31
+ meta[:my_icloud_account] = @my_icloud_account if @my_icloud_account.values.all?
32
32
 
33
33
  yield Chronicle::ETL::Extraction.new(data: message, meta: meta)
34
34
  end
@@ -58,16 +58,16 @@ module Chronicle
58
58
 
59
59
  def load_my_phone_contact(local_contacts)
60
60
  {
61
- phone_number: @config.my_phone_number || local_contacts.my_phone_contact.fetch(:phone_number),
62
- name: @config.my_name || local_contacts.my_phone_contact.fetch(:full_name)
61
+ phone_number: @config.my_phone_number || local_contacts.my_phone_contact&.fetch(:phone_number),
62
+ name: @config.my_name || local_contacts.my_phone_contact&.fetch(:full_name)
63
63
  }
64
64
  end
65
65
 
66
66
  def load_my_icloud_account(local_contacts)
67
67
  {
68
- id: @config.icloud_account_id || local_contacts.my_icloud_account.fetch(:AccountID),
69
- dsid: @config.icloud_account_dsid || local_contacts.my_icloud_account.fetch(:AccountDSID),
70
- display_name: @config.icloud_account_display_name || @config.my_name || local_contacts.my_icloud_account.fetch(:DisplayName)
68
+ id: @config.icloud_account_id || local_contacts.my_icloud_account&.fetch(:AccountID),
69
+ dsid: @config.icloud_account_dsid || local_contacts.my_icloud_account&.fetch(:AccountDSID),
70
+ display_name: @config.icloud_account_display_name || @config.my_name || local_contacts.my_icloud_account&.fetch(:DisplayName)
71
71
  }
72
72
  end
73
73
 
@@ -102,7 +102,7 @@ module Chronicle
102
102
  end
103
103
 
104
104
  def build_identity identity
105
- raise ::Chronicle::ETL::UntransformableRecordError.new("Could not build identity", transformation: self) unless identity
105
+ raise(Chronicle::ETL::UntransformableRecordError, "Could not build record due to missing identity data") unless identity
106
106
 
107
107
  record = ::Chronicle::ETL::Models::Entity.new({
108
108
  represents: 'identity',
@@ -125,7 +125,7 @@ module Chronicle
125
125
 
126
126
  def build_identity_mine_icloud
127
127
  icloud_account = @extraction.meta[:my_icloud_account]
128
- raise(UntransformableRecordError, "Missing iCloud account information") unless icloud_account
128
+ raise(Chronicle::ETL::UntransformableRecordError, "Could not build record due to missing iCloud details. Please provide them through the extractor settings.") unless icloud_account
129
129
 
130
130
  record = ::Chronicle::ETL::Models::Entity.new({
131
131
  represent: 'identity',
@@ -140,7 +140,7 @@ module Chronicle
140
140
 
141
141
  def build_identity_mine_phone
142
142
  phone_account = @extraction.meta[:my_phone_contact]
143
- raise(UntransformableRecordError, "Missing own phone contact information") unless phone_account
143
+ raise(Chronicle::ETL::UntransformableRecordError, "Could not build record due to missing phone details. Please provide them through the extractor settings.") unless phone_account
144
144
 
145
145
  record = ::Chronicle::ETL::Models::Entity.new({
146
146
  represent: 'identity',
@@ -31,6 +31,8 @@ module Chronicle
31
31
  @my_icloud_account ||= load_my_icloud_account
32
32
  end
33
33
 
34
+ private
35
+
34
36
  # The synced address book doesn't have a stable folder location so we
35
37
  # have to search for it
36
38
  def find_local_icloud_address_book
@@ -1,5 +1,5 @@
1
1
  module Chronicle
2
2
  module Imessage
3
- VERSION = "0.2.3"
3
+ VERSION = "0.2.6"
4
4
  end
5
5
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: chronicle-imessage
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.3
4
+ version: 0.2.6
5
5
  platform: ruby
6
6
  authors:
7
7
  - Andrew Louis
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2022-03-15 00:00:00.000000000 Z
11
+ date: 2022-03-25 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: chronicle-etl
@@ -16,14 +16,14 @@ dependencies:
16
16
  requirements:
17
17
  - - "~>"
18
18
  - !ruby/object:Gem::Version
19
- version: 0.4.2
19
+ version: '0.5'
20
20
  type: :runtime
21
21
  prerelease: false
22
22
  version_requirements: !ruby/object:Gem::Requirement
23
23
  requirements:
24
24
  - - "~>"
25
25
  - !ruby/object:Gem::Version
26
- version: 0.4.2
26
+ version: '0.5'
27
27
  - !ruby/object:Gem::Dependency
28
28
  name: sqlite3
29
29
  requirement: !ruby/object:Gem::Requirement