Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

append new line to file does not work #40

Open
wanghaisheng opened this issue Mar 7, 2022 · 3 comments
Open

append new line to file does not work #40

wanghaisheng opened this issue Mar 7, 2022 · 3 comments

Comments

@wanghaisheng
Copy link

i got 1 line dialog as a style template,


from pyonfx import *

io = Ass("1.ass")
meta, styles, lines = io.get_data()

for line in lines:
    
    newline = line.copy()
#     newline.i = lines[0].i+1
    newline.text = 'wo shi ge da sha bi'
    io.write_line(newline)

io.save()

@wanghaisheng
Copy link
Author

io = Ass("1.ass")
meta, styles, lines = io.get_data()
lines.insert(1,lines[0].copy())
lines[1].text = "I am a new line!"
io.write_line(lines[1])
print(len(lines))
io.save()```
does not work too

@wanghaisheng
Copy link
Author

still no luck


from pyonfx import *

io = Ass("1.ass")
meta, styles, lines = io.get_data()
for line in lines:
    print(line.i)
# lines.insert(1,lines[0].copy())
newline=lines[0].copy()
newline.i=len(lines)+1
lines.insert(newline.i,newline)
newline.text = "I am a new line!"
print(newline.start_time,newline.end_time)
newline.start_time += 2000
newline.end_time += 2000
print(newline.start_time,newline.end_time)
io.write_line(newline)
print(len(lines))
io.save()
# io.open_aegisub()

@CoffeeStraw
Copy link
Owner

Hi, could you please provide me the subtitle file you used? Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants