Refactor update table logging and processing; enhance clarity in output messages.
This commit is contained in:
+9
-9
@@ -252,18 +252,11 @@ def main() -> int:
|
|||||||
"select seriesid, timestamp from updates.tvupdates order by seriesid",
|
"select seriesid, timestamp from updates.tvupdates order by seriesid",
|
||||||
lprint
|
lprint
|
||||||
)
|
)
|
||||||
print(f"Saving previous update to file.")
|
print(f"Saving previous updates to file.")
|
||||||
with open(f"{previous_updates_file}", 'w') as pjf:
|
with open(f"{previous_updates_file}", 'w') as pjf:
|
||||||
for pl in previouslisting:
|
for pl in previouslisting:
|
||||||
pjf.write(f"{pl[0]}: {pl[1]}\n")
|
pjf.write(f"{pl[0]}: {pl[1]}\n")
|
||||||
pjf.close()
|
pjf.close()
|
||||||
print(f"Updating update table.")
|
|
||||||
dbExec.update_tvupdates(
|
|
||||||
dbengine["engine"],
|
|
||||||
downloaded_updates_dict,
|
|
||||||
"updates.tvupdates"
|
|
||||||
)
|
|
||||||
print("update complete.")
|
|
||||||
# convert previouslisting (list of tuples) into a dict: row_id -> country_name
|
# convert previouslisting (list of tuples) into a dict: row_id -> country_name
|
||||||
try:
|
try:
|
||||||
_previouslisting_list = previouslisting
|
_previouslisting_list = previouslisting
|
||||||
@@ -289,7 +282,14 @@ def main() -> int:
|
|||||||
for line in skipfile:
|
for line in skipfile:
|
||||||
field = line.split(';')
|
field = line.split(';')
|
||||||
skip_ids[field[0]] = field[1]
|
skip_ids[field[0]] = field[1]
|
||||||
print(f"Processing {len(downloaded_updates_dict)} downloaded updates against {len(previous_listing_dict)} previous listings for files needed.")
|
print(f"Updating update table.")
|
||||||
|
dbExec.update_tvupdates(
|
||||||
|
dbengine["engine"],
|
||||||
|
downloaded_updates_dict,
|
||||||
|
"updates.tvupdates"
|
||||||
|
)
|
||||||
|
print("update complete.")
|
||||||
|
print(f"Processing {len(downloaded_updates_dict)} downloaded updates against {len(previous_listing_dict)} previous updates for files needed.")
|
||||||
for seriesid, ts in downloaded_updates_dict.items():
|
for seriesid, ts in downloaded_updates_dict.items():
|
||||||
if seriesid in previous_listing_dict:
|
if seriesid in previous_listing_dict:
|
||||||
prev_ts = previous_listing_dict[seriesid]
|
prev_ts = previous_listing_dict[seriesid]
|
||||||
|
|||||||
Reference in New Issue
Block a user