Skip to content

Commit

Permalink
Syncing headers
Browse files Browse the repository at this point in the history
  • Loading branch information
jonholdsworth committed Nov 1, 2024
1 parent aae1bd7 commit 44a1bd8
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 8 deletions.
3 changes: 2 additions & 1 deletion bin/find-orphaned-videos.py
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,7 @@
)

# Globals
GLOBAL_COLUMN_HEADINGS = ["Gloss ID", "Gloss", "Suggested Video key"] # Keep synced with other scripts
CSV_DELIMITER = ","
FAKEKEY_PREFIX = "this_is_not_a_key_"
DATABASE_URL = os.getenv("DATABASE_URL", "")
Expand Down Expand Up @@ -254,7 +255,7 @@ def find_orphans():
get_nzsl_raw_keys_dict(), get_s3_bucket_raw_keys_list()
)

print("Gloss ID,Gloss,Suggested Video key")
print(CSV_DELIMITER.join(GLOBAL_COLUMN_HEADINGS))

# Traverse all the NZSL Signbank glosses that are missing S3 objects
for video_key, [
Expand Down
22 changes: 15 additions & 7 deletions bin/repair-orphaned-videos.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,7 @@
import csv
import subprocess
import argparse
import re
from time import sleep
from uuid import uuid4
from pprint import pprint


Expand All @@ -28,10 +26,7 @@
)

# Positional arguments
parser.add_argument(
"csv_filename",
help="Name of CSV file"
)
parser.add_argument("csv_filename", help="Name of CSV file")

# Optional arguments
parser.add_argument(
Expand Down Expand Up @@ -74,6 +69,11 @@
from signbank.video.models import GlossVideo

# Globals
GLOBAL_COLUMN_HEADINGS = [
"Gloss ID",
"Gloss",
"Suggested Video key",
] # Keep synced with other scripts
CSV_DELIMITER = ","
FAKEKEY_PREFIX = "this_is_not_a_key_"
DATABASE_URL = os.getenv("DATABASE_URL", "")
Expand Down Expand Up @@ -123,7 +123,14 @@ def aws_cli(args_list):


def read_csv(csv_filename):
pass
if csv_filename == "-":
f = sys.stdin.read().splitlines()
else:
f = open(csv_filename, "r")
csv_dict = csv.DictReader(f)
for row in csv_dict:
pprint(row)
# print(dict(row))


print(f"Env: {args.env}", file=sys.stderr)
Expand All @@ -132,3 +139,4 @@ def read_csv(csv_filename):
print(f"PGCLI: {PGCLI}", file=sys.stderr)
print(f"AWS profile: {os.environ.get('AWS_PROFILE', '')}", file=sys.stderr)

read_csv(args.csv_filename)

0 comments on commit 44a1bd8

Please sign in to comment.