diff --git a/Gui/GuiCore.hs b/Gui/GuiCore.hs index 2bdb3b6..fd5bd4a 100644 --- a/Gui/GuiCore.hs +++ b/Gui/GuiCore.hs @@ -12,6 +12,7 @@ import Control.Monad.Trans.Either (EitherT,left,right,runEitherT) import System.Directory (doesFileExist) import Control.Monad.Trans.Class(lift) import Data.List.Split(splitOn) +import Paths_MpvLangLearn(getDataFileName) -- import Graphics.UI.WXCore.WxcDefs -- import Graphics.UI.WXCore.Frame -- import Graphics.UI.WXCore.WxcClassesAL @@ -82,7 +83,8 @@ simple f w = logop <- panel p [] - bm <- bitmapCreateFromFile "logo.png" + logoFile <- getDataFileName "logo.png" + bm <- bitmapCreateFromFile $ logoFile bmsize <- get bm size logo <- panel logop [ on paint := onPaint bm] -- f <- fakeout p diff --git a/Makefile b/Makefile deleted file mode 100644 index f1f32a0..0000000 --- a/Makefile +++ /dev/null @@ -1,29 +0,0 @@ - -GUI_MAIN_FILE=GuiMain.hs -CL_MAIN_FILE=CommandLineMain.hs -CORE_HS_FILES=Core.hs Init.hs MpvStructs.hs SrtFile.hs Loops.hs MpvFFI.hs Util.hs EventLoop.hs MpvLoops.hs -GUI_HS_FILES=Gui/GuiCore.hs -CFLAGS=-lmpv -DEBUG=-g -GHC=ghc -default: MpvLL - -gui: MpvLLGui - -clean: - rm -f *.o MpvStructs.hs *.hi MpvLL - -tags: $(HS_FILES) MpvStructs.hsc - hasktags -L . - -foo.o: foo.c - gcc $(DEBUG) -fPIC -c foo.c - -MpvStructs.hs: MpvStructs.hsc - hsc2hs MpvStructs.hsc - -MpvLL: $(CORE_HS_FILES) tags foo.o $(CL_MAIN_FILE) - $(GHC) -fPIC --make $(DEBUG) -o MpvLL -lmpv $(CL_MAIN_FILE) foo.o - -MpvLLGui: $(CORE_HS_FILES) $(GUI_HS_FILES) tags foo.o $(GUI_MAIN_FILE) - $(GHC) -threaded -fPIC --make $(DEBUG) -o MpvLLGui -lmpv $(GUI_MAIN_FILE) foo.o diff --git a/CommandLineMain.hs b/MpvLL.hs similarity index 100% rename from CommandLineMain.hs rename to MpvLL.hs diff --git a/GuiMain.hs b/MpvLLGui.hs similarity index 100% rename from GuiMain.hs rename to MpvLLGui.hs diff --git a/MpvLangLearn.cabal b/MpvLangLearn.cabal index 5d47372..1f09ab6 100644 --- a/MpvLangLearn.cabal +++ b/MpvLangLearn.cabal @@ -10,13 +10,13 @@ name: MpvLangLearn -- PVP summary: +-+------- breaking API changes -- | | +----- non-breaking API additions -- | | | +--- code changes with no API change -version: 0.1.0.0 +version: 1.0.0.1 -- A short (one-line) description of the package. synopsis: Learn a foreign language using mpv and srt files -- A longer description of the package. --- description: +description: Uses subtitles to loop dialog of a video with and without displaying subtitles, to help learn a foreign language. The idea is to loop the video without subtitles, so the user can try and guess what the dialog means, and then repeat with subtitles to verify his/her answer. -- URL for the project homepage or repository. homepage: http://rareventure.com/MpvLangLearn @@ -48,10 +48,11 @@ extra-source-files: Changes -- Constraint on the version of Cabal needed to build this package. cabal-version: >=1.10 +data-files: logo.png -executable MpvLangLearn +executable MpvLL -- .hs or .lhs file containing the Main module. - main-is: Main.hs + main-is: MpvLL.hs -- Modules included in this executable, other than Main. -- other-modules: @@ -60,7 +61,16 @@ executable MpvLangLearn other-extensions: ForeignFunctionInterface -- Other library packages from which modules are imported. - build-depends: base >=4.9 && <4.10, mtl >=2.2 && <2.3, deepseq >=1.4 && <1.5, split >=0.2 && <0.3, text >=1.2 && <1.3, strict, either + build-depends: + base >=4.9 && <4.10, + mtl >=2.2 && <2.3, + deepseq >=1.4 && <1.5, + split >=0.2 && <0.3, + text >=1.2 && <1.3, + either >= 4.4.1 && < 4.5, + transformers >= 0.5.2 && < 0.6, + strict >= 0.3.2 && < 0.4, + directory >= 1.3.0 && < 1.4 -- Directories containing source files. -- hs-source-dirs: @@ -70,4 +80,44 @@ executable MpvLangLearn -- Base language which the package is written in. default-language: Haskell2010 + + extra-libraries: mpv + c-sources: foo.c + +executable MpvLLGui + -- .hs or .lhs file containing the Main module. + main-is: MpvLLGui.hs + + -- Modules included in this executable, other than Main. + -- other-modules: + + -- LANGUAGE extensions used by modules in this package. + other-extensions: ForeignFunctionInterface + + -- Other library packages from which modules are imported. + build-depends: + base >=4.9 && <4.10, + mtl >=2.2 && <2.3, + deepseq >=1.4 && <1.5, + split >=0.2 && <0.3, + text >=1.2 && <1.3, + either >= 4.4.1 && < 4.5, + transformers >= 0.5.2 && < 0.6, + strict >= 0.3.2 && < 0.4, + directory >= 1.3.0 && < 1.4, + wx >= 0.92.2 && < 0.93, + wxcore >= 0.92.2 && < 0.93 + + + -- Directories containing source files. + -- hs-source-dirs: + -- Extra tools (e.g. alex, hsc2hs, ...) needed to build the source. + build-tools: hsc2hs + + -- Base language which the package is written in. + default-language: Haskell2010 + + extra-libraries: mpv + c-sources: foo.c + diff --git a/doc/index.html b/doc/index.html index a340c0f..fb3b8bf 100644 --- a/doc/index.html +++ b/doc/index.html @@ -11,9 +11,10 @@
Below is an example of this for a user who knows English and is trying to learn Chinese.
Mpv Lang Learn is available for Linux and Windows. Executables are available here: foo.html -
Source is here: http://github.com/redfish64/MpvLangLearn/ -
In Linux, Compile with: "make" to build command line tool, and "make gui" to build gui +
Mpv Lang Learn is available for Linux and Windows. Windows Executables are available here: https://github.com/redfish64/MpvLangLearn/releases/latest +
Source is here: https://github.com/redfish64/MpvLangLearn/ +
In Linux, you need ghc, and the development library files for mpv. +See https://wiki.haskell.org/Cabal/How_to_install_a_Cabal_package for how to install.
Command line can be invoked as follows:
MpvLL <srt tracks...> -- <track number or none>[:<speed>[:<lead padding>:<trailing padding>]]] -- [mpv options] <video file>@@ -22,8 +23,9 @@
This would show the video "rtrl.avi" using subtitle tracks, "rtrl-ZN.srt" and "rtrl-EN.srt". First no subtitles would be shown (because "none" was specified), then a loop with subtitles from track 1, "rtrl-ZN.srt", and finally with subtitles from track 2, "rtrl-EN.srt"
It's very important that subtitle files loaded line up with each other and the dialog of the movie. If not, the loops will not occur at the right times.
+ You can use the 'x' and the 'z' keys within mpv to adjust the subtitle delay on the fly. Note that this will not align two different subtitle files,
so if you are trying to use a native and a foreign language subtitle file together, and they are not aligned, you will have to edit one or the other.
+There are several subtitle editor programs available on the web to do this. You can also use the included, srt_fixer.pl program to do this. However, the interface is rather cryptic.