## Add your own database name (no need for full path if running 'xxxx.py' in same folder

import sqlite3
from sqlite3 import Error

print('Create Simple HTML file from MASTER Database Table:')

conn = None
filename = "Endless Feed.db"

try:
      conn = sqlite3.connect(filename)
      print("Create Connection:") 
      sql = ("SELECT * FROM New_Dupe_Tracks WHERE REVIEWED = 0")    
      curr = conn.cursor()
      curr.execute(sql)
      rows = curr.fetchall()

      ## Build simple HTML document file:
      html = "<html><head><title>Duplicated Tracks List</title></head><body>"
      html = html + "<table border='1' cellpadding='3' cellspacing='2'><tr><td colspan='4' bgcolor='#99CC00'>Duplicate Track List</td></tr>"
      
      tr = 1
      for row in rows:
            html = html + "<tr><td>" + str(tr) + "</td><td>" + str(row[0]) + "</td><td>" + str(row[1]) + "</td><td>" + str(row[2]) + "</td></tr>"
            tr = tr + 1
      html = html + "</table></body></html>"

      file = open("index.html", "w")
      file.write(html)
      file.close

except Error as e:       
            print(e)  
finally:
      if conn:
            conn.close()
print('Done..')










