packages feed

Gifcurry 3.0.0.0 → 3.0.0.1

raw patch · 7 files changed

+141/−99 lines, 7 files

Files

CHANGELOG.md view
@@ -4,6 +4,28 @@  ------------------------------------------------------------------------------- +### 3.0.0.1++#### Added++- Added project website under docs++#### Changed++- Changed docs to haddock+- Increased base optimization with fuzz and map+- Increased default frame rate to 15+- Set tighter bounds on number of colors+- Set tighter bounds on quality percent clamp+- Query stream for duration and then container for duration+- Fixed empty file name issue++#### Removed++-++-------------------------------------------------------------------------------+ ### 3.0.0.0  #### Added
Gifcurry.cabal view
@@ -1,5 +1,5 @@ name:                 Gifcurry-version:              3.0.0.0+version:              3.0.0.1 synopsis:             GIF creation utility. description:          Your open source video to GIF maker. homepage:             https://github.com/lettier/gifcurry
README.md view
@@ -28,7 +28,7 @@ No need to download more RAM, Gifcurry is light as a feather. Run it all day, run it all year—you'll never notice. -I know what your thinkin', "Gifcurry is just FFMpeg and ImageMagick," but you'd be wrong.+I know what your're thinkin', "Gifcurry is just FFMpeg and ImageMagick," but you'd be wrong. Gifcurry hides all the goofy details so you can concentrate on what matters—the almighty GIF. Making GIFs with Gifcurry is fun so try it out! @@ -111,7 +111,7 @@          `'╙╙╙╙'``                                                               -Gifcurry 3.0.0.0+Gifcurry 3.0.0.1 (C) 2016 David Lettier lettier.com @@ -163,23 +163,23 @@ ### I use Linux.  If you use Linux then the easiest way to grab a copy of Gifcurry is by downloading the-[AppImage](https://github.com/lettier/gifcurry/releases/download/3.0.0.0/gifcurry-3.0.0.0-x86_64.AppImage).+[AppImage](https://github.com/lettier/gifcurry/releases/download/3.0.0.1/gifcurry-3.0.0.1-x86_64.AppImage). After you download the-[AppImage](https://github.com/lettier/gifcurry/releases/download/3.0.0.0/gifcurry-3.0.0.0-x86_64.AppImage),+[AppImage](https://github.com/lettier/gifcurry/releases/download/3.0.0.1/gifcurry-3.0.0.1-x86_64.AppImage), right click on it, select permissions, and check the box near execute. With that out of the way—you're all set—just double click on the AppImage and the GUI will fire right up.  You can also download and install the-[AppImage](https://github.com/lettier/gifcurry/releases/download/3.0.0.0/gifcurry-3.0.0.0-x86_64.AppImage)+[AppImage](https://github.com/lettier/gifcurry/releases/download/3.0.0.1/gifcurry-3.0.0.1-x86_64.AppImage) using the handy-[AppImage install script](https://raw.githubusercontent.com/lettier/gifcurry/master/distribution/linux/app-image/gifcurry-app-image-install.sh)+[AppImage install script](https://raw.githubusercontent.com/lettier/gifcurry/master/packaging/linux/app-image/gifcurry-app-image-install.sh) (right click and save link as). Download the script, right click on it, select permissions, check the box near execute, and double click on it. You should now see Gifcurry listed alongside your other installed programs.  If you want the CLI then download the-[prebuilt version](https://github.com/lettier/gifcurry/releases/download/3.0.0.0/gifcurry-linux-3.0.0.0.tar.gz)+[prebuilt version](https://github.com/lettier/gifcurry/releases/download/3.0.0.1/gifcurry-linux-3.0.0.1.tar.gz) for Linux, extract it, open up your terminal, `cd` to the bin folder, and then run `gifcurry_cli -?`. As an added bonus, inside the bin directory is the GUI version@@ -228,7 +228,7 @@ [Gifcurry snap](https://snapcraft.io/gifcurry) only comes with the GUI. If you want the CLI, download the-[prebuilt version](https://github.com/lettier/gifcurry/releases/download/3.0.0.0/gifcurry-linux-3.0.0.0.tar.gz)+[prebuilt version](https://github.com/lettier/gifcurry/releases/download/3.0.0.1/gifcurry-linux-3.0.0.1.tar.gz) for Linux.  ### I use Mac.
makefile view
@@ -9,14 +9,20 @@ STACK_GHC_BIN=`$(STACK) path --compiler-bin` STACK_PATHS=$(STACK_PATH_LOCAL_BIN):$(STACK_GHC_BIN) CABAL=env PATH=$(PATH):$(STACK_PATHS) $(STACK_PATH_LOCAL_BIN)/cabal-VERSION='3.0.0.0'+CABAL_SANDBOX_DIR=".cabal-sandbox"+_APPLICATIONS_DESKTOP_DIR="$(CABAL_SANDBOX_DIR)/share/applications"+_ICONS_HICOLOR_SCALABLE_APPS_DIR="$(CABAL_SANDBOX_DIR)/share/icons/hicolor/scalable/apps"+_PACKAGING_LINUX_COMMON_DIR="./packaging/linux/common"+VERSION='3.0.0.1'  export PATH := $(PATH):$(STACK_PATH_LOCAL_BIN) -all: setup update sandbox_clean clean alex happy haskell_gi gtk2hs_buildtools install_dependencies configure build install+all: setup update sandbox_clean clean alex happy haskell_gi gtk2hs_buildtools install_dependencies configure build cabal_install  setup:-  $(STACK) setup && $(STACK) update && $(STACK) install Cabal && $(STACK) install cabal-install+  $(STACK) setup && $(STACK) update && \+  $(STACK) install Cabal && \+  $(STACK) install cabal-install  alex: setup   $(STACK) install alex@@ -51,41 +57,34 @@ configure: sandbox   $(CABAL) --require-sandbox configure -w $(STACK_GHC_EXE) +applications_desktop: sandbox+  mkdir -p $(_APPLICATIONS_DESKTOP_DIR) && \+  cp $(_PACKAGING_LINUX_COMMON_DIR)/gifcurry.desktop $(_APPLICATIONS_DESKTOP_DIR)/++icons_hicolor_scalable_apps: applications_desktop+  mkdir -p $(_ICONS_HICOLOR_SCALABLE_APPS_DIR) && \+  cp $(_PACKAGING_LINUX_COMMON_DIR)/gifcurry-icon.svg $(_ICONS_HICOLOR_SCALABLE_APPS_DIR)/+ build: configure   $(CABAL) --require-sandbox build -j -install: build+cabal_install: applications_desktop icons_hicolor_scalable_apps build   $(CABAL) --require-sandbox install -j -w $(STACK_GHC_EXE) --enable-relocatable  release: check build   $(CABAL) sdist -run_gui: install+run_gui: cabal_install   ./.cabal-sandbox/bin/gifcurry_gui -run_cli: install+run_cli: cabal_install   ./.cabal-sandbox/bin/gifcurry_cli $(CLI_ARGS)  build_docs: setup   $(CABAL) haddock --hyperlink-source \   --html-location='http://hackage.haskell.org/package/Gifcurry/docs' \   --contents-location='http://hackage.haskell.org/package/Gifcurry' && \-  cp -R ./dist/doc/html/Gifcurry/ ./docs/Gifcurry-$(VERSION)-docs && \-  cd ./docs && \+  mkdir -p ./haddock && \+  cp -R ./dist/doc/html/Gifcurry/ ./haddock/Gifcurry-$(VERSION)-docs && \+  cd ./haddock && \   tar --format=ustar -cvf ./Gifcurry-$(VERSION)-docs.tar Gifcurry-$(VERSION)-docs--# Begin Arch Linux Specific-arch_os_build_gifcurry: setup update clean sandbox_clean alex happy haskell_gi gtk2hs_buildtools arch_os_install_dependencies arch_os_configure arch_os_build--arch_os_install_dependencies: sandbox-  $(CABAL) --require-sandbox install -j -w $(STACK_GHC_EXE) --force-reinstalls --reinstall --only-dependencies--arch_os_configure: sandbox-  $(CABAL) --require-sandbox configure -w $(STACK_GHC_EXE) --prefix=$(PREFIX)--arch_os_build: arch_os_configure-  $(CABAL) --require-sandbox build -j--arch_os_install_gifcurry: arch_os_build-  $(CABAL) --require-sandbox copy --destdir=$(DESTDIR)-# End Arch Linux Specific
src/data/gui.glade view
@@ -1224,7 +1224,7 @@     <property name="transient_for">gifcurry-window</property>     <property name="attached_to">gifcurry-window</property>     <property name="program_name">Gifcurry</property>-    <property name="version">3.0.0.0</property>+    <property name="version">3.0.0.1</property>     <property name="copyright" translatable="yes">(C) 2016 David Lettier lettier.com</property>     <property name="website">https://github.com/lettier/gifcurry</property>
src/gui/Main.hs view
@@ -237,6 +237,7 @@       Gifcurry.getVideoDurationInSeconds         Gifcurry.defaultGifParams           { Gifcurry.inputFile = inFilePath }+    print maybeVideoDuration     maybeWidthHeight <-       Gifcurry.getVideoWidthAndHeight         Gifcurry.defaultGifParams@@ -712,7 +713,7 @@ outFileChooserButtonGetFilePath outFileChooserButton outFileNameEntry = do   filePath <- fileChooserButtonGetString outFileChooserButton   fileName <- Data.Text.unpack . Data.Text.strip <$> GI.Gtk.entryGetText outFileNameEntry-  if Data.List.null filePath+  if Data.List.null filePath || Data.List.null fileName     then return fileName     else do       isDirectory <- System.Directory.doesDirectoryExist filePath
src/lib/Gifcurry.hs view
@@ -60,7 +60,7 @@  -- | The version number. versionNumber :: String-versionNumber = "3.0.0.0"+versionNumber = "3.0.0.1"  -- | Specifies default parameters for 'startTime', 'durationTime', 'widthSize', 'qualityPercent', and 'fontChoice'. defaultGifParams :: GifParams@@ -239,18 +239,39 @@ --                      Just float -> float -- @ getVideoDurationInSeconds :: GifParams -> IO (Maybe Float)-getVideoDurationInSeconds GifParams { inputFile } = tryFfprobe params >>= result+getVideoDurationInSeconds GifParams { inputFile } = do+  streamResult <- result <$> tryFfprobe streamParams+  if streamResult <= 0.0+    then do+      containerResult <- result <$> tryFfprobe containerParams+      if containerResult <= 0.0+        then return Nothing+        else return $ Just containerResult+    else return $ Just streamResult   where-    result :: Either IOError String -> IO (Maybe Float)-    result (Left _)               = return Nothing-    result (Right durationString) = return (readMaybe durationString :: Maybe Float)-    params :: [String]-    params =+    result :: Either IOError String -> Float+    result (Left _)               = 0.0+    result (Right durationString) = fromMaybe 0.0 (readMaybe durationString :: Maybe Float)+    streamParams :: [String]+    streamParams =       [ "-i"       , inputFile       , "-v"-      , "quiet"+      , "error"+      , "-select_streams"+      , "v:0"       , "-show_entries"+      , "stream=duration"+      , "-of"+      , "default=noprint_wrappers=1:nokey=1"+      ]+    containerParams :: [String]+    containerParams =+      [ "-i"+      , inputFile+      , "-v"+      , "error"+      , "-show_entries"       , "format=duration"       , "-of"       , "default=noprint_wrappers=1:nokey=1"@@ -334,7 +355,7 @@   defaultGifParams { outputFile = outputFile, saveAsVideo = True }  defaultFrameRate :: Float-defaultFrameRate = 12.0+defaultFrameRate = 15.0  validateAndAdjustFrameRate :: GifParams -> Maybe Float -> Float validateAndAdjustFrameRate gifParams =@@ -530,10 +551,10 @@   frameRate   = do   maybeWidthHeight <--        maybeGetFirstFrameFilePath tempDir-    >>= maybeGetFirstFrameWidthHeight-  let frameRate' = maybeFrameRateOrDefaultFrameRate (Just frameRate)-  let delay = show $ 100.0 / frameRate'+    maybeGetFirstFrameFilePath tempDir >>=+      maybeGetFirstFrameWidthHeight+  let frameRate'  = maybeFrameRateOrDefaultFrameRate (Just frameRate)+  let delay       = show $ 100.0 / frameRate'   let outputFile' =         if saveAsVideo           then tempDir ++ "/finished-result.gif"@@ -543,28 +564,28 @@             , "-delay"             , delay             , tempDir ++ "/*." ++ frameFileExtension-            , "-coalesce"+            ]+        ++  annotate fontChoice maybeWidthHeight topText    "north"+        ++  annotate fontChoice maybeWidthHeight bottomText "south"+        ++  [ "+dither"             , "-colors"-            , show $ ncolors qualityPercent-            , "-dither"-            , "FloydSteinberg"-            , "-layers"-            , "remove-dups"+            , show $ numberOfColors qualityPercent+            , "-fuzz"+            , "2%"             , "-layers"-            , "compare-any"+            , "OptimizeFrame"             , "-layers"-            , "optimize-transparency"+            , "OptimizeTransparency"             , "-loop"             , "0"+            , "+map"+            , outputFile'             ]-        ++  annotate fontChoice maybeWidthHeight topText "north"-        ++  annotate fontChoice maybeWidthHeight bottomText "south"-        ++  [outputFile']   putStrLn $ "[INFO] Saving your GIF to: " ++ outputFile'   result <- try $ readProcess "convert" params []   if isLeft result     then return result-    else return (Right outputFile')+    else return $ Right outputFile'  convertGifToVideo :: GifParams -> String -> IO (Either IOError String) convertGifToVideo GifParams { outputFile } gifFilePath = do@@ -591,50 +612,49 @@     else return (Right outputFile')  qualityPercentClamp :: Float -> Float-qualityPercentClamp qp-  | qp > 100.0   = 100.0-  | qp < 0.0     = 2.0-  | otherwise    = qp+qualityPercentClamp qualityPercent+  | qualityPercent > 100.0   = 100.0+  | qualityPercent < 0.0     = 1.0+  | otherwise                = qualityPercent -ncolors :: Float -> Int-ncolors qp-  | qpc < 0.0    = 1-  | qpc >= 100.0 = 256-  | otherwise  = truncate (qpc / 100.0 * 256.0)+numberOfColors :: Float -> Int+numberOfColors qualityPercent+  | qualityPercentClamp qualityPercent <=   1.0 = 2+  | qualityPercentClamp qualityPercent >= 100.0 = floor maxColors+  | otherwise                                   = truncate $ (qualityPercent / 100.0) * maxColors   where-    qpc :: Float-    qpc = qualityPercentClamp qp+    maxColors :: Float+    maxColors = 256.0  annotate :: String -> Maybe (Int, Int) -> String -> String -> [String] annotate fontChoiceArg maybeWidthHeight text topBottom =-  [ "-gravity"-  , topBottom-  ]-  ++ fontSetting fontChoiceArg-  ++-  [ "-stroke"-  , "#000C"-  , "-strokewidth"-  , "10"-  , "-density"-  , "96"-  , "-pointsize"-  , pointsize-  , "-annotate"-  , "+0+10"-  , text-  , "-stroke"-  , "none"-  , "-fill"-  , "white"-  , "-density"-  , "96"-  , "-pointsize"-  , pointsize-  , "-annotate"-  , "+0+10"-  , text-  ]+      [ "-gravity"+      , topBottom+      ]+  ++  fontSetting fontChoiceArg+  ++  [ "-stroke"+      , "#000C"+      , "-strokewidth"+      , "10"+      , "-density"+      , "96"+      , "-pointsize"+      , pointsize+      , "-annotate"+      , "+0+10"+      , text+      , "-stroke"+      , "none"+      , "-fill"+      , "white"+      , "-density"+      , "96"+      , "-pointsize"+      , pointsize+      , "-annotate"+      , "+0+10"+      , text+      ]   where     pointsize :: String     pointsize = show $ pointSize maybeWidthHeight text