Sverchok / SverchokRedux

A reimplementation of Sverchok
GNU General Public License v3.0
4 stars 2 forks source link

gist_upload / download #25

Closed zeffii closed 8 years ago

zeffii commented 8 years ago

place: utils function: upload and download gists useful in:

intention is to have a set of generic library functions that can be imported wherever gist upload / download features are needed.

proposed function signatures

def gist_upload(text_name, text_str):
    ...
    # no auth so we use anonymous gists for upload only, you can always fork manually 
    # to keep a record
    return acquired_gist_id

and

def gist_download(gist_id, location='TEXTS', path="/tmp/"):
    if location == 'TEXTS':
        download to bpy.data.texts[filename].from_string(downloaded_str)
    elif location == 'PATH':
        download to path

old versions of similar code:
https://github.com/zeffii/rawr/tree/master/blender/scripts/addons_contrib/text_editor_gists

send multifile gist:
https://github.com/zeffii/BlenderConsolePrompt/blob/master/addons_contrib/BCPrompt/bc_gist_utils.py

zeffii commented 8 years ago

maybe download can split out a list of filenames / bpy.data.texts that got different names because they existed already.. as a return variable..

ly29 commented 8 years ago

Is it possible to tag gists?

zeffii commented 8 years ago

sadly no, but one can give the gist a project name, which will return results in the gist search feature.. if the project name is 'some demo this' and you search 'demo' then it will be suggested.

ly29 commented 8 years ago

OK, I see, it would be nice to track public gists as idea exchange.

zeffii commented 8 years ago

we could build our own tagging / search feature. could even be hosted as a static webpage on github.

Collect a document (csv, json, whatever) name, gist_id, [description],(tag|tag|tag|tag)

could be neat to have a database.

ly29 commented 8 years ago

It would