Get file path from mediastore uri

542 views
Skip to first unread message

Gianluca G

unread,
Apr 21, 2013, 5:48:23 AM4/21/13
to tas...@googlegroups.com
I'm using tasker's auto share extension to share a pic to tasker from gallery to perform some tasks on the folder containing that picture..
When shared, tasker receives the uri of the pic in this form "content://media/external/images/media/xxx" and so I need a way to convert it to the real absolute path..
Can tasker do such a thing?

Gianluca G

unread,
Apr 22, 2013, 3:28:54 PM4/22/13
to tas...@googlegroups.com
No one?

Rich D

unread,
Apr 22, 2013, 3:59:50 PM4/22/13
to tas...@googlegroups.com

> I'm using tasker's auto share extension to share a pic to tasker from gallery to perform some tasks on the folder containing that picture..
> When shared, tasker receives the uri of the pic in this form "content://media/external/images/media/xxx" and so I need a way to convert it to the real absolute path..

I had the same problem. Unfortunately I forgot how I fixed it...:(  I just checked my profile and I think if you try the auto command feature it might work.  It adds I additional step to the process but that is what I am currently using and I get the actual file path. 

Give it a try and let me know.  

Rich....

Rich D

unread,
Apr 22, 2013, 4:08:13 PM4/22/13
to tas...@googlegroups.com

Here is a export of my working profile.  I am sharing the pics from Quickpics.  

Profile: Share Pics2 (348)
State: AutoShare [ Configuration:Command: copy pics
Sender: all
Subject: all
Text: all
Image: all ]
Enter: Share Pic On2 (349)
A1: Hide Scene [ Name:File Browser2 Continue Task After Error:On ]
A2: Variable Clear [ Name:%Reload Pattern Matching:Off ]
A3: Variable Clear [ Name:%Filestomove Pattern Matching:Off ]
A4: Variable Set [ Name:%splitter To:content://com.alensw.PicFolder.FileProvider Do Maths:Off Append:Off ]
A5: For [ Variable:%image Items:%asfile() ]
A6: Variable Split [ Name:%image Splitter:%splitter Delete Base:On ]
A7: Variable Set [ Name:%Filestomove To:%image(2), Do Maths:Off Append:On ]
A8: End For
A9: Go Home [ Page:3 ]
A10: Wait [ MS:0 Seconds:1 Minutes:0 Hours:0 Days:0 ]
A11: Show Scene [ Name:File Browser2 Display As:Activity, Full Window Horizontal Position:100 Vertical Position:100 Show Exit Button:On Continue Task Immediately:On ]

Rich D

unread,
Apr 22, 2013, 10:54:47 PM4/22/13
to tas...@googlegroups.com

OK.... I did some testing.. I could not get the correct file path with the gallery either,  With or without the command option. It does however work with quickpics.  Which in my opinion is a far better pic viewer. Sorry for any misinformation ....

Rich...

Gianluca G

unread,
Apr 23, 2013, 1:02:20 AM4/23/13
to tas...@googlegroups.com
Don't worry and thank you for trying to help :)

Gianluca G

unread,
Apr 25, 2013, 8:48:37 AM4/25/13
to tas...@googlegroups.com
I finally managed to do it using python and sl4a.
Here's the python code:

import android

droid = android.Android()

uri = 'content://your/uri/here'

filepath = droid.queryContent(uri, ['_data'] ).result[0]['_data']

print filepath

Reply all
Reply to author
Forward
0 new messages