Browse Source

Automatically update progress status when updating stage

doc-issue-template
MrS0m30n3 8 years ago
parent
commit
afce63727d
2 changed files with 13 additions and 0 deletions
  1. 4
      tests/test_ditem.py
  2. 9
      youtube_dl_gui/downloadmanager.py

4
tests/test_ditem.py

@ -102,15 +102,19 @@ class TestSetItemStage(unittest.TestCase):
def test_set_stage_valid(self):
self.ditem.stage = "Queued"
self.assertEqual(self.ditem.stage, "Queued")
self.assertEqual(self.ditem.progress_stats["status"], "Queued")
self.ditem.stage = "Active"
self.assertEqual(self.ditem.stage, "Active")
self.assertEqual(self.ditem.progress_stats["status"], "Pre Processing")
self.ditem.stage = "Completed"
self.assertEqual(self.ditem.stage, "Completed")
self.assertEqual(self.ditem.progress_stats["status"], "Finished")
self.ditem.stage = "Paused"
self.assertEqual(self.ditem.stage, "Paused")
self.assertEqual(self.ditem.progress_stats["status"], "Paused")
def test_set_stage_invalid(self):
raised = False

9
youtube_dl_gui/downloadmanager.py

@ -116,6 +116,15 @@ class DownloadItem(object):
if value not in self.STAGES:
raise ValueError(value)
if value == "Queued":
self.progress_stats["status"] = value
if value == "Active":
self.progress_stats["status"] = self.ACTIVE_STAGES[0]
if value == "Completed":
self.progress_stats["status"] = self.COMPLETED_STAGES[0]
if value == "Paused":
self.progress_stats["status"] = value
self._stage = value
def get_files(self):

Loading…
Cancel
Save