Skip to content

Commit

Permalink
update yml files and bug fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
KJHJason committed Sep 25, 2022
1 parent b765cd3 commit 4ea1268
Show file tree
Hide file tree
Showing 8 changed files with 100 additions and 82 deletions.
4 changes: 2 additions & 2 deletions .github/FUNDING.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# These are supported funding model platforms

github: [KJHJason]
github: # [KJHJason]
patreon: # Replace with a single Patreon username
open_collective: # Replace with a single Open Collective username
ko_fi: dratornic
Expand All @@ -10,4 +10,4 @@ liberapay: # Replace with a single Liberapay username
issuehunt: # Replace with a single IssueHunt username
otechie: # Replace with a single Otechie username
lfx_crowdfunding: # Replace with a single LFX Crowdfunding project-name e.g., cloud-foundry
custom: # Replace with up to 4 custom sponsorship URLs e.g., ['link1', 'link2']
custom: # Replace with up to 4 custom sponsorship URLs e.g., ['link1', 'link2']
24 changes: 6 additions & 18 deletions .github/ISSUE_TEMPLATE/bug-report-en.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ body:
Thanks for taking the time to fill out this bug report!
- type: dropdown
id: programName
id: program_name
attributes:
label: Which program are you seeing this problem on?
multiple: true
Expand All @@ -22,28 +22,16 @@ body:
validations:
required: true

- type: dropdown
id: browser
attributes:
label: Webdriver/Browser Used
multiple: false
options:
- Chrome
- Edge
- Firefox
validations:
required: true

- type: input
id: programVersion
id: program_version
attributes:
label: Program Version
description: What version of the program are you using? (Can be found when running the program or from the exe file name)
validations:
required: true

- type: textarea
id: stepsToReproduce
id: steps_to_reproduce
attributes:
label: Steps to reproduce the bug
description: This will assist me in finding where it went wrong.
Expand All @@ -57,7 +45,7 @@ body:
required: true

- type: textarea
id: expectedBehaviour
id: expected_behaviour
attributes:
label: Expected behaviour
description: A clear and concise description of what you expected to happen.
Expand All @@ -66,10 +54,10 @@ body:
required: true

- type: textarea
id: errorLogText
id: error_log_text
attributes:
label: Relevant log output (If any)
description: Please copy and paste the text in the error log or copy and paste any tracebacks or any error message text that appeared during a program crash.
description: Please copy and paste the text in the error log that was generated.
validations:
required: false

Expand Down
24 changes: 6 additions & 18 deletions .github/ISSUE_TEMPLATE/bug-report-jp.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ body:
注意: 日本語を勉強中なので、簡単な日本語で書いてください。そうでないと、私が問題を理解し解決することができません。
- type: dropdown
id: programName
id: program_name
attributes:
label: どのプログラムでこの問題が発生したのでしょうか?
multiple: true
Expand All @@ -23,28 +23,16 @@ body:
validations:
required: true

- type: dropdown
id: browser
attributes:
label: 使用したWebdriver/ブラウザ
multiple: false
options:
- Chrome/クローム
- Edge/エッジ
- Firefox/ファイアフォックス
validations:
required: true

- type: input
id: programVersion
id: program_version
attributes:
label: プログラムバージョン
description: ご使用のプログラムのバージョンを教えてください (プログラムを実行したとき、またはexeファイル名から確認できます)。
validations:
required: true

- type: textarea
id: stepsToReproduce
id: steps_to_reproduce
attributes:
label: バグを再現するための手順
description: これによって、どこが悪かったのかがわかるようになります。
Expand All @@ -58,7 +46,7 @@ body:
required: true

- type: textarea
id: expectedBehaviour
id: expected_behaviour
attributes:
label: プログラムの期待する行動
description: 期待したことが明確に、かつ簡潔に書かれていること。
Expand All @@ -67,10 +55,10 @@ body:
required: true

- type: textarea
id: errorLogText
id: error_log_text
attributes:
label: 関連するログ出力(ある場合)
description: エラーログのテキストをコピー&ペーストするか、トレースバックやプログラムクラッシュ時に表示されたエラーメッセージのテキストをコピー&ペーストしてください
description: 生成されたエラーログのテキストを入力してください
validations:
required: false

Expand Down
2 changes: 1 addition & 1 deletion .github/ISSUE_TEMPLATE/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,4 @@ blank_issues_enabled: true
contact_links:
- name: Feature Request
url: https://github.com/KJHJason/Cultured-Downloader/discussions
about: If you have any requests for additional features, please use the Discussions tab instead. Thanks!
about: If you have any requests for additional features, please use the Discussions tab instead. Thanks!
1 change: 0 additions & 1 deletion .github/pull_request_template.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,6 @@ Please add your summary here...
## Checklist (Tick those that apply):

- [ ] I have read the [contribution guidelines](https://github.com/KJHJason/Cultured-Downloader/blob/main/CONTRIBUTING.md) and have adhered to it
- [ ] My code follows the style guidelines of this project
- [ ] I have performed a self-review of my code
- [ ] I have commented my code, particularly in hard-to-understand areas
- [ ] I have made corresponding changes to the documentation
Expand Down
63 changes: 37 additions & 26 deletions src/cultured_downloader.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,14 @@
from urllib3 import exceptions as urllib3_exceptions
from colorama import Fore as F, init as colorama_init

# escape ANSI escape sequences on Windows terminal
if (C.USER_PLATFORM == "Windows"):
# escape ANSI escape sequences on Windows terminal
colorama_init(autoreset=False, convert=True)

# A temporary fix for ProactorBasePipeTransport issues on
# Windows OS Machines that may appear for older versions of Python
asyncio.set_event_loop_policy(asyncio.WindowsSelectorEventLoopPolicy())

def print_main_menu(login_status: dict[str, bool],
drive_service: Union[str, None], pixiv_api: Union[PixivAPI, None]) -> None:
"""Print the menu for the user to read and enter their desired action.
Expand Down Expand Up @@ -237,41 +241,53 @@ def nested_menu(website: str) -> None:
)
if (convert_ugoira == "x"):
continue
convert_ugoira = (convert_ugoira == "y")

convert_ugoira = True if (convert_ugoira == "y") else False
if (pixiv_download_option == "1"):
# Download illustration(s)
illust_ids = pixiv_get_ids_or_tags(pixiv_download_option)
if (illust_ids is not None):
if (convert_ugoira):
delete_ugoira_zip = get_input(
input_msg="Do you want to delete the downloaded Ugoira zip file after converting to GIF? (Y/n/x to cancel): ",
inputs=("y", "n", "x"),
default="y"
)
if (delete_ugoira_zip == "x"):
continue
delete_ugoira_zip = (delete_ugoira_zip == "y")
else:
delete_ugoira_zip = False

def run_pixiv_download(illust_id_arr: Optional[list] = None,
user_id_arr: Optional[list] = None,
tag_name_arr: Optional[list] = None) -> None:
"""Run Pixiv download process."""
try:
asyncio.run(
pixiv_api.download_multiple_illust(
base_folder_path=configs.download_directory,
convert_ugoira=convert_ugoira,
illust_id_arr=illust_ids,
illust_id_arr=illust_id_arr,
user_id_arr=user_id_arr,
tag_name_arr=tag_name_arr,
delete_ugoira_zip=delete_ugoira_zip,
)
)
except (KeyboardInterrupt):
return

if (pixiv_download_option == "1"):
# Download illustration(s)
illust_ids = pixiv_get_ids_or_tags(pixiv_download_option)
if (illust_ids is not None):
run_pixiv_download(illust_id_arr=illust_ids)
elif (pixiv_download_option == "2"):
# Download from artist(s)/illustrator(s)
user_ids = pixiv_get_ids_or_tags(pixiv_download_option)
if (user_ids is not None):
asyncio.run(
pixiv_api.download_multiple_illust(
base_folder_path=configs.download_directory,
convert_ugoira=convert_ugoira,
user_id_arr=user_ids,
)
)
run_pixiv_download(user_id_arr=user_ids)
else:
# Download using tag name(s)
tag_names = pixiv_get_ids_or_tags(pixiv_download_option)
if (tag_names is not None):
asyncio.run(
pixiv_api.download_multiple_illust(
base_folder_path=configs.download_directory,
convert_ugoira=convert_ugoira,
tag_name_arr=tag_names,
)
)
run_pixiv_download(tag_name_arr=tag_names)
else:
break

Expand Down Expand Up @@ -409,11 +425,6 @@ def initialise() -> None:
if (not C.DEBUG_MODE):
sys.excepthook = exception_handler

if (C.USER_PLATFORM == "Windows"):
# A temporary fix for ProactorBasePipeTransport issues on
# Windows OS Machines that may appear for older versions of Python
asyncio.set_event_loop_policy(asyncio.WindowsSelectorEventLoopPolicy())

print(f"""
=========================================== {F.LIGHTBLUE_EX}CULTURED DOWNLOADER v{__version__ }{C.END} ===========================================
================================ {F.LIGHTBLUE_EX}https://github.com/KJHJason/Cultured-Downloader{C.END} =================================
Expand Down
3 changes: 2 additions & 1 deletion src/utils/functional.py
Original file line number Diff line number Diff line change
Expand Up @@ -276,7 +276,7 @@ def change_download_directory(configs: Optional[ConfigSchema] = None,

def get_input(input_msg: str, inputs: Optional[Union[tuple[str], list[str]]] = None,
regex: re.Pattern[str] = None, default: Optional[str] = None, warning: str = None,
extra_information: Optional[str] = None, is_case_sensitive: Optional[bool] = False) -> Any:
extra_information: Optional[str] = None, is_case_sensitive: Optional[bool] = False) -> str:
"""Get the expected input from the user.
Args:
Expand Down Expand Up @@ -835,6 +835,7 @@ def remove_illegal_chars_in_path(string: str) -> str:
str:
The path name with illegal characters replaced with a dash.
"""
string = string.replace(".", " ")
return C.ILLEGAL_PATH_CHARS_REGEX.sub(
repl="-",
string=string.strip()
Expand Down
Loading

0 comments on commit 4ea1268

Please sign in to comment.