Giter Club home page Giter Club logo

danmu2ass's Issues

支持输出到 stdout

建议-o选项支持-参数,以-为参数时(danmu2ass -o - foo.xml)将生成的 ass 内容输出到标准输出。

弹幕中带有回车符时会生成错误的ass内容

环境说明

  • 所用版本:v0.2.1
  • 程序设置:默认的配置文件
  • xml文件:A-Soul录播站提供的2022.4.11 羊驼 测试直播.xml弹幕文件

问题描述

如果一条弹幕中间部分带有回车符,在转换成ass文件后,导致回车符后面的字符另起一行,从而导致这部分内容不会被当成字幕内容。

例如,原始的xml数据为:

<d p="1.085,1,25,5566168,1649656743447,0,xxxx,0" user="xxxx">呵
呵
比
你
们
更
喜
欢
晚
晚</d>

转换后对应的ass内容为:

Dialogue: 2,0:00:01.08,0:00:16.09,Float,,0,0,0,,{\move(1280, 224, -660, 224)\c&Hd8ee54&}呵
呵
比
你
们
更
喜
欢
晚
晚

这样的字幕内容会导致最终的渲染只有内容 ,而 呵比你们更喜欢晚晚 因为格式问题被当作错误数据而不被渲染。

解决方案

在ass格式中,如果要实现换行效果需要显式地使用\N来代替不可见的回车符(参见:aegisub手册)。

也就是说,如果要正确显示上面提到的内容,对应的ass内容应该为:

Dialogue: 2,0:00:01.08,0:00:16.09,Float,,0,0,0,,{\move(1280, 224, -660, 224)\c&Hd8ee54&}呵\N呵\N比\N你\N们\N更\N喜\N欢\N晚\N晚

所以在生成ass文件时需要进行一次字符替换,将\n替换为\N

输出文件名不生效

使用最新的 Windows release, 指定输出文件名无效,输出被存在当前工作目录。同时这也会导致因为某些默认名称含有非法字符而保存失败。例如

.\danmu2ass.exe -o "C:\Users\<Username>\AppData\Local\Temp\PotPlayer\945572024-1-30102.ass" "https://www.bilibili.com/video/BV1xD4y157D4?spm_id_from=..0.0"

中默认文件名包括 |.

遇到某种特殊弹幕后导致xml转ass不完全

正常的抓到的弹幕是这个形式:
<d p="2814.009,1,25,65532,1701171728450,0,22146432,0" user="潘柒颂PanChihSong">对三,要不起</d>

但是最近录到的弹幕里偶尔会出现这种弹幕,我怀疑是b站新出的弹幕复读功能:
<d p="2814.062,7,100,16777215,1701171730079,0,0,0" user="***">[1.0,0.0,"0.8-0.5",10.0,"对三,要不起",0.0,0.0,0.0,0.0,10000,0,true,"黑体",1]</d>

如果存在这种弹幕,他后面的所有弹幕都不能转化成ass文件,我尝试阅读了这个软件的源代码但是没读懂,所以请问这个问题该如何解决呢?

如果我通过加denylist的方式解决,我在denylist里加一个[能把这些弹幕排除掉吗?谢谢!

无法转换高级弹幕

输入的命令:
D:\Peter\Downloads\danmu2ass>danmu2ass.exe -a 0.78 -d 8 -w 1920 -h 1080 -p 1.0 --time-offset 1.3 "[整合全弹幕]【中字】Tiny Stars-涩谷香音&唐可可《LoveLive!Superstar!》.xml"
成功输出了.ass,但我的.xml有830KB输出的.ass却只有13KB
而且显示区域也不是满屏幕

输入的命令:
D:\Peter\Downloads\danmu2ass>danmu2ass.exe -a 0.78 -d 8 -w 1920 -h 1080 -p 1.0 --time-offset 1.3 --force "[整合全弹幕]【中字】Tiny Stars-涩谷香音&唐可可《LoveLive!Superstar!》.xml"
返回的结果:
2022-08-17T15:35:51.353Z INFO danmu2ass::cli > 转换 [整合全弹幕]【中字】Tiny Stars-涩谷香音&唐可可《LoveLive!Superstar!》.xml => [整合全弹幕]【中字】Tiny Stars-涩谷香音&唐可可《LoveLive!Superstar!》.ass
Error: p 属性解析错误
Caused by:
未知的弹幕类型:7

LICENSE 问题

请问,该仓库使用什么 LICENSE 授权?该 repo 中不存在 LICENSE 文件,源代码文件也没有 LICENSE header。

release 模式构建时测试失败

不加 --release 时测试通过。

$ cargo test --release
Compiling danmu2ass v0.2.2
Finished release [optimized] target(s) in 1.17s
Running unittests src/lib.rs (target/release/deps/danmu2ass-2c26aa49fb432fe9)

running 7 tests
test ass_writer::tests::test_escape_text ... ok
test ass_writer::tests::time_point_fmt ... ok
test input_type::tests::parse_bv ... ok
test xml_parser::tests::from_xml ... ok
test input_type::tests::parse_season_or_episode ... ok
test xml_parser::tests::parse_break_line ... FAILED
test xml_parser::tests::iterator ... FAILED

failures:

---- xml_parser::tests::parse_break_line stdout ----
thread 'xml_parser::tests::parse_break_line' panicked at 'assertion failed: `(left == right)`
left: `"呵\n呵\n比\n你\n们\n更\n喜\n欢\n晚\n晚"`,
right: `"0-呵\n呵\n比\n你\n们\n更\n喜\n欢\n晚\n晚"`', src/xml_parser.rs:357:9
note: run with `RUST_BACKTRACE=1` environment variable to display a backtrace

---- xml_parser::tests::iterator stdout ----
thread 'xml_parser::tests::iterator' panicked at 'assertion failed: `(left == right)`
left: `Danmu { timeline_s: 0.581, content: "快快快", type: Float, fontsize: 25, rgb: (227, 63, 255) }`,
right: `Danmu { timeline_s: 0.581, content: "0-快快快", type: Float, fontsize: 25, rgb: (227, 63, 255) }`', src/xml_parser.rs:325:9


failures:
xml_parser::tests::iterator
xml_parser::tests::parse_break_line

test result: FAILED. 5 passed; 2 failed; 0 ignored; 0 measured; 0 filtered out; finished in 0.00s

error: test failed, to rerun pass `--lib`

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.