gphotos 0.1.2 → 0.1.3

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: ca60cae44396023d5a11ffbe51ff0d84df3116a5
4
- data.tar.gz: 6853345ab48a18e8087a073b005d01a4ebebadd2
3
+ metadata.gz: ebeab76559bd4ed56947ad1117d3e208764625e8
4
+ data.tar.gz: ccf6ae3c3950723f4d03a0eee00e88fade105668
5
5
  SHA512:
6
- metadata.gz: 31f8ab4fae2816860c6fceabcfc46e0fdd66193dc3192a134a34992096c328adc7cc90d407cdf2c7b42b3bdd41a5ba55dd87f1dadc1332336b73c2c71eb61cfb
7
- data.tar.gz: 5f1abec0b1187080289f88188fb64158e38b3b2419bfdd419666c3a07de5a6039dbdc251ad5859a0eb4cd632a3f3d9441b4ba907d7ed80ba43b8b6b7f24dfd33
6
+ metadata.gz: 48342084ba713b7efa7f736a64e71ac4ecfe12668ac24675f2c7de7aa6173b684ac8750c8ac2924c36c4174ffba6f40c50de3a2cfbdca70830c0e5f2cfca83ea
7
+ data.tar.gz: 916aa16a1d812bee7792c8ad87b04b975fb47d46ad9ff507773c3290efbf65fbc1022c954e95f01deb1a92b8f3a581a148a789d25315bdf28d9e5649687ff7af
data/README.md CHANGED
@@ -50,7 +50,7 @@ Example:
50
50
  0 skipped
51
51
  0 not exist
52
52
 
53
- Set email and password in config file, `~/.gphotos.yml`:
53
+ Set email and password in config file, `~/.gphotos/config.yml`:
54
54
 
55
55
  :email: foo@gmail.com
56
56
  :passwd: foo
@@ -59,7 +59,7 @@ If you use password managers like [pass](https://www.passwordstore.org/), you ca
59
59
 
60
60
  :passwd_exec: pass show foo@gmail.com
61
61
 
62
- Cookies will be saved in `~/.gphotos.cookies`, so you don't need to login every time.
62
+ ChromeDriver user data(browser settings, cookies, cache) will be saved in `~/.gphotos/chromedriver`, so you don't need to login every time. If you encounter any browser related problem, remove the user data directory and retry.
63
63
 
64
64
  ## Development
65
65
 
@@ -64,7 +64,7 @@ module Gphotos
64
64
 
65
65
  def initialize(args)
66
66
  options = self.class.parse(args)
67
- config = self.class.load_config('~/.gphotos.yml')
67
+ config = self.class.load_config('~/.gphotos/config.yml')
68
68
  @options = OpenStruct.new(config.merge(options.to_h))
69
69
  end
70
70
 
@@ -6,26 +6,15 @@ module Gphotos
6
6
 
7
7
  def initialize(email, passwd, passwd_exec, options = {})
8
8
  options = {:page_timeout => 20, :upload_timeout => 7200 }.merge(options)
9
- profile = Selenium::WebDriver::Chrome::Profile.new
10
- profile['profile.managed_default_content_settings.images'] = 2
11
- @driver = Selenium::WebDriver.for(:chrome, :profile => profile)
9
+ user_data_dir = File.expand_path('~/.gphotos/chromedriver')
10
+ prefs = {"profile" => {"managed_default_content_settings" => {"images" => 2}}}
11
+ @driver = Selenium::WebDriver.for(:chrome, :args => ["--user-data-dir=#{user_data_dir}"], :prefs => prefs)
12
12
  @driver.manage.timeouts.implicit_wait = options[:page_timeout]
13
13
  @wait = Selenium::WebDriver::Wait.new(:timeout => options[:upload_timeout])
14
- @cookies = File.expand_path('~/.gphotos.cookies')
15
14
  @workaround_applied = false
16
- load_cookies(@cookies)
17
15
  login(email, passwd, passwd_exec)
18
16
  end
19
17
 
20
- def load_cookies(file)
21
- @driver.navigate.to 'https://photos.google.com/'
22
- if File.exists?(file)
23
- YAML.load_file(file).each do |cookie|
24
- @driver.manage.add_cookie(cookie)
25
- end
26
- end
27
- end
28
-
29
18
  def login(email, passwd, passwd_exec)
30
19
  @driver.navigate.to 'https://photos.google.com/albums'
31
20
 
@@ -46,7 +35,6 @@ module Gphotos
46
35
  element.submit
47
36
 
48
37
  @driver.find_element(:css => 'input[type="file"]')
49
- File.write(@cookies ,@driver.manage.all_cookies.to_yaml, :perm => 0600)
50
38
  end
51
39
 
52
40
  def upload(files, &block)
@@ -1,3 +1,3 @@
1
1
  module Gphotos
2
- VERSION = "0.1.2"
2
+ VERSION = "0.1.3"
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: gphotos
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.2
4
+ version: 0.1.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Zhong Jianxin
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2017-01-21 00:00:00.000000000 Z
11
+ date: 2017-01-22 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler