add and use is_finished

This commit is contained in:
Marcos Pinto 2008-04-13 03:25:22 +00:00
parent 2cc8b72e96
commit 3f9f4bb662
2 changed files with 7 additions and 6 deletions

View File

@ -304,7 +304,7 @@ class Manager:
except:
pass
else:
if not torrent_state['is_seed']:
if not torrent_state['is_finished']:
try:
os.remove(self.unique_IDs[unique_ID].filename + ".fastresume")
except:
@ -464,7 +464,7 @@ class Manager:
for unique_ID in self.unique_IDs:
try:
state = deluge_core.get_torrent_state(unique_ID)
if not state['is_seed'] and state['state'] != 0 and state['state'] != 1:
if not state['is_finished'] and state['state'] != 0 and state['state'] != 1:
os.remove(self.unique_IDs[unique_ID].filename + ".fastresume")
deluge_core.save_fastresume(unique_ID, self.unique_IDs[unique_ID].filename)
except OSError:
@ -624,7 +624,7 @@ class Manager:
torrent_state['is_paused'] and not \
self.is_user_paused(unique_ID):
# This torrent is a seed so skip all the free space checking
if torrent_state['is_seed']:
if torrent_state['is_finished']:
self.resume(unique_ID)
continue
@ -1055,7 +1055,7 @@ likely the tracker did not responsd in utf-8."
except:
pass
else:
if not torrent_state['is_seed']:
if not torrent_state['is_finished']:
try:
os.remove(self.unique_IDs[unique_ID].filename + ".fastresume")
except:

View File

@ -1315,7 +1315,7 @@ std::cout << asctime(timeinfo) << " torrent_get_torrent_state()" << std::endl;
PyTuple_SetItem(pieces_range, i/2, rangepos);
}
PyObject *ret = Py_BuildValue("{s:s,s:i,s:i,s:l,s:l,s:f,s:f,s:b,s:f,s:L,s:L,s:s,s:s,s:f,s:L,s:L,s:O,s:i,s:i,s:L,s:L,s:i,s:l,s:l,s:b,s:b,s:L,s:L,s:L}",
PyObject *ret = Py_BuildValue("{s:s,s:i,s:i,s:l,s:l,s:f,s:f,s:b,s:f,s:L,s:L,s:s,s:s,s:f,s:L,s:L,s:O,s:i,s:i,s:L,s:L,s:i,s:l,s:l,s:b,s:b,s:L,s:L,s:L,s:b}",
"name", t.handle.get_torrent_info().name().c_str(),
"num_files", t.handle.get_torrent_info().num_files(),
"state", s.state,
@ -1344,7 +1344,8 @@ std::cout << asctime(timeinfo) << " torrent_get_torrent_state()" << std::endl;
"is_seed", t.handle.is_seed(),
"total_done", s.total_done,
"total_wanted", s.total_wanted,
"total_wanted_done", s.total_wanted_done);
"total_wanted_done", s.total_wanted_done,
"is_finished", t.handle.is_finished());
Py_DECREF(pieces_range);
return ret;