Comments (8)
I think you are using the wrong File class.
You need to use System.IO.File.OpenRead (see documentation) and not Microsoft.AspNetCore.Http.IFormFile.OpenReadStream (see documentation).
Let me know if that works.
from subtitlesparser.
i already used System.IO.File.OpenRead but i got another error in that line
"var items = parser.ParseStream(fileStream);" About (ParseStream)
from subtitlesparser.
Could you copy and paste the code you are using to parse subtitle files and the complete error message that you get?
from subtitlesparser.
from subtitlesparser.
Here's a full working csx example:
#!/usr/bin/env dotnet-script
#r "nuget: SubtitlesParser, 1.4.8"
#load "serilog.csx"
using Serilog;
using SubtitlesParser.Classes.Parsers;
var parser = new VttParser();
using (var fileStream = File.OpenRead("captions.vtt")){
var items = parser.ParseStream(fileStream, Encoding.UTF8);
Log.Verbose("{@items}", items);
}
from subtitlesparser.
@mondherroo : your compiling error is due to the fact that you are not specifying an encoding when using the SrtParser.
The generic Parser (SubParser) has a method ParseStream which defaults the encoding to UTF-8 but not the specific parsers.
from subtitlesparser.
@gldraphael Could you provide the subtitles file as well (captions.vtt)?
from subtitlesparser.
Here's the file as a text document: captions.vtt.txt
Also, it'd be nice if the VttParser
could default to a UTF8 encoding, since UTF8 would be in conformance to the WebVTT spec. Link
from subtitlesparser.
Related Issues (20)
- Test could not pass
- Why are you targeting "netcoreapp2.1" instead of "netstandard2.0"? HOT 2
- Please remove all Console.WriteLine calls in the parsers HOT 1
- Tests fail on master HOT 2
- Parsing as srt returned no srt part HOT 2
- How can I get seconds instead of milliseconds? HOT 1
- Location data is lost in the WebVTT file HOT 1
- How to convert SRT to VTT or vice versa? HOT 1
- MicroDvd recognized as SRT HOT 6
- WebVTT timestamps after 24 hours will parse as -1 HOT 3
- Updated NuGet HOT 2
- The decimal numbers of `StartTime` and `EndTime` of `SrtWriter` should be 3 instead of 2. HOT 1
- Parsing CSV type data with Split() has problems when 'Text' might contain commas HOT 2
- MIght want a way for SubParser to report which subtitle type it found HOT 3
- Stream is not in a valid Youtube XML format HOT 1
- Nuget Upgrade from 1.4.8 to 1.5.1 Failed
- The TextWriter writer should not be closed in the WriteStream method HOT 1
- Support for WebVTT writing HOT 1
- Support .NET Core HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from subtitlesparser.