-
Notifications
You must be signed in to change notification settings - Fork 71
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[BUGFIX] Fix variable collision when disabling plugins (#1072)
Fixes #1071
- Loading branch information
Showing
10 changed files
with
84 additions
and
31 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 |
---|---|---|
|
@@ -2,7 +2,6 @@ | |
|
||
|
||
class PluginOperation(Enum): | ||
ANY = -2 | ||
DOWNLOADER = -1 | ||
MODIFY_ENTRY_METADATA = 0 | ||
MODIFY_ENTRY = 1 | ||
|
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
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,60 @@ | ||
from typing import Dict | ||
|
||
import pytest | ||
|
||
from ytdl_sub.entries.entry import ytdl_sub_chapters_from_comments | ||
from ytdl_sub.subscriptions.subscription import Subscription | ||
|
||
|
||
@pytest.fixture | ||
def sponsorblock_disabled_dict(output_directory) -> Dict: | ||
return { | ||
"preset": "Jellyfin Music Videos", | ||
"output_options": {"output_directory": output_directory}, | ||
"chapters": { | ||
"enable": "{enable_sponsorblock}", | ||
"sponsorblock_categories": [ | ||
"outro", | ||
"selfpromo", | ||
"preview", | ||
"interaction", | ||
"sponsor", | ||
"music_offtopic", | ||
"intro", | ||
], | ||
"remove_sponsorblock_categories": "all", | ||
"remove_chapters_regex": [ | ||
"Intro", | ||
"Outro", | ||
], | ||
}, | ||
"overrides": { | ||
"music_video_artist": "JMC", | ||
"url": "https://your.name.here", | ||
"enable_sponsorblock": "False", | ||
}, | ||
} | ||
|
||
|
||
class TestChapters: | ||
def test_chapters_disabled_respected( | ||
self, | ||
config, | ||
subscription_name, | ||
sponsorblock_disabled_dict, | ||
output_directory, | ||
mock_download_collection_entries, | ||
): | ||
subscription = Subscription.from_dict( | ||
config=config, | ||
preset_name=subscription_name, | ||
preset_dict=sponsorblock_disabled_dict, | ||
) | ||
|
||
with mock_download_collection_entries( | ||
is_youtube_channel=False, num_urls=1, is_extracted_audio=False, is_dry_run=True | ||
): | ||
_ = subscription.download(dry_run=True) | ||
|
||
script = subscription.overrides.script | ||
assert script.get(ytdl_sub_chapters_from_comments.variable_name).native == "" |
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