diff options
-rw-r--r-- | docs/api/components.rst | 2 | ||||
-rw-r--r-- | pyload/Api.py | 2 | ||||
-rw-r--r-- | pyload/Core.py | 4 | ||||
-rw-r--r-- | pyload/FileManager.py | 14 | ||||
-rw-r--r-- | pyload/api/DownloadApi.py | 12 | ||||
-rw-r--r-- | pyload/api/FileApi.py | 15 | ||||
-rw-r--r-- | pyload/database/FileDatabase.py | 5 | ||||
-rw-r--r-- | pyload/datatypes/PyFile.py | 10 | ||||
-rw-r--r-- | pyload/remote/apitypes.py | 14 | ||||
-rw-r--r-- | pyload/remote/apitypes_debug.py | 8 | ||||
-rw-r--r-- | pyload/remote/pyload.thrift | 19 | ||||
-rw-r--r-- | pyload/web/app/scripts/models/File.js | 2 | ||||
-rw-r--r-- | pyload/web/app/scripts/models/Package.js | 2 | ||||
-rw-r--r-- | pyload/web/app/scripts/utils/apitypes.js | 2 |
14 files changed, 71 insertions, 40 deletions
diff --git a/docs/api/components.rst b/docs/api/components.rst index 08560b535..cc84943f0 100644 --- a/docs/api/components.rst +++ b/docs/api/components.rst @@ -14,7 +14,7 @@ of the available components listed by topic can be found below. pyload.api.DownloadPreparingApi.DownloadPreparingApi pyload.api.DownloadApi.DownloadApi pyload.api.FileApi.FileApi - pyload.api.CollectorApi.CollectorApi + pyload.api.MediaFinderApi.MediaFinderApi pyload.api.AccountApi.AccountApi pyload.api.UserInteractionApi.UserInteractionApi pyload.api.AddonApi.AddonApi
\ No newline at end of file diff --git a/pyload/Api.py b/pyload/Api.py index afd2bb406..e6bd74a02 100644 --- a/pyload/Api.py +++ b/pyload/Api.py @@ -41,7 +41,7 @@ stateMap = { DownloadState.Finished: frozenset((DownloadStatus.Finished, DownloadStatus.Skipped)), DownloadState.Unfinished: None, # set below DownloadState.Failed: frozenset((DownloadStatus.Failed, DownloadStatus.TempOffline, DownloadStatus.Aborted, - DownloadStatus.NotPossible)), + DownloadStatus.NotPossible, DownloadStatus.FileMismatch)), DownloadState.Unmanaged: None, #TODO } diff --git a/pyload/Core.py b/pyload/Core.py index 4003dd7b1..4893283a8 100644 --- a/pyload/Core.py +++ b/pyload/Core.py @@ -532,7 +532,7 @@ class Core(object): 'ERROR': 'bg_red', 'CRITICAL': 'bg_purple', } - elif self.config['log']['color_theme'] == "light": + else: #light theme cfmt = "%(log_color)s%(asctime)s %(levelname)-8s %(message)s" clr = { 'DEBUG': 'cyan', @@ -540,6 +540,7 @@ class Core(object): 'ERROR': 'red', 'CRITICAL': 'purple', } + console_frm = ColoredFormatter(cfmt, datefmt, clr) else: console_frm = fh_frm @@ -573,7 +574,6 @@ class Core(object): self.log.removeHandler(h) h.close() - def restart(self): self.shutdown() chdir(owd) diff --git a/pyload/FileManager.py b/pyload/FileManager.py index 2aba371fe..4ea7dc5cc 100644 --- a/pyload/FileManager.py +++ b/pyload/FileManager.py @@ -51,9 +51,9 @@ class FileManager: # translations self.statusMsg = [_("none"), _("offline"), _("online"), _("queued"), _("paused"), - _("finished"), _("skipped"), _("failed"), _("starting"), - _("waiting"), _("downloading"), _("temp. offline"), _("aborted"), _("not possible"), - _("decrypting"), _("processing"), _("custom"), _("unknown")] + _("finished"), _("skipped"), _("failed"), _("starting"),_("waiting"), + _("downloading"), _("temp. offline"), _("aborted"), _("not possible"), _("missing"), + _("file mismatch"), _("decrypting"), _("processing"), _("custom"), _("unknown")] self.files = {} # holds instances for files self.packages = {} # same for packages @@ -312,7 +312,7 @@ class FileManager: @lock @invalidate - def deletePackage(self, pid): + def removePackage(self, pid): """delete package and all contained links""" p = self.getPackage(pid) @@ -325,9 +325,6 @@ class FileManager: if pyfile.packageid == pid: pyfile.abortDownload() - # TODO: delete child packages - # TODO: delete folder - self.db.deletePackage(pid) self.releasePackage(pid) @@ -339,7 +336,7 @@ class FileManager: @lock @invalidate - def deleteFile(self, fid): + def removeFile(self, fid): """deletes links""" f = self.getFile(fid) @@ -351,7 +348,6 @@ class FileManager: if fid in self.core.threadManager.processingIds(): f.abortDownload() - # TODO: delete real file self.db.deleteFile(fid, f.fileorder, f.packageid) self.releaseFile(fid) diff --git a/pyload/api/DownloadApi.py b/pyload/api/DownloadApi.py index a0b7c9f96..38871cca7 100644 --- a/pyload/api/DownloadApi.py +++ b/pyload/api/DownloadApi.py @@ -98,24 +98,24 @@ class DownloadApi(ApiComponent): return self.addPackage(th.name, [th.name]) @RequirePerm(Permission.Delete) - def deleteFiles(self, fids): - """Deletes several file entries from pyload. + def removeFiles(self, fids): + """Removes several file entries from pyload. :param fids: list of file ids """ for fid in fids: - self.core.files.deleteFile(fid) + self.core.files.removeFile(fid) self.core.files.save() @RequirePerm(Permission.Delete) - def deletePackages(self, pids): - """Deletes packages and containing links. + def removePackages(self, pids): + """Rempve packages and containing links. :param pids: list of package ids """ for pid in pids: - self.core.files.deletePackage(pid) + self.core.files.removePackage(pid) self.core.files.save() diff --git a/pyload/api/FileApi.py b/pyload/api/FileApi.py index 817bae348..449a520b6 100644 --- a/pyload/api/FileApi.py +++ b/pyload/api/FileApi.py @@ -152,6 +152,21 @@ class FileApi(ApiComponent): """ return self.core.files.moveFiles(fids, pid) + def deleteFiles(self, fids): + """ Deletes files from disk + :param fids: list of file ids + :return: False if any file can't be deleted currently + """ + # TODO + + + def deletePackages(self, pids): + """ Delete package and all content from disk recursively + :param pids: list of package ids + :return: False if any package can't be deleted currently + """ + # TODO + @RequirePerm(Permission.Modify) def orderPackage(self, pid, position): """Set new position for a package. diff --git a/pyload/database/FileDatabase.py b/pyload/database/FileDatabase.py index a07486443..219b16663 100644 --- a/pyload/database/FileDatabase.py +++ b/pyload/database/FileDatabase.py @@ -45,6 +45,7 @@ class FileMethods(DatabaseMethods): # sum is None when no elements are added return (r[0], r[1] if r[1] is not None else 0) if r else (0, 0) + # TODO: missing and not possible DLs ? @queue def queuestats(self, user=None): """ number and size of files in queue not finished yet""" @@ -409,8 +410,8 @@ class FileMethods(DatabaseMethods): @queue def restartFailed(self, owner=None): - # status=queued, where status in failed, aborted, temp offline - self.c.execute("UPDATE files SET dlstatus=3, error='' WHERE dlstatus IN (7, 11, 12)") + # status=queued, where status in failed, aborted, temp offline, file mismatch + self.c.execute("UPDATE files SET dlstatus=3, error='' WHERE dlstatus IN (7, 11, 12, 15)") @queue def findDuplicates(self, id, folder, filename): diff --git a/pyload/datatypes/PyFile.py b/pyload/datatypes/PyFile.py index 3068b8251..e27fdd537 100644 --- a/pyload/datatypes/PyFile.py +++ b/pyload/datatypes/PyFile.py @@ -38,10 +38,12 @@ statusMap = { "temp. offline": 11, "aborted": 12, "not possible": 13, - "decrypting": 14, - "processing": 15, - "custom": 16, - "unknown": 17, + "missing": 14, + "file mismatch": 15, + "decrypting": 16, + "processing": 17, + "custom": 18, + "unknown": 19, } diff --git a/pyload/remote/apitypes.py b/pyload/remote/apitypes.py index 07e04d5de..555deca9f 100644 --- a/pyload/remote/apitypes.py +++ b/pyload/remote/apitypes.py @@ -34,10 +34,12 @@ class DownloadStatus: TempOffline = 11 Aborted = 12 NotPossible = 13 - Decrypting = 14 - Processing = 15 - Custom = 16 - Unknown = 17 + Missing = 14 + FileMismatch = 15 + Decrypting = 16 + Processing = 17 + Custom = 18 + Unknown = 19 class FileStatus: Ok = 0 @@ -489,6 +491,10 @@ class Iface(object): pass def removeAccount(self, account): pass + def removeFiles(self, fids): + pass + def removePackages(self, pids): + pass def removeUser(self, uid): pass def restart(self): diff --git a/pyload/remote/apitypes_debug.py b/pyload/remote/apitypes_debug.py index 382c3e178..74b86f3a8 100644 --- a/pyload/remote/apitypes_debug.py +++ b/pyload/remote/apitypes_debug.py @@ -58,8 +58,8 @@ methods = { 'checkLinks': OnlineCheck, 'createPackage': int, 'deleteConfig': None, - 'deleteFiles': None, - 'deletePackages': None, + 'deleteFiles': bool, + 'deletePackages': bool, 'findFiles': TreeCollection, 'findPackages': TreeCollection, 'freeSpace': int, @@ -106,6 +106,8 @@ methods = { 'quit': None, 'recheckPackage': None, 'removeAccount': None, + 'removeFiles': None, + 'removePackages': None, 'removeUser': None, 'restart': None, 'restartFailed': None, @@ -124,7 +126,7 @@ methods = { 'unpauseServer': None, 'updateAccount': AccountInfo, 'updateAccountInfo': None, - 'updatePackage': None, + 'updatePackage': PackageInfo, 'updateUserData': None, 'uploadContainer': int, } diff --git a/pyload/remote/pyload.thrift b/pyload/remote/pyload.thrift index c68bf5502..9b8415d0f 100644 --- a/pyload/remote/pyload.thrift +++ b/pyload/remote/pyload.thrift @@ -26,6 +26,8 @@ enum DownloadStatus { TempOffline, Aborted, NotPossible, + Missing, + FileMismatch, Decrypting, Processing, Custom, @@ -417,9 +419,9 @@ service Pyload { void addLinks(1: PackageID pid, 2: LinkList links) throws (1: PackageDoesNotExist e), void addLocalFile(1: PackageID pid, 2: string name, 3: string path) throws (1: PackageDoesNotExist e) - // these are real file operations and WILL delete files on disk - void deleteFiles(1: list<FileID> fids), - void deletePackages(1: list<PackageID> pids), // delete the whole folder recursive + // removes the links with out actually deleting the files + void removeFiles(1: list<FileID> fids), + void removePackages(1: list<PackageID> pids), // remove the whole folder recursive // Modify Downloads @@ -430,9 +432,9 @@ service Pyload { void stopDownloads(1: list<FileID> fids), void stopAllDownloads(), - //////////////////////////// + /////////////////////////////// // File Information retrieval - //////////////////////////// + /////////////////////////////// TreeCollection getAllFiles(), TreeCollection getFilteredFiles(1: DownloadState state), @@ -461,6 +463,9 @@ service Pyload { bool movePackage(1: PackageID pid, 2: PackageID root) throws (1: PackageDoesNotExist e), bool moveFiles(1: list<FileID> fids, 2: PackageID pid) throws (1: PackageDoesNotExist e), + bool deletePackages(1: list<PackageID> pids), // remove the whole folder recursive + bool deleteFiles(1: list<FileID> fids), + void orderPackage(1: list<PackageID> pids, 2: i16 position), void orderFiles(1: list<FileID> fids, 2: PackageID pid, 3: i16 position), @@ -525,6 +530,10 @@ service Pyload { JSONString invokeAddonHandler(1: PluginName plugin, 2: string func, 3: PackageID pid_or_fid) throws (1: ServiceDoesNotExist e, 2: ServiceException ex), + /////////////////////// + // Media finder + /////////////////////// + //scheduler diff --git a/pyload/web/app/scripts/models/File.js b/pyload/web/app/scripts/models/File.js index 562e6b0ae..5a70d8e2f 100644 --- a/pyload/web/app/scripts/models/File.js +++ b/pyload/web/app/scripts/models/File.js @@ -45,7 +45,7 @@ define(['jquery', 'backbone', 'underscore', 'app', 'utils/apitypes'], function($ destroy: function(options) { // also not working when using data options = App.apiRequest( - 'deleteFiles/[' + this.get('fid') + ']', + 'removeFiles/[' + this.get('fid') + ']', null, options); options.method = 'post'; diff --git a/pyload/web/app/scripts/models/Package.js b/pyload/web/app/scripts/models/Package.js index a1828ed67..463ec8c13 100644 --- a/pyload/web/app/scripts/models/Package.js +++ b/pyload/web/app/scripts/models/Package.js @@ -100,7 +100,7 @@ define(['jquery', 'backbone', 'underscore', 'app', 'utils/apitypes', 'collection destroy: function(options) { // TODO: Not working when using data?, array seems to break it options = App.apiRequest( - 'deletePackages/[' + this.get('pid') + ']', + 'removePackages/[' + this.get('pid') + ']', null, options); options.method = 'post'; diff --git a/pyload/web/app/scripts/utils/apitypes.js b/pyload/web/app/scripts/utils/apitypes.js index cb094a05b..12ad6b78d 100644 --- a/pyload/web/app/scripts/utils/apitypes.js +++ b/pyload/web/app/scripts/utils/apitypes.js @@ -4,7 +4,7 @@ define([], function() { 'use strict'; return { DownloadState: {'Failed': 3, 'All': 0, 'Unmanaged': 4, 'Finished': 1, 'Unfinished': 2}, - DownloadStatus: {'NotPossible': 13, 'Downloading': 10, 'NA': 0, 'Processing': 15, 'Waiting': 9, 'Decrypting': 14, 'Paused': 4, 'Failed': 7, 'Finished': 5, 'Skipped': 6, 'Unknown': 17, 'Aborted': 12, 'Online': 2, 'TempOffline': 11, 'Offline': 1, 'Custom': 16, 'Starting': 8, 'Queued': 3}, + DownloadStatus: {'NotPossible': 13, 'FileMismatch': 15, 'Downloading': 10, 'Missing': 14, 'NA': 0, 'Processing': 17, 'Waiting': 9, 'Decrypting': 16, 'Paused': 4, 'Failed': 7, 'Finished': 5, 'Skipped': 6, 'Unknown': 19, 'Aborted': 12, 'Online': 2, 'TempOffline': 11, 'Offline': 1, 'Custom': 18, 'Starting': 8, 'Queued': 3}, FileStatus: {'Remote': 2, 'Ok': 0, 'Missing': 1}, InputType: {'PluginList': 13, 'Multiple': 11, 'Int': 2, 'NA': 0, 'Time': 7, 'List': 12, 'Bool': 8, 'File': 3, 'Text': 1, 'Table': 14, 'Folder': 4, 'Password': 6, 'Click': 9, 'Select': 10, 'Textbox': 5}, Interaction: {'Captcha': 2, 'All': 0, 'Query': 4, 'Notification': 1}, |