-
Notifications
You must be signed in to change notification settings - Fork 38
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #289 from mov-cli/v4.3
V4.3
- Loading branch information
Showing
18 changed files
with
311 additions
and
202 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -4,4 +4,4 @@ | |
from .scraper import * | ||
from .download import * | ||
|
||
__version__ = "4.2.13" | ||
__version__ = "4.3.0" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,59 @@ | ||
from __future__ import annotations | ||
from typing import TYPE_CHECKING | ||
|
||
if TYPE_CHECKING: | ||
from typing import Tuple, List, Dict, NoReturn | ||
|
||
from ..plugins import PluginHookData | ||
|
||
from devgoldyutils import Colours | ||
|
||
from ..plugins import load_plugin | ||
from ..logger import mov_cli_logger | ||
|
||
def get_plugins_data(plugins: Dict[str, str]) -> List[Tuple[str, str, PluginHookData]]: | ||
plugins_data: List[Tuple[str, str, PluginHookData]] = [] | ||
|
||
for plugin_namespace, plugin_module_name in plugins.items(): | ||
plugin = load_plugin(plugin_module_name) | ||
|
||
if plugin is None: | ||
continue | ||
|
||
plugin_data, _ = plugin | ||
|
||
if plugin_data is None: | ||
continue | ||
|
||
plugins_data.append( | ||
(plugin_namespace, plugin_module_name, plugin_data) | ||
) | ||
|
||
return plugins_data | ||
|
||
def show_all_plugins(plugins: Dict[str, str]) -> None: | ||
|
||
for plugin_namespace, plugin_module_name, plugin_hook_data in get_plugins_data(plugins): | ||
# TODO: Have 'get_plugins_data' return plugin module so we shouldn't have to load the plugin twice. | ||
plugin = load_plugin(plugin_module_name) | ||
|
||
if plugin is not None: | ||
plugin_module = plugin[1] | ||
|
||
plugin_version = getattr(plugin_module, "__version__", "N/A") | ||
|
||
print(f"- {Colours.PURPLE.apply(plugin_module_name)} ({plugin_namespace}) [{Colours.BLUE.apply(plugin_version)}]") | ||
|
||
for scraper_name in plugin_hook_data["scrapers"]: | ||
if scraper_name == "DEFAULT": | ||
continue | ||
|
||
print(f" - {Colours.PINK_GREY.apply(scraper_name)}") | ||
|
||
def handle_internal_plugin_error(e: Exception) -> NoReturn: | ||
mov_cli_logger.critical( | ||
"An error occurred inside a plugin. This is MOST LIKELY not a mov-cli error, " \ | ||
f"make SURE mov-cli and your plugins are up to date. Also report this to the plugin, not mov-cli! \nError: {e}" | ||
) | ||
|
||
raise e |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.