kopia lustrzana https://github.com/bellingcat/auto-archiver
cleanup
rodzic
2d145802b5
commit
374852e740
|
@ -35,7 +35,6 @@ def update_sheet(gw, row, result: archivers.ArchiveResult):
|
|||
batch_if_valid('timestamp', result.timestamp)
|
||||
|
||||
gw.update_batch(update)
|
||||
|
||||
|
||||
|
||||
def process_sheet(sheet):
|
||||
|
@ -54,11 +53,11 @@ def process_sheet(sheet):
|
|||
logger.info(f'Opening worksheet {ii}: "{wks.title}"')
|
||||
gw = GWorksheet(wks)
|
||||
|
||||
if not gw.col_exists("url"):
|
||||
if not gw.col_exists('url'):
|
||||
logger.warning(f'No "Media URL" column found, skipping worksheet {wks.title}')
|
||||
continue
|
||||
|
||||
if not gw.col_exists("status"):
|
||||
if not gw.col_exists('status'):
|
||||
logger.warning("No 'Archive status' column found, skipping")
|
||||
continue
|
||||
|
||||
|
@ -110,14 +109,14 @@ def process_sheet(sheet):
|
|||
|
||||
def main():
|
||||
parser = argparse.ArgumentParser(
|
||||
description="Automatically archive social media videos from a Google Sheets document")
|
||||
parser.add_argument("--sheet", action="store", dest="sheet")
|
||||
description='Automatically archive social media videos from a Google Sheets document')
|
||||
parser.add_argument('--sheet', action='store', dest='sheet')
|
||||
args = parser.parse_args()
|
||||
|
||||
logger.info("Opening document " + args.sheet)
|
||||
logger.info(f'Opening document {args.sheet}')
|
||||
|
||||
process_sheet(args.sheet)
|
||||
|
||||
|
||||
if __name__ == "__main__":
|
||||
if __name__ == '__main__':
|
||||
main()
|
||||
|
|
|
@ -68,30 +68,3 @@ class GWorksheet:
|
|||
def to_a1(self, row: int, col: int):
|
||||
# row, col are 1-based
|
||||
return utils.rowcol_to_a1(row, col)
|
||||
|
||||
# def index_to_col(self, index):
|
||||
# alphabet = 'ABCDEFGHIJKLMNOPQRSTUVWXYZ'
|
||||
|
||||
# if index > 25:
|
||||
# t = index
|
||||
# dig = 0
|
||||
# while t > 25:
|
||||
# t = math.floor(t / 26)
|
||||
# dig += 1
|
||||
# return alphabet[t - 1] + self.index_to_col(index - t * int(math.pow(26, dig)))
|
||||
# else:
|
||||
# return alphabet[index]
|
||||
|
||||
# def col_to_index(self, col):
|
||||
# col = list(col)
|
||||
# ndigits = len(col)
|
||||
# alphabet = ' ABCDEFGHIJKLMNOPQRSTUVWXYZ'
|
||||
# v = 0
|
||||
# i = ndigits - 1
|
||||
|
||||
# for digit in col:
|
||||
# index = alphabet.find(digit)
|
||||
# v += (26 ** i) * index
|
||||
# i -= 1
|
||||
|
||||
# return v - 1
|
||||
|
|
Ładowanie…
Reference in New Issue