Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Main] Recognize ddl.to and turb.to Issue 3702 #3770

Open
wants to merge 5 commits into
base: develop
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
18 changes: 13 additions & 5 deletions src/pyload/core/managers/plugin_manager.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@
import sys
from ast import literal_eval
from itertools import chain
from collections import OrderedDict

# import semver

from pyload import APPID, PKGDIR

Expand All @@ -28,6 +28,7 @@ class PluginManager:

_PATTERN = re.compile(r'\s*__pattern__\s*=\s*r?(?:"|\')([^"\']+)')
_VERSION = re.compile(r'\s*__version__\s*=\s*(?:"|\')([\d.]+)')
_ORDER = re.compile(r'\s*__order__\s*=\s*(?:"|\')([\d.]+)')
# _PYLOAD_VERSION = re.compile(r'\s*__pyload_version__\s*=\s*(?:"|\')([\d.]+)')
_CONFIG = re.compile(r"\s*__config__\s*=\s*(\[[^\]]+\])", re.MULTILINE)
_DESC = re.compile(r'\s*__description__\s*=\s*(?:"|"""|\')([^"\']+)', re.MULTILINE)
Expand Down Expand Up @@ -190,6 +191,12 @@ def parse(self, folder, pattern=False, home={}):
else:
version = float(m_ver.group(1))

m_order = self._ORDER.search(content)
if m_order is None:
order = 0
else:
order = float(m_order.group(1))

# home contains plugins from pyload root
if isinstance(home, dict) and name in home:
if home[name]["v"] >= version:
Expand All @@ -204,6 +211,7 @@ def parse(self, folder, pattern=False, home={}):
plugins[name]["user"] = True if home else False
plugins[name]["name"] = module
plugins[name]["folder"] = folder
plugins[name]["order"] = order

if pattern:
m_pat = self._PATTERN.search(content)
Expand Down Expand Up @@ -257,7 +265,7 @@ def parse(self, folder, pattern=False, home={}):
plugins.update(temp_plugins)
configs.update(temp_configs)

return plugins, configs
return plugins , configs

def parse_urls(self, urls):
"""
Expand All @@ -281,9 +289,9 @@ def parse_urls(self, urls):
continue

for name, value in chain(
self.crypter_plugins.items(),
self.hoster_plugins.items(),
self.container_plugins.items(),
OrderedDict(sorted(self.crypter_plugins.items(), key=lambda t: t[1]['order'])).items(),
OrderedDict(sorted(self.hoster_plugins.items(), key=lambda t: t[1]['order'])).items(),
OrderedDict(sorted(self.container_plugins.items(), key=lambda t: t[1]['order'])).items()
):
if value["re"].match(url):
res.append((url, name))
Expand Down
1 change: 1 addition & 0 deletions src/pyload/plugins/downloaders/XFileSharing.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ class XFileSharing(XFSDownloader):
__type__ = "downloader"
__version__ = "0.65"
__status__ = "testing"
__order__ = "100"

__pattern__ = r"^unmatchable$"
__config__ = [
Expand Down