更换为python

This commit is contained in:
limil 2025-05-08 22:51:57 +08:00
parent f494e63831
commit c7792745bf
8 changed files with 134 additions and 222 deletions

135
.gitignore vendored
View File

@ -1,135 +0,0 @@
## Ignore Visual Studio temporary files, build results, and
## files generated by popular Visual Studio add-ons.
# User-specific files
*.suo
*.user
*.sln.docstates
# Build results
[Dd]ebug/
[Rr]elease/
x64/
[Bb]in/
[Oo]bj/
# MSTest test Results
[Tt]est[Rr]esult*/
[Bb]uild[Ll]og.*
*_i.c
*_p.c
*_i.h
*.ilk
*.meta
*.obj
*.pch
*.pdb
*.pgc
*.pgd
*.rsp
*.sbr
*.tlb
*.tli
*.tlh
*.tmp
*.tmp_proj
*.log
*.vspscc
*.vssscc
.builds
*.pidb
*.log
*.svclog
*.scc
# Visual C++ cache files
ipch/
*.aps
*.ncb
*.opensdf
*.sdf
*.cachefile
# Visual Studio profiler
*.psess
*.vsp
*.vspx
# Guidance Automation Toolkit
*.gpState
# ReSharper is a .NET coding add-in
_ReSharper*/
*.[Rr]e[Ss]harper
*.DotSettings.user
# Click-Once directory
publish/
# Publish Web Output
*.Publish.xml
*.pubxml
*.azurePubxml
# NuGet Packages Directory
## TODO: If you have NuGet Package Restore enabled, uncomment the next line
packages/
## TODO: If the tool you use requires repositories.config, also uncomment the next line
!packages/repositories.config
# Windows Azure Build Output
csx/
*.build.csdef
# Windows Store app package directory
AppPackages/
# Others
sql/
*.Cache
ClientBin/
[Ss]tyle[Cc]op.*
![Ss]tyle[Cc]op.targets
~$*
*~
*.dbmdl
*.[Pp]ublish.xml
*.publishsettings
# RIA/Silverlight projects
Generated_Code/
# Backup & report files from converting an old project file to a newer
# Visual Studio version. Backup files are not needed, because we have git ;-)
_UpgradeReport_Files/
Backup*/
UpgradeLog*.XML
UpgradeLog*.htm
# SQL Server files
App_Data/*.mdf
App_Data/*.ldf
# =========================
# Windows detritus
# =========================
# Windows image file caches
Thumbs.db
ehthumbs.db
# Folder config file
Desktop.ini
# Recycle Bin used on file shares
$RECYCLE.BIN/
# Mac desktop service store files
.DS_Store
_NCrunch*
.idea

View File

@ -1,16 +0,0 @@

Microsoft Visual Studio Solution File, Format Version 12.00
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "BangumiRenamer", "BangumiRenamer\BangumiRenamer.csproj", "{46889D6D-165B-4984-A4A6-D2589EE3BE27}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Release|Any CPU = Release|Any CPU
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{46889D6D-165B-4984-A4A6-D2589EE3BE27}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{46889D6D-165B-4984-A4A6-D2589EE3BE27}.Debug|Any CPU.Build.0 = Debug|Any CPU
{46889D6D-165B-4984-A4A6-D2589EE3BE27}.Release|Any CPU.ActiveCfg = Release|Any CPU
{46889D6D-165B-4984-A4A6-D2589EE3BE27}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
EndGlobal

View File

@ -1,14 +0,0 @@
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFramework>net8.0</TargetFramework>
<ImplicitUsings>enable</ImplicitUsings>
<Nullable>enable</Nullable>
</PropertyGroup>
<ItemGroup>
<PackageReference Include="RestSharp" Version="112.1.0" />
</ItemGroup>
</Project>

View File

@ -1,31 +0,0 @@
using System.Text;
using System.Text.Json;
// var basePath = "\\\\192.168.31.10\\media\\downloads\\aria2\\";
//
//
//
//
//
// var files = Directory.GetFiles(basePath, "*.*", SearchOption.AllDirectories);
//
// files = files.Select(file => file.Replace(basePath, "").Replace("\\", "/")).ToArray();
//
// StringBuilder result = new StringBuilder();
//
// foreach (var file in files)
// {
// result.AppendLine(file);
// }
//
// File.WriteAllText("files.txt", result.ToString());
//
//
var filePath = "Lie.To.Me.S02.1080p.WEBRip.x265-RARBG/Lie.To.Me.S02E20.1080p.WEBRip.x265-RARBG.mp4";
var dirPart = Path.GetDirectoryName(filePath);
var namePart = Path.GetFileNameWithoutExtension(filePath);
var extension = Path.GetExtension(filePath);
Console.Write(namePart);

View File

@ -1,26 +0,0 @@
using System.Net;
using RestSharp;
namespace BangumiRenamer;
public class TMDbHelper
{
private const string URL = "https://api.themoviedb.org/3/authentication";
private const string APIKEY = "eyJhbGciOiJIUzI1NiJ9.eyJhdWQiOiI5OTExMDdhZjI1OTEzNTYyY2ZhMDY2MjJhNTI4NzNlMSIsIm5iZiI6MTcyMjY1MzY4My4xNjUsInN1YiI6IjY2YWQ5YmYzNTYzOGJjYmZmMWMwNWUzNiIsInNjb3BlcyI6WyJhcGlfcmVhZCJdLCJ2ZXJzaW9uIjoxfQ.BWFxLMJoAPl3wXNi_Gszx97WIPhbca3K33ASwjx_EPk";
public async Task SendRequest()
{
var options = new RestClientOptions(URL)
{
Proxy = new WebProxy("http://127.0.0.1:7897")
};
var client = new RestClient(options);
var request = new RestRequest("");
request.AddHeader("accept", "application/json");
request.AddHeader("Authorization",$"Bearer {APIKEY}");
var response = await client.GetAsync(request);
Console.WriteLine("{0}", response.Content);
}
}

98
Prompt.txt Normal file
View File

@ -0,0 +1,98 @@
你的任务是我提供一个文件的路径给你你从其中提取信息填充到以下的json结构中告诉我。只需要告诉我一个json结构即可不要说其它的。
我会告诉你json的结构及各字段的含义和要求以及一些示例以帮助你理解。
json结构如下
```json
{
    path: "",
    name: "",
    session: "",
    episode: "",
    group: "",
    type: ""
}
```
其中各字段含义为:
+ path直接填入我提供的原始文件路径即可
+ name这个文件对应的剧集名。请进行一定程度的格式化即如果其中单词使用的是其他符号进行分割替换成空格
+ session这个文件对应的季度如果文件路径不包含这个信息留空即可
+ episode这个文件对应哪一集如果文件路径不包含这个信息留空即可
+ group这个文件可能是那个发布组发布的如果文件路径不包含这个信息留空即可
+ type: 文件可能是正片的视频文件,也可能是字幕文件。如果是视频文件就填`episode`,字幕文件填`subtitle`,其余填`others`。如果文件路径中包含"CD""SP""Scan"等字样表明它不属于正片的文件,请将类型统一设置为`others`
下面是一些示例:
示例1
输入:`[VCB-Studio] Shoujo Kageki Revue Starlight/[VCB-Studio] Shoujo Conte All Starlight [Ma10p_1080p]/[VCB-Studio] Shoujo Conte All Starlight [19][Ma10p_1080p][x265_flac].mkv`
输出:
```json
{
    path: "[VCB-Studio] Shoujo Kageki Revue Starlight/[VCB-Studio] Shoujo Conte All Starlight [Ma10p_1080p]/[VCB-Studio] Shoujo Conte All Starlight [19][Ma10p_1080p][x265_flac].mkv",
    name: "Shoujo Conte All Starlight",
    session: "",
    episode: "19",
    group: "VCB-Studio",
    type: "episode"
}
```
示例2
输入:`[VCB-Studio] Shoujo Kageki Revue Starlight/[DMG&MH&VCB-Studio] Shoujo Kageki Revue Starlight [Ma10p_1080p]/[DMG&MH&VCB-Studio] Shoujo Kageki Revue Starlight [03][Ma10p_1080p][x265_flac].tc.ass`
输出:
```json
{
    path: "[VCB-Studio] Shoujo Kageki Revue Starlight/[DMG&MH&VCB-Studio] Shoujo Kageki Revue Starlight [Ma10p_1080p]/[DMG&MH&VCB-Studio] Shoujo Kageki Revue Starlight [03][Ma10p_1080p][x265_flac].tc.ass",
    name: "Shoujo Kageki Revue Starlight",
    session: "",
    episode: "03",
    group: "VCB-Studio",
    type: "subtitle"
}
```
示例3
输入:`[Nekomoe kissaten&VCB-Studio] BanG Dream! Its MyGO!!!!! [Ma10p_1080p]/Scans/Official Guidebook 「FOOTPRINTS」/021.jpeg`
输出:
```json
{
    path: "[Nekomoe kissaten&VCB-Studio] BanG Dream! Its MyGO!!!!! [Ma10p_1080p]/Scans/Official Guidebook 「FOOTPRINTS」/021.jpeg",
    name: "BanG Dream! Its MyGO!!!!!",
    session: "",
    episode: "",
    group: "Nekomoe kissaten&VCB-Studio",
    type: "others"
}
```
示例4
输入:`Lie.To.Me.S01.1080p.BluRay.x265-RARBG/Lie.To.Me.S01E01.1080p.BluRay.x265-RARBG.mp4`
输出:
```json
{
    path: "Lie.To.Me.S01.1080p.BluRay.x265-RARBG/Lie.To.Me.S01E01.1080p.BluRay.x265-RARBG.mp4",
    name: "Lie To Me",
    session: "S01",
    episode: "E01",
    group: "RARBG",
    type: "episode"
}
```
示例5
输入:`[Nekomoe kissaten&VCB-Studio] BanG Dream! Its MyGO!!!!! [Ma10p_1080p]\SPs\[Nekomoe kissaten&VCB-Studio] BanG Dream! Its MyGO!!!!! [NCED][Ma10p_1080p][x265_flac].mkv`
输出:
```json
{
    path: "[Nekomoe kissaten&VCB-Studio] BanG Dream! Its MyGO!!!!! [Ma10p_1080p]\SPs\[Nekomoe kissaten&VCB-Studio] BanG Dream! Its MyGO!!!!! [NCED][Ma10p_1080p][x265_flac].mkv",
    name: "BanG Dream! Its MyGO!!!!!",
    session: "",
    episode: "",
    group: "Nekomoe kissaten&VCB-Studio",
    type: "others"
}
```
不需要分析路径里面的信息的含义,只要按照要求确认好哪部分应该是标题,那部分应该是集数,季数等信息即可。
清楚了会回答我明白了,然后我们开始。

16
ds.py Normal file
View File

@ -0,0 +1,16 @@
# Please install OpenAI SDK first: `pip3 install openai`
from openai import OpenAI
client = OpenAI(api_key="sk-9cfe4cd39c824a108c5904db8e38a783", base_url="https://api.deepseek.com")
response = client.chat.completions.create(
model="deepseek-chat",
messages=[
{"role": "system", "content": "You are a helpful assistant"},
{"role": "user", "content": "Hello"},
],
stream=False
)
print(response.choices[0].message.content)

20
main.py Normal file
View File

@ -0,0 +1,20 @@
import ollama
if __name__ == "__main__":
pass
# 读取整个文件内容
content = file.read()
# 打印文件内容
print(content)
# 关闭文件 (非常重要!)
file.close()
response = ollama.generate(
model="gemma3:12b-it-q8_0",
prompt="我上一个问题是什么"
)
print(response["response"])