added MIT license fixes #5, also fixes #6

This commit is contained in:
worldveil 2013-12-16 10:28:22 -06:00
parent 62cf1f6f89
commit 9aa80ff87c
4 changed files with 17 additions and 5 deletions

9
LICENSE.md Normal file
View file

@ -0,0 +1,9 @@
### MIT License
Copyright (c) 2013 Will Drevo
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

View file

@ -233,7 +233,7 @@ class SQLDatabase():
return self.cursor.fetchone() return self.cursor.fetchone()
except mysql.Error, e: except mysql.Error, e:
print "Error in get_songs(), %d: %s" % (e.args[0], e.args[1]) print "Error in get_songs(), %d: %s" % (e.args[0], e.args[1])
return None return None
def insert(self, key, value): def insert(self, key, value):

View file

@ -202,8 +202,9 @@ class Fingerprinter():
# extract idenfication # extract idenfication
song = self.db.get_song_by_id(song_id) song = self.db.get_song_by_id(song_id)
songname = song.get(SQLDatabase.FIELD_SONGNAME, None) if song:
if not songname: songname = song.get(SQLDatabase.FIELD_SONGNAME, None)
else:
return None return None
songname = songname.replace("_", " ") songname = songname.replace("_", " ")
elapsed = time.time() - starttime elapsed = time.time() - starttime

6
go.py
View file

@ -15,6 +15,8 @@ dejavu.fingerprint("va_us_top_40/mp3", "va_us_top_40/wav", [".mp3"], 5)
from dejavu.recognize import Recognizer from dejavu.recognize import Recognizer
recognizer = Recognizer(dejavu.fingerprinter, config) recognizer = Recognizer(dejavu.fingerprinter, config)
song = recognizer.read("va_us_top_40/wav/17_-_#Beautiful_-_Mariah_Carey_ft.wav")
# recognize song playing over microphone for 10 seconds # recognize song playing over microphone for 10 seconds
song = recognizer.listen(seconds=1, verbose=True) #song = recognizer.listen(seconds=1, verbose=True)
print song #print song