gsheet_feeder_db#

Submodules#

Package Contents#

class gsheet_feeder_db.GWorksheet(worksheet, columns=COLUMN_NAMES, header_row=1)#

This class makes read/write operations to the a worksheet easier. It can read the headers from a custom row number, but the row references should always include the offset of the header. eg: if header=4, row 5 will be the first with data.

COLUMN_NAMES#
wks#
columns#
values#
col_exists(col: str)#
count_rows()#
get_row(row: int)#
get_values()#
get_cell(row, col: str, fresh=False)#

returns the cell value from (row, col), where row can be an index (1-based) OR list of values as received from self.get_row(row) if fresh=True, the sheet is queried again for this cell

get_cell_or_default(row, col: str, default: str = None, fresh=False, when_empty_use_default=True)#

return self.get_cell or default value on error (eg: column is missing)

set_cell(row: int, col: str, val)#
batch_set_cell(cell_updates)#

receives a list of [(row:int, col:str, val)] and batch updates it, the parameters are the same as in the self.set_cell() method

to_a1(row: int, col: str)#
class gsheet_feeder_db.GsheetsFeederDB#

Bases: auto_archiver.core.Feeder, auto_archiver.core.Database

Base class for implementing feeders in the media archiving framework.

Subclasses must implement the __iter__ method to define platform-specific behavior.

setup() None#
open_sheet() gspread.Spreadsheet#
enumerate_sheets(sheet) Iterator[gspread.Worksheet]#
should_process_sheet(sheet_name: str) bool#
missing_required_columns(gw: auto_archiver.modules.gsheet_feeder_db.GWorksheet) list#
started(item: auto_archiver.core.Metadata) None#

signals the DB that the given item archival has started

failed(item: auto_archiver.core.Metadata, reason: str) None#

update DB accordingly for failure

aborted(item: auto_archiver.core.Metadata) None#

abort notification if user cancelled after start

fetch(item: auto_archiver.core.Metadata) auto_archiver.core.Metadata | bool#

check if the given item has been archived already

done(item: auto_archiver.core.Metadata, cached: bool = False) None#

archival result ready - should be saved to DB