import os
import sqlite3
vvvvidb = "vvvvidb.sqlite3"
if not os.path.isfile(vvvvidb):
print("{} file not found. Scrape the DB first using vvvvget.py".format(vvvvidb))
exit(1)
con = sqlite3.connect(vvvvidb)
cur = con.cursor()
out = open('index.html', 'w')
out.write('''
''')
# Select all the series
# cur.execute("SELECT * FROM series;")
# Selecy only series with at least one episodes
cur.execute("SELECT s.* FROM series as s INNER JOIN episodes as e ON e.serie_id = s.id AND e.season_id = s.season_id GROUP BY s.id, s.season_id;")
series = cur.fetchall()
for s in series:
serie = (str(s[0]), str(s[2]))
out.write("\t
{}: {} - Id Serie: {} - Tipo: {}
\n\t
\n".format(s[0], s[1], s[2], s[3]))
cur.execute("SELECT e.cdn_url FROM episodes AS e JOIN series AS s ON e.serie_id = s.id AND e.season_id = s.season_id WHERE s.id = ? AND s.season_id = ? AND e.cdn_url != '';", serie)
episodes = cur.fetchall()
[out.write("\t\t