yesyoucam 0.3 → 0.4
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 +4 -4
- data/README.md +1 -0
- data/lib/project/yesyoucam.rb +21 -2
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 65dceb82e7c9c52267b755520051fea86edeb1d5
|
4
|
+
data.tar.gz: 9b3bdd2914b75582413d3b704cd5c4dd291cac9c
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: ea356be68df5c96b06a9eb567d786ccd256a2a8458142509b0cf230ea1aa697ffa7035e3bd5c9160ea91f7d869db0044175e2700c52736f6e68fb78c902f44da
|
7
|
+
data.tar.gz: b83ed311d441200af969a61a6e001eab485a59bc4fdb98488e9724b78b60f5af1d90ee14638799a39e8c716b8db305a46f0e6684ffd1a90249ff19651771d668
|
data/README.md
CHANGED
@@ -1,5 +1,6 @@
|
|
1
1
|
# Yes You Cam
|
2
2
|
## A **Ridiculous**ly Simple BluePotion Camera Library to help you achieve your dreams...
|
3
|
+
[](http://badge.fury.io/rb/yesyoucam)
|
3
4
|

|
4
5
|
|
5
6
|
## Usage ("Nothing is impossible")
|
data/lib/project/yesyoucam.rb
CHANGED
@@ -71,9 +71,28 @@ class YesYouCam
|
|
71
71
|
|
72
72
|
def pic_path_from_uri (content_uri)
|
73
73
|
cursor = find.app.context.contentResolver.query(content_uri, nil, nil, nil, nil)
|
74
|
-
column_index = cursor.
|
74
|
+
column_index = cursor.getColumnIndex(YesYouCam::DATA)
|
75
|
+
path = nil
|
75
76
|
cursor.moveToFirst
|
76
|
-
|
77
|
+
|
78
|
+
# Some devices have SD cards/google services that make this a living hell... protect the user!
|
79
|
+
if column_index >= 0
|
80
|
+
path = cursor.getString(column_index)
|
81
|
+
else
|
82
|
+
# We're probably on an SD card - check common places (We're not the first one to attempt this terrible idea... DAMN YOU ANDROID!)
|
83
|
+
external = Potion::Environment.getExternalStorageDirectory.getAbsolutePath
|
84
|
+
dcim = Potion::Environment.getExternalStoragePublicDirectory(Potion::Environment::DIRECTORY_DCIM).getAbsolutePath
|
85
|
+
pictures = Potion::Environment.getExternalStoragePublicDirectory(Potion::Environment::DIRECTORY_PICTURES).getAbsolutePath
|
86
|
+
|
87
|
+
potential_dirs = ["#{dcim}/Camera/", "#{dcim}/100Media/", "#{dcim}/100ANDRO/", "#{dcim}/100LGDSC/", "#{external}/Images/", "#{pictures}/", "#{dcim}"]
|
88
|
+
|
89
|
+
potential_dirs.each do |current_path|
|
90
|
+
potential_file = current_path + cursor.getString(0)
|
91
|
+
path = potential_file if Potion::File.new(potential_file).exists
|
92
|
+
break if path #shortcircuit now that we've found it!
|
93
|
+
end
|
94
|
+
end
|
95
|
+
|
77
96
|
cursor.close
|
78
97
|
|
79
98
|
path
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: yesyoucam
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: '0.
|
4
|
+
version: '0.4'
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Gant
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2015-07
|
11
|
+
date: 2015-08-07 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: rake
|