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

compatibility error #18

Open
mondherroo opened this issue Apr 26, 2019 · 8 comments
Open

compatibility error #18

mondherroo opened this issue Apr 26, 2019 · 8 comments

Comments

@mondherroo
Copy link

hello sir,
i used this parser in asp net core 2.1 but it doesn't work, i got this error in that line
"using (var fileStream = File.OpenRead(pathToSrtFile))"
i got this error message(IformFile doesn't have definition for "OpenRead")
i replaced (OpenRead with OpenReadStream) but still don't work.
so do you have any suggestion sir?

@AlexPoint
Copy link
Owner

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.

@mondherroo
Copy link
Author

i already used System.IO.File.OpenRead but i got another error in that line
"var items = parser.ParseStream(fileStream);" About (ParseStream)

@AlexPoint
Copy link
Owner

Could you copy and paste the code you are using to parse subtitle files and the complete error message that you get?

@mondherroo
Copy link
Author

Sans titre

@gldraphael
Copy link
Contributor

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);
}

@AlexPoint
Copy link
Owner

@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.

@AlexPoint
Copy link
Owner

@gldraphael Could you provide the subtitles file as well (captions.vtt)?

@gldraphael
Copy link
Contributor

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

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

3 participants