seiran package — Seiran 1.6.0 documentation

Skip to main content

# seiran package

## Submodules

## seiran.ff_bkm_import module

Import bookmarks from Firefox and derivatives: Pale Moon, IceCat, Basilisk, Nightly, etc. This is not extremely well-tested. Use at your own risk!

`seiran.ff_bkm_import.` `flattenJson`(imported_json: dict) → list

  Flatten out the nested dictionary from a Firefox JSON import.

  Parameters
    imported_jsondict

      The JSON input to flatten.

  Returns
    list of dict

      The JSON flatted out into a format usable by Seiran.

`seiran.ff_bkm_import.` `formList`(bookmark_tup: tuple) → list

  Convert a tuple of bookmark data into a format Seiran can use.

  Parameters
    bookmark_tuptuple

      Raw bookmark data from the imported database.

  Returns
    list of tuple

      The title, URL, and date for the bookmark.

`seiran.ff_bkm_import.` `importDatabase`() → list

  Import a database from a Firefox-type browser profile.

  Returns
    list

      The bookmark data converted to Seiran’s internal format.

`seiran.ff_bkm_import.` `import_ffjson`(json_path: str) → list

  Import JSON data from a Firefox-type bookmark backup.

  Parameters
    json_pathstr

      Path to the JSON backup file.

  Returns
    list of tuple

      Processed bookmarks.

## seiran.onetab_bkm_import module

Import bookmarks from the OneTab addon. This is not extremely well-tested. Use at your own risk!

`seiran.onetab_bkm_import.` `importFromTxt`() → list

  Import bookmarks from a plain-text list of titles and URLs.

  Returns
    list of tuple

      The bookmark data converted to Seiran’s internal format.

## seiran.seiran module

`seiran.seiran.` `addBKM`(c: sqlite3.Cursor, conn: sqlite3.Connection, title: str, url: str, folder: str) → None

  Add a new bookmark to the database.

  Parameters
    csqlite3.Cursor

      Cursor of the bookmarks database.

    connsqlite3.Connection

      Connection to the bookmarks database.

    titlestr

      The name of the new bookmark.

    urlstr

      The new bookmark’s Uniform Resource Locator. Must be unique.

    folderstr

      A category or folder for the new bookmark.

`seiran.seiran.` `cleanBKMs`(c: sqlite3.Cursor, conn: sqlite3.Connection) → None

  Perform basic housekeeping features on the bookmarks database.

  It checks for bookmarks without titles, then adds their U.R.L. as a title. It also lists bookmarks that have the same title, which may indicate duplicates.

  Parameters
    csqlite3.Cursor

      Cursor of the bookmarks database.

    connsqlite3.Connection

      Connection to the bookmarks database.

`seiran.seiran.` `delBKM`(c: sqlite3.Cursor, conn: sqlite3.Connection, url: str) → None

  Remove a bookmark from the database.

  Parameters
    csqlite3.Cursor

      Cursor of the bookmarks database.

    connsqlite3.Connection

      Connection to the bookmarks database.

    urlstr

      The U.R.L. of the bookmark to be deleted.

`seiran.seiran.` `editBKM`(c: sqlite3.Cursor, conn: sqlite3.Connection, url: str, field: str, new: str) → None

  Edit an existing bookmark.

  Parameters
    csqlite3.Cursor

      Cursor of the bookmarks database.

    connsqlite3.Connection

      Connection to the bookmarks database.

    urlstr

      The U.R.L. of the target bookmark.

    fieldstr

      The field to be edited. Can be title or folder.

    newstr

      The new value for the edited field.

`seiran.seiran.` `exportBookmarks`(c: sqlite3.Cursor, fformat: str) → None

  Export bookmark database to a file in the user data directory.

  Parameters
    csqlite3.Cursor

      Cursor of the bookmarks database.

    fformatstr

      The target output format. Can be txt, html, or json.

`seiran.seiran.` `getFirefoxBookmarks`(c: sqlite3.Cursor, conn: sqlite3.Connection) → None

  Import bookmarks from Mozilla-based browsers.

  This is an experimental feature and may cause errors. Please back up your bookmark database before use.

  Parameters
    csqlite3.Cursor

      Cursor of the bookmarks database.

    connsqlite3.Connection

      Connection to the bookmarks database.

`seiran.seiran.` `getJsonBookmarks`(c: sqlite3.Cursor, conn: sqlite3.Connection) → None

  Import bookmarks from a Seiran JSON export.

  Parameters
    csqlite3.Cursor

      Cursor of the bookmarks database.

    connsqlite3.Connection

      Connection to the bookmarks database.

`seiran.seiran.` `getOneTabBookmarks`(c: sqlite3.Cursor, conn: sqlite3.Connection) → None

  Import bookmarks from a OneTab text export.

  This is an experimental feature and may cause errors. Please back up your bookmark database before use.

  Parameters
    csqlite3.Cursor

      Cursor of the bookmarks database.

    connsqlite3.Connection

      Connection to the bookmarks database.

`seiran.seiran.` `getSeiranBookmarks`(c: sqlite3.Cursor, conn: sqlite3.Connection) → None

  Import bookmarks from an existing Seiran database.

  This is an experimental feature and may cause errors. Please back up your bookmark database before use.

  Parameters
    csqlite3.Cursor

      Cursor of the bookmarks database.

    connsqlite3.Connection

      Connection to the bookmarks database.

`seiran.seiran.` `initBookmarks`(c: sqlite3.Cursor) → None

  Check if a bookmarks database already exists.

  Parameters
    csqlite3.Cursor

      Cursor of the bookmarks database.

`seiran.seiran.` `installToConfig`() → str

  Create a Seiran folder in the user’s data directory, and get the path to the bookmarks database within.

  Returns
    str

      The path to the active bookmarks.db file.

`seiran.seiran.` `listBKMs`(c: sqlite3.Cursor) → None

  List all bookmarks in the database.

  Spaces are included at the ends of lines such that the output can be interpreted as Markdown.

  Parameters
    csqlite3.Cursor

      Cursor of the bookmarks database.

`seiran.seiran.` `main`() → None

  Set up the database and parse arguments.

`seiran.seiran.` `oneSearch`(c: sqlite3.Cursor, search_term: str, column: str) → None

  Search a single field in the bookmark database.

  Parameters
    csqlite3.Cursor

      Cursor of the bookmarks database.

    search_termstr

      The phrase for which to search.

    columnstr

      The field to search. Can be title, url, folder, or date.

`seiran.seiran.` `searchAll`(c: sqlite3.Cursor, search_term: str) → None

  Search all fields in the bookmark database.

  Parameters
    csqlite3.Cursor

      Cursor of the bookmarks database.

    search_termstr

      The phrase for which to search.

## Module contents

Manage bookmarks locally.