Skip to content

Commit

Permalink
Merge branch 'sqzw-x:master' into master
Browse files Browse the repository at this point in the history
  • Loading branch information
xuhao61 authored Nov 26, 2024
2 parents fe88b7a + 4da2048 commit 305b5c0
Show file tree
Hide file tree
Showing 82 changed files with 1,758 additions and 3,194 deletions.
108 changes: 108 additions & 0 deletions .editorconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,108 @@
[*]
charset = utf-8
end_of_line = lf
indent_size = 4
indent_style = space
insert_final_newline = false
max_line_length = 170
tab_width = 4
ij_continuation_indent_size = 8
ij_formatter_off_tag = @formatter:off
ij_formatter_on_tag = @formatter:on
ij_formatter_tags_enabled = true
ij_smart_tabs = false
ij_visual_guides =
ij_wrap_on_typing = false

[.editorconfig]
ij_editorconfig_align_group_field_declarations = false
ij_editorconfig_space_after_colon = false
ij_editorconfig_space_after_comma = true
ij_editorconfig_space_before_colon = false
ij_editorconfig_space_before_comma = false
ij_editorconfig_spaces_around_assignment_operators = true


[{*.bash,*.sh,*.zsh}]
indent_size = 2
tab_width = 2
ij_shell_binary_ops_start_line = false
ij_shell_keep_column_alignment_padding = false
ij_shell_minify_program = false
ij_shell_redirect_followed_by_space = false
ij_shell_switch_cases_indented = false
ij_shell_use_unix_line_separator = true


[{*.py,*.pyc,*.pyw}]
ij_python_align_collections_and_comprehensions = true
ij_python_align_multiline_imports = true
ij_python_align_multiline_parameters = true
ij_python_align_multiline_parameters_in_calls = true
ij_python_blank_line_at_file_end = true
ij_python_blank_lines_after_imports = 1
ij_python_blank_lines_after_local_imports = 0
ij_python_blank_lines_around_class = 1
ij_python_blank_lines_around_method = 1
ij_python_blank_lines_around_top_level_classes_functions = 2
ij_python_blank_lines_before_first_method = 0
ij_python_call_parameters_new_line_after_left_paren = false
ij_python_call_parameters_right_paren_on_new_line = false
ij_python_call_parameters_wrap = on_every_item
ij_python_dict_alignment = 0
ij_python_dict_new_line_after_left_brace = false
ij_python_dict_new_line_before_right_brace = true
ij_python_dict_wrapping = 5
ij_python_from_import_new_line_after_left_parenthesis = false
ij_python_from_import_new_line_before_right_parenthesis = false
ij_python_from_import_parentheses_force_if_multiline = false
ij_python_from_import_trailing_comma_if_multiline = false
ij_python_from_import_wrapping = 1
ij_python_hang_closing_brackets = false
ij_python_keep_blank_lines_in_code = 1
ij_python_keep_blank_lines_in_declarations = 1
ij_python_keep_indents_on_empty_lines = false
ij_python_keep_line_breaks = true
ij_python_method_parameters_new_line_after_left_paren = false
ij_python_method_parameters_right_paren_on_new_line = false
ij_python_method_parameters_wrap = on_every_item
ij_python_new_line_after_colon = false
ij_python_new_line_after_colon_multi_clause = true
ij_python_optimize_imports_always_split_from_imports = false
ij_python_optimize_imports_case_insensitive_order = false
ij_python_optimize_imports_join_from_imports_with_same_source = true
ij_python_optimize_imports_sort_by_type_first = true
ij_python_optimize_imports_sort_imports = true
ij_python_optimize_imports_sort_names_in_from_imports = true
ij_python_space_after_comma = true
ij_python_space_after_number_sign = true
ij_python_space_after_py_colon = true
ij_python_space_before_backslash = true
ij_python_space_before_comma = false
ij_python_space_before_for_semicolon = false
ij_python_space_before_lbracket = false
ij_python_space_before_method_call_parentheses = false
ij_python_space_before_method_parentheses = false
ij_python_space_before_number_sign = true
ij_python_space_before_py_colon = false
ij_python_space_within_empty_method_call_parentheses = false
ij_python_space_within_empty_method_parentheses = false
ij_python_spaces_around_additive_operators = true
ij_python_spaces_around_assignment_operators = true
ij_python_spaces_around_bitwise_operators = true
ij_python_spaces_around_eq_in_keyword_argument = false
ij_python_spaces_around_eq_in_named_parameter = false
ij_python_spaces_around_equality_operators = true
ij_python_spaces_around_multiplicative_operators = true
ij_python_spaces_around_power_operator = true
ij_python_spaces_around_relational_operators = true
ij_python_spaces_around_shift_operators = true
ij_python_spaces_within_braces = false
ij_python_spaces_within_brackets = false
ij_python_spaces_within_method_call_parentheses = false
ij_python_spaces_within_method_parentheses = false
ij_python_use_continuation_indent_for_arguments = false
ij_python_use_continuation_indent_for_collection_and_comprehensions = false
ij_python_use_continuation_indent_for_parameters = true
ij_python_wrap_long_lines = false

58 changes: 57 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,52 @@ ARM64(AArch64) 架构: 可本地构建. 若欲使用 GitHub Actions 构建, 需

## 开发

### 环境准备
- python 3.9
- Windows 10/11
- macOS 10.15.7+

### 准备源码
- 方式1: 下载 [仓库源码](https://github.com/sqzw-x/mdcx/archive/refs/heads/master.zip)[Release源码](https://github.com/sqzw-x/mdcx/archive/refs/tags/daily_release.zip),下载后解压
- 方式2: git克隆项目
```bash
git clone https://github.com/sqzw-x/mdcx.git
```

### 运行
#### Windows

- cmd
```batch
cd /d D:\dev\mdcx
python -m venv venv
venv\Scripts\activate
pip install -r requirements.txt
set PYTHONPATH=.\src;%PYTHONPATH%
python main.py
```

- powershell
```powershell
cd D:\dev\mdcx
python -m venv venv
venv\Scripts\Activate.ps1
pip install -r requirements.txt
$env:PYTHONPATH = "./src;$env:PYTHONPATH"
python main.py
```

#### macOS

```bash
cd /path/to/mdcx
python -m venv venv
source venv/bin/activate
pip install -r requirements-mac.txt
export PYTHONPATH=./src:$PYTHONPATH
python main.py
```

### 如何添加新配置项

1.`config.ini.default` 中添加配置项及其默认值, 值类型可以是字符串, 整数, 浮点数
Expand All @@ -68,4 +114,14 @@ ARM64(AArch64) 架构: 可本地构建. 若欲使用 GitHub Actions 构建, 需
* `core` 包括核心功能实现, 其中 `scraper.py` 包括刮削过程的实现
* `signals.py` 包括 Qt 信号量, 这是 MC 解耦的关键, 它也负责日志打印
* `config``signal` 是预定义的单例, 可以在任何位置导入使用
* `views``controllers` 结构相对简单, 可参考上文说明
* `views``controllers` 结构相对简单, 可参考上文说明


## 授权许可
本插件项目在 GPLv3 许可授权下发行。此外,如果使用本项目表明还额外接受以下条款:

- 本项目仅供学习以及技术交流使用
- 请勿在公共社交平台上宣传此项目
- 使用本软件时请遵守当地法律法规
- 法律及使用后果由使用者自己承担
- 禁止将本软件用于任何的商业用途
67 changes: 40 additions & 27 deletions changelog.md
Original file line number Diff line number Diff line change
@@ -1,40 +1,53 @@
## 重要
## 新增

### [每日构建](https://github.com/sqzw-x/mdcx/releases/tag/daily_release)
* 点击左下角可直接查看 daily_release
* 添加网站 javday
* 更灵活的图片裁剪工具

在此版本后, mdcx 将**降低**版本号变化频率, 版本号基本只用来处理会破坏配置文件兼容性的变更.
一般的功能更新与 bug 修复均通过 Github actions 每日构建, 可在上述链接下载.
发布页将显示最后一次提交时间, 时区为 UTC+0, 对应北京时间 +8h 即可.
## 修复

得益于此, 任何代码提交均将在 24h 内被发布, 因此总是可以获取到最新版本.
代价是每日构建 **_不会在软件内提示更新_**, 需要手动前往上述页面查看.
* iqqtv, airav_cc
* 有道翻译
* Google Translate 混合标题和简介
* wiki 演员信息
* 日文演员名不进行繁简转换
* 其他错误修复

除此之外, 请注意此后 **任何 issue 报告均需要包含提交 hash**, 这基本上取代了原来版本号的功能, 文件名中将自动包含提交 hash
## 其他

## 新增
由于本人最近较为繁忙, issue 和 PR 可能无法及时回应.

* 单文件刮削自动选择网站 by @
* 可设置刮削完成后自动创建 kodi actor 目录及自动创建软链接

## 修复
此外重申: 原则上不考虑加入新功能, 因此添加新网站等 issue 将被直接关闭, 请谅解.

* madouqu year 获取
* iqqtv url
* 未知演员写入 nfo

<details>
<summary>Full Changelog</summary>

26af362 fix: write unknown actor to nfo (close #151)
a175c97 CI: fix daily release tag
bab46d7 CI: fix release.yml
96ee83b feat: 刮削完成后 自动创建actor目录 及 自动创建软链接 (close #142)
761db21 CI: daily release time
7ed3531 CI: daily release tag and log
7099844 feat: single file scraping without site selection
60122f1 CI: daily build
5b60511 chore
e4d7c7a fix: iqqtv default url (close #134)
e70294b fix(madouqu): year字段类型;处理失败时返回空值 (#129)
7cd1fbe fix: iqqtv ( #246), airav_cc (#251) (#264)
3950f99 fix: 有道翻译 (#261)
19ecef6 fix: wiki字段 (#260)
677884b fix: wiki fields (fix #255)
1cc1a88 fix: 图片裁剪同名时无法生成
928724b fix: close #237
9704c1d remove test
39c358a fix: google translate 混合多行文本
3c9638f fix: numpy 2.0 incompatibility(close #234)
1649b55 修复madouqu番号获取
cc3bf58 修复madouqu番号获取
7efda28 docs: 源码运行
b63509c fix: crawlers; logging; add referer header (#221)
daff178 fix: 番号后缀顺序允许设置分辨率 (close #204)
dff05d3 feat: 图片裁剪工具允许任意大小及位置 (close #203)
e89dc18 fix: 当演员名包含假名时不进行繁简转换; 更新 zhcdict.json (close #194)
58af476 CI: macos aarch64; allow workflow_disspatch (#199)
fb4262c Fix Issue 197 (#202)
e345697 chore: 完善番号官网映射 (#192)
8940684 feat: add website javday (#172)
f49516a fix: dont remove slash (close #165)
28432b1 CI: only delete before build
57ce07f CI: delete old daily build
ff818b9 fix: UI not set from config (#164)
5c9fcc9 fix: airavcc cover url relative path (close #157)
b39b85f CI: commit sha

</details>
1 change: 1 addition & 0 deletions changelog.sh
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ commitlog=$(git log --pretty=format:"%h %s" $last..HEAD)

echo "## 新增
*
## 修复
*
Expand Down
4 changes: 2 additions & 2 deletions config.ini.default
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[modified_time]
modified_time = 2024-03-21 00:21:00
version = 120240321
modified_time = 2024-09-24 23:18:45
version = 120240924

[media]
media_path =
Expand Down
1 change: 1 addition & 0 deletions requirements-mac.txt
Original file line number Diff line number Diff line change
Expand Up @@ -14,5 +14,6 @@ opencv-contrib-python-headless==4.7.0.68
deepl-translate==1.2.0
ping3==4.0.4
oshash==0.1.1
numpy==1.26.4
curl-cffi==0.6.0b9
AppKit
1 change: 1 addition & 0 deletions requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -13,4 +13,5 @@ opencv-contrib-python-headless==4.7.0.68
deepl-translate==1.2.0
ping3==4.0.4
oshash==0.1.1
numpy==1.26.4
curl-cffi==0.6.0b9
10 changes: 5 additions & 5 deletions resources/c_number/__get_c_number.py
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,7 @@ def get_c_number():
)

while i:
url = ('https://www.sehuatang.org/forum-103-%s.html' % i)
url = (f'https://www.sehuatang.org/forum-103-{i}.html')
# 获取当前页面信息
try:
res = requests.get(url, headers=headers)
Expand All @@ -119,9 +119,9 @@ def get_c_number():
html = etree.HTML(res.text.replace('encoding="utf-8"', ''))
if i == 1:
page_total = html.xpath('//a[@class="last"]/text()')[0][-3:]
print('当前共 %s 页数据!' % page_total)
print('当前共 {} 页数据!'.format(page_total))
print('\n' + '**' * 20)
print('开始下载第 %s 页数据...\n页面地址:%s' % (i, url))
print(f'开始下载第 {i} 页数据...\n页面地址:{url}')
# 获取当前页面帖子列表
try:
post_info = html.xpath('//tbody[contains(@id, "normal")]/tr/th/a[2]')
Expand All @@ -131,7 +131,7 @@ def get_c_number():
save_log(error_info)
else:
post_number = len(post_info)
print('帖子数量:%s' % post_number)
print(f'帖子数量:{post_number}')
j = 0
for each in post_info:
j += 1
Expand Down Expand Up @@ -183,7 +183,7 @@ def get_c_number():
print(j)
print(post_title)
print(number + ' : ' + title)
print('\n当前第 %s 页数据...\n页面地址:%s' % (i, url))
print(f'\n当前第 {i} 页数据...\n页面地址:{url}')
print('**' * 20)
with open(json_filename, 'w', encoding='utf-8') as f:
json.dump(
Expand Down
Loading

0 comments on commit 305b5c0

Please sign in to comment.