summaryrefslogtreecommitdiffstats
path: root/module/file_list.py
diff options
context:
space:
mode:
authorGravatar mkaay <mkaay@mkaay.de> 2009-12-04 20:01:17 +0100
committerGravatar mkaay <mkaay@mkaay.de> 2009-12-04 20:01:17 +0100
commit78f061eed59e084f001f8a0cd9c5b585f6fc0ce0 (patch)
tree1c5cc3cbfa4eb993a5af0f2b6556e1ff5f0021c7 /module/file_list.py
parentConvert read_url_list to new Plugin (diff)
downloadpyload-78f061eed59e084f001f8a0cd9c5b585f6fc0ce0.tar.xz
fixes, minimal gui changes
Diffstat (limited to 'module/file_list.py')
-rw-r--r--module/file_list.py16
1 files changed, 12 insertions, 4 deletions
diff --git a/module/file_list.py b/module/file_list.py
index f66567e0f..2bfe37298 100644
--- a/module/file_list.py
+++ b/module/file_list.py
@@ -136,7 +136,7 @@ class File_List(object):
try:
n, pyfile = self.collector._getFileFromID(id)
except NoSuchElementException:
- key, n, pyfile, pypack, pid = self.packager._getFileFromID()
+ key, n, pyfile, pypack, pid = self.packager._getFileFromID(id)
info = {}
info["id"] = pyfile.id
info["url"] = pyfile.url
@@ -146,6 +146,7 @@ class File_List(object):
info["status_url"] = pyfile.status.url
info["status_filename"] = pyfile.status.filename
info["status_error"] = pyfile.status.error
+ info["active"] = pyfile.active
return info
class pyLoadCollector():
@@ -260,11 +261,11 @@ class File_List(object):
for n, pypack in enumerate(packager.file_list.data["packages"]):
for pyfile in pypack.files:
if pyfile.id == id:
- return ("packages", n, pyfile, pypack, pid)
+ return ("packages", n, pyfile, pypack, pypack.data["id"])
for n, pypack in enumerate(packager.file_list.data["queue"]):
for pyfile in pypack.files:
if pyfile.id == id:
- return ("queue", n, pyfile, pypack, pid)
+ return ("queue", n, pyfile, pypack, pypack.data["id"])
raise NoSuchElementException()
def addNewPackage(packager, package_name=None):
@@ -291,6 +292,8 @@ class File_List(object):
try:
key, n, pyfile, pypack, pid = self._getFileFromID()
del pypack.files[n]
+ if not pypack.files:
+ packager.removePackage(pid)
finally:
packager.file_list.lock.release()
@@ -343,11 +346,14 @@ class File_List(object):
pypack.files.append(pyfile)
packager.file_list.data[key][n] = pypack
+ #oooops, duplicate?
def removeFileFromPackage(packager, id, pid):
key, n, pypack = packager._getPackageFromID(pid)
for k, pyfile in enumerate(pypack.files):
if id == pyfile.id:
del pypack.files[k]
+ if not pypack.files:
+ packager.removePackage(pid)
return True
raise NoSuchElementException()
@@ -368,7 +374,7 @@ class PyLoadFile():
self.file_list = file_list
self.core = file_list.core
self.package = None
- self.filename = "filename"
+ self.filename = "n/a"
self.download_folder = ""
self.active = False
pluginName = self._get_my_plugin()
@@ -380,6 +386,8 @@ class PyLoadFile():
pluginClass = module.Plugin.Plugin
self.plugin = pluginClass(self)
self.status = Status(self)
+ if self.plugin.file_exists():
+ self.filename = self.plugin.get_file_name()
def _get_my_plugin(self):
for plugin, plugin_pattern in self.core.plugins_avaible.items():