edit empty trackers fix
This commit is contained in:
parent
2a8d36029e
commit
5a90e14794
|
@ -478,6 +478,8 @@ namespace libtorrent
|
||||||
m_files.release(this);
|
m_files.release(this);
|
||||||
buffer().swap(m_scratch_buffer);
|
buffer().swap(m_scratch_buffer);
|
||||||
|
|
||||||
|
std::string error;
|
||||||
|
|
||||||
// delete the files from disk
|
// delete the files from disk
|
||||||
std::set<std::string> directories;
|
std::set<std::string> directories;
|
||||||
typedef std::set<std::string>::iterator iter_t;
|
typedef std::set<std::string>::iterator iter_t;
|
||||||
|
@ -493,13 +495,21 @@ namespace libtorrent
|
||||||
std::pair<iter_t, bool> ret = directories.insert((m_save_path / bp).string());
|
std::pair<iter_t, bool> ret = directories.insert((m_save_path / bp).string());
|
||||||
bp = bp.branch_path();
|
bp = bp.branch_path();
|
||||||
}
|
}
|
||||||
std::remove(p.c_str());
|
if (std::remove(p.c_str()) != 0 && errno != ENOENT)
|
||||||
|
error = std::strerror(errno);
|
||||||
}
|
}
|
||||||
|
|
||||||
// remove the directories. Reverse order to delete
|
// remove the directories. Reverse order to delete
|
||||||
// subdirectories first
|
// subdirectories first
|
||||||
std::for_each(directories.rbegin(), directories.rend()
|
|
||||||
, bind((int(*)(char const*))&std::remove, bind(&std::string::c_str, _1)));
|
for (std::set<std::string>::reverse_iterator i = directories.rbegin()
|
||||||
|
, end(directories.rend()); i != end; ++i)
|
||||||
|
{
|
||||||
|
if (std::remove(i->c_str()) != 0 && errno != ENOENT)
|
||||||
|
error = std::strerror(errno);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!error.empty()) throw std::runtime_error(error);
|
||||||
}
|
}
|
||||||
|
|
||||||
void storage::write_resume_data(entry& rd) const
|
void storage::write_resume_data(entry& rd) const
|
||||||
|
|
|
@ -498,7 +498,7 @@ namespace libtorrent
|
||||||
{
|
{
|
||||||
INVARIANT_CHECK;
|
INVARIANT_CHECK;
|
||||||
|
|
||||||
if (m_torrent_file->trackers().empty()) return false;
|
if (m_trackers.empty()) return false;
|
||||||
|
|
||||||
if (m_just_paused)
|
if (m_just_paused)
|
||||||
{
|
{
|
||||||
|
@ -1071,10 +1071,17 @@ namespace libtorrent
|
||||||
session_impl::mutex_t::scoped_lock l(m_ses.m_mutex);
|
session_impl::mutex_t::scoped_lock l(m_ses.m_mutex);
|
||||||
|
|
||||||
if (alerts().should_post(alert::warning))
|
if (alerts().should_post(alert::warning))
|
||||||
|
{
|
||||||
|
if (ret != 0)
|
||||||
|
{
|
||||||
|
alerts().post_alert(torrent_deleted_alert(get_handle(), "delete files failed: " + j.str));
|
||||||
|
}
|
||||||
|
else
|
||||||
{
|
{
|
||||||
alerts().post_alert(torrent_deleted_alert(get_handle(), "files deleted"));
|
alerts().post_alert(torrent_deleted_alert(get_handle(), "files deleted"));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
void torrent::on_files_released(int ret, disk_io_job const& j)
|
void torrent::on_files_released(int ret, disk_io_job const& j)
|
||||||
{
|
{
|
||||||
|
|
|
@ -1010,11 +1010,15 @@ of HD space! Oops!\nWe had to pause at least one torrent"))
|
||||||
return deluge_core.pe_settings(out_enc_policy, in_enc_policy, allowed_enc_level, prefer_rc4)
|
return deluge_core.pe_settings(out_enc_policy, in_enc_policy, allowed_enc_level, prefer_rc4)
|
||||||
|
|
||||||
def get_trackers(self, unique_ID):
|
def get_trackers(self, unique_ID):
|
||||||
|
if self.unique_IDs[unique_ID].trackers:
|
||||||
|
return self.unique_IDs[unique_ID].trackers
|
||||||
|
else:
|
||||||
return deluge_core.get_trackers(unique_ID)
|
return deluge_core.get_trackers(unique_ID)
|
||||||
|
|
||||||
def replace_trackers(self, unique_ID, trackers):
|
def replace_trackers(self, unique_ID, trackerslist):
|
||||||
|
self.unique_IDs[unique_ID].trackers = trackerslist
|
||||||
try:
|
try:
|
||||||
return deluge_core.replace_trackers(unique_ID, trackers)
|
return deluge_core.replace_trackers(unique_ID, trackerslist)
|
||||||
except:
|
except:
|
||||||
pass
|
pass
|
||||||
|
|
||||||
|
|
|
@ -490,7 +490,6 @@ window, please enter your password"))
|
||||||
include_hidden_chars=False).strip()
|
include_hidden_chars=False).strip()
|
||||||
self.manager.replace_trackers(torrent, self.textlist)
|
self.manager.replace_trackers(torrent, self.textlist)
|
||||||
self.edit_window.destroy()
|
self.edit_window.destroy()
|
||||||
self.manager.unique_IDs[torrent].trackers = self.textlist
|
|
||||||
|
|
||||||
def show_edit_tracker_dialog(self, list):
|
def show_edit_tracker_dialog(self, list):
|
||||||
self.textbuffer = gtk.TextBuffer(table=None)
|
self.textbuffer = gtk.TextBuffer(table=None)
|
||||||
|
|
Loading…
Reference in New Issue