Gifcurry 2.0.0.0 → 2.0.0.1
raw patch · 5 files changed
+38/−34 lines, 5 filesdep ~basedep ~process
Dependency ranges changed: base, process
Files
- Gifcurry.cabal +4/−4
- Gifcurry.hs +9/−9
- README.md +6/−2
- cli_src/Main.hs +4/−4
- gui_src/Main.hs +15/−15
Gifcurry.cabal view
@@ -1,5 +1,5 @@ name: Gifcurry-version: 2.0.0.0+version: 2.0.0.1 synopsis: Create animated GIFs, overlaid with optional text, from video files. description: GIF creation utility. homepage: https://github.com/lettier/gifcurry@@ -21,12 +21,12 @@ library exposed-modules: Gifcurry- build-depends: base >=4.7 && <4.9, process >=1.2 && <1.3, temporary >=1.2 && <1.3, directory ==1.2.*+ build-depends: base >=4.7 && <=4.9.0.0, process >=1.2 && <=1.4.2.0, temporary >=1.2 && <1.3, directory ==1.2.* default-language: Haskell2010 executable gifcurry_gui main-is: Main.hs- build-depends: base >=4.7 && <4.9, gtk3 >=0.14 && <0.15, process >=1.2 && <1.3, temporary >=1.2 && <1.3, directory ==1.2.*+ build-depends: base >=4.7 && <=4.9.0.0, gtk3 >=0.14 && <0.15, process >=1.2 && <=1.4.2.0, temporary >=1.2 && <1.3, directory ==1.2.* other-modules: Paths_Gifcurry, Gifcurry ghc-options: -O3 -threaded -with-rtsopts=-N hs-source-dirs: gui_src, ./@@ -34,7 +34,7 @@ executable gifcurry_cli main-is: Main.hs- build-depends: base >=4.7 && <4.9, process >=1.2 && <1.3, temporary >=1.2 && <1.3, directory == 1.2.*, cmdargs ==0.10.*+ build-depends: base >=4.7 && <=4.9.0.0, process >=1.2 && <=1.4.2.0, temporary >=1.2 && <1.3, directory == 1.2.*, cmdargs ==0.10.* other-modules: Gifcurry hs-source-dirs: cli_src, ./ default-language: Haskell2010
Gifcurry.hs view
@@ -21,14 +21,14 @@ -- | The data type record required by 'gif'. data GifParams = GifParams {- inputFile :: [Char]- , outputFile :: [Char]+ inputFile :: String+ , outputFile :: String , startTime :: Float , durationTime :: Float , widthSize :: Int , qualityPercent :: Float- , topText :: [Char]- , bottomText :: [Char]+ , topText :: String+ , bottomText :: String } deriving (Show, Read) -- | Specifies default parameters for 'startTime', 'durationTime', 'widthSize', and 'qualityPercent'.@@ -107,7 +107,7 @@ unless valid $ putStrLn "\n[Error] Invalid params." return valid -printGifParams :: GifParams -> [Char] -> IO ()+printGifParams :: GifParams -> String -> IO () printGifParams GifParams { inputFile = ipf@@ -131,7 +131,7 @@ , "\nWriting temporary frames to... " ++ tmpdir ] -tryFfmpeg :: GifParams -> [Char] -> IO (Either IOError String)+tryFfmpeg :: GifParams -> String -> IO (Either IOError String) tryFfmpeg GifParams { inputFile = ipf@@ -166,7 +166,7 @@ dts = printf "%.3f" dt wss = show ws -tryConvert :: GifParams -> [Char] -> IO (Either IOError String)+tryConvert :: GifParams -> String -> IO (Either IOError String) tryConvert GifParams { outputFile = opf@@ -210,7 +210,7 @@ | otherwise = truncate (qpc / 100.0 * 256.0) where qpc = qualityPercentClamp qp -annotate :: Int -> [Char] -> [Char] -> [[Char]]+annotate :: Int -> String -> String -> [String] annotate widthSize text topBottom = [ "-gravity" , topBottom@@ -235,7 +235,7 @@ ] where ps = show $ pointSize widthSize text -pointSize :: Int -> [Char] -> Int+pointSize :: Int -> String -> Int pointsize _ "" = 0 pointSize widthSize text | widthSize <= 0 = 0
README.md view
@@ -53,11 +53,13 @@ ## Dependencies * [Haskell](https://www.haskell.org/platform/)+ * [alex](https://hackage.haskell.org/package/alex)+ * [happy](https://hackage.haskell.org/package/happy)+ * [gtk2hs-buildtools](https://hackage.haskell.org/package/gtk2hs-buildtools)+ * [cmdargs](https://hackage.haskell.org/package/cmdargs) * [System.IO.Temp (temporary)](https://hackage.haskell.org/package/temporary) * [Graphics.UI.Gtk (gtk)](https://hackage.haskell.org/package/gtk3) * [System.Directory (directory)](https://hackage.haskell.org/package/directory)- * [gtk2hs-buildtools](https://hackage.haskell.org/package/gtk2hs-buildtools)- * [cmdargs](https://hackage.haskell.org/package/cmdargs) * [FFmpeg](https://www.ffmpeg.org/download.html) * [ImageMagick](http://www.imagemagick.org/script/download.php) * [GTK+](http://www.gtk.org/download/index.php)@@ -151,6 +153,7 @@ # Install ffmpeg and imagemagick cabal update cabal configure+cabal install alex happy -j cabal install gtk2hs-buildtools -j cabal install gifcurry -j cd ~/.cabal/bin@@ -168,6 +171,7 @@ cabal sandbox init cabal update cabal configure+cabal install alex happy -j cabal install gtk2hs-buildtools -j cabal install -j ./.cabal-sandbox/bin/gifcurry_gui
cli_src/Main.hs view
@@ -14,14 +14,14 @@ import qualified Gifcurry (gif, GifParams(..), defaultGifParams, gifParamsValid) data CliArgs = CliArgs {- inputFile :: [Char]- , outputFile :: [Char]+ inputFile :: String+ , outputFile :: String , startTime :: Float , durationTime :: Float , widthSize :: Int , qualityPercent :: Float- , topText :: [Char]- , bottomText :: [Char]+ , topText :: String+ , bottomText :: String } deriving (Data, Typeable, Show, Eq) cliargs = CliArgs {
gui_src/Main.hs view
@@ -83,13 +83,13 @@ if paramsValid then do forkOS $ do- entrySetText statusEntry "One GIF coming up!"+ postGUIAsync $ entrySetText statusEntry "One GIF coming up!" success <- (ioSuccess . gif) params if not success- then entrySetText statusEntry "Did not work. Check your settings."+ then postGUIAsync $ entrySetText statusEntry "Did not work. Check your settings." else do forkOS $ openGifCommand outputFilePathName- entrySetText statusEntry "Ready."+ postGUIAsync $ entrySetText statusEntry "Ready." return () else entrySetText statusEntry "Settings are wrong." return ()@@ -130,7 +130,7 @@ builderAddFromFile builder gladeFile return builder -inputFileButtonGetText :: FileChooserButton -> IO [Char]+inputFileButtonGetText :: FileChooserButton -> IO String inputFileButtonGetText inputFileButton = do inputFileButtonText <- fileChooserGetFilename inputFileButton inputFilePathName <- case inputFileButtonText of@@ -146,7 +146,7 @@ Nothing -> return nothing Just x -> return x -assembleOutputFilePathName :: FileChooserButton -> Entry -> IO ([Char], [Char])+assembleOutputFilePathName :: FileChooserButton -> Entry -> IO (String, String) assembleOutputFilePathName outputFilePathButton outputFileNameEntry = do outputFilePathText <- fileChooserGetFilename outputFilePathButton outputFilePath <- case outputFilePathText of@@ -157,18 +157,18 @@ let outputFilePathName = outputFilePath ++ "/" ++ outputGifFileName return (outputGifFileName, outputFilePathName) -openGifCommand :: [Char] -> IO ()+openGifCommand :: String -> IO () openGifCommand outputFilePathName = do fileExists <- doesFileExist outputFilePathName when fileExists $ do spawnCommand $ command ++ outputFilePathName return ()- where command = if "linux" `isInfixOf` (fmap toLower System.Info.os) then "xdg-open " else "open "+ where command = if "linux" `isInfixOf` fmap toLower System.Info.os then "xdg-open " else "open " resetImage :: Image -> IO () resetImage image = imageSetFromIconName image "gtk-missing-image" IconSizeButton -makeGifPreview :: [Char] -> [Char] -> Float -> [Char] -> IO (Either IOError String)+makeGifPreview :: String -> String -> Float -> String -> IO (Either IOError String) makeGifPreview inputFile outputFile startTime bottomText = gif $ defaultGifParams { inputFile = inputFile , outputFile = outputFile@@ -198,9 +198,9 @@ let outputFilePathName = tmpdir ++ "/end.gif" success <- ioSuccess $ makeGifPreview inputFilePathName outputFilePathName startTime' " LAST FRAME " if success- then imageSetFromFile lastFrameImage outputFilePathName- else resetImage lastFrameImage- else resetImage lastFrameImage+ then postGUIAsync $ imageSetFromFile lastFrameImage outputFilePathName+ else postGUIAsync $ resetImage lastFrameImage+ else postGUIAsync $ resetImage lastFrameImage return () makeFirstFramePreview :: FileChooserButton -> Entry -> Entry -> Image -> Image -> IO ()@@ -209,12 +209,12 @@ withTempDirectory "." "previews" $ \tmpDir -> do inputFilePathName <- inputFileButtonGetText inputFileButton startTime <- entryGetFloat startTimeEntry (-1.0)- if (not $ null inputFilePathName) && (startTime >= 0.0) then do+ if not (null inputFilePathName) && (startTime >= 0.0) then do let outputFilePathName = tmpDir ++ "/start.gif" success <- ioSuccess $ makeGifPreview inputFilePathName outputFilePathName startTime " FIRST FRAME " if success- then imageSetFromFile firstFrameImage outputFilePathName- else resetImage firstFrameImage- else resetImage firstFrameImage+ then postGUIAsync $ imageSetFromFile firstFrameImage outputFilePathName+ else postGUIAsync $ resetImage firstFrameImage+ else postGUIAsync $ resetImage firstFrameImage makeLastFramePreview inputFileButton startTimeEntry durationTimeEntry lastFrameImage return ()