diff --git a/LICENSE.md b/LICENSE.md new file mode 100644 index 0000000..7cbfdc7 --- /dev/null +++ b/LICENSE.md @@ -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. \ No newline at end of file diff --git a/dejavu/database.py b/dejavu/database.py index 80a40c5..f03e33e 100644 --- a/dejavu/database.py +++ b/dejavu/database.py @@ -233,7 +233,7 @@ class SQLDatabase(): return self.cursor.fetchone() except mysql.Error, e: print "Error in get_songs(), %d: %s" % (e.args[0], e.args[1]) - return None + return None def insert(self, key, value): diff --git a/dejavu/fingerprint.py b/dejavu/fingerprint.py index 89b57f6..d1f78cc 100644 --- a/dejavu/fingerprint.py +++ b/dejavu/fingerprint.py @@ -202,8 +202,9 @@ class Fingerprinter(): # extract idenfication song = self.db.get_song_by_id(song_id) - songname = song.get(SQLDatabase.FIELD_SONGNAME, None) - if not songname: + if song: + songname = song.get(SQLDatabase.FIELD_SONGNAME, None) + else: return None songname = songname.replace("_", " ") elapsed = time.time() - starttime diff --git a/go.py b/go.py index 7b2d4cb..2aaee89 100644 --- a/go.py +++ b/go.py @@ -15,6 +15,8 @@ dejavu.fingerprint("va_us_top_40/mp3", "va_us_top_40/wav", [".mp3"], 5) from dejavu.recognize import Recognizer 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 -song = recognizer.listen(seconds=1, verbose=True) -print song \ No newline at end of file +#song = recognizer.listen(seconds=1, verbose=True) +#print song \ No newline at end of file