[Core] Remove compact allocation references

* This has been removed from lt 1.1 so no longer relevant.
This commit is contained in:
Calum Lind 2016-10-28 11:08:33 +01:00
parent 08192033fb
commit 4dc59b5255
4 changed files with 15 additions and 43 deletions

View File

@ -382,9 +382,6 @@ class Torrent(object):
return None, None return None, None
if not self.has_metadata: if not self.has_metadata:
return None, None return None, None
if self.get_status(["storage_mode"])["storage_mode"] == "compact":
log.debug("Setting first/last priority with compact allocation does not work!")
return None, None
# A list of priorities for each piece in the torrent # A list of priorities for each piece in the torrent
priorities = self.handle.piece_priorities() priorities = self.handle.piece_priorities()
prioritized_pieces = [] prioritized_pieces = []
@ -417,11 +414,8 @@ class Torrent(object):
Args: Args:
set_sequencial (bool): Enable sequencial downloading. set_sequencial (bool): Enable sequencial downloading.
""" """
if self.get_status(["storage_mode"])["storage_mode"] != "compact":
self.options["sequential_download"] = set_sequencial self.options["sequential_download"] = set_sequencial
self.handle.set_sequential_download(set_sequencial) self.handle.set_sequential_download(set_sequencial)
else:
self.options["sequential_download"] = False
def set_auto_managed(self, auto_managed): def set_auto_managed(self, auto_managed):
"""Set auto managed mode, i.e. will be started or queued automatically. """Set auto managed mode, i.e. will be started or queued automatically.
@ -500,11 +494,6 @@ class Torrent(object):
self.options["file_priorities"] = self.handle.file_priorities() self.options["file_priorities"] = self.handle.file_priorities()
return return
if self.get_status(["storage_mode"])["storage_mode"] == "compact":
log.warning("Setting file priority with compact allocation does not work!")
self.options["file_priorities"] = self.handle.file_priorities()
return
if log.isEnabledFor(logging.DEBUG): if log.isEnabledFor(logging.DEBUG):
log.debug("Setting %s's file priorities: %s", self.torrent_id, file_priorities) log.debug("Setting %s's file priorities: %s", self.torrent_id, file_priorities)
@ -982,7 +971,7 @@ class Torrent(object):
"seeding_time": lambda: self.status.seeding_time, "seeding_time": lambda: self.status.seeding_time,
"finished_time": lambda: self.status.finished_time, "finished_time": lambda: self.status.finished_time,
"all_time_download": lambda: self.status.all_time_download, "all_time_download": lambda: self.status.all_time_download,
"storage_mode": lambda: self.status.storage_mode.name.split("_")[2], # sparse, allocate or compact "storage_mode": lambda: self.status.storage_mode.name.split("_")[2], # sparse or allocate
"distributed_copies": lambda: max(0.0, self.status.distributed_copies), "distributed_copies": lambda: max(0.0, self.status.distributed_copies),
"download_payload_rate": lambda: self.status.download_payload_rate, "download_payload_rate": lambda: self.status.download_payload_rate,
"file_priorities": lambda: self.options["file_priorities"], "file_priorities": lambda: self.options["file_priorities"],

View File

@ -538,9 +538,6 @@ class TorrentManager(component.Component):
try: try:
for attr in set(dir(t_state_tmp)) - set(dir(state.torrents[0])): for attr in set(dir(t_state_tmp)) - set(dir(state.torrents[0])):
for t_state in state.torrents: for t_state in state.torrents:
if attr == "storage_mode" and getattr(t_state, "compact", None):
setattr(t_state, attr, "compact")
else:
setattr(t_state, attr, getattr(t_state_tmp, attr, None)) setattr(t_state, attr, getattr(t_state_tmp, attr, None))
except AttributeError as ex: except AttributeError as ex:
log.error("Unable to update state file to a compatible version: %s", ex) log.error("Unable to update state file to a compatible version: %s", ex)

View File

@ -445,10 +445,6 @@ class FilesTab(Tab):
if self.torrent_id != torrent_id: if self.torrent_id != torrent_id:
return return
# Store this torrent's compact setting
if "storage_mode" in status:
self.__compact = status["storage_mode"] == "compact"
if "is_seed" in status: if "is_seed" in status:
self.__is_seed = status["is_seed"] self.__is_seed = status["is_seed"]
@ -498,7 +494,7 @@ class FilesTab(Tab):
self.listview.get_selection().select_iter(row) self.listview.get_selection().select_iter(row)
for widget in self.file_menu_priority_items: for widget in self.file_menu_priority_items:
widget.set_sensitive(not (self.__compact or self.__is_seed)) widget.set_sensitive(not self.__is_seed)
self.file_menu.popup(None, None, None, event.button, event.time) self.file_menu.popup(None, None, None, event.button, event.time)
return True return True

View File

@ -147,14 +147,6 @@ class OptionsTab(Tab):
if status["owner"] != self.prev_status["owner"]: if status["owner"] != self.prev_status["owner"]:
self.summary_owner.set_text(status["owner"]) self.summary_owner.set_text(status["owner"])
if status["storage_mode"] == "compact":
self.chk_prioritize_first_last.set_sensitive(False)
if self.chk_sequential_download.get_property("visible"):
self.chk_prioritize_first_last.hide()
self.chk_sequential_download.set_sensitive(False)
if self.chk_sequential_download.get_property("visible"):
self.chk_sequential_download.hide()
else:
if status["prioritize_first_last"] != self.prev_status["prioritize_first_last"]: if status["prioritize_first_last"] != self.prev_status["prioritize_first_last"]:
self.chk_prioritize_first_last.set_active(status["prioritize_first_last"]) self.chk_prioritize_first_last.set_active(status["prioritize_first_last"])
if not self.chk_prioritize_first_last.get_property("visible"): if not self.chk_prioritize_first_last.get_property("visible"):
@ -180,12 +172,10 @@ class OptionsTab(Tab):
if self.spin_max_upload_slots.get_value_as_int() != self.prev_status["max_upload_slots"]: if self.spin_max_upload_slots.get_value_as_int() != self.prev_status["max_upload_slots"]:
client.core.set_torrent_max_upload_slots( client.core.set_torrent_max_upload_slots(
self.prev_torrent_id, self.spin_max_upload_slots.get_value_as_int()) self.prev_torrent_id, self.spin_max_upload_slots.get_value_as_int())
if (self.chk_prioritize_first_last.get_active() != if (self.chk_prioritize_first_last.get_active() != self.prev_status["prioritize_first_last"]):
self.prev_status["prioritize_first_last"] and self.prev_status["storage_mode"] != "compact"):
client.core.set_torrent_prioritize_first_last( client.core.set_torrent_prioritize_first_last(
self.prev_torrent_id, self.chk_prioritize_first_last.get_active()) self.prev_torrent_id, self.chk_prioritize_first_last.get_active())
if (self.chk_sequential_download.get_active() != if (self.chk_sequential_download.get_active() != self.prev_status["sequential_download"]):
self.prev_status["sequential_download"] and self.prev_status["storage_mode"] != "compact"):
client.core.set_torrent_options( client.core.set_torrent_options(
[self.prev_torrent_id], {"sequential_download": self.chk_sequential_download.get_active()}) [self.prev_torrent_id], {"sequential_download": self.chk_sequential_download.get_active()})
if self.chk_auto_managed.get_active() != self.prev_status["is_auto_managed"]: if self.chk_auto_managed.get_active() != self.prev_status["is_auto_managed"]: