Sverchok / SverchokRedux

A reimplementation of Sverchok

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

gist_upload / download

zeffii opened this issue · comments

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

  • import/export tree json as gist
  • import/export scripted node code (to gest, or to bpy.data.texts) - never autoexecuting.

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

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

commented

Is it possible to tag gists?

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.

commented

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

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.

commented

It would