#!/usr/bin/env python

import os, time
import sqlite3 as lite
import populatedb as pdb

class AmpycheApp():
	def __init__(self):
		ANSN      = ('N', 'n', 'No', 'no')
		ANSY      = ('Y', 'y', 'Yes', 'yes')
		self.ANSN = ANSN
		self.ANSY = ANSY
		self.pdb  = pdb

	def _get_selection(self):
		print("""
\nWelcome to Ampyche. Please select the appropriate action.

1. Setup Ampyche.
2. Rescan/Add new music.
3. Setup Ampyche using an already existing
	Ampache mysql database.
""")
		selection = input("---> ")
		return selection

	def _get_music_path(self):
		print("""
\nPlease enter the path to where the music files reside.
For example: /home/music: """)
		m_path = input("--->  ")
		m_path = str(m_path)
		return m_path

	def _select_one(self, a_path):
		gettags = pdb.Ampyche()
		gettags = gettags.run(a_path)

	def _select_two(self):
		print("selection two")
		#update = self.upd.UpdateDb()
		#update = update._update()

##############################################################
##  Start of MySQL stuff

	def _get_hostname(self):
		print("""
Please enter the Hostname of the MySql Database.  """)
		response = input("---> ")
		return response
		
	def _get_username(self):
		print("""
Please enter the MySql Database Username. """)
		response = input("---> ")
		return response
		
	def _get_password(self):
		print("""
Please enter the MySql Database Password. """)
		response = input("---> ")
		#need to validate for letters and numbers only
		return response

	def _get_dbname(self):
		print("""
Please enter the MySql Database Name. """)
		response = input("---> ")
		#need to validate for letters and numbers only
		return response

	def _select_three(self, ):
		print("selection three")
#		hostname = self._get_hostname()
#		username = self._get_username()
#		password = self._get_password()
#		dbname   = self._get_dbname()
		
		#make db connection and generate static files.
		#do more stuff here

	def main(self):
		selection    = self._get_selection()
		music_path   = self._get_music_path()
		if selection == '1':
			make_it_so = self._select_one(music_path)
			print("selection 1 complete")
		if selection == '2':
			make_it_so2 = self._select_two()
			print("selection 2 complete")
		if selection == '3':
		
			print("this is selection three")


if __name__ == "__main__":
	app = AmpycheApp()
	app = app.main()