Dialog database api

From vret
Jump to: navigation, search

Dialog database API

Main files

  • Database.py
  • MultiThreadAccesDatabase.py
  • ReadOnlyDatabase.py

Support files

  • Action.py
  • Link.py
  • Property.py
  • Sentence.py

ReadOnlyDatabase.py

Contains functions too read the dialog database file. Can be used if you want to be sure you don't override any data in the database

Database.py

Extends ReadOnlyDatabase.py with functions to create and add/edit the dialog database file.

MultiThreadAccesDatabase.py

Interface class that provides a mean to access an database from multiple threads. Python sqlite implementation doesn't allow multiple threads to access the same database.

Support files

Provides the data from the database in python classes that can be edited and then updated to the database using the correct functions.


Getting started

db = MultiThreadAccesDatabase()
db.createNewDatabase("C:\\temp.db3")
sentence = Sentence("first sentence")
sentence = db.updateSentence(sentence)

Documentation

Documentation can be found in the .py files for what every function does.

Structure

Database structuur

Sentence
id Int Unique identification number
sentence String Sentence string (text)
-----------
Link
reply_to_sentenceIntSentence id identifying the sentence replied to
Reply_sentenceintSentence id identifying the sentence reply
order int Sentence position in reply list
-----------
Property
id Int Unique identification number
name String Property name
show Int Enable/disable property in database
-----------
Property_list
property_idIntProperty id indentifying the property
sentence_idIntSentence id indentifying the sentence
value StringValue of the property
-----------
Action
id Int Unique identification number
action String Action string
-----------
Action_list
action_idIntAction id indentifying the Action
sentence_idInt Sentence id indentifying the Sentence
orderIntAction position in action list
kindIntIdentifying if the action is a pre or post action

Notes: Default properties already available in the database are:

  • audio_url (default = “”)
  • avatar_type (default = “”)
  • is_root (default=”0”)


Orders of sentences or actions are not forced to be unique so multiple sentences can be placed on the same order number the real order of the data in the list will be unknown then.

Id’s will be automatically generated by the database and can’t be manipulated

Action Kind will be 0 = PreAction and 1 = PostAction

Property show will be 0 = Disabled and 1 = Enabled. When disabled property will not be added to property list of sentences

Download

Dialogue 1.1

Pre build tools