[autoqueue] r283 committed - * add 20 neighbours instead of 10...

0 views
Skip to first unread message

codesite...@google.com

unread,
Sep 26, 2009, 8:53:08 AM9/26/09
to auto...@googlegroups.com
Revision: 283
Author: this...@gmail.com
Date: Sat Sep 26 05:52:06 2009
Log: * add 20 neighbours instead of 10
* offset last.fm tracks by 1000
* check for new closer reverse neighbours


http://code.google.com/p/autoqueue/source/detail?r=283

Modified:
/trunk/autoqueue.py
/trunk/mirage.py

=======================================
--- /trunk/autoqueue.py Tue Sep 22 05:15:53 2009
+++ /trunk/autoqueue.py Sat Sep 26 05:52:06 2009
@@ -553,7 +553,8 @@
if self.use_db:
self._tracks_to_update.setdefault(track_id,
[]).append(result)
yield (
- scale(match, self.max_track_match, 10000, invert=True),
result)
+ scale(match, self.max_track_match, 10000, offset=1000,
+ invert=True), result)

def get_similar_artists_from_lastfm(self, artist_name, artist_id):
"""get similar artists"""
@@ -694,7 +695,8 @@
yield
if add_neighbours:
exclude_ids = self.get_artist_tracks(artist_id)
- for dummy in db.add_neighbours(track_id, scms,
exclude_ids=exclude_ids):
+ for dummy in db.add_neighbours(track_id, scms,
+ exclude_ids=exclude_ids):
yield
return

=======================================
--- /trunk/mirage.py Thu Sep 17 05:43:27 2009
+++ /trunk/mirage.py Sat Sep 26 05:52:06 2009
@@ -409,13 +409,24 @@
self.close_database_connection(connection)
return None

- def has_scores(self, trackid, no=10):
+ def has_scores(self, trackid, no=20):
connection = self.get_database_connection()
cursor = connection.execute(
"SELECT COUNT(*) FROM distance WHERE track_1 = ?", (trackid,))
l = cursor.fetchone()[0]
self.close_database_connection(connection)
- return l >= no
+ if l >= no:
+ return True
+ connection = self.get_database_connection()
+ cursor = connection.execute(
+ "SELECT COUNT(*) FROM distance WHERE track_2 = ? AND distance
< "
+ "(SELECT MAX(distance) FROM distance WHERE track_1 <= ?);",
+ (trackid, trackid))
+ l = cursor.fetchone()[0]
+ self.close_database_connection(connection)
+ if l >= no:
+ return True
+ return False

def get_tracks(self, exclude_ids=None):
if not exclude_ids:

Reply all
Reply to author
Forward
0 new messages