禁漫天堂格式整理
This commit is contained in:
8
.idea/.gitignore
generated
vendored
Normal file
8
.idea/.gitignore
generated
vendored
Normal file
@@ -0,0 +1,8 @@
|
||||
# 默认忽略的文件
|
||||
/shelf/
|
||||
/workspace.xml
|
||||
# 基于编辑器的 HTTP 客户端请求
|
||||
/httpRequests/
|
||||
# Datasource local storage ignored files
|
||||
/dataSources/
|
||||
/dataSources.local.xml
|
||||
8
.idea/MoreSex.iml
generated
Normal file
8
.idea/MoreSex.iml
generated
Normal file
@@ -0,0 +1,8 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<module type="PYTHON_MODULE" version="4">
|
||||
<component name="NewModuleRootManager">
|
||||
<content url="file://$MODULE_DIR$" />
|
||||
<orderEntry type="jdk" jdkName="Poetry (MoreSex)" jdkType="Python SDK" />
|
||||
<orderEntry type="sourceFolder" forTests="false" />
|
||||
</component>
|
||||
</module>
|
||||
6
.idea/inspectionProfiles/Project_Default.xml
generated
Normal file
6
.idea/inspectionProfiles/Project_Default.xml
generated
Normal file
@@ -0,0 +1,6 @@
|
||||
<component name="InspectionProjectProfileManager">
|
||||
<profile version="1.0">
|
||||
<option name="myName" value="Project Default" />
|
||||
<inspection_tool class="MarkdownIncorrectTableFormatting" enabled="false" level="WEAK WARNING" enabled_by_default="false" />
|
||||
</profile>
|
||||
</component>
|
||||
6
.idea/inspectionProfiles/profiles_settings.xml
generated
Normal file
6
.idea/inspectionProfiles/profiles_settings.xml
generated
Normal file
@@ -0,0 +1,6 @@
|
||||
<component name="InspectionProjectProfileManager">
|
||||
<settings>
|
||||
<option name="USE_PROJECT_PROFILE" value="false" />
|
||||
<version value="1.0" />
|
||||
</settings>
|
||||
</component>
|
||||
6
.idea/misc.xml
generated
Normal file
6
.idea/misc.xml
generated
Normal file
@@ -0,0 +1,6 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project version="4">
|
||||
<component name="Black">
|
||||
<option name="sdkName" value="Poetry (MoreSex)" />
|
||||
</component>
|
||||
</project>
|
||||
8
.idea/modules.xml
generated
Normal file
8
.idea/modules.xml
generated
Normal file
@@ -0,0 +1,8 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project version="4">
|
||||
<component name="ProjectModuleManager">
|
||||
<modules>
|
||||
<module fileurl="file://$PROJECT_DIR$/.idea/MoreSex.iml" filepath="$PROJECT_DIR$/.idea/MoreSex.iml" />
|
||||
</modules>
|
||||
</component>
|
||||
</project>
|
||||
4
.idea/vcs.xml
generated
Normal file
4
.idea/vcs.xml
generated
Normal file
@@ -0,0 +1,4 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project version="4">
|
||||
<component name="VcsDirectoryMappings" defaultProject="true" />
|
||||
</project>
|
||||
2553
poetry.lock
generated
Normal file
2553
poetry.lock
generated
Normal file
File diff suppressed because it is too large
Load Diff
22
pyproject.toml
Normal file
22
pyproject.toml
Normal file
@@ -0,0 +1,22 @@
|
||||
[project]
|
||||
name = "moresex"
|
||||
version = "0.1.0"
|
||||
description = ""
|
||||
authors = [
|
||||
{name = "lanyuanxiaoyao",email = "lanyuanxiaoyao@gmail.com"}
|
||||
]
|
||||
readme = "README.md"
|
||||
requires-python = ">=3.13"
|
||||
dependencies = [
|
||||
"requests (>=2.32.3,<3.0.0)",
|
||||
"beautifulsoup4 (>=4.13.3,<5.0.0)",
|
||||
"lxml (>=5.3.0,<6.0.0)",
|
||||
"selenium (>=4.28.1,<5.0.0)",
|
||||
"requests (>=2.32.3,<3.0.0)",
|
||||
"jupyter (>=1.1.1,<2.0.0)"
|
||||
]
|
||||
|
||||
|
||||
[build-system]
|
||||
requires = ["poetry-core>=2.0.0,<3.0.0"]
|
||||
build-backend = "poetry.core.masonry.api"
|
||||
230
漫画/Tachiyomi.ipynb
Normal file
230
漫画/Tachiyomi.ipynb
Normal file
@@ -0,0 +1,230 @@
|
||||
{
|
||||
"cells": [
|
||||
{
|
||||
"cell_type": "code",
|
||||
"id": "initial_id",
|
||||
"metadata": {
|
||||
"collapsed": true,
|
||||
"ExecuteTime": {
|
||||
"end_time": "2025-02-07T09:41:38.049465Z",
|
||||
"start_time": "2025-02-07T09:41:38.045253Z"
|
||||
}
|
||||
},
|
||||
"source": "root_path = \"/Users/lanyuanxiaoyao/Documents/comic/待处理/调教开关\"",
|
||||
"outputs": [],
|
||||
"execution_count": 81
|
||||
},
|
||||
{
|
||||
"metadata": {
|
||||
"ExecuteTime": {
|
||||
"end_time": "2025-02-07T09:41:38.071893Z",
|
||||
"start_time": "2025-02-07T09:41:38.059949Z"
|
||||
}
|
||||
},
|
||||
"cell_type": "code",
|
||||
"source": [
|
||||
"import os\n",
|
||||
"\n",
|
||||
"# CBZ解压\n",
|
||||
"for path in list(\n",
|
||||
" filter(lambda x: x.endswith('.cbz'), map(lambda x: os.path.join(root_path, x), os.listdir(root_path)))\n",
|
||||
"):\n",
|
||||
" os.rename(path, path.replace('.cbz', '.zip'))\n",
|
||||
" # print(f'{root_path}/{os.path.basename(path).replace(\".cbz\", \"zip\")}')"
|
||||
],
|
||||
"id": "ff77e3324c9a90d6",
|
||||
"outputs": [],
|
||||
"execution_count": 82
|
||||
},
|
||||
{
|
||||
"metadata": {
|
||||
"ExecuteTime": {
|
||||
"end_time": "2025-02-07T09:41:40.793331Z",
|
||||
"start_time": "2025-02-07T09:41:38.088816Z"
|
||||
}
|
||||
},
|
||||
"cell_type": "code",
|
||||
"source": [
|
||||
"import zipfile\n",
|
||||
"\n",
|
||||
"# ZIP解压\n",
|
||||
"for path in list(\n",
|
||||
" filter(lambda x: x.endswith('.zip'), map(lambda x: os.path.join(root_path, x), os.listdir(root_path)))\n",
|
||||
"):\n",
|
||||
" folder_name = os.path.splitext(path)[0]\n",
|
||||
" os.makedirs(folder_name, exist_ok=True)\n",
|
||||
" with zipfile.ZipFile(path, 'r') as zip_ref:\n",
|
||||
" zip_ref.extractall(folder_name)"
|
||||
],
|
||||
"id": "bfd49eed033959fb",
|
||||
"outputs": [],
|
||||
"execution_count": 83
|
||||
},
|
||||
{
|
||||
"metadata": {
|
||||
"ExecuteTime": {
|
||||
"end_time": "2025-02-07T09:41:40.882038Z",
|
||||
"start_time": "2025-02-07T09:41:40.804754Z"
|
||||
}
|
||||
},
|
||||
"cell_type": "code",
|
||||
"source": [
|
||||
"# 删除ZIP\n",
|
||||
"for path in list(\n",
|
||||
" filter(lambda x: x.endswith('.zip'), map(lambda x: os.path.join(root_path, x), os.listdir(root_path)))\n",
|
||||
"):\n",
|
||||
" os.remove(path)"
|
||||
],
|
||||
"id": "64f9b9d169f9e416",
|
||||
"outputs": [],
|
||||
"execution_count": 84
|
||||
},
|
||||
{
|
||||
"metadata": {
|
||||
"ExecuteTime": {
|
||||
"end_time": "2025-02-07T09:41:40.912970Z",
|
||||
"start_time": "2025-02-07T09:41:40.891555Z"
|
||||
}
|
||||
},
|
||||
"cell_type": "code",
|
||||
"source": [
|
||||
"# 删除ComicInfo\n",
|
||||
"for root, dirs, files in os.walk(root_path):\n",
|
||||
" for file in files:\n",
|
||||
" if file.endswith('.xml'):\n",
|
||||
" os.remove(os.path.join(root, file))"
|
||||
],
|
||||
"id": "200531eb9a12439b",
|
||||
"outputs": [],
|
||||
"execution_count": 85
|
||||
},
|
||||
{
|
||||
"metadata": {
|
||||
"ExecuteTime": {
|
||||
"end_time": "2025-02-07T09:41:41.318381Z",
|
||||
"start_time": "2025-02-07T09:41:40.922687Z"
|
||||
}
|
||||
},
|
||||
"cell_type": "code",
|
||||
"source": [
|
||||
"# 按序重命名文件夹\n",
|
||||
"import re\n",
|
||||
"\n",
|
||||
"\n",
|
||||
"def natural_sort_key(s):\n",
|
||||
" \"\"\"\n",
|
||||
" 将字符串转换为自然排序的键。\n",
|
||||
" \"\"\"\n",
|
||||
" return [int(text) if text.isdigit() else text for text in re.split('([0-9]+)', s)]\n",
|
||||
"\n",
|
||||
"\n",
|
||||
"def mac_like_sorted(file_list, reverse=False):\n",
|
||||
" \"\"\"\n",
|
||||
" 按照类似 macOS Finder 的逻辑对文件列表进行排序。\n",
|
||||
" \"\"\"\n",
|
||||
" return sorted(file_list, key=lambda x: natural_sort_key(x), reverse=reverse)\n",
|
||||
"\n",
|
||||
"\n",
|
||||
"for index, path in enumerate(\n",
|
||||
" mac_like_sorted(\n",
|
||||
" filter(lambda x: os.path.isdir(x), map(lambda x: os.path.join(root_path, x), os.listdir(root_path)))\n",
|
||||
" )\n",
|
||||
"):\n",
|
||||
" for index2, path2 in enumerate(\n",
|
||||
" mac_like_sorted(\n",
|
||||
" filter(lambda x: os.path.isfile(x), map(lambda x: os.path.join(path, x), os.listdir(path)))\n",
|
||||
" )\n",
|
||||
" ):\n",
|
||||
" os.rename(path2, f'{os.path.dirname(path2)}/{str(index2 + 1).zfill(3)}{os.path.splitext(path2)[1]}')\n",
|
||||
" os.rename(path, f'{os.path.dirname(path)}/第{str(index + 1).zfill(2)}话')"
|
||||
],
|
||||
"id": "e5b7bced98c094f9",
|
||||
"outputs": [],
|
||||
"execution_count": 86
|
||||
},
|
||||
{
|
||||
"metadata": {
|
||||
"ExecuteTime": {
|
||||
"end_time": "2025-02-07T09:41:41.357835Z",
|
||||
"start_time": "2025-02-07T09:41:41.338196Z"
|
||||
}
|
||||
},
|
||||
"cell_type": "code",
|
||||
"source": [
|
||||
"import xml.etree.ElementTree as ET\n",
|
||||
"\n",
|
||||
"for index, path in enumerate(\n",
|
||||
" mac_like_sorted(\n",
|
||||
" filter(lambda x: os.path.isdir(x), map(lambda x: os.path.join(root_path, x), os.listdir(root_path)))\n",
|
||||
" )\n",
|
||||
"):\n",
|
||||
" root = ET.Element('ComicInfo')\n",
|
||||
" ET.SubElement(root, 'Title').text = os.path.basename(path)\n",
|
||||
" ET.SubElement(root, 'Series').text = '调教开关'\n",
|
||||
" ET.SubElement(root, 'Number').text = str(index + 1)\n",
|
||||
" ET.SubElement(\n",
|
||||
" root, 'Summary'\n",
|
||||
" ).text = '平时把我当奴隶使唤的学姐偶然被我抓到了把柄学姐~ 这次换我来调教你了!'\n",
|
||||
" ET.SubElement(root, 'Writer').text = 'KMH/外殼'\n",
|
||||
" ET.SubElement(root, 'Genre').text = '控制, 調教, 韩漫, 跳蛋'\n",
|
||||
" tree = ET.ElementTree(root)\n",
|
||||
" tree.write(f'{path}/ComicInfo.xml', encoding='utf-8', xml_declaration=True)"
|
||||
],
|
||||
"id": "17c6388c9a60cd94",
|
||||
"outputs": [],
|
||||
"execution_count": 87
|
||||
},
|
||||
{
|
||||
"metadata": {
|
||||
"ExecuteTime": {
|
||||
"end_time": "2025-02-07T10:18:39.559242Z",
|
||||
"start_time": "2025-02-07T10:18:30.819510Z"
|
||||
}
|
||||
},
|
||||
"cell_type": "code",
|
||||
"source": [
|
||||
"# 先运行上面的,然后压缩图片,在运行下面的\n",
|
||||
"import shutil\n",
|
||||
"\n",
|
||||
"for index, path in enumerate(\n",
|
||||
" mac_like_sorted(\n",
|
||||
" filter(lambda x: os.path.isdir(x), map(lambda x: os.path.join(root_path, x), os.listdir(root_path)))\n",
|
||||
" )\n",
|
||||
"):\n",
|
||||
" with zipfile.ZipFile(f'{path}.zip', 'w', zipfile.ZIP_DEFLATED, compresslevel=9) as zip_ref:\n",
|
||||
" for index2, path2 in enumerate(\n",
|
||||
" mac_like_sorted(\n",
|
||||
" filter(lambda x: os.path.isfile(x), map(lambda x: os.path.join(path, x), os.listdir(path)))\n",
|
||||
" )\n",
|
||||
" ):\n",
|
||||
" zip_ref.write(path2, arcname=os.path.relpath(path2, path))\n",
|
||||
" shutil.rmtree(path)\n",
|
||||
" os.rename(f'{path}.zip', f'{path}.cbz')"
|
||||
],
|
||||
"id": "fbc823de11a39ba2",
|
||||
"outputs": [],
|
||||
"execution_count": 88
|
||||
}
|
||||
],
|
||||
"metadata": {
|
||||
"kernelspec": {
|
||||
"display_name": "Python 3",
|
||||
"language": "python",
|
||||
"name": "python3"
|
||||
},
|
||||
"language_info": {
|
||||
"codemirror_mode": {
|
||||
"name": "ipython",
|
||||
"version": 2
|
||||
},
|
||||
"file_extension": ".py",
|
||||
"mimetype": "text/x-python",
|
||||
"name": "python",
|
||||
"nbconvert_exporter": "python",
|
||||
"pygments_lexer": "ipython2",
|
||||
"version": "2.7.6"
|
||||
}
|
||||
},
|
||||
"nbformat": 4,
|
||||
"nbformat_minor": 5
|
||||
}
|
||||
Reference in New Issue
Block a user