Skip to content

StudioEtrange/delverlens-tools

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Delver Lens Tools

This project contains various tools to use with Delver Lens data for Magic The Gathering card game.

Delver lens : https://www.delverlab.com/ App : https://play.google.com/store/apps/details?id=delverlab.delverlens

SCRIPT dlens-restore-db.sh

This script rebuilds SQLite databases files for Delver Lens application from a previously saved <date>_exported.dlens file or <date>_backup.dlens file.

How-To

  • To generate an export file :

    • use Create Backup File feature menu, select "keep images", then use "Ok" button. Store the generated <date>_exported.dlens file in a safe place.
  • To generate a backup file :

    • use Create Backup File feature menu, select "keep images", then use "Download" button. Store the generated <date>_backup.dlens file in a safe place as backup.
  • To restore :

    • Transfert <date>_exported.dlens to your machine
    • Launch this script
    • Transfert the generated files user.v2.dlens, images.v2.dlens, .timestamp.user.v2 and .timestamp.images.v2 in your dropbox backup delveer lens folder
    • In Dropbox Sync feature menu, use "restore"

About files used as source database

  • <date>_backup.dlens file is a SQLite database which contains all data needed to export the entire dataset (including data retrieved from the internet) and use it without requiring the Delver Lens application

  • <date>_exported.dlens file is a SQLite database which contains only the data required by the Delver Lens application

Script Usage

./dlens-restore-db.sh <exported|backup> <date>_<source_db>.dlens [user.v2.dlens output path] [images.v2.dlens output path]
  • <exported|backup> : database type of database source used to restore
  • _<source_db>.dlens : path to the source database used to restore data
  • [user.v2.dlens output path] : path for the output user database file
  • [images.v2.dlens output path] : path for the output image database file

Requirements

  • bash
  • sqlite3

Delver Lens sqlite files analysis

The image of each card is in images.v2.dlens database and the links between cards and images are images.v2.dlens.cards.card <===> user.v2.dlens.cards._id

FILES backed up to Dropbox by the Delver Lens application

  • FILE user.v2.dlens : SQLite database – Contains the data required to use the Delver Lens application

    important tables: cards, lists, delverlens

    • TABLE cards : cards saved in Delver Lens app (it does not contain photos, image field empty)

      CREATE TABLE cards (
      _id INTEGER PRIMARY KEY,
      card INTEGER NOT NULL,
      foil INTEGER NOT NULL DEFAULT 0,
      price REAL NOT NULL DEFAULT 0,
      quantity INTEGER NOT NULL DEFAULT 1,
      image BLOB,
      creation NUMERIC NOT NULL,
      list INTEGER NOT NULL,
      note TEXT NOT NULL DEFAULT '',
      condition TEXT NOT NULL DEFAULT '',
      language TEXT NOT NULL DEFAULT '',
      publish INTEGER NOT NULL DEFAULT 0,
      tab INTEGER NOT NULL DEFAULT 0,
      downloaded_img INTEGER NOT NULL DEFAULT 0,
      general INTEGER NOT NULL DEFAULT 0,
      img_uuid TEXT NOT NULL DEFAULT '',
      uuid TEXT NOT NULL DEFAULT '',
      price_acquired REAL NOT NULL DEFAULT 0,
      scryfall_id TEXT NOT NULL DEFAULT '',
      FOREIGN KEY (list) REFERENCES lists (_id)
      )
      
    • TABLE lists : lists created in Delver Lens

      CREATE TABLE lists (
      _id INTEGER PRIMARY KEY,
      background INTEGER NOT NULL DEFAULT -1,
      category INTEGER NOT NULL DEFAULT 1,
      name TEXT NOT NULL DEFAULT '',
      creation NUMERIC NOT NULL,
      tab INTEGER NOT NULL DEFAULT 0,
      uuid TEXT NOT NULL DEFAULT '',
      note TEXT NOT NULL DEFAULT ''
      )
      
    • TABLE delverlens : important records in value fields: version and timestamp

      CREATE TABLE delverlens (
      key TEXT PRIMARY KEY,
      value TEXT DEFAULT ''
      )
      
  • FILE images.v2.dlens : SQLite database – Contains all card images for use within the Delver Lens application

    important data table: cards

    • TABLE cards : images of cards saved in Delver Lens app
      CREATE TABLE cards (
          _id INTEGER PRIMARY KEY,
          card INTEGER NOT NULL,
          image BLOB
      )
      

FILES created via the Delver Lens application using "Create Backup File"

There are two types of files created by the "Create Backup File" feature, depending on whether the "Download" button is used not.
Using the Download button generates the file <date>_backup.dlens.
Without using this button, <date>_exported.dlens is generated.
In both cases, you must select "keep images".

  • _FILE exported.dlens : SQLite database – Contains the data required to use the Delver Lens application

    important tables: cards, lists

    • TABLE cards : cards saved in Delver Lens (with photos, image field not empty)

      CREATE TABLE cards (
          _id INTEGER PRIMARY KEY,
          card INTEGER NOT NULL,
          foil INTEGER NOT NULL DEFAULT 0,
          price REAL NOT NULL DEFAULT 0,
          quantity INTEGER NOT NULL DEFAULT 1,
          image BLOB,
          creation NUMERIC NOT NULL,
          list INTEGER NOT NULL,
          note TEXT NOT NULL DEFAULT '',
          condition TEXT NOT NULL DEFAULT '',
          language TEXT NOT NULL DEFAULT '',
          publish INTEGER NOT NULL DEFAULT 0,
          tab INTEGER NOT NULL DEFAULT 0,
          downloaded_img INTEGER NOT NULL DEFAULT 0,
          general INTEGER NOT NULL DEFAULT 0,
          img_uuid TEXT NOT NULL DEFAULT '',
          uuid TEXT NOT NULL DEFAULT '',
          price_acquired REAL NOT NULL DEFAULT 0,
          scryfall_id TEXT NOT NULL DEFAULT '',
          FOREIGN KEY (list) REFERENCES lists (_id)
      )
      
    • TABLE lists : lists created in Delver Lens

      CREATE TABLE lists (
      _id INTEGER PRIMARY KEY,
      background INTEGER NOT NULL DEFAULT -1,
      category INTEGER NOT NULL DEFAULT 1,
      name TEXT NOT NULL DEFAULT '',
      creation NUMERIC NOT NULL,
      tab INTEGER NOT NULL DEFAULT 0,
      uuid TEXT NOT NULL DEFAULT '',
      note TEXT NOT NULL DEFAULT ''
      )
      

  • _FILE backup.dlens : SQLite database – Contains all data needed to export the entire dataset (including data retrieved from the internet) and use it without requiring the Delver Lens application

    important tables: cards, lists, data_cards, data_names, data_editions

    • TABLE cards : cards saved in Delver Lens (with photos, image field not empty)

      CREATE TABLE cards (
      _id INTEGER PRIMARY KEY,
      card INTEGER NOT NULL,
      foil INTEGER NOT NULL DEFAULT 0,
      price REAL NOT NULL DEFAULT 0,
      quantity INTEGER NOT NULL DEFAULT 1,
      image BLOB,
      creation NUMERIC NOT NULL,
      list INTEGER NOT NULL,
      note TEXT NOT NULL DEFAULT '',
      condition TEXT NOT NULL DEFAULT '',
      language TEXT NOT NULL DEFAULT '',
      publish INTEGER NOT NULL DEFAULT 0,
      tab INTEGER NOT NULL DEFAULT 0,
      downloaded_img INTEGER NOT NULL DEFAULT 0,
      general INTEGER NOT NULL DEFAULT 0,
      img_uuid TEXT NOT NULL DEFAULT '',
      uuid TEXT NOT NULL DEFAULT '',
      price_acquired REAL NOT NULL DEFAULT 0,
      FOREIGN KEY (list) REFERENCES lists (_id)
      )
      
    • TABLE lists : lists created in Delver Lens

      CREATE TABLE lists (
      _id INTEGER PRIMARY KEY,
      background INTEGER NOT NULL DEFAULT -1,
      category INTEGER NOT NULL DEFAULT 1,
      name TEXT NOT NULL DEFAULT '',
      creation NUMERIC NOT NULL,
      tab INTEGER NOT NULL DEFAULT 0,
      uuid TEXT NOT NULL DEFAULT '',
      note TEXT NOT NULL DEFAULT ''
      )
      
    • TABLE data_cards : card data with links to data_names and data_editions

      CREATE TABLE data_cards (
      _id INTEGER,
      name INTEGER NOT NULL,
      edition INTEGER NOT NULL,
      number TEXT,
      rarity INTEGER,
      multiverseid INTEGER,
      foil INTEGER,
      promo INTEGER,
      digital INTEGER,
      price_mid REAL,
      tcg_productid TEXT DEFAULT '',
      scryfall_id TEXT DEFAULT '',
      disabled INTEGER DEFAULT 0,
      has_img INTEGER DEFAULT 0,
      price_timestamp INTEGER DEFAULT 0,
      face INTEGER DEFAULT 0,
      highres_img INTEGER DEFAULT 0,
      artist TEXT DEFAULT '',
      alt INTEGER,
      frame INTEGER NOT NULL DEFAULT 0,
      finish INTEGER NOT NULL DEFAULT 0,
      cardmarket_id INTEGER,
      tcg_sku TEXT NOT NULL DEFAULT '',
      tcg_sku_foil TEXT NOT NULL DEFAULT '',
      FOREIGN KEY (edition) REFERENCES editions (_id),
      PRIMARY KEY (_id),
      FOREIGN KEY (name) REFERENCES names (_id)
      )
      
    • TABLE data_names : card name, card text, rules clarifications, card characteristics, legal formats, ...

      CREATE TABLE data_names (
      _id INTEGER,
      name TEXT,
      mana TEXT,
      cmana INTEGER,
      type TEXT,
      rules TEXT,
      rulings TEXT DEFAULT '',
      color INTEGER,
      type_code INTEGER,
      power INTEGER,
      toughness INTEGER,
      loyalty INTEGER,
      legal TEXT DEFAULT '',
      restricted TEXT DEFAULT '',
      alt INTEGER,
      reserved INTEGER,
      PRIMARY KEY (_id)
      )
      
    • TABLE data_editions : list of Magic editions

      CREATE TABLE data_editions (
      _id INTEGER,
      name TEXT,
      release_date DATETIME,
      tl_abb TEXT,
      mtgo_id TEXT,
      PRIMARY KEY (_id)
      )
      

License

This project is licensed under the GNU Affero General Public License v3.0 (AGPLv3). See the LICENSE file for details.

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages