The module adds into the DB (bt_torrents_files table) only first file's properties (as I can see). Is it possible to calculate the total size of the files in a torrent?
I'm sorry if this question is stupid or if this question already has an answer - it's hard to me to read all the issues.:)

Comments

bradfordcp’s picture

It should be grabbing all of the various file sizes as listed in the torrent file. I am not sure how this is happening, the code for this is located in bt_torrent_insert():

  if (is_array($torrent['info']) && array_key_exists('files', $torrent['info'])) {
    foreach ($torrent['info']['files'] as $torrent_file) {
      db_query("INSERT INTO {bt_torrents_files}(nid, length, path, name) VALUES (%d, '%s', '%s', '%s')", $node->nid, $torrent_file['length'], serialize($torrent_file['path']), array_pop($torrent_file['path']));
    }
  }
  elseif (is_array($torrent['info'])) {
    db_query("INSERT INTO {bt_torrents_files}(nid, length, path, name) VALUES (%d, '%s', '%s', '%s')", $node->nid, $torrent['info']['length'], serialize($torrent['info']['name']), $torrent['info']['name']);
  }
  else {
  	watchdog('BitTorrent Upload Error', 'User attempted to upload torrent with invalid info section.', WATCHDOG_ERROR);
  }

As you can see it first checks to see if this is a single or multi-file torrent. From there it either loops over the files array or pulls the information from the info section. I will look into the issue and try and duplicate. Thanks for the report!

liquixis’s picture

(sorry for my english)

Check "bt_torrents_files" table structure. It must not has "primary key" (for field "nid"). If it has, change it to "index" (because it must be not unique).

liquixis’s picture

Assigned: Flash_Haos » Unassigned
Category: support » bug
Status: Active » Fixed

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.