On Monday, November 14, 2016 at 12:17:51 AM UTC, PMario wrote:
>
> On Sunday, November 13, 2016 at 10:41:10 PM UTC+1, Tobias Beer wrote:
>>
>> Great stuff. Any chance / idea for also grabbing binary files once put up 
>> via:
>>
>> <<binaryUploadPublic title:foo.jpg>>
>>
>
> I didn't think about them yet. 
>
> Downloading the stuff should be possible, but how can we "automagically" 
> find them?
> Is there anything we can use to identify them. 
>
>  
 Each tidlder has an attribute named 'type' that, if it has a value is the 
type of tiddler that it is, for example 'image/jpeg'. The fat json that 
your script downloads can be inspected for that. The 'text' attribute 
contains the base64 encoded data that represents the binary. That can be 
decoded. Thus is it possible to go through a fat json tiddlers collection 
and extract all the images to separate file.

I've made a quick python (works for both 2 and 3) script that will do this 
for images: https://gist.github.com/cdent/1254a9c98d8ba316e6c0223f9dd03925

If you run it in the directory where the fat json files are as `python 
extractbin.py *.json` all the image tiddlers will be dumped into a 
directory named 'binaries'.

I hope this is enough to keep people some ideas on how to process the data. 
There are also ways to search tiddlyspace for tiddlers of particular types, 
but since the fat json already includes the data locally processing that 
seems easier.

-- 
You received this message because you are subscribed to the Google Groups 
"TiddlyWiki" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at https://groups.google.com/group/tiddlywiki.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/tiddlywiki/3b12fe30-22b0-4088-b314-53bdaf42b60e%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to