repo migration

This commit is contained in:
2025-05-20 12:02:07 -04:00
commit 29814092b7
54 changed files with 6690 additions and 0 deletions
+39
View File
@@ -0,0 +1,39 @@
import sqlalchemy
import progressbar
from tvmaze.Processor import loadjson
class Updater():
def __init__(self):
global jprocess
def __del__(self):
pass
class tvupdates():
def __init__(self):
pass
def update_tables(engine, updatesapi, tablename):
jprocess = loadjson()
print('Now retrieving available updates.')
print('Creating update transaction.')
ins = tablename.insert()
seriesupdates = jprocess.load(updatesapi)
updatelist = []
seriesrange = len(seriesupdates)
with progressbar.ProgressBar(maxval=seriesrange, redirect_stdout=True) as p:
for key, value in seriesupdates.items():
i = int(key)
updater = {}
updater['seriesid'] = key
updater['timestamp'] = value
updatelist.append(updater)
if i <= seriesrange:
p.update(i)
#time.sleep(0.1)
print('Update of tvupdates table is complete.')
print('Done.')
return(ins, updatelist)
def __del__(self):
pass