diff --git a/bt_torrent/bt_torrent.module b/bt_torrent/bt_torrent.module index 0a4abb5..5cf3188 100644 --- a/bt_torrent/bt_torrent.module +++ b/bt_torrent/bt_torrent.module @@ -238,7 +238,7 @@ function bt_torrent_insert($node) { } // Insert the torrent into the database - db_query("INSERT INTO {bt_torrents}(nid, info_hash, metadata) VALUES (%d, '%s', %b)", $node->nid, info_hash($torrent), bencode($torrent)); + db_query("INSERT INTO {bt_torrents}(nid, info_hash, metadata, announce_url) VALUES (%d, '%s', %b, '%s')", $node->nid, info_hash($torrent), bencode($torrent), $torrent['announce']); if (is_array($torrent['info']) && array_key_exists('files', $torrent['info'])) { foreach ($torrent['info']['files'] as $torrent_file) { @@ -277,7 +277,7 @@ function bt_torrent_update($node) { $torrent['announce'] = variable_get('bt_override_announce_url', ''); } - db_query("UPDATE {bt_torrents} SET info_hash = '%s', metadata = %b WHERE nid = %d", info_hash($torrent), bencode($torrent), $node->nid); + db_query("UPDATE {bt_torrents} SET info_hash = '%s', metadata = %b, announce_url = '%s' WHERE nid = %d", info_hash($torrent), bencode($torrent), $node->nid, $torrent['announce']); db_query("DELETE FROM {bt_torrents_files} WHERE nid = %d", $node->nid); @@ -788,7 +788,7 @@ function bt_torrent_cron() { $last_scrape = variable_get('bt_last_scrape', 0); if (time() - $last_scrape > variable_get('bt_scrape_cron_interval', 7200)) { // Retrieve a list of unique announce URLs (not including ourself) - $tracker_result = db_query("SELECT DISTINCT announce_url FROM {bt_torrents} bt WHERE NOT (announce_url = '%s')", variable_get('bt_override_announce_url', '')); + $tracker_result = db_query("SELECT DISTINCT announce_url FROM {bt_torrents} bt WHERE NOT (announce_url = '%s') AND NOT (announce_url = '')", variable_get('bt_override_announce_url', '')); while ($row = db_fetch_object($tracker_result)) { // Grab all torrents using that tracker