[autoqueue commit] r262 - trunk

0 views
Skip to first unread message

codesite...@google.com

unread,
Mar 11, 2009, 4:31:47 PM3/11/09
to auto...@googlegroups.com
Author: this...@gmail.com
Date: Wed Mar 11 13:14:22 2009
New Revision: 262

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

Log:
a little necessary defensive code, and changed the cutoff and minimum
number of mirage connections

Modified: trunk/autoqueue.py
==============================================================================
--- trunk/autoqueue.py (original)
+++ trunk/autoqueue.py Wed Mar 11 13:14:22 2009
@@ -653,7 +653,10 @@
track_id, artist_id, updated = track[0], track[1], track[3]
db = Db(self.get_db_path())
for match, mtrack_id in db.get_neighbours(track_id):
- track_artist, track_title =
self.get_artist_and_title(mtrack_id)
+ result = self.get_artist_and_title(mtrack_id)
+ if not result:
+ continue
+ track_artist, track_title = result
yield(scale(match, maximum, scale_to),
{'mirage_distance': match,
'artist': track_artist,

Modified: trunk/mirage.py
==============================================================================
--- trunk/mirage.py (original)
+++ trunk/mirage.py Wed Mar 11 13:14:22 2009
@@ -431,7 +431,8 @@
connection.commit()
self.close_database_connection(connection)

- def add_and_compare(self, trackid, scms, cutoff=15000,
exclude_ids=None):
+ def add_and_compare(self, trackid, scms, cutoff=10000,
exclude_ids=None):
+ min_add = 5
if not exclude_ids:
exclude_ids = []
self.add_track(trackid, scms)
@@ -447,14 +448,14 @@
if dist < cutoff:
add.append((trackid, otherid, dist))
else:
- if len(add) > 9:
+ if len(add) > min_add - 1:
continue
- if len(best_of_the_rest) > 9:
+ if len(best_of_the_rest) > min_add - 1:
if dist > best_of_the_rest[-1][0]:
continue
best_of_the_rest.append((dist, trackid, otherid))
best_of_the_rest.sort()
- while len(best_of_the_rest) > 10:
+ while len(best_of_the_rest) > min_add:
best_of_the_rest.pop()
yield
added = 0
@@ -468,7 +469,7 @@
connection.commit()
self.close_database_connection(connection)
connection = self.get_database_connection()
- while best_of_the_rest and added < 10:
+ while best_of_the_rest and added < min_add:
dist, trackid, otherid = best_of_the_rest.pop(0)
connection.execute(
"INSERT INTO distance (track_1, track_2, distance) "

Reply all
Reply to author
Forward
0 new messages