Unexpected output from srt.compose()
sinaahmadi opened this issue · 3 comments
Thanks for this nice package.
I came across an issue that I would like to report.
I parse my srt
file, work on the content and then append my target Subtitle
objects to a new list()
. As described in your API, I convert my new srt list
using srt.compose()
. However, the output of this function doesn't keep the order and, bizarrely, seems to be identical to the original srt object rather than that of the new list.
My script is quite long, but essentially, this is what happens:
subs = list(srt.parse(text))
new_subs = list()
for sub in subs:
sub.content = "I change the content"
new_subs.append(sub)
srt.compose(new_subs)
This said, srt.Subtitle.to_srt()
works perfectly fine.
Thanks.
Hi! Can you please provide a minimum reproducible example? I don't seen any problems doing that :-)
I'm sorry but unfortunately, it's hard to provide an MWE.
I checked my srt files which is a huge file containing content from merged srt files. Perhaps that's what poses the reported problem.
Anyway. I thought I should report it just in case there is something wrong with srt.compose()
.
Thanks.
This library is regularly tested with huge SRTs so I think it's unlikely that's the problem, but I'm curious. If you find out more feel free to let me know. If the order is changed, my best guess is that you're using a set or similar somewhere and things are getting mixed up. :-)