Exemplo n.º 1
0
	def __init__(self):
		self.cursor.execute('SELECT name FROM sqlite_master WHERE type=\'table\'')
		result=self.cursor.fetchall()
		if not ('config',) in result:
			CMP.warn('config table missing. Creating...')
			self.initalize_config()
		self.extract_settings()
Exemplo n.º 2
0
	def __init__(self,library_dir):
		self.library_create = 'CREATE TABLE library (song_id INTEGER PRIMARY KEY, file VARCHAR(255), tracknum INT(8), title VARCHAR(255), artist VARCHAR(255), album VARCHAR(255), year INT(16), modified VARCHAR(20))'
		self.library_insert = 'INSERT INTO library VALUES (null, ?, ?, ?, ?, ?, ?, ?)'
		self.library_dir = library_dir

		#add the library table if it doesn't exist
		self.cursor.execute('SELECT name FROM sqlite_master WHERE type=\'table\'')
		result=self.cursor.fetchall()
		if not ('library',) in result:
			CMP.warn('library table missing. Creating...')
			self.cursor.execute(self.library_create)
			self.connection.commit()
		self.check_for_changes()
Exemplo n.º 3
0
	def remove_from_library(self,songfile):
		CMP.warn("track "+songfile+" is missing. removing from database")
		self.cursor.execute('DELETE FROM library WHERE file =?',(songfile,))
Exemplo n.º 4
0
	def add_to_library(self,songfile):
		mytagger = tagger()
		tags = mytagger.get_track_info(songfile)
		CMP.warn("adding "+songfile)
		self.cursor.execute(self.library_insert, ( songfile, tags['tracknum'], tags["title"], tags["artist"], tags["album"], tags['year'], str(os.path.getmtime(songfile)) ) )