Posted: Mon 16 Apr 2018, 20:54
I've put that on top and works well.wiak wrote:Could you test it in dutch with that inserted.
assert(os.setlocale('C'))
Fred
READ-ONLY Archive
https://oldforum.puppylinux.com/
I've put that on top and works well.wiak wrote:Could you test it in dutch with that inserted.
assert(os.setlocale('C'))
Code: Select all
chmod +x gifenc-iup.lua
Code: Select all
#!/usr/bin/lua5.3
-- gifenc-iup.lua: translated by wiak from fredx181's gifenc-sel yad code
require( "iuplua" )
-- set initial values
assert(os.setlocale('C'))
VIDFILE = arg[1] or ""; SIZE = 100; START = 0; DUR = 0; NUM = 0; LOWQUAL = 0
if os.execute("command -v ffmpeg >/dev/null")~=true then
iup.Message("gifenc-iup.lua", "No ffmpeg found, please install ffmpeg")
os.exit(1)
end
function do_convert()
print("LOWQUAL", LOWQUAL)
if LOWQUAL == 1 then
print("Low quality selected...")
filters="fps=4,scale="..SIZE..":-1"
result = os.execute("ffmpeg -ss "..START.." -t "..DUR.." -v warning -i "..VIDFILE.." -loop "..NUM.." -vf \""..filters.."\" -y "..VIDFILE:match("(.+)%..+")..".gif")
else
palette = "/tmp/palette.png"
filters = "fps=10,scale="..SIZE..":-1:flags=lanczos"
ffmpeg_args1 = "-ss "..START.." -t "..DUR.." -v warning -i "..VIDFILE.." -loop "..NUM.." -vf \""..filters..",palettegen\" -y "..palette
result = os.execute("ffmpeg "..ffmpeg_args1)
ffmpeg_args2 = "-ss "..START.." -t "..DUR.." -v warning -i "..VIDFILE.." -i "..palette.." -loop "..NUM.." -lavfi \""..filters.." [x]; [x][1:v] paletteuse\" -y "..VIDFILE:match("(.+)%..+")..".gif"
result = os.execute("ffmpeg "..ffmpeg_args2)
end
os.execute("xterm -T 'PLEASE WAIT FOR GIF ENCODE' -e sleep 3")
end
function param_action(dialog, param_index) --this function not actually required for gifenc
if (param_index == iup.GETPARAM_OK) then
print("OK pressed")
elseif (param_index == iup.GETPARAM_CANCEL) then
print("Cancel pressed")
os.exit(3)
end
return 1
end
ret, VIDFILE, SIZE, START, DUR, NUM, LOWQUAL =
iup.GetParam("GifenC-iuplua", param_action,
"Convert (portion of) short video to animated gif%t\n"..
"The new .gif will be in the same folder as the video%t\n"..
"Select video: %f\n"..
" Please set the desired .gif size%t\n"..
"Size: %i[0,2000,10]\n"..
" Set start time and duration: %t\n"..
"Start at (seconds): %r[0,20000,.01]\n"..
"Duration (seconds) (0=all): %r[0,20000,.01]\n"..
"Do not loop (just once): %b\n"..
"Low quality (much smaller gif size): %b\n",
VIDFILE, SIZE, START, DUR, NUM, LOWQUAL)
result = do_convert()
iup.Message("gifenc-iup.lua", VIDFILE:match("(.+)%..+")..".gif has been created")
os.exit(0)
if (iup.MainLoopLevel()==0) then
iup.MainLoop()
end
Code: Select all
simplegui () {
export SIMPLEGUI="
<window title=\"makepup $programversion\">
<vbox>
<notebook labels=\"$(gettext 'Basic|Advanced')\">
<vbox>
<frame $(gettext 'Settings')>
<hbox>
<text><label>$(gettext 'woof-CE-branch [-w]: ')</label></text>
<combobox>
<variable>WOOFBRANCH</variable>
$(combobox_list woof-CE-testing woof-CE-rationalise)
</combobox>
</hbox>
<hbox>
<text><label>$(gettext 'target architecture [-t]: ')</label></text>
<combobox>
<variable>TARGETARCH</variable>
$(combobox_list 2:x86 1:arm 2:x86 3:x86_64)
</combobox>
</hbox>
<hbox>
<text><label>$(gettext 'distro base [-d]: ')</label></text>
<combobox>
<variable>COMPATDISTRO</variable>
$(combobox_list 3:slackware 1:debian 2:devuan 3:slackware 4:trisquel 5:ubuntu)
</combobox>
</hbox>
<hbox>
<text><label>$(gettext 'release version [-r]: ')</label></text>
<combobox>
<variable>COMPATVERSION</variable>
$(combobox_list 3:Slackware14.2 1:DebianStretch 1:DevuanAscii 1:Slackware14.0 1:UbuntuArtful32 1:UbuntuTahr64 1:TrisquelBelenos 2:Slackware14.1 2:UbuntuTahr32 2:UbuntuXenial64 3:Slackware14.2 3:UbuntuXenial32)
</combobox>
</hbox>
<hbox>
<text><label>$(gettext 'Huge kernel [-H]: ')</label></text>
<combobox>
<variable>HUGEKERNEL</variable>
${HKERNEL_ITEMS}
</combobox>
</hbox>
</frame>
<hbox>
<text><label>$(gettext 'Check your settings and then:')</label></text>
<button>
<label>$(gettext 'Build your Pup!')</label>
<action type=\"exit\">BUILD</action>
</button>
</hbox>
</vbox>
<vbox>
<frame $(gettext 'makepup optional switches')>
<checkbox>
<label>$(gettext '[-D] also build devx')</label>
<variable>DEVX</variable>
</checkbox>
<checkbox>
<label>$(gettext '[-k] keep previous woof-CE branch')</label>
<variable>KEEPBRANCH</variable>
<default>$KEEPBRANCH</default>
</checkbox>
<checkbox>
<label>$(gettext '[-R] REBUILD ALL_PACKAGES (post-install scripts etc)')</label>
<variable>REBUILDALL</variable>
</checkbox>
<checkbox>
<label>$(gettext '[-T] allow pop-up "choose-THEMES" gui during build')</label>
<variable>POPUPTHEMES</variable>
</checkbox>
<checkbox>
<label>$(gettext '[-p] pause makepup soon after 0setup routine')</label>
<variable>PAUSE</variable>
</checkbox>
<checkbox>
<label>$(gettext '[-a] adds pets from local-repositories/pets2add/')</label>
<variable>ADDPETS</variable>
</checkbox>
<checkbox>
<label>$(gettext '[-A] adds packages from local-repositories/pkgs2add/')</label>
<variable>ADDPKGS</variable>
</checkbox>
<checkbox>
<label>$(gettext '[-i] interactive mode (like woof-CE manual build)')</label>
<variable>INTERACTIVE</variable>
</checkbox>
<radiobutton>
<label>$(gettext 'Use woof-CE default extra rootfs-packages')</label>
<variable>DEFAULTEXTRA</variable>
</radiobutton>
<radiobutton>
<label>$(gettext 'Use makepup_extra.conf for extra rootfs-packages')</label>
<variable>EXTRACONF</variable>
</radiobutton>
<radiobutton>
<label>$(gettext 'allow pop-up "choose extra rootfs-packages" gui')</label>
<variable>POPUPEXTRA</variable>
</radiobutton>
</frame>
<hbox>
<text><label>$(gettext 'Check your settings and then:') </label></text>
<button>
<label>$(gettext 'Build your Pup!')</label>
<action type=\"exit\">BUILD</action>
</button>
</hbox>
</vbox>
</notebook>
<hbox>
<button tooltip-text=\"$(gettext 'Opens filemanager at local-repositories/pets2add directory')\">
<label>$(gettext 'pets2add')</label>
<action>$FMANAGER local-repositories/pets2add</action>
</button>
<button tooltip-text=\"$(gettext 'Opens filemanager at local-repositories/pkgs2add directory')\">
<label>$(gettext 'pkgs2add')</label>
<action>$FMANAGER local-repositories/pkgs2add</action>
</button>
<button tooltip-text=\"$(gettext 'Opens filemanager at local-repositories/huge_kernels directory')\">
<label>$(gettext 'kernel2add')</label>
<action>$FMANAGER local-repositories/kernel2add</action>
</button>
<button><label>$(gettext 'QUIT')</label></button>
</hbox>
</vbox>
</window>
"
Code: Select all
-- Program: makepup-iup.lua (GUI part as iuplua exemplar)
-- Version 1.0a: one big dialog...
-- Author: wiak (https://github.com/wiake). Licence: MIT
require( "iuplua" )
programversion = "1.0a"
-- Creates dialog
simplegui = iup.dialog{
iup.vbox -- start of outermost container
{
iup.tabs -- start of tabs
{
iup.frame -- start of main frame1
{
iup.vbox -- start of main vbox1
{
iup.hbox
{
iup.fill{},
-- note that I haven't managed to get label to align with dropdown list
-- alignment="ARIGHT:ACENTER" didn't work (nor did ":ACENTER")
iup.label{title="woof-CE-branch [-w]: "},
iup.list {"woof-CE testing", "woof-CE rationalise"; dropdown="YES", value=1, bgcolor="255 255 0", size="80x"}
},
iup.hbox
{
iup.fill{},
iup.label{title="target architecture [-t]: "},
iup.list {"1:arm", "2:x86", "3x86_64"; dropdown="YES", value=2, size="80x"}
},
iup.hbox
{
iup.fill{},
iup.label{title="distro base [-d]: "},
iup.list {"1:debian", "2:devuan", "3:slackware", "4:trisquel", "5:ubuntu"; dropdown="YES", value=3, size="80x"}
},
iup.hbox
{
iup.fill{},
iup.label{title="release version [-r]: "},
iup.list {"1:DebianStretch", "1:DevuanAscii", "1:Slackware14.0", "1:UbuntuArtful32", "1:UbuntuTahr64", "1:TrisquelBelenos", "2:Slackware14.1", "2:UbuntuTahr32", "2:UbuntuXenial64", "3:Slackware14.2", "3:UbuntuXenial32"; dropdown="YES", bgcolor="255 0 128", fgcolor="255 0 128", value=10, size="80x"}
},
iup.hbox
{
iup.fill{},
iup.label{title="Huge kernel [-H]: "},
iup.list {"hugekernel_list"; dropdown="YES", value=1, size="80x"}
},
iup.fill{},
iup.frame
{
iup.hbox{
iup.fill{},
iup.label{title="Check your settings and then: "},
iup.button{title="Build your Pup!"}
}
}
}; -- end of main vbox1
title = "Settings", -- attribute of main frame1
tabtitle = "Basic"
}, -- end of main frame1
iup.frame -- start of main frame2
{
iup.vbox -- start of main vbox2
{
iup.toggle{title = "[-D] also build devx"},
iup.toggle{title = "[-k] keep previous woof-CE branch", value="ON"},
iup.toggle{title = "[-R] REBUILD ALL_PACKAGES (post-install scripts etc)"},
iup.toggle{title = '[-T] allow pop-up "choose-THEMES" gui during build'},
iup.toggle{title = "[-p] pause makepup soon after 0setup routine"},
iup.toggle{title = "[-a] adds pets from local-repositories/pets2add/"},
iup.toggle{title = "[-A] adds packages from local-repositories/pkgs2add/"},
iup.toggle{title = "[-i] interactive mode (like woof-CE manual build)"},
iup.radio
{
iup.vbox
{
iup.toggle{title="Use woof-CE default extra rootfs-packages"},
iup.toggle{title="Use makepup_extra.conf for extra rootfs-packages"},
iup.toggle{title='allow pop-up "choose extra rootfs-packages" gui'}
};
value=1
},
iup.fill{},
iup.frame
{
iup.hbox{
iup.fill{},
iup.label{title="Check options and then: "},
iup.button{title="Build your advanced Pup!"}
}
}
}; -- end of main vbox2
title = "makepup optional switches", -- attribute of main frame2
tabtitle = "Advanced",
fgcolor = "0 0 255"
} -- end of main frame2
}, -- end of tabs
iup.vbox
{
iup.hbox{
iup.fill{},
iup.button{title="pets2add", tip='Opens filemanager at local-repositories/pets2add directory'},
iup.button{title="pkgs2add", tip='Opens filemanager at local-repositories/pkgs2add directory'},
iup.button{title="kernel2add", tip='Opens filemanager at local-repositories/huge_kernels directory'},
iup.button{title="QUIT"}
}
}
}; -- end of outermost container
title="makepup-iuplua " .. programversion
}
-- Shows dialog in the center of the screen
simplegui:showxy(iup.CENTER, iup.CENTER)
if (iup.MainLoopLevel()==0) then
iup.MainLoop()
end
Code: Select all
-- Program: makepup-iup.lua (GUI part as iuplua exemplar)
-- Version 1.0b: partially broken into bottom-up design pieces
-- Author: wiak (https://github.com/wiake). Licence: MIT
require( "iuplua" )
programversion = "1.0b"
-- Create main frames
frame1_bottom = iup.frame
{
iup.hbox
{
iup.fill{},
iup.label{title="Check your settings and then: "},
iup.button{title="Build your Pup!"}
}
}
frame2_bottom = iup.frame
{
iup.hbox
{
iup.fill{},
iup.label{title="Check options and then: "},
iup.button{title="Build your advanced Pup!"}
}
}
frame1 = iup.frame{
iup.vbox -- start of main vbox1
{
iup.hbox
{
iup.fill{},
-- note that I haven't managed to get label to align with dropdown list
-- alignment="ARIGHT:ACENTER" didn't work (nor did ":ACENTER")
iup.label{title="woof-CE-branch [-w]: "},
iup.list {"woof-CE testing", "woof-CE rationalise"; dropdown="YES", value=1, bgcolor="255 255 0", size="80x"}
},
iup.hbox
{
iup.fill{},
iup.label{title="target architecture [-t]: "},
iup.list {"1:arm", "2:x86", "3x86_64"; dropdown="YES", value=2, size="80x"}
},
iup.hbox
{
iup.fill{},
iup.label{title="distro base [-d]: "},
iup.list {"1:debian", "2:devuan", "3:slackware", "4:trisquel", "5:ubuntu"; dropdown="YES", value=3, size="80x"}
},
iup.hbox
{
iup.fill{},
iup.label{title="release version [-r]: "},
iup.list {"1:DebianStretch", "1:DevuanAscii", "1:Slackware14.0", "1:UbuntuArtful32", "1:UbuntuTahr64", "1:TrisquelBelenos", "2:Slackware14.1", "2:UbuntuTahr32", "2:UbuntuXenial64", "3:Slackware14.2", "3:UbuntuXenial32"; dropdown="YES", bgcolor="255 0 128", fgcolor="255 0 128", value=10, size="80x"}
},
iup.hbox
{
iup.fill{},
iup.label{title="Huge kernel [-H]: "},
iup.list {"hugekernel_list"; dropdown="YES", value=1, size="80x"}
},
iup.fill{},
frame1_bottom
}; -- end of main vbox1
title = "Settings", -- attribute of main frame1
tabtitle = "Basic"
}
--[[ or after frame1 already defined, could here instead now use:
frame1.title = "Settings"
frame1.tabtitle = "Basic"
]]
frame2 = iup.frame{
iup.vbox -- start of main vbox2
{
iup.toggle{title = "[-D] also build devx"},
iup.toggle{title = "[-k] keep previous woof-CE branch", value="ON"},
iup.toggle{title = "[-R] REBUILD ALL_PACKAGES (post-install scripts etc)"},
iup.toggle{title = '[-T] allow pop-up "choose-THEMES" gui during build'},
iup.toggle{title = "[-p] pause makepup soon after 0setup routine"},
iup.toggle{title = "[-a] adds pets from local-repositories/pets2add/"},
iup.toggle{title = "[-A] adds packages from local-repositories/pkgs2add/"},
iup.toggle{title = "[-i] interactive mode (like woof-CE manual build)"},
iup.radio
{
iup.vbox
{
iup.toggle{title="Use woof-CE default extra rootfs-packages"},
iup.toggle{title="Use makepup_extra.conf for extra rootfs-packages"},
iup.toggle{title='allow pop-up "choose extra rootfs-packages" gui'}
};
value=1
},
iup.fill{},
frame2_bottom
}; -- end of main vbox2
title = "makepup optional switches", -- attribute of main frame2
tabtitle = "Advanced",
fgcolor = "0 0 255"
}
--[[ or after frame2 is already defined, could here instead now use:
frame2.title = "makepup optional switches"
frame2.tabtitle = "Advanced"
frame2.fgcolor = "0 0 255"
]]
-- Creates tabs
tabs = iup.vbox{iup.tabs{frame1, frame2}}
-- Creates dialog
makepup_dlg = iup.dialog{
iup.vbox -- start of outermost container
{
tabs,
iup.hbox{ -- this horizontal panel will be identical in both tabs
iup.fill{},
iup.button{title="pets2add", tip='Opens filemanager at local-repositories/pets2add directory'},
iup.button{title="pkgs2add", tip='Opens filemanager at local-repositories/pkgs2add directory'},
iup.button{title="kernel2add", tip='Opens filemanager at local-repositories/huge_kernels directory'},
iup.button{title="QUIT"}
}
}; -- end of outermost container
title="makepup-iuplua " .. programversion
}
-- Shows dialog in the center of the screen
makepup_dlg:showxy(iup.CENTER, iup.CENTER)
if (iup.MainLoopLevel()==0) then
iup.MainLoop()
end