GithubHelp home page GithubHelp logo

xu-hardy / potplayer_translate_plug_in Goto Github PK

View Code? Open in Web Editor NEW
44.0 2.0 2.0 2.72 MB

PotPlayer 字幕在线翻译插件- 基于aws translate翻译的potplayer实时字幕

AngelScript 31.39% Python 22.75% Shell 0.19% JavaScript 21.96% HTML 8.37% CSS 15.34%
aws potplayer flask docker angelscript translate translation

potplayer_translate_plug_in's Introduction

potplayer_translate_plug_in

本文参考大佬的百度插件进行二次开发:https://github.com/fjqingyou/PotPlayer_Subtitle_Translate_Baidu

PotPlayer 字幕在线翻译插件- 基于aws transcribe翻译的potplayer实时字幕

安装说明

  1. 安装potplayer,官网是https://potplayer.daum.net/
  2. 下载项目脚本,git clone [email protected]:Xu-Hardy/potplayer_translate_plug_in.git
  3. 安装Python和依赖,这里推荐minicondapip清华源
pip config set global.index-url https://pypi.tuna.tsinghua.edu.cn/simple
  1. 运行翻译后端,进入translate_api目录,然后执行:
pip install -r requirements.txt
python translate.py

然后浏览器打开http://localhost:50000来查看服务是否正常运行

  1. 安装播放器脚本,把Extension目录下的1SubtitleTranslate - aws.asSubtitleTranslate - aws.ico放到C:\Program Files\DAUM\PotPlayer\Extension\Subtitle\Translate这个目录,如果你的默认路径不是这个,那么按照如图所示

这里打开文件夹可以看到你的potplayer插件目录,然后点击账户设置。

填写刚刚运行的python脚本的地址,http://yourip:50000/pt, apiley随意。

  1. 翻译效果

执行如下指令查看翻译是否可用:

curl --location 'http://localhost:50000/pt?msg=hello' \
--header 'Content-Type: application/json' \
--data '{
    "msg": "您好",
    "src": "zh",
    "dst": "en"
}'

声明:本程序不提供任何aws的凭证,也不会采集任何凭证,源码均已开放

基于aws翻译的potplayer实时字幕

具体部署步骤可以见部署文档

了解,我会为你提供一个中英对照的项目介绍说明。


Using the PopLayer Plugin with AWS Translation API - Project Introduction

使用 PopLayer 插件与 AWS 翻译 API - 项目介绍

This project integrates the dynamic functionalities of the PopLayer plugin with the robust AWS Translation API. By harnessing the capabilities of both, we aim to offer real-time translation features for applications and websites seamlessly.

此项目将 PopLayer 插件的动态功能与强大的 AWS 翻译 API 整合在一起。通过结合两者的功能,我们旨在为应用程序和网站无缝地提供实时翻译功能。

Features | 功能

  1. Real-time translation: Translate content instantaneously without the need to refresh or reload. 实时翻译:无需刷新或重新加载即可瞬间翻译内容。

  2. Pop-up interface: Leveraging the PopLayer plugin, translations are shown in a user-friendly pop-up interface. 弹出界面:利用 PopLayer 插件,翻译内容将在用户友好的弹出界面中显示。

  3. Support for multiple languages: With AWS Translation API, we offer translation for a wide range of languages. 支持多种语言:借助 AWS 翻译 API,我们提供多种语言的翻译。

Applications | 应用场景 Ideal for websites and applications with a diverse user base, aiming to provide multilingual support without compromising user experience. 适用于拥有多元用户群的网站和应用程序,目标是在不影响用户体验的情况下提供多语言支持。

Future Prospects | 未来展望 We aim to expand the range of supported languages and refine the integration for smoother user experiences. 我们计划扩展支持的语言范围,并优化集成以提供更流畅的用户体验。


希望这个中英对照的项目介绍可以满足您的需求!如果有其他需要,请告诉我。

语言支持

2022/11/22 支持英文翻译成中文 2023/10/30 支持输入api地址和apikey

最后:

欢迎大家提pull request。

https://github.com/mengze-han/potplayer_translate_plug_in

potplayer_translate_plug_in's People

Contributors

xu-hardy avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar

Forkers

janot

potplayer_translate_plug_in's Issues

大佬能根据彩云小译的api, 做个potplayer字幕翻译插件吗....

创建 bash 脚本,xiaoyi.sh:
#!/bin/bash
tee xiaoyi.sh << END
DIRECTION=$1
SOURCE=$2

if test -f $HOME/.xiaoyi ; then
. $HOME/.xiaoyi
fi

BODY='{"source": ["'$SOURCE'"], "trans_type": "'$DIRECTION'", "replaced": true, "media": "text", "request_id": "demo" }'

export PYTHONIOENCODING=utf8
curl -s -X POST [http://api.interpreter.caiyunai.com/v1/translator](http://api.interpreter.caiyunai.com/v1/translator%5C)
-H 'Content-Type: application/json'
-H "X-Authorization: token 填自己的token"
-d "$BODY" | python -c "import sys, json; print json.load(sys.stdin)['target'][0]"
END
输入您想要翻译的英文句子并运行以下指令:
sh xiaoyi.sh en2zh "The sentence you want to translate."

创建 python 脚本:
import requests
import json

url = "http://api.interpreter.caiyunai.com/v1/translator"

token = "填自己的token"

payload = {
"source" : ["Lingocloud is the best translation service.",
"ColorfulClouds Weather is the best weather service."],
"trans_type" : "en2zh",
"request_id" : "demo",
}

headers = {
'content-type': "application/json",
'x-authorization': "token " + token,
}

response = requests.request("POST", url, data=json.dumps(payload), headers=headers)

print(response.text)
print(json.loads(response.text)['target'][0])
print(json.loads(response.text)['target'][1])
输出:
{"confidence":0.8,"target":["\u5f69\u4e91\u5c0f\u8bd1\u662f\u6700\u597d\u7684\u7ffb\u8bd1\u670d\u52a1\u3002",
"\u5f69\u4e91\u5929\u6c14\u662f\u6700\u597d\u7684\u6c14\u8c61\u670d\u52a1\u3002"],"rc":0}

彩云小译是最好的翻译服务。
彩云天气是最好的气象服务。

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.