GithubHelp home page GithubHelp logo

Comments (7)

glut23 avatar glut23 commented on August 29, 2024

Hi @coryl I converted the caption and resulted in the expected output:

WEBVTT

00:00:00.000 --> 00:00:05.000
The halo effect that I was going every metric possible seems like really ambitious.

Could you provide the captions file? Also some details like Python version and operating system that helps troubleshoot the issue? I assume you used the latest version of webvtt-py 0.4.2?

Thanks.

from webvtt-py.

coryl avatar coryl commented on August 29, 2024

Python 3.7.2
Webvtt-py 0.4.2
MacOS 10.14

My SRT is initially in a database, so write to a tempfile:

 temp = tempfile.NamedTemporaryFile(suffix=".srt", mode='w+t')
            try:  
                temp.writelines(job.srt)
                temp.seek(0)

                print(temp.read())

            finally:  
                webvtt_from_srt = webvtt.from_srt(temp.name)
                webvtt_from_srt.save()
                print(webvtt_from_srt)

Console output:

1
0:00:00,000 --> 0:00:05,000
The halo effect that I was going every metric possible seems like really ambitious. 

2
0:00:05,000 --> 0:00:09,300
Like there's a lot of things that people people like me, except that like, 

3
0:00:09,300 --> 0:00:11,800
I love my electric car, but I I know it's not going to put 

## [... lots more lines, but SRT temp file printout looks valid] ##

00:00:00.000 00:00:05.000 The halo effect that I was going every metric possible seems like really ambitious. 
00:00:05.000 00:00:09.300 Like there's a lot of things that people people like me, except that like, 
00:00:09.300 00:00:11.800 I love my electric car, but I I know it's not going to put 
  • I also tested it directly on an SRT file, with the same result, missing arrows.
    Thanks

from webvtt-py.

glut23 avatar glut23 commented on August 29, 2024

Hi @coryl apologies for the late reply. As I see in your code you are printing the webvtt_from_srt object that what it does is printing all the captions for the user to see the content. This is not including the -->

Saving the files should have worked as expected producing valid WebVTT captions. Check the saved files and let me know.

Thanks.

from webvtt-py.

coryl avatar coryl commented on August 29, 2024

Hey @glut23 yes you are correct. Saving to a file produces the proper outcome.

Any chance the stored string value will be correctly parsed in future updates? Would save me from juggling and closing temp files as I write directly to a database. Thanks

from webvtt-py.

glut23 avatar glut23 commented on August 29, 2024

Hi @coryl for sure, I will add options in the next release for your use case so you don't need to use files. I am keeping this issue open till I get it implemented. Thanks.

from webvtt-py.

glut23 avatar glut23 commented on August 29, 2024

Hi @coryl the recently released version 0.4.3 includes a way to read captions from a buffer:

https://webvtt-py.readthedocs.io/en/latest/usage.html#reading-webvtt-caption-files-from-file-like-object

Does this solve your use case?

Thanks!

from webvtt-py.

glut23 avatar glut23 commented on August 29, 2024

Hi @coryl you can get the full WebVTT content with the property content. I am closing this issue now. Thanks!

from webvtt-py.

Related Issues (20)

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.