Projects
Multimedia
selene
Sign Up
Log In
Username
Password
Overview
Repositories
Revisions
Requests
Users
Attributes
Meta
Expand all
Collapse all
Changes of Revision 2
View file
selene.changes
Changed
@@ -1,4 +1,11 @@ ------------------------------------------------------------------- +Mon Sep 14 10:56:52 UTC 2015 - sor.alexei@meowr.ru + +- Update to 2.5.8. +- Rebase selene-fix-makefile.patch. +- Remove selene-liststore.patch: fixed upstream. + +------------------------------------------------------------------- Wed Jul 1 16:18:43 UTC 2015 - sor.alexei@meowr.ru - Initial package.
View file
selene.spec
Changed
@@ -16,24 +16,22 @@ # -%define _version 2.5.2~185~ubuntu15.04.1 +%define _version 2.5.8~198~ubuntu15.10.1 Name: selene -Version: 2.5.2 +Version: 2.5.8 Release: 0 Summary: GUI audio-video converter for GNU/Linux License: GPL-3.0+ Group: Productivity/Multimedia/Video/Editors and Convertors Url: https://launchpad.net/selene Source: http://ppa.launchpad.net/teejee2008/ppa/ubuntu/pool/main/s/%{name}/%{name}_%{_version}.tar.xz -# PATCH-FIX-UPSTREAM selene-fix-makefile.patch sor.alexei@meowr.ru -- Various fixes to Makefile. +# PATCH-FIX-OPENSUSE selene-fix-makefile.patch sor.alexei@meowr.ru -- Various Makefile fixes. Patch0: %{name}-fix-makefile.patch -# PATCH-FIX-UPSTREAM selene-liststore.patch sor.alexei@meowr.ru -- error: `ListStore' is an ambiguous reference between `GLib.ListStore' and `Gtk.ListStore'. -Patch1: %{name}-liststore.patch BuildRequires: fdupes BuildRequires: gettext BuildRequires: update-desktop-files BuildRequires: vala -BuildRequires: pkgconfig(gee-1.0) +BuildRequires: pkgconfig(gee-0.8) BuildRequires: pkgconfig(glib-2.0) BuildRequires: pkgconfig(gtk+-3.0) BuildRequires: pkgconfig(json-glib-1.0) @@ -45,7 +43,7 @@ Requires: rsync Requires: vorbis-tools Requires: x264 -Recommends: %{name}-lang = %{version} +Recommends: %{name}-lang Recommends: ffmpeg2theora Recommends: gpac Recommends: opus-tools @@ -63,7 +61,6 @@ %prep %setup -q -n %{name}-%{_version} %patch0 -p1 -%patch1 -p1 sed -i 's/^Caption=/Comment=/' src/%{name}.desktop # Use ffmpeg instead of libav. find src/ -type f | while read file; do
View file
selene-fix-makefile.patch
Changed
@@ -18,12 +18,12 @@ all: #build binaries -- valac -X -D'GETTEXT_PACKAGE="${app_name}"' --Xcc="-lm" -X -Wl,-rpath,/usr/share/${app_name}/libs "Main.vala" "Utility.vala" "MainWindow.vala" "AppConfigWindow.vala" "EncoderConfigWindow.vala" "EncoderStatusWindow.vala" "FileInfoWindow.vala" "AboutWindow.vala" "DonationWindow.vala" -o ${app_name} --pkg glib-2.0 --pkg gio-unix-2.0 --pkg posix --pkg gtk+-3.0 --pkg gee-1.0 --pkg json-glib-1.0 -+ valac -X -D'GETTEXT_PACKAGE="${app_name}"' --Xcc="-lm" -X -Wl,-rpath,$(libdir)/$(app_name) "Main.vala" "Utility.vala" "MainWindow.vala" "AppConfigWindow.vala" "EncoderConfigWindow.vala" "EncoderStatusWindow.vala" "FileInfoWindow.vala" "AboutWindow.vala" "DonationWindow.vala" -o $(app_name) --pkg glib-2.0 --pkg gio-unix-2.0 --pkg posix --pkg gtk+-3.0 --pkg gee-1.0 --pkg json-glib-1.0 +- valac -X -D'GETTEXT_PACKAGE="${app_name}"' --Xcc="-lm" -X -Wl,-rpath,/usr/share/${app_name}/libs "Main.vala" "Utility.vala" "MainWindow.vala" "AppConfigWindow.vala" "EncoderConfigWindow.vala" "EncoderStatusWindow.vala" "FileInfoWindow.vala" "AboutWindow.vala" "DonationWindow.vala" -o ${app_name} --pkg glib-2.0 --pkg gio-unix-2.0 --pkg posix --pkg gtk+-3.0 --pkg gee-0.8 --pkg json-glib-1.0 ++ valac -X -D'GETTEXT_PACKAGE="${app_name}"' --Xcc="-lm" -X -Wl,-rpath,$(libdir)/$(app_name) "Main.vala" "Utility.vala" "MainWindow.vala" "AppConfigWindow.vala" "EncoderConfigWindow.vala" "EncoderStatusWindow.vala" "FileInfoWindow.vala" "AboutWindow.vala" "DonationWindow.vala" -o $(app_name) --pkg glib-2.0 --pkg gio-unix-2.0 --pkg posix --pkg gtk+-3.0 --pkg gee-0.8 --pkg json-glib-1.0 #update translation template xgettext --language=C --keyword=_ --copyright-holder='Tony George (teejee2008@gmail.com)' --package-name='${app_name}' --package-version='2.2' --msgid-bugs-address='teejee2008@gmail.com' --escape --sort-output -o ../${app_name}.pot *.vala -@@ -22,6 +25,7 @@ +@@ -22,6 +25,7 @@ clean: install: mkdir -p "$(DESTDIR)$(bindir)" mkdir -p "$(DESTDIR)$(sharedir)" @@ -31,12 +31,12 @@ mkdir -p "$(DESTDIR)$(mandir)" mkdir -p "$(DESTDIR)$(man1dir)" mkdir -p "$(DESTDIR)$(launcherdir)" -@@ -35,7 +39,7 @@ - +@@ -35,7 +39,7 @@ install: + #shared files cp -dpr --no-preserve=ownership -t "$(DESTDIR)$(sharedir)/${app_name}" ./share/${app_name}/* - chmod --recursive 0755 $(DESTDIR)$(sharedir)/${app_name}/* + chmod -R a-rwx,u+rwX,g+rwX,o+rX $(DESTDIR)$(sharedir)/${app_name}/* - + #launcher install -m 0755 ${app_name}.desktop "$(DESTDIR)$(launcherdir)"
View file
selene-liststore.patch
Deleted
@@ -1,115 +0,0 @@ -diff -aur a/src/EncoderConfigWindow.vala b/src/EncoderConfigWindow.vala ---- a/src/EncoderConfigWindow.vala -+++ b/src/EncoderConfigWindow.vala -@@ -1200,12 +1200,12 @@ - } - - private void cmbFileFormat_changed(){ -- ListStore model; -+ Gtk.ListStore model; - TreeIter iter; - - //populate file extensions --------------------------- - -- model = new ListStore(2, typeof(string), typeof(string)); -+ model = new Gtk.ListStore(2, typeof(string), typeof(string)); - cmbFileExtension.set_model(model); - - switch (format) { -@@ -1470,7 +1470,7 @@ - } - - private void cmbACodec_changed(){ -- ListStore model; -+ Gtk.ListStore model; - TreeIter iter; - - //show & hide options -@@ -1891,7 +1891,7 @@ - } - - private void cmbVCodec_changed(){ -- ListStore model; -+ Gtk.ListStore model; - TreeIter iter; - - //show x264 options -diff -aur a/src/MainWindow.vala b/src/MainWindow.vala ---- a/src/MainWindow.vala -+++ b/src/MainWindow.vala -@@ -632,7 +632,7 @@ - - private void cmbScriptFolder_changed(){ - //create empty model -- ListStore model = new ListStore(2, typeof(ScriptFile), typeof(string)); -+ Gtk.ListStore model = new Gtk.ListStore(2, typeof(ScriptFile), typeof(string)); - cmbScriptFile.set_model(model); - - string path = gtk_combobox_get_value(cmbScriptFolder,0,""); -@@ -721,7 +721,7 @@ - cmbScriptFolder.set_active(-1); - - //add the selected file -- ListStore model1 = new ListStore(2, typeof(ScriptFile), typeof(string)); -+ Gtk.ListStore model1 = new Gtk.ListStore(2, typeof(ScriptFile), typeof(string)); - cmbScriptFile.set_model(model1); - ScriptFile sh = new ScriptFile(filePath); - model1.append(out iter); -@@ -732,7 +732,7 @@ - } - - //select file -- ListStore model1 = (ListStore) cmbScriptFile.model; -+ Gtk.ListStore model1 = (Gtk.ListStore) cmbScriptFile.model; - for (bool next = model1.get_iter_first (out iter); next; next = model1.iter_next (ref iter)) { - ScriptFile sh = new ScriptFile(filePath); - model1.get (iter, 0, out sh); -@@ -1213,10 +1213,10 @@ - MediaFile file = App.InputFiles[index]; - - if (file.crop_detect()){ -- ((ListStore)tvFiles.model).set (iter, InputField.FILE_CROPVAL, file.crop_values_info()); -+ ((Gtk.ListStore)tvFiles.model).set (iter, InputField.FILE_CROPVAL, file.crop_values_info()); - } - else{ -- ((ListStore)tvFiles.model).set (iter, InputField.FILE_CROPVAL, _("N/A")); -+ ((Gtk.ListStore)tvFiles.model).set (iter, InputField.FILE_CROPVAL, _("N/A")); - } - - do_events(); -@@ -1341,7 +1341,7 @@ - } - - private void refresh_file_list (bool refresh_model){ -- ListStore inputStore = new ListStore (9, typeof(MediaFile), typeof (string), typeof (string), typeof (string), typeof (string), typeof (string), typeof (string), typeof (int), typeof (string)); -+ Gtk.ListStore inputStore = new Gtk.ListStore (9, typeof(MediaFile), typeof (string), typeof (string), typeof (string), typeof (string), typeof (string), typeof (string), typeof (int), typeof (string)); - - TreeIter iter; - foreach(MediaFile mFile in App.InputFiles) { -@@ -1381,7 +1381,7 @@ - } - } - -- ListStore model = (ListStore) tvFiles.model; -+ Gtk.ListStore model = (Gtk.ListStore) tvFiles.model; - TreeIter iter; - model.get_iter (out iter, new TreePath.from_string (path)); - model.set (iter, InputField.FILE_CROPVAL, mf.crop_values_info()); -@@ -1651,7 +1651,7 @@ - - public bool update_status(){ - TreeIter iter; -- ListStore model = (ListStore)tvFiles.model; -+ Gtk.ListStore model = (Gtk.ListStore)tvFiles.model; - - switch (App.Status) { - case AppStatus.PAUSED: -@@ -1747,7 +1747,7 @@ - } - - public void update_status_all(){ -- ListStore model = (ListStore)tvFiles.model; -+ Gtk.ListStore model = (Gtk.ListStore)tvFiles.model; - MediaFile mf; - int index = -1; - TreeIter iter;
View file
selene_2.5.2~185~ubuntu15.04.1.tar.xz/doc/README
Deleted
-(symlink to /home/teejee/projects/selene/README)
View file
selene_2.5.2~185~ubuntu15.04.1.tar.xz/doc/README-Scripts
Deleted
-(symlink to /home/teejee/projects/selene/src/selene-scripts/README-Scripts)
View file
selene_2.5.2~185~ubuntu15.04.1.tar.xz/doc/changelog
Deleted
-(symlink to /home/teejee/projects/selene/debian/changelog)
View file
selene_2.5.2~185~ubuntu15.04.1.tar.xz/build-release.sh -> selene_2.5.8~198~ubuntu15.10.1.tar.xz/build-release.sh
Changed
@@ -4,15 +4,6 @@ DIR="$( cd "$( dirname "$0" )" && pwd )" cd "$DIR" -sh push.sh - -#check for errors -if [ $? -ne 0 ]; then - cd "$backup" - echo "Failed" - exit 1 -fi - sh build-installer.sh #check for errors @@ -28,5 +19,14 @@ cp -p --no-preserve=ownership -t /home/teejee/Dropbox/Public/linux ./selene-latest-${arch}.run cp -p --no-preserve=ownership -t /home/teejee/Dropbox/Public/linux ./selene-latest-${arch}.deb done +cd .. + +sh push.sh +#check for errors +if [ $? -ne 0 ]; then + cd "$backup" + echo "Failed" + exit 1 +fi cd "$backup"
View file
selene_2.5.8~198~ubuntu15.10.1.tar.xz/build.sh
Added
@@ -0,0 +1,2 @@ + +make 2>&1 | grep -E --color=never 'error:|.vala:.*warning:' | grep -E --color=always "error:|$"
View file
selene_2.5.2~185~ubuntu15.04.1.tar.xz/debian/bzr-builder.manifest -> selene_2.5.8~198~ubuntu15.10.1.tar.xz/debian/bzr-builder.manifest
Changed
@@ -1,2 +1,2 @@ -# bzr-builder format 0.3 deb-version {debupstream}~185 -lp:selene revid:tony.george.kol@gmail.com-20150126102307-yiwe5uyvjvj3hail +# bzr-builder format 0.3 deb-version {debupstream}~198 +lp:selene revid:tony.george.kol@gmail.com-20150908003712-9dfiu0yoyqmfl1lo
View file
selene_2.5.2~185~ubuntu15.04.1.tar.xz/debian/changelog -> selene_2.5.8~198~ubuntu15.10.1.tar.xz/debian/changelog
Changed
@@ -1,17 +1,11 @@ -selene (2.5.2~185~ubuntu15.04.1) vivid; urgency=low +selene (2.5.8~198~ubuntu15.10.1) wily; urgency=low * Auto build. - -- Tony George <teejee2008@gmail.com> Mon, 26 Jan 2015 10:26:40 +0000 + -- Tony George <teejee2008@gmail.com> Tue, 08 Sep 2015 00:47:04 +0000 -selene (2.5.2) trusty; urgency=low +selene (2.5.8) trusty; urgency=low - * Added VP9 encoding support - - * Updated VP8 encoding options to use ffmpeg/avconv instead of vpxenc - - * Fixed: Progress not displayed for x264 encoding - - * Fixed: x264 encoding fails if not compiled with lavf/ffms support + * Fixed a UI issue - -- Tony George <tony.george.kol@gmail.com> Mon, 26 Jan 2015 11:00:00 +0530 + -- Tony George <tony.george.kol@gmail.com> Mon, 07 Sep 2015 14:00:00 +0530
View file
selene_2.5.2~185~ubuntu15.04.1.tar.xz/debian/control -> selene_2.5.8~198~ubuntu15.10.1.tar.xz/debian/control
Changed
@@ -2,7 +2,7 @@ Section: video Priority: extra Maintainer: Tony George <tony.george.kol@gmail.com> -Build-Depends: debhelper (>= 8.0.0), autotools-dev, valac, libgtk-3-dev, libgee-dev, libjson-glib-dev +Build-Depends: debhelper (>= 8.0.0), autotools-dev, valac-0.26, libgtk-3-dev, libgee-0.8-dev, libjson-glib-dev Standards-Version: 3.9.3 Homepage: http://teejeetech.blogspot.in/p/selene-media-encoder.html #Vcs-Git: git://git.debian.org/collab-maint/hello.git
View file
selene_2.5.2~185~ubuntu15.04.1.tar.xz/selene.geany -> selene_2.5.8~198~ubuntu15.10.1.tar.xz/selene.geany
Changed
@@ -17,19 +17,13 @@ long_line_column=80 [files] -current_page=9 -FILE_NAME_0=39672;Vala;0;EUTF-8;1;1;0;%2Fhome%2Fteejee%2Fprojects%2Flinux%2Fselene%2Fsrc%2FUtility.vala;0;4 -FILE_NAME_1=906;Vala;0;EUTF-8;1;1;0;%2Fhome%2Fteejee%2Fprojects%2Flinux%2Fselene%2Fsrc%2FMain.vala;0;4 -FILE_NAME_2=52504;Vala;0;EUTF-8;1;1;0;%2Fhome%2Fteejee%2Fprojects%2Flinux%2Fselene%2Fsrc%2FMainWindow.vala;0;4 -FILE_NAME_3=459;Make;0;EUTF-8;1;1;0;%2Fhome%2Fteejee%2Fprojects%2Flinux%2Fselene%2Fsrc%2Fmakefile;0;4 -FILE_NAME_4=882;Vala;0;EUTF-8;1;1;0;%2Fhome%2Fteejee%2Fprojects%2Flinux%2Fselene%2Fsrc%2FFileInfoWindow.vala;0;4 -FILE_NAME_5=925;Sh;0;EUTF-8;1;1;0;%2Fhome%2Fteejee%2Fprojects%2Flinux%2Fselene%2Finstaller%2Finstall.sh;0;4 -FILE_NAME_6=346;None;0;EUTF-8;1;1;0;%2Fhome%2Fteejee%2Fprojects%2Flinux%2Fselene%2Fdebian%2Fchangelog;0;4 -FILE_NAME_7=8355;Vala;0;EUTF-8;1;1;0;%2Fhome%2Fteejee%2Fprojects%2Flinux%2Fselene%2Fsrc%2FAboutWindow.vala;0;4 -FILE_NAME_8=380;Conf;0;EUTF-8;1;1;0;%2Fhome%2Fteejee%2Fprojects%2Flinux%2Fselene%2Fdebian%2Fcontrol;0;4 -FILE_NAME_9=13551;Vala;0;EUTF-8;1;1;0;%2Fhome%2Fteejee%2Fprojects%2Flinux%2Fselene%2Fsrc%2FEncoderConfigWindow.vala;0;4 -FILE_NAME_10=1353;Vala;0;EUTF-8;1;1;0;%2Fhome%2Fteejee%2Fprojects%2Flinux%2Fselene%2Fsrc%2FAppConfigWindow.vala;0;4 -FILE_NAME_11=1248;Vala;0;EUTF-8;1;1;0;%2Fhome%2Fteejee%2Fprojects%2Flinux%2Fselene%2Fsrc%2FEncoderStatusWindow.vala;0;4 +current_page=2 +FILE_NAME_0=9149;Vala;0;EUTF-8;1;1;0;%2Fhome%2Fteejee%2Fprojects%2Flinux%2Fselene%2Fsrc%2FUtility.vala;0;4 +FILE_NAME_1=1189;Vala;0;EUTF-8;1;1;0;%2Fhome%2Fteejee%2Fprojects%2Flinux%2Fselene%2Fsrc%2FMain.vala;0;4 +FILE_NAME_2=26275;Vala;0;EUTF-8;1;1;0;%2Fhome%2Fteejee%2Fprojects%2Flinux%2Fselene%2Fsrc%2FMainWindow.vala;0;4 +FILE_NAME_3=618;Make;0;EUTF-8;1;1;0;%2Fhome%2Fteejee%2Fprojects%2Flinux%2Fselene%2Fsrc%2Fmakefile;0;4 +FILE_NAME_4=160;None;0;EUTF-8;1;1;0;%2Fhome%2Fteejee%2Fprojects%2Flinux%2Fselene%2Fdebian%2Fchangelog;0;4 +FILE_NAME_5=186;Conf;0;EUTF-8;1;1;0;%2Fhome%2Fteejee%2Fprojects%2Flinux%2Fselene%2Fdebian%2Fcontrol;0;4 [VTE] last_dir=/home/teejee
View file
selene_2.5.2~185~ubuntu15.04.1.tar.xz/selene.pot -> selene_2.5.8~198~ubuntu15.10.1.tar.xz/selene.pot
Changed
@@ -8,7 +8,7 @@ msgstr "" "Project-Id-Version: selene 2.2\n" "Report-Msgid-Bugs-To: teejee2008@gmail.com\n" -"POT-Creation-Date: 2015-01-26 15:51+0530\n" +"POT-Creation-Date: 2015-09-07 20:26-0400\n" "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n" "Last-Translator: FULL NAME <EMAIL@ADDRESS>\n" "Language-Team: LANGUAGE <LL@li.org>\n" @@ -17,7 +17,7 @@ "Content-Type: text/plain; charset=CHARSET\n" "Content-Transfer-Encoding: 8bit\n" -#: EncoderConfigWindow.vala:2304 +#: EncoderConfigWindow.vala:2361 msgid "" "\n" "\n" @@ -25,7 +25,7 @@ "and should start with same name." msgstr "" -#: EncoderConfigWindow.vala:490 +#: EncoderConfigWindow.vala:514 msgid "" "<b>Additional Options</b>\n" "These options will be passed to the encoder\n" @@ -33,19 +33,19 @@ "any options that are already provided by the GUI." msgstr "" -#: EncoderConfigWindow.vala:899 +#: EncoderConfigWindow.vala:923 msgid "<b>Adjustments:</b>" msgstr "" -#: AppConfigWindow.vala:88 +#: AppConfigWindow.vala:127 msgid "<b>Backup Folder</b>" msgstr "" -#: EncoderConfigWindow.vala:818 +#: EncoderConfigWindow.vala:842 msgid "<b>Channels & Sampling:</b>" msgstr "" -#: EncoderConfigWindow.vala:458 +#: EncoderConfigWindow.vala:461 msgid "" "<b>Compression Vs Device Compatibility</b>\n" "'High' profile gives the best compression.\n" @@ -54,115 +54,136 @@ "support the 'High' profile" msgstr "" -#: EncoderConfigWindow.vala:426 +#: EncoderConfigWindow.vala:429 msgid "" "<b>Compression Vs Encoding Speed</b>\n" "Slower presets give better compression and smaller files\n" "but take more time to encode." msgstr "" -#: EncoderConfigWindow.vala:411 +#: EncoderConfigWindow.vala:414 msgid "" "<b>Compression Vs Quality</b>\n" "Smaller values give better quality video and larger files" msgstr "" -#: EncoderConfigWindow.vala:1141 +#: EncoderConfigWindow.vala:1165 msgid "" "<b>Embed</b> - Subtitle files will be combined with the output file.\n" "These subtitles can be switched off since they are added as a separate track" msgstr "" -#: EncoderConfigWindow.vala:1012 +#: EncoderConfigWindow.vala:1036 msgid "<b>Fade:</b>" msgstr "" -#: EncoderConfigWindow.vala:241 +#: EncoderConfigWindow.vala:244 msgid "<b>File Format:</b>" msgstr "" -#: EncoderConfigWindow.vala:1077 +#: AppConfigWindow.vala:65 +msgid "<b>General</b>" +msgstr "" + +#: EncoderConfigWindow.vala:1101 msgid "<b>Other Effects:</b>" msgstr "" -#: AppConfigWindow.vala:63 +#: AppConfigWindow.vala:102 msgid "<b>Output Folder</b>" msgstr "" -#: EncoderConfigWindow.vala:298 +#: EncoderConfigWindow.vala:301 msgid "<b>Preset:</b>" msgstr "" -#: EncoderConfigWindow.vala:474 +#: EncoderConfigWindow.vala:1981 +msgid "" +"<b>Quality Vs Encoding Speed</b>\n" +"\n" +"<b>Best:</b> Best quality, slower\n" +"<b>Good:</b> Good quality, faster\n" +"<b>Realtime:</b> Fastest" +msgstr "" + +#: EncoderConfigWindow.vala:1983 +msgid "" +"<b>Quality Vs Encoding Speed</b>\n" +"\n" +"Smaller values = Better quality, slower\n" +"Larger value = Lower quality, faster\n" +msgstr "" + +#: EncoderConfigWindow.vala:1992 msgid "" "<b>Quality Vs Encoding Speed</b>\n" "Higher values speed-up encoding at the expense of quality.\n" "Lower values improve quality at the expense of encoding speed." msgstr "" -#: EncoderConfigWindow.vala:1143 +#: EncoderConfigWindow.vala:1167 msgid "" "<b>Render</b> - Subtitles are rendered/burned on the video.\n" "These subtitles cannot be switched off since they become a part of the video" msgstr "" -#: EncoderConfigWindow.vala:639 +#: EncoderConfigWindow.vala:663 msgid "<b>Resample:</b>" msgstr "" -#: EncoderConfigWindow.vala:538 +#: EncoderConfigWindow.vala:562 msgid "<b>Resize:</b>" msgstr "" -#: EncoderConfigWindow.vala:868 +#: EncoderConfigWindow.vala:892 msgid "<b>SOX Audio Processing:</b>" msgstr "" -#: EncoderConfigWindow.vala:265 +#: EncoderConfigWindow.vala:268 msgid "AC3 Audio (*.ac3)" msgstr "" -#: MainWindow.vala:189 +#: MainWindow.vala:208 msgid "Abort" msgstr "" -#: MainWindow.vala:237 +#: MainWindow.vala:256 msgid "About" msgstr "" -#: MainWindow.vala:1393 +#: MainWindow.vala:1474 msgid "Add File(s)" msgstr "" -#: MainWindow.vala:144 +#: MainWindow.vala:163 msgid "Add Files" msgstr "" -#: MainWindow.vala:365 +#: MainWindow.vala:564 msgid "Add New Preset" msgstr "" -#: MainWindow.vala:363 +#: MainWindow.vala:562 msgid "Add Preset" msgstr "" -#: MainWindow.vala:147 +#: MainWindow.vala:166 msgid "Add file(s)" msgstr "" -#: EncoderConfigWindow.vala:1108 +#: EncoderConfigWindow.vala:1132 msgid "Adjust Stereo for Headphones" msgstr "" -#: Main.vala:592 +#: Main.vala:596 msgid "All files removed" msgstr "" -#: MainWindow.vala:1465 +#: MainWindow.vala:1546 msgid "An audio-video converter for Linux" msgstr "" -#: MainWindow.vala:213 +#: MainWindow.vala:232 msgid "Application Settings" msgstr "" @@ -171,11 +192,11 @@ msgid "Artists" msgstr "" -#: EncoderConfigWindow.vala:708 +#: EncoderConfigWindow.vala:732 msgid "Audio" msgstr "" -#: EncoderConfigWindow.vala:329 +#: EncoderConfigWindow.vala:332 msgid "Author" msgstr "" @@ -184,19 +205,19 @@ msgid "Authors" msgstr "" -#: MainWindow.vala:477 +#: MainWindow.vala:437 msgid "AutoCrop Video" msgstr "" -#: EncoderConfigWindow.vala:1547 EncoderConfigWindow.vala:1572 -#: EncoderConfigWindow.vala:1603 EncoderConfigWindow.vala:1620 -#: EncoderConfigWindow.vala:1971 EncoderConfigWindow.vala:1994 -#: EncoderConfigWindow.vala:2017 +#: EncoderConfigWindow.vala:1572 EncoderConfigWindow.vala:1597 +#: EncoderConfigWindow.vala:1628 EncoderConfigWindow.vala:1645 +#: EncoderConfigWindow.vala:2008 EncoderConfigWindow.vala:2031 +#: EncoderConfigWindow.vala:2054 msgid "Average Bitrate" msgstr "" -#: EncoderConfigWindow.vala:1973 EncoderConfigWindow.vala:1996 -#: EncoderConfigWindow.vala:2019 +#: EncoderConfigWindow.vala:2010 EncoderConfigWindow.vala:2033 +#: EncoderConfigWindow.vala:2056 msgid "Average Bitrate (2-pass)" msgstr "" @@ -204,54 +225,58 @@ msgid "Back" msgstr "" -#: MainWindow.vala:252 +#: MainWindow.vala:271 msgid "Background" msgstr "" -#: AppConfigWindow.vala:96 +#: AppConfigWindow.vala:135 msgid "Backup Location" msgstr "" -#: EncoderConfigWindow.vala:913 +#: EncoderConfigWindow.vala:937 msgid "Bass (lower freq)" msgstr "" -#: EncoderConfigWindow.vala:400 EncoderConfigWindow.vala:748 +#: EncoderConfigWindow.vala:490 +msgid "Best" +msgstr "" + +#: EncoderConfigWindow.vala:403 EncoderConfigWindow.vala:772 msgid "Bitrate (kbps)" msgstr "" -#: EncoderConfigWindow.vala:911 +#: EncoderConfigWindow.vala:935 msgid "Boost or cut the bass (lower) frequencies of the audio." msgstr "" -#: EncoderConfigWindow.vala:937 +#: EncoderConfigWindow.vala:961 msgid "Boost or cut the treble (upper) frequencies of the audio." msgstr "" -#: MainWindow.vala:385 +#: MainWindow.vala:584 msgid "Browse" msgstr "" -#: MainWindow.vala:1738 +#: MainWindow.vala:1821 msgid "CPU: " msgstr "" -#: Main.vala:1147 Main.vala:1161 +#: Main.vala:1151 Main.vala:1165 msgid "Cancelled" msgstr "" -#: EncoderConfigWindow.vala:963 +#: EncoderConfigWindow.vala:987 msgid "Change audio pitch (shrillness) without changing audio tempo (speed)." msgstr "" -#: EncoderConfigWindow.vala:989 +#: EncoderConfigWindow.vala:1013 msgid "" "Change audio tempo (speed) without changing audio pitch (shrillness).\n" "\n" "WARNING: This will change the duration of the audio track" msgstr "" -#: EncoderConfigWindow.vala:837 +#: EncoderConfigWindow.vala:861 msgid "Channels" msgstr "" @@ -259,29 +284,29 @@ msgid "Close" msgstr "" -#: Main.vala:986 Main.vala:996 Main.vala:1004 +#: Main.vala:990 Main.vala:1000 Main.vala:1008 msgid "Completed" msgstr "" -#: EncoderConfigWindow.vala:1549 EncoderConfigWindow.vala:1574 -#: EncoderConfigWindow.vala:1605 EncoderConfigWindow.vala:2043 +#: EncoderConfigWindow.vala:1574 EncoderConfigWindow.vala:1599 +#: EncoderConfigWindow.vala:1630 EncoderConfigWindow.vala:2080 msgid "Constant Bitrate" msgstr "" -#: EncoderConfigWindow.vala:1551 +#: EncoderConfigWindow.vala:1576 msgid "Constant Bitrate (Strict)" msgstr "" -#: Main.vala:902 Main.vala:1195 +#: Main.vala:906 Main.vala:1199 msgid "Converting..." msgstr "" -#: MainWindow.vala:1010 +#: MainWindow.vala:1113 #, c-format msgid "Converting: '%s'" msgstr "" -#: Main.vala:900 Main.vala:1193 +#: Main.vala:904 Main.vala:1197 msgid "Converting: Enter (q) to quit or (p) to pause..." msgstr "" @@ -289,19 +314,19 @@ msgid "Credits" msgstr "" -#: MainWindow.vala:312 +#: MainWindow.vala:384 msgid "CropVideo (L:T:R:B)" msgstr "" -#: EncoderConfigWindow.vala:554 EncoderConfigWindow.vala:657 +#: EncoderConfigWindow.vala:578 EncoderConfigWindow.vala:681 msgid "Custom" msgstr "" -#: MainWindow.vala:372 +#: MainWindow.vala:571 msgid "Delete Preset" msgstr "" -#: EncoderConfigWindow.vala:702 +#: EncoderConfigWindow.vala:726 msgid "Denominator" msgstr "" @@ -328,20 +353,20 @@ "teejeetech@gmail.com" msgstr "" -#: EncoderConfigWindow.vala:1308 EncoderConfigWindow.vala:1318 -#: EncoderConfigWindow.vala:1327 +#: EncoderConfigWindow.vala:1333 EncoderConfigWindow.vala:1343 +#: EncoderConfigWindow.vala:1352 msgid "Disable Audio" msgstr "" -#: EncoderConfigWindow.vala:1281 +#: EncoderConfigWindow.vala:1306 msgid "Disable Video" msgstr "" -#: AppConfigWindow.vala:106 +#: AppConfigWindow.vala:145 msgid "Do not move input files" msgstr "" -#: EncoderConfigWindow.vala:625 +#: EncoderConfigWindow.vala:649 msgid "Do not stretch or squeeze the video (Fit-To-Box)" msgstr "" @@ -350,7 +375,7 @@ msgid "Documenters" msgstr "" -#: DonationWindow.vala:36 MainWindow.vala:226 MainWindow.vala:227 +#: DonationWindow.vala:36 MainWindow.vala:245 MainWindow.vala:246 msgid "Donate" msgstr "" @@ -363,43 +388,43 @@ msgid "Donations" msgstr "" -#: Main.vala:981 +#: Main.vala:985 msgid "Done" msgstr "" -#: MainWindow.vala:998 +#: MainWindow.vala:1101 msgid "Drag files on this window or click the 'Add' button" msgstr "" -#: MainWindow.vala:304 +#: MainWindow.vala:376 msgid "Duration" msgstr "" -#: MainWindow.vala:454 +#: MainWindow.vala:657 msgid "Edit Preset" msgstr "" -#: EncoderConfigWindow.vala:340 +#: EncoderConfigWindow.vala:343 msgid "Email" msgstr "" -#: EncoderConfigWindow.vala:1417 +#: EncoderConfigWindow.vala:1442 msgid "Embed / Soft Subs" msgstr "" -#: EncoderConfigWindow.vala:2339 +#: EncoderConfigWindow.vala:2396 msgid "Empty Preset Name" msgstr "" -#: EncoderStatusWindow.vala:45 MainWindow.vala:219 +#: EncoderStatusWindow.vala:45 MainWindow.vala:238 msgid "Encoders" msgstr "" -#: EncoderConfigWindow.vala:387 EncoderConfigWindow.vala:735 +#: EncoderConfigWindow.vala:390 EncoderConfigWindow.vala:759 msgid "Encoding Mode" msgstr "" -#: MainWindow.vala:444 +#: MainWindow.vala:647 msgid "Encoding Script or Preset File" msgstr "" @@ -407,51 +432,51 @@ msgid "Encoding Tool" msgstr "" -#: Main.vala:673 +#: Main.vala:677 msgid "Enter any key to Cancel..." msgstr "" -#: Main.vala:991 Utility.vala:108 +#: Main.vala:995 Utility.vala:108 msgid "Error" msgstr "" -#: Main.vala:708 +#: Main.vala:712 msgid "Error: File missing" msgstr "" -#: EncoderConfigWindow.vala:678 +#: EncoderConfigWindow.vala:702 msgid "Examples:" msgstr "" -#: EncoderConfigWindow.vala:287 +#: EncoderConfigWindow.vala:290 msgid "Extension" msgstr "" -#: EncoderConfigWindow.vala:493 +#: EncoderConfigWindow.vala:517 msgid "Extra Options" msgstr "" -#: EncoderConfigWindow.vala:267 +#: EncoderConfigWindow.vala:270 msgid "FLAC Audio (*.flac)" msgstr "" -#: EncoderConfigWindow.vala:675 +#: EncoderConfigWindow.vala:699 msgid "FPS Ratio" msgstr "" -#: EncoderConfigWindow.vala:1024 +#: EncoderConfigWindow.vala:1048 msgid "Fade In (seconds)" msgstr "" -#: EncoderConfigWindow.vala:1038 +#: EncoderConfigWindow.vala:1062 msgid "Fade Out (seconds)" msgstr "" -#: EncoderConfigWindow.vala:1052 +#: EncoderConfigWindow.vala:1076 msgid "Fade Type" msgstr "" -#: Main.vala:1007 +#: Main.vala:1011 msgid "Failed" msgstr "" @@ -459,85 +484,85 @@ msgid "Failed to set ownership" msgstr "" -#: EncoderConfigWindow.vala:441 +#: EncoderConfigWindow.vala:444 msgid "Fast" msgstr "" -#: MainWindow.vala:286 +#: MainWindow.vala:307 msgid "File" msgstr "" -#: MainWindow.vala:539 +#: MainWindow.vala:499 msgid "File Info (Output)" msgstr "" -#: MainWindow.vala:533 +#: MainWindow.vala:493 msgid "File Info (Source)" msgstr "" -#: Main.vala:572 +#: AppConfigWindow.vala:76 +msgid "File View" +msgstr "" + +#: Main.vala:576 msgid "File added:" msgstr "" -#: MainWindow.vala:1026 +#: MainWindow.vala:1129 #, c-format msgid "File added: '%s'" msgstr "" -#: Main.vala:586 +#: Main.vala:590 msgid "File removed:" msgstr "" -#: MainWindow.vala:273 -msgid "File(s) to convert" -msgstr "" - -#: Main.vala:609 +#: Main.vala:613 #, c-format msgid "Files will be saved in '%s'" msgstr "" -#: Main.vala:612 +#: Main.vala:616 msgid "Files will be saved in source directory" msgstr "" -#: EncoderConfigWindow.vala:525 EncoderConfigWindow.vala:804 +#: EncoderConfigWindow.vala:549 EncoderConfigWindow.vala:828 msgid "Filters" msgstr "" -#: MainWindow.vala:197 MainWindow.vala:199 +#: MainWindow.vala:216 MainWindow.vala:218 msgid "Finish" msgstr "" -#: EncoderConfigWindow.vala:622 +#: EncoderConfigWindow.vala:646 msgid "Fits the video in a box of given width and height." msgstr "" -#: EncoderConfigWindow.vala:1637 +#: EncoderConfigWindow.vala:1662 msgid "Fixed Bitrate" msgstr "" -#: MainWindow.vala:419 MainWindow.vala:429 +#: MainWindow.vala:622 MainWindow.vala:632 msgid "Folder" msgstr "" -#: Main.vala:308 +#: Main.vala:309 msgid "Following encoders are not installed on your system:" msgstr "" -#: MainWindow.vala:1576 +#: MainWindow.vala:1659 msgid "Following encoders were not found on your system:" msgstr "" -#: EncoderConfigWindow.vala:249 +#: EncoderConfigWindow.vala:252 msgid "Format" msgstr "" -#: EncoderConfigWindow.vala:373 EncoderConfigWindow.vala:721 +#: EncoderConfigWindow.vala:376 EncoderConfigWindow.vala:745 msgid "Format / Codec" msgstr "" -#: MainWindow.vala:1410 +#: MainWindow.vala:1491 msgid "Format not supported:" msgstr "" @@ -545,45 +570,49 @@ msgid "Found" msgstr "" -#: EncoderConfigWindow.vala:647 +#: EncoderConfigWindow.vala:671 msgid "Frame Rate" msgstr "" -#: EncoderConfigWindow.vala:649 +#: EncoderConfigWindow.vala:673 msgid "Frames/sec" msgstr "" -#: EncoderConfigWindow.vala:228 +#: EncoderConfigWindow.vala:231 msgid "General" msgstr "" -#: EncoderConfigWindow.vala:1067 +#: EncoderConfigWindow.vala:492 +msgid "Good" +msgstr "" + +#: EncoderConfigWindow.vala:1091 msgid "Half Sine" msgstr "" -#: EncoderConfigWindow.vala:601 +#: EncoderConfigWindow.vala:625 msgid "Height" msgstr "" -#: MainWindow.vala:400 MainWindow.vala:402 MainWindow.vala:954 +#: MainWindow.vala:599 MainWindow.vala:601 MainWindow.vala:1057 msgid "Info" msgstr "" -#: MainWindow.vala:1554 +#: MainWindow.vala:1637 msgid "" "Input queue is empty!\n" "Please add some files.\n" msgstr "" -#: Main.vala:600 +#: Main.vala:604 msgid "Input queue is empty! Please add some files." msgstr "" -#: Main.vala:234 +#: Main.vala:235 msgid "Input queue is empty! Please select files to convert." msgstr "" -#: EncoderConfigWindow.vala:1073 +#: EncoderConfigWindow.vala:1097 msgid "Inverted Parabola" msgstr "" @@ -591,43 +620,43 @@ msgid "Key" msgstr "" -#: EncoderConfigWindow.vala:1069 +#: EncoderConfigWindow.vala:1093 msgid "Linear" msgstr "" -#: Main.vala:356 +#: Main.vala:357 msgid "Loading presets from:" msgstr "" -#: Main.vala:355 +#: Main.vala:356 msgid "Loading scripts from:" msgstr "" -#: EncoderConfigWindow.vala:1071 +#: EncoderConfigWindow.vala:1095 msgid "Logarithmic" msgstr "" -#: EncoderConfigWindow.vala:1664 +#: EncoderConfigWindow.vala:1689 msgid "Lossless" msgstr "" -#: Main.vala:722 Main.vala:725 +#: Main.vala:726 Main.vala:729 msgid "Lyrics:" msgstr "" -#: EncoderConfigWindow.vala:269 +#: EncoderConfigWindow.vala:272 msgid "MP3 Audio (*.mp3)" msgstr "" -#: EncoderConfigWindow.vala:271 +#: EncoderConfigWindow.vala:274 msgid "MP4 Audio (*.mp4)" msgstr "" -#: EncoderConfigWindow.vala:259 +#: EncoderConfigWindow.vala:262 msgid "MPEG4 Video (*.mp4)" msgstr "" -#: EncoderConfigWindow.vala:1106 +#: EncoderConfigWindow.vala:1130 msgid "" "Makes audio easier to listen to on headphones. Adds 'cues' to the audio so " "that when listened to on headphones the stereo image is moved from inside " @@ -635,19 +664,19 @@ "(standard for speakers)." msgstr "" -#: EncoderConfigWindow.vala:257 +#: EncoderConfigWindow.vala:260 msgid "Matroska Video (*.mkv)" msgstr "" -#: EncoderConfigWindow.vala:1091 +#: EncoderConfigWindow.vala:1115 msgid "Maximize Volume Level (Normalize)" msgstr "" -#: EncoderConfigWindow.vala:1089 +#: EncoderConfigWindow.vala:1113 msgid "Maximize the volume level (loudness)" msgstr "" -#: EncoderConfigWindow.vala:443 +#: EncoderConfigWindow.vala:446 msgid "Medium" msgstr "" @@ -655,7 +684,7 @@ msgid "Missing" msgstr "" -#: Main.vala:308 MainWindow.vala:1576 +#: Main.vala:309 MainWindow.vala:1659 msgid "Missing Encoders" msgstr "" @@ -663,147 +692,147 @@ msgid "Missing Icon" msgstr "" -#: EncoderConfigWindow.vala:791 +#: EncoderConfigWindow.vala:815 msgid "Music" msgstr "" -#: Main.vala:2819 MainWindow.vala:1219 +#: Main.vala:2869 MainWindow.vala:1322 msgid "N/A" msgstr "" -#: EncoderConfigWindow.vala:306 +#: EncoderConfigWindow.vala:309 msgid "Name" msgstr "" -#: EncoderConfigWindow.vala:313 +#: EncoderConfigWindow.vala:316 msgid "New Preset" msgstr "" -#: EncoderConfigWindow.vala:552 EncoderConfigWindow.vala:655 -#: EncoderConfigWindow.vala:678 EncoderConfigWindow.vala:1684 -#: EncoderConfigWindow.vala:1724 EncoderConfigWindow.vala:1752 -#: EncoderConfigWindow.vala:1766 EncoderConfigWindow.vala:1795 -#: EncoderConfigWindow.vala:1815 +#: EncoderConfigWindow.vala:576 EncoderConfigWindow.vala:679 +#: EncoderConfigWindow.vala:702 EncoderConfigWindow.vala:1709 +#: EncoderConfigWindow.vala:1749 EncoderConfigWindow.vala:1777 +#: EncoderConfigWindow.vala:1791 EncoderConfigWindow.vala:1820 +#: EncoderConfigWindow.vala:1840 msgid "No Change" msgstr "" -#: EncoderConfigWindow.vala:1415 +#: EncoderConfigWindow.vala:1440 msgid "No Subtitles" msgstr "" -#: EncoderConfigWindow.vala:633 +#: EncoderConfigWindow.vala:657 msgid "No Up-Scaling" msgstr "" -#: EncoderConfigWindow.vala:787 +#: EncoderConfigWindow.vala:811 msgid "None" msgstr "" -#: Main.vala:308 +#: Main.vala:309 msgid "Not possible to continue!" msgstr "" -#: EncoderConfigWindow.vala:693 +#: EncoderConfigWindow.vala:717 msgid "Numerator" msgstr "" -#: EncoderConfigWindow.vala:261 +#: EncoderConfigWindow.vala:264 msgid "OGG Theora Video (*.ogv)" msgstr "" -#: EncoderConfigWindow.vala:273 +#: EncoderConfigWindow.vala:276 msgid "OGG Vorbis Audio (*.ogg)" msgstr "" -#: MainWindow.vala:387 +#: MainWindow.vala:586 msgid "Open Folder" msgstr "" -#: MainWindow.vala:510 +#: MainWindow.vala:470 msgid "Open Log File" msgstr "" -#: MainWindow.vala:504 +#: MainWindow.vala:464 msgid "Open Output Folder" msgstr "" -#: MainWindow.vala:498 +#: MainWindow.vala:458 msgid "Open Temp Folder" msgstr "" -#: MainWindow.vala:265 +#: MainWindow.vala:284 msgid "Open output folder" msgstr "" -#: EncoderConfigWindow.vala:770 +#: EncoderConfigWindow.vala:794 msgid "Optimization" msgstr "" -#: EncoderConfigWindow.vala:275 +#: EncoderConfigWindow.vala:278 msgid "Opus Audio (*.opus)" msgstr "" -#: MainWindow.vala:263 +#: MainWindow.vala:282 msgid "Output" msgstr "" -#: AppConfigWindow.vala:71 +#: AppConfigWindow.vala:110 msgid "Output Location" msgstr "" -#: MainWindow.vala:180 MainWindow.vala:1535 MainWindow.vala:1537 +#: MainWindow.vala:199 MainWindow.vala:1618 MainWindow.vala:1620 msgid "Pause" msgstr "" -#: Main.vala:1174 Main.vala:1179 +#: Main.vala:1178 Main.vala:1183 msgid "Paused" msgstr "" -#: Main.vala:1177 +#: Main.vala:1181 msgid "Paused: Enter (r) to resume..." msgstr "" -#: EncoderConfigWindow.vala:965 +#: EncoderConfigWindow.vala:989 msgid "Pitch (shrillness)" msgstr "" -#: MainWindow.vala:527 +#: MainWindow.vala:487 msgid "Play File (Output)" msgstr "" -#: MainWindow.vala:521 +#: MainWindow.vala:481 msgid "Play File (Source)" msgstr "" -#: EncoderConfigWindow.vala:2337 +#: EncoderConfigWindow.vala:2394 msgid "Please enter a name for this preset" msgstr "" -#: MainWindow.vala:1576 +#: MainWindow.vala:1659 msgid "Please install required packages or select another preset" msgstr "" -#: EncoderConfigWindow.vala:889 +#: EncoderConfigWindow.vala:913 msgid "Please install the 'sox' package on your system to use this feature" msgstr "" -#: EncoderConfigWindow.vala:429 MainWindow.vala:434 +#: EncoderConfigWindow.vala:432 MainWindow.vala:637 msgid "Preset" msgstr "" -#: MainWindow.vala:892 +#: MainWindow.vala:995 msgid "Preset deleted" msgstr "" -#: MainWindow.vala:1670 +#: MainWindow.vala:1753 msgid "Press 'Cancel' to abort shutdown" msgstr "" -#: MainWindow.vala:482 +#: MainWindow.vala:442 msgid "Preview File" msgstr "" -#: EncoderConfigWindow.vala:461 +#: EncoderConfigWindow.vala:464 msgid "Profile" msgstr "" @@ -811,68 +840,76 @@ msgid "Properties" msgstr "" -#: EncoderConfigWindow.vala:414 EncoderConfigWindow.vala:759 +#: EncoderConfigWindow.vala:417 EncoderConfigWindow.vala:783 msgid "Quality" msgstr "" -#: EncoderConfigWindow.vala:1065 +#: EncoderConfigWindow.vala:1089 msgid "Quarter Sine" msgstr "" -#: MainWindow.vala:1556 +#: MainWindow.vala:1639 msgid "Queue is Empty" msgstr "" -#: Main.vala:630 Main.vala:689 Main.vala:2585 +#: Main.vala:634 Main.vala:693 Main.vala:2603 msgid "Queued" msgstr "" +#: EncoderConfigWindow.vala:494 +msgid "Realtime" +msgstr "" + #: EncoderStatusWindow.vala:109 msgid "Refresh" msgstr "" -#: MainWindow.vala:161 +#: MainWindow.vala:180 msgid "Remove all file(s)" msgstr "" -#: MainWindow.vala:154 +#: MainWindow.vala:173 msgid "Remove selected file(s)" msgstr "" -#: EncoderConfigWindow.vala:930 EncoderConfigWindow.vala:956 -#: EncoderConfigWindow.vala:982 EncoderConfigWindow.vala:1008 +#: EncoderConfigWindow.vala:954 EncoderConfigWindow.vala:980 +#: EncoderConfigWindow.vala:1006 EncoderConfigWindow.vala:1032 msgid "Reset" msgstr "" -#: EncoderConfigWindow.vala:607 +#: EncoderConfigWindow.vala:631 msgid "Resizing Method" msgstr "" -#: EncoderConfigWindow.vala:545 +#: EncoderConfigWindow.vala:569 msgid "Resolution" msgstr "" -#: MainWindow.vala:1529 MainWindow.vala:1531 +#: MainWindow.vala:1612 MainWindow.vala:1614 msgid "Resume" msgstr "" -#: MainWindow.vala:257 +#: MainWindow.vala:294 +msgid "Right-click for more options" +msgstr "" + +#: MainWindow.vala:276 msgid "Run processes with lower priority" msgstr "" -#: EncoderConfigWindow.vala:855 +#: EncoderConfigWindow.vala:879 msgid "SOX" msgstr "" -#: EncoderConfigWindow.vala:824 +#: EncoderConfigWindow.vala:848 msgid "Sampling Rate (Hz)" msgstr "" -#: AppConfigWindow.vala:81 +#: AppConfigWindow.vala:120 msgid "Save in input file location" msgstr "" -#: MainWindow.vala:996 +#: MainWindow.vala:1099 msgid "Select a script from the dropdown and click 'Start' to begin" msgstr "" @@ -880,7 +917,7 @@ msgid "Send Email" msgstr "" -#: EncoderConfigWindow.vala:572 +#: EncoderConfigWindow.vala:596 msgid "" "Set either Width or Height and leave the other as 0.\n" "It will be calculated automatically.\n" @@ -891,69 +928,73 @@ "Enable the 'Fit-To-Box' option to avoid changes to aspect ratio." msgstr "" -#: MainWindow.vala:242 +#: MainWindow.vala:261 msgid "Shutdown" msgstr "" -#: MainWindow.vala:1508 +#: MainWindow.vala:1591 msgid "Shutdown Disabled" msgstr "" -#: MainWindow.vala:1505 +#: MainWindow.vala:1588 msgid "Shutdown Enabled" msgstr "" -#: MainWindow.vala:247 +#: MainWindow.vala:266 msgid "Shutdown system after completion" msgstr "" -#: MainWindow.vala:296 +#: AppConfigWindow.vala:89 +msgid "Simple" +msgstr "" + +#: MainWindow.vala:368 msgid "Size" msgstr "" -#: MainWindow.vala:472 +#: MainWindow.vala:432 msgid "Skip File" msgstr "" -#: EncoderConfigWindow.vala:445 +#: EncoderConfigWindow.vala:448 msgid "Slow" msgstr "" -#: EncoderConfigWindow.vala:447 +#: EncoderConfigWindow.vala:450 msgid "Slower" msgstr "" -#: Main.vala:618 +#: Main.vala:622 #, c-format msgid "Source files will be moved to '%s'" msgstr "" -#: Main.vala:720 +#: Main.vala:724 msgid "Source:" msgstr "" -#: EncoderConfigWindow.vala:889 +#: EncoderConfigWindow.vala:913 msgid "Sox Not Installed" msgstr "" -#: EncoderConfigWindow.vala:789 +#: EncoderConfigWindow.vala:813 msgid "Speech" msgstr "" -#: EncoderConfigWindow.vala:477 +#: EncoderConfigWindow.vala:478 msgid "Speed" msgstr "" -#: MainWindow.vala:171 MainWindow.vala:173 +#: MainWindow.vala:190 MainWindow.vala:192 msgid "Start" msgstr "" -#: Main.vala:604 +#: Main.vala:608 #, c-format msgid "Starting batch of %d file(s):" msgstr "" -#: EncoderStatusWindow.vala:99 MainWindow.vala:323 +#: EncoderStatusWindow.vala:99 MainWindow.vala:395 msgid "Status" msgstr "" @@ -961,61 +1002,61 @@ msgid "Stopped" msgstr "" -#: Main.vala:1001 +#: Main.vala:1005 msgid "Stopped!" msgstr "" -#: EncoderConfigWindow.vala:1129 +#: EncoderConfigWindow.vala:1153 msgid "Subs" msgstr "" -#: EncoderConfigWindow.vala:1146 +#: EncoderConfigWindow.vala:1170 msgid "Subtitle Mode" msgstr "" -#: EncoderConfigWindow.vala:1162 +#: EncoderConfigWindow.vala:1186 msgid "Subtitles" msgstr "" -#: Main.vala:722 Main.vala:725 +#: Main.vala:726 Main.vala:729 msgid "Subtitles:" msgstr "" -#: EncoderConfigWindow.vala:439 +#: EncoderConfigWindow.vala:442 msgid "SuperFast" msgstr "" -#: EncoderConfigWindow.vala:2310 EncoderConfigWindow.vala:2313 -#: EncoderConfigWindow.vala:2316 EncoderConfigWindow.vala:2319 +#: EncoderConfigWindow.vala:2367 EncoderConfigWindow.vala:2370 +#: EncoderConfigWindow.vala:2373 EncoderConfigWindow.vala:2376 msgid "Supported Formats:" msgstr "" -#: MainWindow.vala:1672 +#: MainWindow.vala:1755 msgid "System shutdown" msgstr "" -#: MainWindow.vala:1679 +#: MainWindow.vala:1762 #, c-format msgid "System shutdown was cancelled by user!" msgstr "" -#: Main.vala:209 +#: Main.vala:210 msgid "System will be shutdown after completion" msgstr "" -#: Main.vala:672 MainWindow.vala:1669 +#: Main.vala:676 MainWindow.vala:1752 msgid "System will shutdown in one minute!" msgstr "" -#: EncoderConfigWindow.vala:991 +#: EncoderConfigWindow.vala:1015 msgid "Tempo (speed)" msgstr "" -#: EncoderConfigWindow.vala:889 +#: EncoderConfigWindow.vala:913 msgid "The Sox utility was not found on your system" msgstr "" -#: EncoderConfigWindow.vala:604 +#: EncoderConfigWindow.vala:628 msgid "" "The resizing filter affects the sharpness and compressibility of the video.\n" "For example, the 'Lanzos' filter gives sharper video but the extra detail\n" @@ -1029,29 +1070,33 @@ msgid "Third Party Tools" msgstr "" +#: AppConfigWindow.vala:91 +msgid "Tiles" +msgstr "" + #: AboutWindow.vala:338 #, c-format msgid "Translators" msgstr "" -#: EncoderConfigWindow.vala:939 +#: EncoderConfigWindow.vala:963 msgid "Treble (upper freq)" msgstr "" -#: EncoderConfigWindow.vala:437 +#: EncoderConfigWindow.vala:440 msgid "UltraFast" msgstr "" -#: Main.vala:577 +#: Main.vala:581 msgid "Unknown format:" msgstr "" -#: MainWindow.vala:1023 +#: MainWindow.vala:1126 #, c-format msgid "Unknown format: '%s'" msgstr "" -#: Main.vala:357 +#: Main.vala:358 msgid "Using temp folder:" msgstr "" @@ -1059,33 +1104,33 @@ msgid "Value" msgstr "" -#: EncoderConfigWindow.vala:1545 EncoderConfigWindow.vala:1570 -#: EncoderConfigWindow.vala:1601 EncoderConfigWindow.vala:1618 -#: EncoderConfigWindow.vala:2015 EncoderConfigWindow.vala:2039 +#: EncoderConfigWindow.vala:1570 EncoderConfigWindow.vala:1595 +#: EncoderConfigWindow.vala:1626 EncoderConfigWindow.vala:1643 +#: EncoderConfigWindow.vala:2052 EncoderConfigWindow.vala:2076 msgid "Variable Bitrate" msgstr "" -#: EncoderConfigWindow.vala:2041 +#: EncoderConfigWindow.vala:2078 msgid "Variable Bitrate (2pass)" msgstr "" -#: EncoderConfigWindow.vala:1969 EncoderConfigWindow.vala:1992 +#: EncoderConfigWindow.vala:2006 EncoderConfigWindow.vala:2029 msgid "Variable Bitrate / CRF" msgstr "" -#: EncoderConfigWindow.vala:318 +#: EncoderConfigWindow.vala:321 msgid "Version" msgstr "" -#: EncoderConfigWindow.vala:449 +#: EncoderConfigWindow.vala:452 msgid "VerySlow" msgstr "" -#: EncoderConfigWindow.vala:360 +#: EncoderConfigWindow.vala:363 msgid "Video" msgstr "" -#: EncoderConfigWindow.vala:630 +#: EncoderConfigWindow.vala:654 msgid "" "Video will not be resized if it's smaller than the given width and height" msgstr "" @@ -1094,7 +1139,7 @@ msgid "Visit Website" msgstr "" -#: EncoderConfigWindow.vala:277 +#: EncoderConfigWindow.vala:280 msgid "WAV Audio (*.wav)" msgstr "" @@ -1102,36 +1147,36 @@ msgid "Warning" msgstr "" -#: Main.vala:212 +#: Main.vala:213 msgid "" "Warning: User does not have Admin priviledges. '--shutdown' will be ignored." msgstr "" -#: EncoderConfigWindow.vala:263 +#: EncoderConfigWindow.vala:266 msgid "WebM Video (*.webm)" msgstr "" -#: EncoderConfigWindow.vala:592 +#: EncoderConfigWindow.vala:616 msgid "Width" msgstr "" -#: EncoderConfigWindow.vala:575 +#: EncoderConfigWindow.vala:599 msgid "Width x Height" msgstr "" -#: MainWindow.vala:1002 +#: MainWindow.vala:1105 msgid "" "[Batch completed] Right-click for options or click 'Finish' to continue." msgstr "" -#: MainWindow.vala:1006 +#: MainWindow.vala:1109 msgid "[Paused] Click 'Resume' to continue or 'Stop' to abort." msgstr "" -#: MainWindow.vala:605 +#: MainWindow.vala:708 msgid "presets" msgstr "" -#: MainWindow.vala:601 +#: MainWindow.vala:704 msgid "scripts" msgstr ""
View file
selene_2.5.2~185~ubuntu15.04.1.tar.xz/src/AboutWindow.vala -> selene_2.5.8~198~ubuntu15.10.1.tar.xz/src/AboutWindow.vala
Changed
@@ -1,26 +1,26 @@ /* * AboutWindow.vala - * + * * Copyright 2012 Tony George <teejee2008@gmail.com> * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. - * + * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. - * + * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, * MA 02110-1301, USA. - * - * + * + * */ - + using Gtk; using TeeJee.Logging; @@ -39,7 +39,7 @@ private Box hbox_action; private Button btn_credits; private Button btn_close; - + private Gtk.Image img_logo; private Label lbl_program_name; private Label lbl_version; @@ -106,7 +106,7 @@ _donations = value; } } - + private string _license = ""; public string license{ get{ @@ -116,7 +116,7 @@ _license = value; } } - + private Gdk.Pixbuf _logo; public Gdk.Pixbuf logo{ get{ @@ -146,7 +146,7 @@ _translators = value; } } - + private string[] _third_party; public string[] third_party{ get{ @@ -156,7 +156,7 @@ _third_party = value; } } - + private string _version = ""; public string version{ get{ @@ -186,21 +186,21 @@ _website_label = value; } } - + public AboutWindow() { window_position = WindowPosition.CENTER_ON_PARENT; set_destroy_with_parent (true); set_modal (true); skip_taskbar_hint = false; - set_default_size (450, 400); + set_default_size (450, 400); vbox_main = get_content_area(); vbox_main.margin = 6; vbox_main.spacing = 6; - + vbox_logo = new Box(Orientation.VERTICAL,0); vbox_main.add(vbox_logo); - + vbox_credits = new Box(Orientation.VERTICAL,0); vbox_credits.no_show_all = true; vbox_main.add(vbox_credits); @@ -213,7 +213,7 @@ img_logo.margin_top = 6; img_logo.margin_bottom = 6; vbox_logo.add(img_logo); - + //program_name lbl_program_name = new Label(""); lbl_program_name.set_use_markup(true); @@ -230,7 +230,7 @@ lbl_comments.set_use_markup(true); lbl_comments.margin_top = 10; vbox_logo.add(lbl_comments); - + //website lbtn_website = new LinkButton(""); lbtn_website.margin_top = 5; @@ -238,13 +238,13 @@ lbtn_website.activate_link.connect(()=>{ try{ - return Gtk.show_uri(null, lbtn_website.uri, Gdk.CURRENT_TIME); + return Gtk.show_uri(null, lbtn_website.uri, Gdk.CURRENT_TIME); } catch(Error e){ return false; } }); - + //copyright lbl_copyright = new Label(""); lbl_copyright.set_use_markup(true); @@ -260,27 +260,27 @@ var sw_credits = new ScrolledWindow(null, null); sw_credits.set_shadow_type(ShadowType.ETCHED_IN); sw_credits.expand = true; - + vbox_credits.add(sw_credits); sw_credits.add(vbox_lines); - + //hbox_commands -------------------------------------------------- - + hbox_action = (Box) get_action_area(); - + //btn_credits btn_credits = new Button.with_label(" " + _("Credits")); btn_credits.set_image (new Image.from_stock ("gtk-about", IconSize.MENU)); - hbox_action.add(btn_credits); - + hbox_action.add(btn_credits); + btn_credits.clicked.connect(()=>{ vbox_logo.visible = !(vbox_logo.visible); vbox_credits.visible = !(vbox_credits.visible); - + if ((vbox_credits.visible)&&(!sw_credits.visible)){ sw_credits.show_all(); } - + if (vbox_credits.visible){ btn_credits.label = " " + _("Back"); btn_credits.set_image (new Image.from_stock ("gtk-go-back", IconSize.MENU)); @@ -295,10 +295,10 @@ btn_close = new Button.with_label(" " + _("Close")); btn_close.set_image (new Image.from_stock ("gtk-close", IconSize.MENU)); hbox_action.add(btn_close); - + btn_close.clicked.connect(()=>{ this.destroy(); }); } - + public void initialize() { title = program_name; img_logo.pixbuf = logo; @@ -309,7 +309,7 @@ lbtn_website.label = website_label; //lbl_copyright.label = "<span size='smaller'>%s</span>".printf(copyright); lbl_copyright.label = "<span>%s</span>".printf(copyright); - + if (authors.length > 0){ add_line("<b>%s</b>\n".printf(_("Authors"))); foreach(string name in authors){ @@ -317,7 +317,7 @@ } add_line("\n"); } - + if (third_party.length > 0){ add_line("<b>%s</b>\n".printf(_("Third Party Tools"))); foreach(string name in third_party){ @@ -325,7 +325,7 @@ } add_line("\n"); } - + if (artists.length > 0){ add_line("<b>%s</b>\n".printf(_("Artists"))); foreach(string name in artists){ @@ -362,12 +362,12 @@ btn_credits.visible = false; } } - + public void add_line(string text){ if (text.split(":").length >= 2){ var link = new LinkButton(text.split(":")[0]); vbox_lines.add(link); - + string val = text[text.index_of(":") + 1:text.length]; if (val.contains("@")){ link.uri = "mailto:" + val; @@ -381,7 +381,7 @@ link.activate_link.connect(()=>{ try{ - return Gtk.show_uri(null, link.uri, Gdk.CURRENT_TIME); + return Gtk.show_uri(null, link.uri, Gdk.CURRENT_TIME); } catch(Error e){ return false;
View file
selene_2.5.2~185~ubuntu15.04.1.tar.xz/src/AppConfigWindow.vala -> selene_2.5.8~198~ubuntu15.10.1.tar.xz/src/AppConfigWindow.vala
Changed
@@ -1,26 +1,26 @@ /* * PrefWindow.vala - * + * * Copyright 2012 Tony George <teejee2008@gmail.com> * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. - * + * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. - * + * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, * MA 02110-1301, USA. - * - * + * + * */ - + using Gtk; using TeeJee.Logging; @@ -35,6 +35,7 @@ public class AppConfigWindow : Dialog { private Box vboxMain; + private Label lblView; private Label lblOutput; private CheckButton chkOutput; private FileChooserButton fcbOutput; @@ -43,22 +44,60 @@ private FileChooserButton fcbBackup; private Button btnSave; private Button btnCancel; - + private ComboBox cmbFileView; + public AppConfigWindow() { - title = "Application Settings"; + title = "Settings"; set_default_size (350, 400); - + window_position = WindowPosition.CENTER_ON_PARENT; destroy_with_parent = true; skip_taskbar_hint = true; modal = true; deletable = false; icon = get_app_icon(16); - + // get content area vboxMain = get_content_area(); vboxMain.margin = 6; - + + // lblView + lblView = new Label (_("<b>General</b>")); + lblView.set_use_markup(true); + lblView.halign = Align.START; + lblView.margin_bottom = 12; + lblView.margin_top = 12; + vboxMain.pack_start (lblView, false, true, 0); + + //hboxFileView + Box hboxFileView = new Box(Orientation.HORIZONTAL,6); + vboxMain.add(hboxFileView); + + Label lblFileView = new Gtk.Label(_("File View")); + lblFileView.xalign = (float) 0.0; + hboxFileView.pack_start(lblFileView,false,false,0); + + cmbFileView = new ComboBox(); + var textCell = new CellRendererText(); + cmbFileView.pack_start(textCell, false); + cmbFileView.set_attributes(textCell, "text", 0); + hboxFileView.pack_start(cmbFileView,false,false,0); + + Gtk.TreeIter iter; + var model = new Gtk.ListStore (2, typeof (string), typeof (string)); + model.append (out iter); + model.set (iter, 0, _("Simple"), 1, "list"); + model.append (out iter); + model.set (iter, 0, _("Tiles"), 1, "tiles"); + cmbFileView.set_model(model); + + if (App.TileView){ + cmbFileView.set_active(1); + } + else{ + cmbFileView.set_active(0); + } + // lblOutput lblOutput = new Label (_("<b>Output Folder</b>")); lblOutput.set_use_markup(true); @@ -66,7 +105,7 @@ lblOutput.margin_bottom = 12; lblOutput.margin_top = 12; vboxMain.pack_start (lblOutput, false, true, 0); - + // fcbOutput fcbOutput = new FileChooserButton (_("Output Location"), FileChooserAction.SELECT_FOLDER); fcbOutput.set_sensitive(App.OutputDirectory.length > 0); @@ -76,14 +115,14 @@ fcbOutput.set_filename (App.OutputDirectory); } vboxMain.add (fcbOutput); - + // chkOutput chkOutput = new CheckButton.with_label (_("Save in input file location")); chkOutput.active = (App.OutputDirectory.length == 0); chkOutput.margin_left = 6; chkOutput.clicked.connect (chkOutput_clicked); vboxMain.pack_start (chkOutput, false, true, 0); - + // lblBackup lblBackup = new Label (_("<b>Backup Folder</b>")); lblBackup.set_use_markup(true); @@ -91,7 +130,7 @@ lblBackup.margin_bottom = 12; lblBackup.margin_top = 12; vboxMain.pack_start (lblBackup, false, true, 0); - + // fcbBackup fcbBackup = new FileChooserButton (_("Backup Location"), FileChooserAction.SELECT_FOLDER); fcbBackup.set_sensitive(App.BackupDirectory.length > 0); @@ -101,31 +140,31 @@ fcbBackup.set_filename (App.BackupDirectory); } vboxMain.add (fcbBackup); - + // chkBackup chkBackup = new CheckButton.with_label (_("Do not move input files")); chkBackup.active = (App.BackupDirectory.length == 0); chkBackup.margin_left = 6; chkBackup.clicked.connect (chkBackup_clicked); vboxMain.pack_start (chkBackup, false, true, 0); - + // btnSave btnSave = (Button) add_button ("gtk-save", Gtk.ResponseType.ACCEPT); btnSave.clicked.connect (btnSave_clicked); - + // btnCancel btnCancel = (Button) add_button ("gtk-cancel", Gtk.ResponseType.CANCEL); btnCancel.clicked.connect (btnCancel_clicked); } - + private void chkOutput_clicked(){ fcbOutput.set_sensitive(!chkOutput.active); } - + private void chkBackup_clicked(){ fcbBackup.set_sensitive(!chkBackup.active); } - + private void btnSave_clicked(){ if (chkOutput.active){ App.OutputDirectory = ""; @@ -135,7 +174,7 @@ App.OutputDirectory = fcbOutput.get_filename(); } } - + if (chkBackup.active){ App.BackupDirectory = ""; } @@ -144,13 +183,15 @@ App.BackupDirectory = fcbBackup.get_filename(); } } - + + App.TileView = (cmbFileView.active == 1); + // Save settings App.save_config(); - + destroy(); } - + private void btnCancel_clicked(){ destroy(); }
View file
selene_2.5.2~185~ubuntu15.04.1.tar.xz/src/DonationWindow.vala -> selene_2.5.8~198~ubuntu15.10.1.tar.xz/src/DonationWindow.vala
Changed
@@ -1,26 +1,26 @@ /* * DonationWindow.vala - * + * * Copyright 2012 Tony George <teejee2008@gmail.com> * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. - * + * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. - * + * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, * MA 02110-1301, USA. - * - * + * + * */ - + using Gtk; using TeeJee.Logging; @@ -38,23 +38,23 @@ set_destroy_with_parent (true); set_modal (true); skip_taskbar_hint = false; - set_default_size (400, 20); + set_default_size (400, 20); icon = get_app_icon(16); - + //vbox_main Box vbox_main = get_content_area(); vbox_main.margin = 6; vbox_main.homogeneous = false; - + get_action_area().visible = false; - + //lbl_message Label lbl_message = new Gtk.Label(""); string msg = _("Did you find this software useful?\n\nYou can buy me a coffee or make a donation via PayPal to show your support. Or just drop me an email and say Hi.\n\nThis application is completely free and will continue to remain that way. Your contributions will help in keeping this project alive and to develop it further.\n\nFeel free to drop me an email if you find any issues or if you have suggestions for improvement.\n\nRegards,\nTony George\nteejeetech@gmail.com"); lbl_message.label = msg; lbl_message.wrap = true; vbox_main.pack_start(lbl_message,true,true,0); - + //vbox_actions Box vbox_actions = new Box (Orientation.VERTICAL, 6); vbox_actions.margin_left = 50; @@ -75,7 +75,7 @@ btn_send_email.clicked.connect(()=>{ xdg_open("mailto:teejeetech@gmail.com"); }); - + //btn_visit Button btn_visit = new Button.with_label(" " + _("Visit Website") + " "); vbox_actions.add(btn_visit);
View file
selene_2.5.2~185~ubuntu15.04.1.tar.xz/src/EncoderConfigWindow.vala -> selene_2.5.8~198~ubuntu15.10.1.tar.xz/src/EncoderConfigWindow.vala
Changed
@@ -1,26 +1,26 @@ /* * ConfigWindow.vala - * + * * Copyright 2012 Tony George <teejee2008@gmail.com> * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. - * + * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. - * + * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, * MA 02110-1301, USA. - * - * + * + * */ - + using Gtk; using Json; @@ -34,50 +34,50 @@ using TeeJee.Misc; public class EncoderConfigWindow : Dialog { - + public string Folder; public string Name; public bool CreateNew = false; - + private Notebook tabMain; private Box vboxMain; private Label lblGeneral; private Grid gridGeneral; - + private Label lblVideo; private Grid gridVideo; - + private Label lblAudio; private Grid gridAudio; - + private Label lblSubtitle; private Grid gridSubtitle; - + private Label lblVideoFilters; private Grid gridVideoFilters; - + private Label lblAudioFilters; private Grid gridAudioFilters; - + private Label lblPresetName; private Entry txtPresetName; private Label lblFileFormat; private ComboBox cmbFileFormat; - + private Label lblFileExtension; private ComboBox cmbFileExtension; - + private Label lblVCodec; private ComboBox cmbVCodec; - + private Label lblVideoMode; private ComboBox cmbVideoMode; - + private Label lblVideoBitrate; private SpinButton spinVideoBitrate; - + private ComboBox cmbX264Preset; private Label lblX264Preset; @@ -86,10 +86,11 @@ private Label lblVideoQuality; private SpinButton spinVideoQuality; - + + private ComboBox cmbVpxSpeed; private Label lblVpxSpeed; private Scale scaleVpxSpeed; - + private Label lblHeaderFileFormat; private Label lblHeaderPreset; private Label lblHeaderFrameSize; @@ -98,7 +99,7 @@ private Gtk.Image imgAudioCodec; private Gtk.Image imgVideoCodec; private Gtk.Image imgFileFormat; - + private Label lblFrameSize; private ComboBox cmbFrameSize; private Label lblFrameSizeCustom; @@ -107,7 +108,7 @@ private Box hboxFrameSize; private CheckButton chkNoUpScale; private CheckButton chkFitToBox; - + private Label lblFPS; private ComboBox cmbFPS; private Label lblFPSCustom; @@ -116,37 +117,37 @@ private Box hboxFPS; private Label lblResizingMethod; private ComboBox cmbResizingMethod; - + private Label lblVCodecOptions; private Gtk.TextView txtVCodecOptions; - + private Label lblACodec; private ComboBox cmbACodec; - + private Label lblAudioMode; private ComboBox cmbAudioMode; - + private Label lblAudioBitrate; private SpinButton spinAudioBitrate; - + private Label lblAudioQuality; private SpinButton spinAudioQuality; - + private Label lblOpusOptimize; private ComboBox cmbOpusOptimize; - + private Label lblAuthorName; private Entry txtAuthorName; - + private Label lblAuthorEmail; private Entry txtAuthorEmail; - + private Label lblPresetVersion; private Entry txtPresetVersion; - + private Label lblAudioSampleRate; private ComboBox cmbAudioSampleRate; - + private Label lblAudioChannels; private ComboBox cmbAudioChannels; @@ -172,30 +173,30 @@ private Label lblSubtitleMode; private ComboBox cmbSubtitleMode; - + private Label lblSubFormatMessage; - + private Button btnSave; private Button btnCancel; - + public EncoderConfigWindow() { title = "Preset"; - set_default_size (400, 550); - - window_position = WindowPosition.CENTER_ON_PARENT; - destroy_with_parent = true; - skip_taskbar_hint = true; + set_default_size (450, 550); + + window_position = WindowPosition.CENTER_ON_PARENT; + destroy_with_parent = true; + skip_taskbar_hint = true; modal = true; icon = get_app_icon(16); - + this.delete_event.connect(on_delete_event); - + int row = 0; Gtk.ListStore model; Gtk.CellRendererText textCell; Gtk.TreeIter iter; string tt; - + //get content area vboxMain = get_content_area(); @@ -205,27 +206,29 @@ tabMain.set_show_border(false); tabMain.margin = 6; vboxMain.pack_start (tabMain, true, true, 0); - + //styles --------------------------------------------------- - - string css_style = """ + + /*string css_style = """ GtkNotebook tab { - padding: 0px; + padding: 1px; } """;//color: #703910; - + CssProvider css_provider = new CssProvider(); try { css_provider.load_from_data(css_style,-1); Gtk.StyleContext.add_provider_for_screen(this.get_screen(),css_provider,Gtk.STYLE_PROVIDER_PRIORITY_USER); } catch (GLib.Error e) { warning(e.message); - } + }*/ + + /* Note: Setting tab button padding to 0 causes problems with some GTK themes like Mint-X */ //General tab --------------------------------------------- - + //lblGeneral - lblGeneral = new Label (" " + _("General") + " "); + lblGeneral = new Label ("" + _("General") + ""); //gridGeneral gridGeneral = new Grid(); @@ -234,9 +237,9 @@ gridGeneral.margin = 12; gridGeneral.visible = false; tabMain.append_page (gridGeneral, lblGeneral); - + row = -1; - + //lblHeaderFileFormat lblHeaderFileFormat = new Gtk.Label(_("<b>File Format:</b>")); lblHeaderFileFormat.set_use_markup(true); @@ -244,15 +247,15 @@ //lblHeaderFileFormat.margin_top = 6; lblHeaderFileFormat.margin_bottom = 6; gridGeneral.attach(lblHeaderFileFormat,0,++row,2,1); - + //lblFileFormat lblFileFormat = new Gtk.Label(_("Format")); lblFileFormat.xalign = (float) 0.0; gridGeneral.attach(lblFileFormat,0,++row,1,1); - + //cmbFileFormat model = new Gtk.ListStore (2, typeof (string), typeof (string)); - + model.append (out iter); model.set (iter,0,_("Matroska Video (*.mkv)"),1,"mkv"); model.append (out iter); @@ -275,7 +278,7 @@ model.set (iter,0,_("Opus Audio (*.opus)"),1,"opus"); model.append (out iter); model.set (iter,0,_("WAV Audio (*.wav)"),1,"wav"); - + cmbFileFormat = new ComboBox.with_model(model); textCell = new CellRendererText(); cmbFileFormat.pack_start( textCell, false ); @@ -293,7 +296,7 @@ cmbFileExtension.pack_start( textCell, false ); cmbFileExtension.set_attributes( textCell, "text", 0 ); gridGeneral.attach(cmbFileExtension,1,row,1,1); - + //lblHeaderPreset lblHeaderPreset = new Gtk.Label(_("<b>Preset:</b>")); lblHeaderPreset.set_use_markup(true); @@ -301,63 +304,63 @@ lblHeaderPreset.margin_top = 6; lblHeaderPreset.margin_bottom = 6; gridGeneral.attach(lblHeaderPreset,0,++row,2,1); - + //lblPresetName lblPresetName = new Gtk.Label(_("Name")); lblPresetName.xalign = (float) 0.0; gridGeneral.attach(lblPresetName,0,++row,1,1); - + //txtPresetName txtPresetName = new Gtk.Entry(); txtPresetName.xalign = (float) 0.0; txtPresetName.text = _("New Preset"); txtPresetName.hexpand = true; gridGeneral.attach(txtPresetName,1,row,1,1); - + //lblPresetVersion lblPresetVersion = new Gtk.Label(_("Version")); lblPresetVersion.xalign = (float) 0.0; gridGeneral.attach(lblPresetVersion,0,++row,1,1); - + //txtPresetVersion txtPresetVersion = new Gtk.Entry(); txtPresetVersion.xalign = (float) 0.0; txtPresetVersion.text = "1.0"; gridGeneral.attach(txtPresetVersion,1,row,1,1); - + //lblAuthorName lblAuthorName = new Gtk.Label(_("Author")); lblAuthorName.xalign = (float) 0.0; gridGeneral.attach(lblAuthorName,0,++row,1,1); - + //txtAuthorName txtAuthorName = new Gtk.Entry(); txtAuthorName.xalign = (float) 0.0; txtAuthorName.text = ""; gridGeneral.attach(txtAuthorName,1,row,1,1); - + //lblAuthorEmail lblAuthorEmail = new Gtk.Label(_("Email")); lblAuthorEmail.xalign = (float) 0.0; gridGeneral.attach(lblAuthorEmail,0,++row,1,1); - + //txtAuthorEmail txtAuthorEmail = new Gtk.Entry(); txtAuthorEmail.xalign = (float) 0.0; txtAuthorEmail.text = ""; gridGeneral.attach(txtAuthorEmail,1,row,1,1); - + //imgFileFormat imgFileFormat = new Gtk.Image(); imgFileFormat.margin_top = 6; imgFileFormat.margin_bottom = 6; imgFileFormat.expand = true; gridGeneral.attach(imgFileFormat,0,++row,2,1); - + //Video tab --------------------------------------------- - + //lblVideo - lblVideo = new Label(" " + _("Video") + " "); + lblVideo = new Label("" + _("Video") + ""); //gridVideo gridVideo = new Grid(); @@ -366,14 +369,14 @@ gridVideo.visible = false; gridVideo.margin = 12; tabMain.append_page (gridVideo, lblVideo); - + row = -1; - + //lblVCodec lblVCodec = new Gtk.Label(_("Format / Codec")); lblVCodec.xalign = (float) 0.0; gridVideo.attach(lblVCodec,0,++row,1,1); - + //cmbVCodec cmbVCodec = new ComboBox(); textCell = new CellRendererText(); @@ -382,12 +385,12 @@ cmbVCodec.changed.connect(cmbVCodec_changed); cmbVCodec.hexpand = true; gridVideo.attach(cmbVCodec,1,row,1,1); - + //lblVideoMode lblVideoMode = new Gtk.Label(_("Encoding Mode")); lblVideoMode.xalign = (float) 0.0; gridVideo.attach(lblVideoMode,0,++row,1,1); - + //cmbVideoMode cmbVideoMode = new ComboBox(); textCell = new CellRendererText(); @@ -407,9 +410,9 @@ spinVideoBitrate = new Gtk.SpinButton (adjVideoBitrate, 0.1, 2); spinVideoBitrate.xalign = (float) 0.5; gridVideo.attach(spinVideoBitrate,1,row,1,1); - + tt = _("<b>Compression Vs Quality</b>\nSmaller values give better quality video and larger files"); - + //lblVideoQuality lblVideoQuality = new Gtk.Label(_("Quality")); lblVideoQuality.xalign = (float) 0.0; @@ -422,15 +425,15 @@ spinVideoQuality.set_tooltip_markup(tt); spinVideoQuality.xalign = (float) 0.5; gridVideo.attach(spinVideoQuality,1,row,1,1); - + tt = _("<b>Compression Vs Encoding Speed</b>\nSlower presets give better compression and smaller files\nbut take more time to encode."); - + //lblPreset lblX264Preset = new Gtk.Label(_("Preset")); lblX264Preset.xalign = (float) 0.0; lblX264Preset.set_tooltip_markup(tt); gridVideo.attach(lblX264Preset,0,++row,1,1); - + //cmbx264Preset model = new Gtk.ListStore (2, typeof (string), typeof (string)); model.append (out iter); @@ -447,7 +450,7 @@ model.set (iter, 0, _("Slower"), 1, "slower"); model.append (out iter); model.set (iter, 0, _("VerySlow"), 1, "veryslow"); - + cmbX264Preset = new ComboBox.with_model(model); textCell = new CellRendererText(); cmbX264Preset.pack_start( textCell, false ); @@ -456,13 +459,13 @@ gridVideo.attach(cmbX264Preset,1,row,1,1); tt = _("<b>Compression Vs Device Compatibility</b>\n'High' profile gives the best compression.\nChange this to 'Baseline' or 'Main' only if you are encoding\nfor a particular device (mobiles,PMPs,etc) which does not\nsupport the 'High' profile"); - + //lblProfile lblX264Profile = new Gtk.Label(_("Profile")); lblX264Profile.xalign = (float) 0.0; lblX264Profile.set_tooltip_markup(tt); gridVideo.attach(lblX264Profile,0,++row,1,1); - + //cmbX264Profile cmbX264Profile = new ComboBox(); textCell = new CellRendererText(); @@ -471,31 +474,52 @@ cmbX264Profile.set_tooltip_markup(tt); gridVideo.attach(cmbX264Profile,1,row,1,1); - tt = _("<b>Quality Vs Encoding Speed</b>\nHigher values speed-up encoding at the expense of quality.\nLower values improve quality at the expense of encoding speed."); - //lblVpxSpeed lblVpxSpeed = new Gtk.Label(_("Speed")); lblVpxSpeed.xalign = (float) 0.0; lblVpxSpeed.no_show_all = true; - lblVpxSpeed.set_tooltip_markup(tt); gridVideo.attach(lblVpxSpeed,0,++row,1,1); - + + Box hboxVpxSpeed = new Box (Orientation.HORIZONTAL, 0); + hboxVpxSpeed.homogeneous = false; + gridVideo.attach(hboxVpxSpeed,1,row,1,1); + + //cmbVpxSpeed + model = new Gtk.ListStore (2, typeof (string), typeof (string)); + model.append (out iter); + model.set (iter, 0, _("Best"), 1, "best"); + model.append (out iter); + model.set (iter, 0, _("Good"), 1, "good"); + model.append (out iter); + model.set (iter, 0, _("Realtime"), 1, "realtime"); + cmbVpxSpeed = new ComboBox.with_model(model); + textCell = new CellRendererText(); + cmbVpxSpeed.pack_start( textCell, false ); + cmbVpxSpeed.set_attributes( textCell, "text", 0 ); + hboxVpxSpeed.add(cmbVpxSpeed); + + cmbVpxSpeed.changed.connect(cmbVpxSpeed_changed); + + Label lblSpacer = new Gtk.Label(" "); + hboxVpxSpeed.add(lblSpacer); + //scaleVpxSpeed - scaleVpxSpeed = new Gtk.Scale.with_range (Gtk.Orientation.HORIZONTAL, -16, 16, 1); + scaleVpxSpeed = new Gtk.Scale.with_range (Gtk.Orientation.HORIZONTAL, 0, 5, 1); scaleVpxSpeed.adjustment.value = 1; scaleVpxSpeed.has_origin = false; scaleVpxSpeed.value_pos = PositionType.LEFT; - gridVideo.attach(scaleVpxSpeed,1,row,1,1); + scaleVpxSpeed.hexpand = true; + hboxVpxSpeed.add(scaleVpxSpeed); tt = _("<b>Additional Options</b>\nThese options will be passed to the encoder\non the command line. Please do not specify\nany options that are already provided by the GUI."); - + //lblVCodecOptions lblVCodecOptions = new Gtk.Label(_("Extra Options")); lblVCodecOptions.xalign = (float) 0.0; lblVCodecOptions.margin_top = 6; lblVCodecOptions.set_tooltip_markup(tt); gridVideo.attach(lblVCodecOptions,0,++row,1,1); - + //txtVCodecOptions txtVCodecOptions = new Gtk.TextView(); TextBuffer buff = new TextBuffer(null); @@ -506,23 +530,23 @@ //txtVCodecOptions.set_size_request(-1,100); txtVCodecOptions.set_tooltip_markup(tt); txtVCodecOptions.set_wrap_mode (Gtk.WrapMode.WORD); - + Gtk.ScrolledWindow scrollWin = new Gtk.ScrolledWindow (null, null); scrollWin.set_shadow_type (ShadowType.ETCHED_IN); scrollWin.add (txtVCodecOptions); //scrollWin.set_size_request(-1,100); gridVideo.attach(scrollWin,0,++row,2,1); - + //imgVideoCodec imgVideoCodec = new Gtk.Image(); imgVideoCodec.margin_top = 6; imgVideoCodec.margin_bottom = 6; gridVideo.attach(imgVideoCodec,0,++row,2,1); - + //Video Filters tab --------------------------------------------- - + //lblVideoFilters - lblVideoFilters = new Label (" " + _("Filters") + " "); + lblVideoFilters = new Label ("" + _("Filters") + ""); //gridVideoFilters gridVideoFilters = new Grid(); @@ -531,21 +555,21 @@ gridVideoFilters.margin = 12; gridVideoFilters.visible = false; tabMain.append_page (gridVideoFilters, lblVideoFilters); - + row = -1; - + //lblHeaderFrameSize lblHeaderFrameSize = new Gtk.Label(_("<b>Resize:</b>")); lblHeaderFrameSize.set_use_markup(true); lblHeaderFrameSize.xalign = (float) 0.0; lblHeaderFrameSize.margin_bottom = 6; gridVideoFilters.attach(lblHeaderFrameSize,0,++row,1,1); - + //lblFrameSize lblFrameSize = new Gtk.Label(_("Resolution")); lblFrameSize.xalign = (float) 0.0; gridVideoFilters.attach(lblFrameSize,0,++row,1,1); - + //cmbFrameSize model = new Gtk.ListStore (2, typeof (string), typeof (string)); model.append (out iter); @@ -560,7 +584,7 @@ model.set (iter,0,"720p",1,"720p"); model.append (out iter); model.set (iter,0,"1080p",1,"1080p"); - + cmbFrameSize = new ComboBox.with_model(model); textCell = new CellRendererText(); cmbFrameSize.pack_start( textCell, false ); @@ -568,7 +592,7 @@ cmbFrameSize.changed.connect(cmbFrameSize_changed); cmbFrameSize.hexpand = true; gridVideoFilters.attach(cmbFrameSize,1,row,1,1); - + tt = _("Set either Width or Height and leave the other as 0.\nIt will be calculated automatically.\n\nSetting both width and height is not recommended\nsince the video may get stretched or squeezed.\n\nEnable the 'Fit-To-Box' option to avoid changes to aspect ratio."); //lblFrameSizeCustom @@ -600,9 +624,9 @@ spinFrameHeight.width_chars = 5; spinFrameHeight.set_tooltip_text (_("Height")); hboxFrameSize.pack_start (spinFrameHeight, false, false, 5); - + tt = _("The resizing filter affects the sharpness and compressibility of the video.\nFor example, the 'Lanzos' filter gives sharper video but the extra detail\nmakes the video more difficult to compress resulting in slightly bigger files.\nThe 'Bilinear' filter gives smoother video (less detail) and smaller files."); - + //lblResizingMethod lblResizingMethod = new Gtk.Label(_("Resizing Method")); lblResizingMethod.xalign = (float) 0.0; @@ -620,15 +644,15 @@ gridVideoFilters.attach(cmbResizingMethod,1,row,1,1); tt = _("Fits the video in a box of given width and height."); - + //chkFitToBox chkFitToBox = new CheckButton.with_label(_("Do not stretch or squeeze the video (Fit-To-Box)")); chkFitToBox.active = true; chkFitToBox.set_tooltip_markup(tt); gridVideoFilters.attach(chkFitToBox,0,++row,2,1); - + tt = _("Video will not be resized if it's smaller than the given width and height"); - + //chkNoUpScale chkNoUpScale = new CheckButton.with_label(_("No Up-Scaling")); chkNoUpScale.active = true; @@ -642,13 +666,13 @@ lblHeaderFrameRate.margin_top = 6; lblHeaderFrameRate.margin_bottom = 6; gridVideoFilters.attach(lblHeaderFrameRate,0,++row,1,1); - + //lblFPS lblFPS = new Gtk.Label(_("Frame Rate")); lblFPS.xalign = (float) 0.0; lblFPS.set_tooltip_text (_("Frames/sec")); gridVideoFilters.attach(lblFPS,0,++row,1,1); - + //cmbFPS model = new Gtk.ListStore (2, typeof (string), typeof (string)); model.append (out iter); @@ -663,14 +687,14 @@ model.set (iter,0,"30",1,"30"); model.append (out iter); model.set (iter,0,"60",1,"60"); - + cmbFPS = new ComboBox.with_model(model); textCell = new CellRendererText(); cmbFPS.pack_start( textCell, false ); cmbFPS.set_attributes( textCell, "text", 0 ); cmbFPS.changed.connect(cmbFPS_changed); gridVideoFilters.attach(cmbFPS,1,row,1,1); - + //lblFPSCustom lblFPSCustom = new Gtk.Label(_("FPS Ratio")); lblFPSCustom.xalign = (float) 0.0; @@ -683,7 +707,7 @@ hboxFPS = new Box (Orientation.HORIZONTAL, 0); hboxFPS.homogeneous = false; gridVideoFilters.attach(hboxFPS,1,row,1,1); - + //spinFPSNum Gtk.Adjustment adjFPSNum = new Gtk.Adjustment(0, 0, 999999, 1, 1, 0); spinFPSNum = new Gtk.SpinButton (adjFPSNum, 1, 0); @@ -692,7 +716,7 @@ spinFPSNum.width_chars = 5; spinFPSNum.set_tooltip_text (_("Numerator")); hboxFPS.pack_start(spinFPSNum, false, false, 0); - + //spinFPSDenom Gtk.Adjustment adjFPSDenom = new Gtk.Adjustment(0, 0, 999999, 1, 1, 0); spinFPSDenom = new Gtk.SpinButton (adjFPSDenom, 1, 0); @@ -701,11 +725,11 @@ spinFPSDenom.width_chars = 5; spinFPSDenom.set_tooltip_text (_("Denominator")); hboxFPS.pack_start(spinFPSDenom, false, false, 5); - + // Audio tab -------------------------------------------------- - + //lblAudio - lblAudio = new Label (" " + _("Audio") + " "); + lblAudio = new Label ("" + _("Audio") + ""); //gridAudio gridAudio = new Grid(); @@ -714,14 +738,14 @@ gridAudio.margin = 12; gridAudio.visible = false; tabMain.append_page (gridAudio, lblAudio); - + row = -1; //lblACodec lblACodec = new Gtk.Label(_("Format / Codec")); lblACodec.xalign = (float) 0.0; gridAudio.attach(lblACodec,0,++row,1,1); - + //cmbACodec cmbACodec = new ComboBox(); textCell = new CellRendererText(); @@ -730,7 +754,7 @@ cmbACodec.changed.connect(cmbACodec_changed); cmbACodec.hexpand = true; gridAudio.attach(cmbACodec,1,row,1,1); - + //lblAudioMode lblAudioMode = new Gtk.Label(_("Encoding Mode")); lblAudioMode.xalign = (float) 0.0; @@ -743,29 +767,29 @@ cmbAudioMode.set_attributes(textCell, "text", 0); cmbAudioMode.changed.connect(cmbAudioMode_changed); gridAudio.attach(cmbAudioMode,1,row,1,1); - + //lblAudioBitrate lblAudioBitrate = new Gtk.Label(_("Bitrate (kbps)")); lblAudioBitrate.xalign = (float) 0.0; gridAudio.attach(lblAudioBitrate,0,++row,1,1); - + //spinAudioBitrate Gtk.Adjustment adjAudioBitrate = new Gtk.Adjustment(128, 32, 320, 1, 1, 0); spinAudioBitrate = new Gtk.SpinButton (adjAudioBitrate, 1, 0); spinAudioBitrate.xalign = (float) 0.5; gridAudio.attach(spinAudioBitrate,1,row,1,1); - + //lblAudioQuality lblAudioQuality = new Gtk.Label(_("Quality")); lblAudioQuality.xalign = (float) 0.0; gridAudio.attach(lblAudioQuality,0,++row,1,1); - + //spinAudioQuality Gtk.Adjustment adjAudioQuality = new Gtk.Adjustment(4, 0, 9, 1, 1, 0); spinAudioQuality = new Gtk.SpinButton (adjAudioQuality, 1, 0); spinAudioQuality.xalign = (float) 0.5; gridAudio.attach(spinAudioQuality,1,row,1,1); - + //lblOpusOptimize lblOpusOptimize = new Gtk.Label(_("Optimization")); lblOpusOptimize.xalign = (float) 0.0; @@ -780,7 +804,7 @@ cmbOpusOptimize.no_show_all = true; cmbOpusOptimize.set_size_request(150,-1); gridAudio.attach(cmbOpusOptimize,1,row,1,1); - + //populate model = new Gtk.ListStore (2, typeof (string), typeof (string)); model.append (out iter); @@ -790,18 +814,18 @@ model.append (out iter); model.set (iter,0,_("Music"),1,"music"); cmbOpusOptimize.set_model(model); - + //imgAudioCodec imgAudioCodec = new Gtk.Image(); imgAudioCodec.margin_top = 6; imgAudioCodec.margin_bottom = 6; imgAudioCodec.expand = true; gridAudio.attach(imgAudioCodec,0,++row,3,1); - + //Audio Filters tab --------------------------------------------- - + //lblAudioFilters - lblAudioFilters = new Label (" " + _("Filters") + " "); + lblAudioFilters = new Label ("" + _("Filters") + ""); //gridAudioFilters gridAudioFilters = new Grid(); @@ -810,7 +834,7 @@ gridAudioFilters.margin = 12; gridAudioFilters.visible = false; tabMain.append_page (gridAudioFilters, lblAudioFilters); - + row = -1; int col; @@ -819,20 +843,20 @@ lblHeaderSampling.set_use_markup(true); lblHeaderSampling.xalign = (float) 0.0; gridAudioFilters.attach(lblHeaderSampling,col=0,++row,2,1); - + //lblAudioSampleRate lblAudioSampleRate = new Gtk.Label(_("Sampling Rate (Hz)")); lblAudioSampleRate.xalign = (float) 0.0; gridAudioFilters.attach(lblAudioSampleRate,col=0,++row,1,1); - + //cmbAudioSampleRate cmbAudioSampleRate = new ComboBox(); textCell = new CellRendererText(); - cmbAudioSampleRate.pack_start(textCell, false); + cmbAudioSampleRate.pack_start(textCell, false); cmbAudioSampleRate.set_attributes(textCell, "text", 0); cmbAudioSampleRate.hexpand = true; gridAudioFilters.attach(cmbAudioSampleRate,col+1,row,1,1); - + //lblAudioChannels lblAudioChannels = new Gtk.Label(_("Channels")); lblAudioChannels.xalign = (float) 0.0; @@ -850,20 +874,20 @@ int scaleWidth = 200; int sliderMarginBottom = 0; int spacing = 5; - + //lblAudioFilters - Label lblAudioSox = new Label (" " + _("SOX") + " "); + Label lblAudioSox = new Label ("" + _("SOX") + ""); //vboxSox Box vboxSoxOuter = new Box(Orientation.VERTICAL,spacing); vboxSoxOuter.margin = 12; tabMain.append_page (vboxSoxOuter, lblAudioSox); - + //hboxSoxSwitch Box hboxSoxSwitch = new Box(Orientation.HORIZONTAL,0); hboxSoxSwitch.margin_bottom = 6; vboxSoxOuter.add(hboxSoxSwitch); - + //lblHeaderSox lblHeaderSox = new Gtk.Label(_("<b>SOX Audio Processing:</b>")); lblHeaderSox.set_use_markup(true); @@ -879,10 +903,10 @@ //vboxSox Box vboxSox = new Box(Orientation.VERTICAL,spacing); vboxSoxOuter.add(vboxSox); - + switchSox.notify["active"].connect(()=>{ vboxSox.sensitive = switchSox.active; - + App.Encoders["sox"].CheckAvailability(); if (!App.Encoders["sox"].IsAvailable){ if (switchSox.active){ @@ -891,7 +915,7 @@ } } }); - + switchSox.active = false; vboxSox.sensitive = switchSox.active; @@ -903,7 +927,7 @@ //lblHeaderAdjustments.margin_top = 5; lblHeaderAdjustments.margin_bottom = 5; vboxSox.add(lblHeaderAdjustments); - + //hboxBass Box hboxBass = new Box(Orientation.HORIZONTAL,spacing); vboxSox.add(hboxBass); @@ -914,7 +938,7 @@ lblAudioBass.xalign = (float) 0.0; lblAudioBass.set_tooltip_text(tt); hboxBass.pack_start(lblAudioBass,false,false,0); - + scaleBass = new Gtk.Scale.with_range (Gtk.Orientation.HORIZONTAL, -20, 20, 1); scaleBass.adjustment.value = 0; scaleBass.has_origin = false; @@ -922,25 +946,25 @@ scaleBass.set_size_request(scaleWidth,-1); scaleBass.margin_bottom = sliderMarginBottom; hboxBass.pack_start(scaleBass,true,true,0); - + scaleBass.format_value.connect((val)=>{ return "%.0f ".printf(val); }); Button btnReset = new Button.with_label("X"); btnReset.clicked.connect(()=>{ scaleBass.adjustment.value = 0; }); btnReset.set_tooltip_text(_("Reset")); hboxBass.pack_start(btnReset,false,true,0); - + //hboxTreble Box hboxTreble = new Box(Orientation.HORIZONTAL,spacing); vboxSox.add(hboxTreble); tt = _("Boost or cut the treble (upper) frequencies of the audio."); - + lblAudioTreble = new Gtk.Label(_("Treble (upper freq)") + ": "); lblAudioTreble.xalign = (float) 0.0; lblAudioTreble.set_tooltip_text(tt); hboxTreble.pack_start(lblAudioTreble,false,false,0); - + scaleTreble = new Gtk.Scale.with_range (Gtk.Orientation.HORIZONTAL, -20, 20, 1); scaleTreble.adjustment.value = 0; scaleTreble.has_origin = false; @@ -948,14 +972,14 @@ scaleTreble.set_size_request(scaleWidth,-1); scaleTreble.margin_bottom = sliderMarginBottom; hboxTreble.pack_start(scaleTreble,true,true,0); - + scaleTreble.format_value.connect((val)=>{ return "%.0f ".printf(val); }); btnReset = new Button.with_label("X"); btnReset.clicked.connect(()=>{ scaleTreble.adjustment.value = 0; }); btnReset.set_tooltip_text(_("Reset")); hboxTreble.pack_start(btnReset,false,true,0); - + //hboxPitch Box hboxPitch = new Box(Orientation.HORIZONTAL,spacing); vboxSox.add(hboxPitch); @@ -966,7 +990,7 @@ lblAudioPitch.xalign = (float) 0.0; lblAudioPitch.set_tooltip_text(tt); hboxPitch.pack_start(lblAudioPitch,false,false,0); - + scalePitch = new Gtk.Scale.with_range (Gtk.Orientation.HORIZONTAL, 0, 500, 1); scalePitch.adjustment.value = 100; //scalePitch.has_origin = false; @@ -974,25 +998,25 @@ scalePitch.set_size_request(scaleWidth,-1); scalePitch.margin_bottom = sliderMarginBottom; hboxPitch.pack_start(scalePitch,true,true,0); - + scalePitch.format_value.connect((val)=>{ return "%.0f%% ".printf(val); }); btnReset = new Button.with_label("X"); btnReset.clicked.connect(()=>{ scalePitch.adjustment.value = 100; }); btnReset.set_tooltip_text(_("Reset")); hboxPitch.pack_start(btnReset,false,true,0); - + //hboxTempo Box hboxTempo = new Box(Orientation.HORIZONTAL,spacing); vboxSox.add(hboxTempo); - + tt = _("Change audio tempo (speed) without changing audio pitch (shrillness).\n\nWARNING: This will change the duration of the audio track"); lblAudioTempo = new Gtk.Label(_("Tempo (speed)") + ": "); lblAudioTempo.xalign = (float) 0.0; lblAudioTempo.set_tooltip_text(tt); hboxTempo.pack_start(lblAudioTempo,false,false,0); - + scaleTempo = new Gtk.Scale.with_range (Gtk.Orientation.HORIZONTAL, 30, 200, 1); scaleTempo.adjustment.value = 100; //scaleTempo.has_origin = false; @@ -1007,7 +1031,7 @@ btnReset.clicked.connect(()=>{ scaleTempo.adjustment.value = 100; }); btnReset.set_tooltip_text(_("Reset")); hboxTempo.pack_start(btnReset,false,true,0); - + //lblHeaderFade Label lblHeaderFade = new Gtk.Label(_("<b>Fade:</b>")); lblHeaderFade.set_use_markup(true); @@ -1016,11 +1040,11 @@ lblHeaderFade.margin_top = 5; lblHeaderFade.margin_bottom = 5; vboxSox.add(lblHeaderFade); - + //hboxFadeIn Box hboxFadeIn = new Box(Orientation.HORIZONTAL,spacing); vboxSox.add(hboxFadeIn); - + lblFadeIn = new Gtk.Label(_("Fade In (seconds)")); lblFadeIn.xalign = (float) 0.0; lblFadeIn.set_size_request(150,-1); @@ -1030,11 +1054,11 @@ spinFadeIn = new Gtk.SpinButton (adjFadeIn, 1, 0); spinFadeIn.xalign = (float) 0.5; hboxFadeIn.pack_start(spinFadeIn,false,false,0); - + //hboxFadeOut Box hboxFadeOut = new Box(Orientation.HORIZONTAL,spacing); vboxSox.add(hboxFadeOut); - + lblFadeOut = new Gtk.Label(_("Fade Out (seconds)")); lblFadeOut.xalign = (float) 0.0; lblFadeOut.set_size_request(150,-1); @@ -1044,7 +1068,7 @@ spinFadeOut = new Gtk.SpinButton (adjFadeOut, 1, 0); spinFadeOut.xalign = (float) 0.5; hboxFadeOut.pack_start(spinFadeOut,false,false,0); - + //hboxFadeType Box hboxFadeType = new Box(Orientation.HORIZONTAL,spacing); vboxSox.add(hboxFadeType); @@ -1053,13 +1077,13 @@ lblFadeType.xalign = (float) 0.0; lblFadeType.set_size_request(150,-1); hboxFadeType.pack_start(lblFadeType,false,false,0); - + cmbFadeType = new ComboBox(); textCell = new CellRendererText(); cmbFadeType.pack_start(textCell, false); cmbFadeType.set_attributes(textCell, "text", 0); hboxFadeType.pack_start(cmbFadeType,false,false,0); - + model = new Gtk.ListStore (2, typeof (string), typeof (string)); model.append (out iter); model.set (iter,0,_("Quarter Sine"),1,"q"); @@ -1081,19 +1105,19 @@ lblHeaderOther.margin_top = 5; lblHeaderOther.margin_bottom = 5; vboxSox.add(lblHeaderOther); - + //hboxNormalize Box hboxNormalize = new Box(Orientation.HORIZONTAL,0); vboxSox.add(hboxNormalize); tt = _("Maximize the volume level (loudness)"); - + lblNormalize = new Gtk.Label(_("Maximize Volume Level (Normalize)")); lblNormalize.xalign = (float) 0.0; lblNormalize.hexpand = true; lblNormalize.set_tooltip_text(tt); hboxNormalize.pack_start(lblNormalize,true,true,0); - + switchNormalize = new Gtk.Switch(); switchNormalize.set_size_request(100,-1); switchNormalize.active = false; @@ -1104,7 +1128,7 @@ vboxSox.add(hboxEarWax); tt = _("Makes audio easier to listen to on headphones. Adds 'cues' to the audio so that when listened to on headphones the stereo image is moved from inside your head (standard for headphones) to outside and in front of the listener (standard for speakers)."); - + lblEarWax = new Gtk.Label(_("Adjust Stereo for Headphones")); lblEarWax.xalign = (float) 0.0; lblEarWax.hexpand = true; @@ -1122,11 +1146,11 @@ lnkSoxHome.valign = Align.END; lnkSoxHome.activate_link.connect(()=>{ return exo_open_url(lnkSoxHome.uri); }); vboxSoxOuter.pack_end(lnkSoxHome,true,true,0); - + //Subtitles tab --------------------------------------------- - + //lblSubtitle - lblSubtitle = new Label (" " + _("Subs") + " "); + lblSubtitle = new Label ("" + _("Subs") + ""); //gridSubtitle gridSubtitle = new Grid(); @@ -1135,19 +1159,19 @@ gridSubtitle.margin = 12; gridSubtitle.visible = false; tabMain.append_page (gridSubtitle, lblSubtitle); - + row = -1; - + tt = _("<b>Embed</b> - Subtitle files will be combined with the output file.\nThese subtitles can be switched off since they are added as a separate track"); tt += "\n\n"; tt += _("<b>Render</b> - Subtitles are rendered/burned on the video.\nThese subtitles cannot be switched off since they become a part of the video"); - + //lblSubtitleMode lblSubtitleMode = new Gtk.Label(_("Subtitle Mode")); lblSubtitleMode.xalign = (float) 0.0; lblSubtitleMode.set_tooltip_markup (tt); gridSubtitle.attach(lblSubtitleMode,0,++row,1,1); - + //cmbSubtitleMode cmbSubtitleMode = new ComboBox(); textCell = new CellRendererText(); @@ -1157,7 +1181,7 @@ cmbSubtitleMode.hexpand = true; cmbSubtitleMode.set_tooltip_markup (tt); gridSubtitle.attach(cmbSubtitleMode,1,row,1,1); - + //lblSubFormatMessage lblSubFormatMessage = new Gtk.Label(_("Subtitles")); lblSubFormatMessage.xalign = (float) 0.0; @@ -1168,7 +1192,7 @@ gridSubtitle.attach(lblSubFormatMessage,0,++row,2,1); //Defaults -------------------------------- - + cmbFileFormat.set_active(0); //cmbAudioMode.set_active(0); //cmbVideoMode.set_active(0); @@ -1176,36 +1200,37 @@ cmbOpusOptimize.set_active(0); cmbX264Preset.set_active(3); //cmbX264Profile.set_active(2); + cmbVpxSpeed.set_active (1); cmbFPS.set_active (0); cmbFrameSize.set_active (0); cmbFadeType.set_active (0); //cmbResizingMethod.set_active (2); //cmbFileExtension.set_active (0); - + // Actions ---------------------------------------------- - + //btnSave btnSave = (Button) add_button ("gtk-save", Gtk.ResponseType.ACCEPT); btnSave.clicked.connect (btnSave_clicked); - + //btnCancel btnCancel = (Button) add_button ("gtk-cancel", Gtk.ResponseType.CANCEL); btnCancel.clicked.connect (() => { destroy(); }); } - + private bool on_delete_event(Gdk.EventAny event){ this.delete_event.disconnect(on_delete_event); //disconnect this handler btnSave_clicked(); return false; } - + private void cmbFileFormat_changed(){ - ListStore model; + Gtk.ListStore model; TreeIter iter; - + //populate file extensions --------------------------- - - model = new ListStore(2, typeof(string), typeof(string)); + + model = new Gtk.ListStore(2, typeof(string), typeof(string)); cmbFileExtension.set_model(model); switch (format) { @@ -1243,12 +1268,12 @@ cmbFileExtension.set_active(0); break; } - + //populate video codecs --------------------------- - + model = new Gtk.ListStore (2, typeof (string), typeof (string)); cmbVCodec.set_model(model); - + switch (format) { case "mkv": model.append (out iter); @@ -1282,7 +1307,7 @@ cmbVCodec.set_active(0); break; } - + switch (format) { case "mkv": case "mp4v": @@ -1296,12 +1321,12 @@ gridVideoFilters.sensitive = false; break; } - + //populate audio codecs --------------------------- - + model = new Gtk.ListStore (2, typeof (string), typeof (string)); cmbACodec.set_model(model); - + switch (format) { case "mkv": model.append (out iter); @@ -1312,7 +1337,7 @@ model.set (iter,0,"AAC / Nero",1,"neroaac"); cmbACodec.set_active(1); break; - + case "mp4v": model.append (out iter); model.set (iter,0,_("Disable Audio"),1,"disable"); @@ -1320,7 +1345,7 @@ model.set (iter,0,"AAC / Nero",1,"neroaac"); cmbACodec.set_active(1); break; - + case "ogv": case "webm": model.append (out iter); @@ -1329,7 +1354,7 @@ model.set (iter,0,"Vorbis",1,"vorbis"); cmbACodec.set_active(1); break; - + case "ogg": model.append (out iter); model.set (iter,0,"Vorbis",1,"vorbis"); @@ -1341,31 +1366,31 @@ model.set (iter,0,"MP3 / LAME",1,"mp3lame"); cmbACodec.set_active(0); break; - + case "mp4a": model.append (out iter); model.set (iter,0,"AAC / Nero",1,"neroaac"); cmbACodec.set_active(0); break; - + case "opus": model.append (out iter); model.set (iter,0,"Opus",1,"opus"); cmbACodec.set_active(0); break; - + case "ac3": model.append (out iter); model.set (iter,0,"AC3 / Libav",1,"ac3"); cmbACodec.set_active(0); break; - + case "flac": model.append (out iter); model.set (iter,0,"FLAC / Libav",1,"flac"); cmbACodec.set_active(0); break; - + case "wav": //model.append (out iter); //model.set (iter,0,"PCM 8-bit Signed / Libav",1,"pcm_s8"); @@ -1398,33 +1423,33 @@ cmbACodec.set_active(1); break; } - + //populate subtitle options - + model = new Gtk.ListStore (2, typeof (string), typeof (string)); cmbSubtitleMode.set_model(model); - + switch (format){ case "mkv": case "mp4v": case "ogg": case "ogv": gridSubtitle.sensitive = true; - + model.append (out iter); model.set (iter,0,_("No Subtitles"),1,"disable"); model.append (out iter); model.set (iter,0,_("Embed / Soft Subs"),1,"embed"); cmbSubtitleMode.set_active(1); break; - + default: gridSubtitle.sensitive = false; break; } //set logo - + switch (format){ case "mkv": imgFileFormat.set_from_file(App.SharedImagesFolder + "/matroska.png"); @@ -1468,9 +1493,9 @@ break; } } - + private void cmbACodec_changed(){ - ListStore model; + Gtk.ListStore model; TreeIter iter; //show & hide options @@ -1524,7 +1549,7 @@ cmbOpusOptimize.visible = false; break; } - + //disable options when audio is disabled switch (acodec){ case "disable": @@ -1534,11 +1559,11 @@ gridAudioFilters.sensitive = true; break; } - + //populate encoding modes model = new Gtk.ListStore (2, typeof (string), typeof (string)); cmbAudioMode.set_model(model); - + switch (acodec){ case "mp3lame": model.append (out iter); @@ -1550,21 +1575,21 @@ model.append (out iter); model.set (iter,0,_("Constant Bitrate (Strict)"),1,"cbr-strict"); cmbAudioMode.set_active(0); - + spinAudioBitrate.adjustment.configure(128, 32, 320, 1, 1, 0); spinAudioBitrate.set_tooltip_text (""); spinAudioBitrate.digits = 0; - + spinAudioQuality.adjustment.configure(4, 0, 9, 1, 1, 0); spinAudioQuality.set_tooltip_text (""); spinAudioQuality.digits = 0; - + cmbAudioMode.sensitive = true; spinAudioBitrate.sensitive = true; spinAudioQuality.sensitive = true; cmbAudioMode_changed(); break; - + case "neroaac": model.append (out iter); model.set (iter,0,_("Variable Bitrate"),1,"vbr"); @@ -1573,7 +1598,7 @@ model.append (out iter); model.set (iter,0,_("Constant Bitrate"),1,"cbr"); cmbAudioMode.set_active(0); - + spinAudioBitrate.adjustment.configure(160, 8, 400, 1, 1, 0); spinAudioBitrate.set_tooltip_text (""); spinAudioBitrate.digits = 0; @@ -1591,11 +1616,11 @@ 0.85 = ~332 kbps 0.95 = ~381 kbps"""); spinAudioQuality.digits = 1; - + cmbAudioMode.sensitive = true; cmbAudioMode_changed(); break; - + case "opus": model.append (out iter); model.set (iter,0,_("Variable Bitrate"),1,"vbr"); @@ -1604,43 +1629,43 @@ model.append (out iter); model.set (iter,0,_("Constant Bitrate"),1,"cbr"); cmbAudioMode.set_active(0); - + spinAudioBitrate.adjustment.configure(128, 6, 512, 1, 1, 0); spinAudioBitrate.set_tooltip_text (""); spinAudioBitrate.digits = 0; - + cmbAudioMode.sensitive = true; cmbAudioMode_changed(); break; - + case "vorbis": model.append (out iter); model.set (iter,0,_("Variable Bitrate"),1,"vbr"); model.append (out iter); model.set (iter,0,_("Average Bitrate"),1,"abr"); cmbAudioMode.set_active(0); - + spinAudioBitrate.adjustment.configure(128, 32, 500, 1, 1, 0); spinAudioBitrate.set_tooltip_text (""); spinAudioBitrate.digits = 0; - + spinAudioQuality.adjustment.configure(3, -2, 10, 1, 1, 0); spinAudioQuality.set_tooltip_text (""); spinAudioQuality.digits = 1; - + cmbAudioMode.sensitive = true; cmbAudioMode_changed(); break; - + case "ac3": model.append (out iter); model.set (iter,0,_("Fixed Bitrate"),1,"cbr"); cmbAudioMode.set_active(0); - + spinAudioBitrate.adjustment.configure(128, 1, 512, 1, 1, 0); spinAudioBitrate.set_tooltip_text (""); spinAudioBitrate.digits = 0; - + cmbAudioMode.sensitive = true; cmbAudioMode_changed(); break; @@ -1663,17 +1688,17 @@ model.append (out iter); model.set (iter,0,_("Lossless"),1,"lossless"); cmbAudioMode.set_active(0); - + cmbAudioMode.sensitive = true; break; - + default: //disable cmbAudioMode.sensitive = false; spinAudioBitrate.sensitive = false; spinAudioQuality.sensitive = false; break; } - + //populate sampling rates model = new Gtk.ListStore (2, typeof (string), typeof (string)); cmbAudioSampleRate.set_model(model); @@ -1702,7 +1727,7 @@ model.set (iter,0,"48000",1,"48000"); cmbAudioSampleRate.set_active(0); break; - + case "pcm_s8": case "pcm_u8": case "pcm_s16le": @@ -1746,7 +1771,7 @@ model.set (iter,0,"96000",1,"96000"); cmbAudioSampleRate.set_active(0); break; - + case "ac3": model.append (out iter); model.set (iter,0,_("No Change"),1,"disable"); @@ -1760,14 +1785,14 @@ model.set (iter,0,"48000",1,"48000"); cmbAudioSampleRate.set_active(0); break; - + default: model.append (out iter); model.set (iter,0,_("No Change"),1,"disable"); cmbAudioSampleRate.set_active(0); break; } - + //populate channels model = new Gtk.ListStore (2, typeof (string), typeof (string)); cmbAudioChannels.set_model(model); @@ -1820,7 +1845,7 @@ cmbAudioChannels.set_active(0); break; } - + //set logo switch (acodec){ case "opus": @@ -1868,7 +1893,7 @@ break; } } - + private void cmbAudioMode_changed(){ switch (audio_mode) { case "vbr": @@ -1891,9 +1916,9 @@ } private void cmbVCodec_changed(){ - ListStore model; + Gtk.ListStore model; TreeIter iter; - + //show x264 options switch (vcodec){ case "x264": @@ -1910,7 +1935,7 @@ cmbX264Profile.visible = false; break; } - + switch(vcodec){ case "x264": model = new Gtk.ListStore (2, typeof (string), typeof (string)); @@ -1929,7 +1954,7 @@ cmbX264Profile.set_model(model); cmbX264Profile.set_active(2); break; - + case "x265": model = new Gtk.ListStore (2, typeof (string), typeof (string)); model.append (out iter); @@ -1942,27 +1967,39 @@ cmbX264Profile.set_active(0); break; } - + //show vp8 options switch (vcodec){ case "vp8": case "vp9": lblVpxSpeed.visible = true; + cmbVpxSpeed.visible = true; scaleVpxSpeed.visible = true; scaleVpxSpeed.adjustment.value = 1; + + lblVpxSpeed.set_tooltip_markup(""); + string tt = _("<b>Quality Vs Encoding Speed</b>\n\n<b>Best:</b> Best quality, slower\n<b>Good:</b> Good quality, faster\n<b>Realtime:</b> Fastest"); + cmbVpxSpeed.set_tooltip_markup(tt); + tt = _("<b>Quality Vs Encoding Speed</b>\n\nSmaller values = Better quality, slower\nLarger value = Lower quality, faster\n"); + scaleVpxSpeed.set_tooltip_markup(tt); break; + default: lblVpxSpeed.visible = false; + cmbVpxSpeed.visible = false; scaleVpxSpeed.visible = false; + + string tt = _("<b>Quality Vs Encoding Speed</b>\nHigher values speed-up encoding at the expense of quality.\nLower values improve quality at the expense of encoding speed."); + lblVpxSpeed.set_tooltip_markup(tt); break; } - + //populate encoding modes model = new Gtk.ListStore (2, typeof (string), typeof (string)); cmbVideoMode.set_model(model); lblVideoQuality.visible = true; spinVideoQuality.visible = true; - + switch (vcodec){ case "x264": model.append (out iter); @@ -1972,21 +2009,21 @@ model.append (out iter); model.set (iter,0,_("Average Bitrate (2-pass)"),1,"2pass"); cmbVideoMode.set_active(0); - + spinVideoBitrate.adjustment.configure(800, 1, 10000000, 1, 1, 0); spinVideoBitrate.set_tooltip_text (""); spinVideoBitrate.digits = 0; - + spinVideoQuality.adjustment.configure(23.0, 0, 51, 1, 1, 0); spinVideoQuality.set_tooltip_text (""); spinVideoQuality.digits = 1; - + cmbVideoMode.sensitive = true; spinVideoBitrate.sensitive = true; spinVideoQuality.sensitive = true; cmbVideoMode_changed(); break; - + case "x265": model.append (out iter); model.set (iter,0,_("Variable Bitrate / CRF"),1,"vbr"); @@ -1995,21 +2032,21 @@ model.append (out iter); model.set (iter,0,_("Average Bitrate (2-pass)"),1,"2pass"); cmbVideoMode.set_active(0); - + spinVideoBitrate.adjustment.configure(800, 1, 10000000, 1, 1, 0); spinVideoBitrate.set_tooltip_text (""); spinVideoBitrate.digits = 0; - + spinVideoQuality.adjustment.configure(28.0, 0, 51, 1, 1, 0); spinVideoQuality.set_tooltip_text (""); spinVideoQuality.digits = 1; - + cmbVideoMode.sensitive = true; spinVideoBitrate.sensitive = true; spinVideoQuality.sensitive = true; cmbVideoMode_changed(); break; - + case "theora": model.append (out iter); model.set (iter,0,_("Variable Bitrate"),1,"vbr"); @@ -2018,21 +2055,21 @@ model.append (out iter); model.set (iter,0,_("Average Bitrate (2-pass)"),1,"2pass"); cmbVideoMode.set_active(0); - + spinVideoBitrate.adjustment.configure(800, 1, 10000000, 1, 1, 0); spinVideoBitrate.set_tooltip_text (""); spinVideoBitrate.digits = 0; - + spinVideoQuality.adjustment.configure(6, 0, 10, 1, 1, 0); spinVideoQuality.set_tooltip_text (""); spinVideoQuality.digits = 1; - + cmbVideoMode.sensitive = true; spinVideoBitrate.sensitive = true; spinVideoQuality.sensitive = true; cmbVideoMode_changed(); break; - + case "vp8": case "vp9": model.append (out iter); @@ -2044,15 +2081,15 @@ //model.append (out iter); //model.set (iter,0,_("Constant Quality"),1,"cq"); cmbVideoMode.set_active(0); - + spinVideoBitrate.adjustment.configure(800, 1, 1000000000, 1, 1, 0); spinVideoBitrate.set_tooltip_text (""); spinVideoBitrate.digits = 0; - + /*spinVideoQuality.adjustment.configure(-1, -1, 63, 1, 1, 0); spinVideoQuality.set_tooltip_text (""); spinVideoQuality.digits = 0;*/ - + cmbVideoMode.sensitive = true; spinVideoBitrate.sensitive = true; //spinVideoQuality.sensitive = true; @@ -2060,18 +2097,18 @@ spinVideoQuality.visible = false; cmbVideoMode_changed(); break; - + default: //disable cmbVideoMode.sensitive = false; spinVideoBitrate.sensitive = false; spinVideoQuality.sensitive = false; break; } - + //populate resize methods model = new Gtk.ListStore (2, typeof (string), typeof (string)); cmbResizingMethod.set_model(model); - + switch (vcodec){ case "x264": case "x265": @@ -2099,12 +2136,12 @@ model.set (iter,0,"Lanczos",1,"lanczos"); cmbResizingMethod.set_active(2); break; - + default: lblResizingMethod.visible = false; cmbResizingMethod.visible = false; break; - + } //set logo @@ -2139,7 +2176,7 @@ break; } } - + private void cmbFrameSize_changed(){ if (gtk_combobox_get_value(cmbFrameSize,1,"disable") == "custom") { spinFrameWidth.sensitive = true; @@ -2149,7 +2186,7 @@ spinFrameWidth.sensitive = false; spinFrameHeight.sensitive = false; } - + if (gtk_combobox_get_value(cmbFrameSize,1,"disable") == "disable") { cmbResizingMethod.sensitive = false; chkFitToBox.sensitive = false; @@ -2160,7 +2197,7 @@ chkFitToBox.sensitive = true; chkNoUpScale.sensitive = true; } - + switch (gtk_combobox_get_value(cmbFrameSize,1,"disable")) { case "disable": spinFrameWidth.value = 0; @@ -2187,11 +2224,11 @@ spinFrameHeight.value = 1080; break; } - + lblFrameSizeCustom.visible = true; spinFrameWidth.visible = true; spinFrameHeight.visible = true; - + /* if (gtk_combobox_get_value(cmbFrameSize,1,"disable") == "disable"){ lblFrameSizeCustom.visible = false; @@ -2214,7 +2251,7 @@ spinFPSNum.sensitive = false; spinFPSDenom.sensitive = false; } - + switch (gtk_combobox_get_value(cmbFPS,1,"disable")) { case "disable": spinFPSNum.value = 0; @@ -2241,7 +2278,7 @@ spinFPSDenom.value = 1; break; } - + lblFPSCustom.visible = true; spinFPSNum.visible = true; spinFPSDenom.visible = true; @@ -2257,7 +2294,7 @@ spinFPSDenom.visible = true; }*/ } - + private void cmbVideoMode_changed(){ switch(vcodec){ case "vp8": @@ -2297,9 +2334,29 @@ } break; } - + } - + + private void cmbVpxSpeed_changed(){ + switch (vpx_deadline) { + case "best": + scaleVpxSpeed.adjustment.configure(0, 0, 0, 1, 1, 0); + scaleVpxSpeed.sensitive = false; + break; + + case "realtime": + scaleVpxSpeed.sensitive = true; + scaleVpxSpeed.adjustment.configure(0, 0, 15, 1, 1, 0); + break; + + case "good": + default: + scaleVpxSpeed.sensitive = true; + scaleVpxSpeed.adjustment.configure(1, 0, 5, 1, 1, 0); + break; + } + } + private void cmbSubtitleMode_changed(){ string msg = _("\n\nSubtitle files should be present in the same folder\nand should start with same name."); @@ -2323,7 +2380,7 @@ break; } break; - + default: lblSubFormatMessage.label = ""; break; @@ -2341,10 +2398,10 @@ dlg.set_transient_for(this); dlg.run(); dlg.destroy(); - + return; } - + save_script(); destroy(); } @@ -2355,7 +2412,7 @@ var video = new Json.Object(); var audio = new Json.Object(); var subs = new Json.Object(); - + config.set_object_member("general",general); general.set_string_member("format",format); general.set_string_member("extension",extension); @@ -2363,7 +2420,7 @@ general.set_string_member("authorEmail",author_email); general.set_string_member("presetName",preset_name); general.set_string_member("presetVersion",preset_version); - + config.set_object_member("video",video); video.set_string_member("codec",vcodec); if (vcodec != "disable") { @@ -2375,6 +2432,7 @@ video.set_string_member("preset",x264_preset); } if ((vcodec == "vp8")||(vcodec == "vp9")){ + video.set_string_member("vpx_deadline",vpx_deadline); video.set_string_member("vpx_speed",vpx_speed); } video.set_string_member("options",x264_options); @@ -2388,7 +2446,7 @@ video.set_string_member("fpsNum",frame_rate_num); video.set_string_member("fpsDenom",frame_rate_denom); } - + config.set_object_member("audio",audio); audio.set_string_member("codec",acodec); if (acodec != "disable") { @@ -2401,7 +2459,7 @@ } audio.set_string_member("channels",audio_channels); audio.set_string_member("samplingRate",audio_sampling); - + //sox audio.set_boolean_member("soxEnabled",sox_enabled); if (sox_enabled) { @@ -2416,10 +2474,10 @@ audio.set_boolean_member("soxEarwax",sox_earwax); } } - + config.set_object_member("subtitle",subs); subs.set_string_member("mode",subtitle_mode); - + var filePath = Folder + "/" + txtPresetName.text + ".json"; var json = new Json.Generator(); json.pretty = true; @@ -2427,7 +2485,7 @@ var node = new Json.Node(NodeType.OBJECT); node.set_object(config); json.set_root(node); - + try{ json.to_file(filePath); } catch (Error e) { @@ -2437,13 +2495,13 @@ //Set the newly saved file as the active script App.SelectedScript = new ScriptFile(filePath); } - + public void load_script(){ var filePath = Folder + "/" + Name + ".json"; if(file_exists(filePath) == false){ return; } - + txtPresetName.text = Name; - + var parser = new Json.Parser(); try{ parser.load_from_file(filePath); @@ -2456,20 +2514,20 @@ Json.Object video = (Json.Object) config.get_object_member("video"); Json.Object audio = (Json.Object) config.get_object_member("audio"); Json.Object subs = (Json.Object) config.get_object_member("subtitle"); - + //general ---------------------------- - + format = general.get_string_member("format"); extension = general.get_string_member("extension"); //preset_name = general.get_string_member("presetName"); //set from file name preset_version = general.get_string_member("presetVersion"); author_name = general.get_string_member("authorName"); author_email = general.get_string_member("authorEmail"); - + //video -------------------------- - + vcodec = video.get_string_member("codec"); - + if (vcodec != "disable") { switch(vcodec){ case "x264": @@ -2480,6 +2538,9 @@ break; case "vp8": case "vp9": + if (video.has_member("vpx_deadline")){ + vpx_deadline = video.get_string_member("vpx_deadline"); + } if (video.has_member("vpx_speed")){ vpx_speed = video.get_string_member("vpx_speed"); } @@ -2488,9 +2549,9 @@ video_mode = video.get_string_member("mode"); video_bitrate = video.get_string_member("bitrate"); video_quality = video.get_string_member("quality"); - + //video filters ------------------------ - + frame_size = video.get_string_member("frameSize"); frame_width = video.get_string_member("frameWidth"); frame_height = video.get_string_member("frameHeight"); @@ -2501,11 +2562,11 @@ frame_rate_num = video.get_string_member("fpsNum"); frame_rate_denom = video.get_string_member("fpsDenom"); } - + //audio --------------------- - + acodec = audio.get_string_member("codec"); - + if (acodec != "disable") { //codec config audio_mode = audio.get_string_member("mode"); @@ -2516,9 +2577,9 @@ } audio_channels = audio.get_string_member("channels"); audio_sampling = audio.get_string_member("samplingRate"); - + //sox config - + if (audio.get_boolean_member("soxEnabled")){ App.Encoders["sox"].CheckAvailability(); if (!App.Encoders["sox"].IsAvailable){ @@ -2546,376 +2607,384 @@ } //subtitles -------------- - + subtitle_mode = subs.get_string_member("mode"); } public string format{ - owned get { + owned get { return gtk_combobox_get_value(cmbFileFormat,1,"mkv"); } - set { + set { gtk_combobox_set_value(cmbFileFormat,1,value); } } public string extension{ - owned get { + owned get { return gtk_combobox_get_value(cmbFileExtension,1,".mkv"); } - set { + set { gtk_combobox_set_value(cmbFileExtension,1,value); } } - + public string author_name{ - owned get { + owned get { return txtAuthorName.text; } - set { + set { txtAuthorName.text = value; } } - + public string author_email{ - owned get { + owned get { return txtAuthorEmail.text; } - set { + set { txtAuthorEmail.text = value; } } - + public string preset_name{ - owned get { + owned get { return txtPresetName.text; } - set { + set { txtPresetName.text = value; } } - + public string preset_version{ - owned get { + owned get { return txtPresetVersion.text; } - set { + set { txtPresetVersion.text = value; } } - + public string vcodec{ - owned get { + owned get { return gtk_combobox_get_value(cmbVCodec,1,"x264"); } - set { + set { gtk_combobox_set_value(cmbVCodec,1,value); } } - + public string video_mode{ - owned get { + owned get { return gtk_combobox_get_value(cmbVideoMode,1,"vbr"); } - set { + set { gtk_combobox_set_value(cmbVideoMode,1,value); } } public string video_bitrate{ - owned get { - return spinVideoBitrate.get_value().to_string(); + owned get { + return spinVideoBitrate.get_value().to_string(); } - set { + set { spinVideoBitrate.set_value(double.parse(value)); } } - + public string video_quality{ - owned get { - return "%.1f".printf(spinVideoQuality.get_value()); + owned get { + return "%.1f".printf(spinVideoQuality.get_value()); } - set { + set { spinVideoQuality.get_adjustment().set_value(double.parse(value)); } } - + public string x264_preset { - owned get { + owned get { return gtk_combobox_get_value(cmbX264Preset,1,"medium"); } - set { + set { gtk_combobox_set_value(cmbX264Preset,1,value); } } - + public string x264_profile{ - owned get { + owned get { return gtk_combobox_get_value(cmbX264Profile,1,"high"); } - set { + set { gtk_combobox_set_value(cmbX264Profile, 1, value); } } public string x264_options{ - owned get { + owned get { return txtVCodecOptions.buffer.text; } - set { + set { txtVCodecOptions.buffer.text = value; } } + public string vpx_deadline{ + owned get { + return gtk_combobox_get_value(cmbVpxSpeed,1,"good"); + } + set { + gtk_combobox_set_value(cmbVpxSpeed,1,value); + } + } + public string vpx_speed{ - owned get { + owned get { return scaleVpxSpeed.adjustment.value.to_string(); } - set { + set { scaleVpxSpeed.adjustment.value = int.parse(value); } } - - + public string frame_size{ - owned get { + owned get { return gtk_combobox_get_value(cmbFrameSize,1,"disable"); } - set { + set { gtk_combobox_set_value(cmbFrameSize, 1, value); } } - + public string resizing_method{ - owned get { + owned get { return gtk_combobox_get_value(cmbResizingMethod,1,"cubic"); } - set { + set { gtk_combobox_set_value(cmbResizingMethod, 1, value); } } - + public string frame_width{ - owned get { - return spinFrameWidth.get_value().to_string(); + owned get { + return spinFrameWidth.get_value().to_string(); } - set { + set { spinFrameWidth.set_value(double.parse(value)); } } - + public string frame_height{ - owned get { - return spinFrameHeight.get_value().to_string(); + owned get { + return spinFrameHeight.get_value().to_string(); } - set { + set { spinFrameHeight.set_value(double.parse(value)); } } - + public bool fit_to_box{ - get { - return chkFitToBox.active; + get { + return chkFitToBox.active; } - set { + set { chkFitToBox.set_active((bool)value); } } - + public bool no_upscaling{ - get { - return chkNoUpScale.active; + get { + return chkNoUpScale.active; } - set { + set { chkNoUpScale.set_active((bool)value); } } - + public string frame_rate{ - owned get { + owned get { return gtk_combobox_get_value(cmbFPS,1,"disable"); } - set { + set { gtk_combobox_set_value(cmbFPS, 1, value); } } - + public string frame_rate_num{ - owned get { - return spinFPSNum.get_value().to_string(); + owned get { + return spinFPSNum.get_value().to_string(); } - set { + set { spinFPSNum.set_value(double.parse(value)); } } public string frame_rate_denom{ - owned get { - return spinFPSDenom.get_value().to_string(); + owned get { + return spinFPSDenom.get_value().to_string(); } - set { + set { spinFPSDenom.set_value(double.parse(value)); } } - + public string acodec{ - owned get { + owned get { return gtk_combobox_get_value(cmbACodec,1,"mp3lame"); } - set { + set { gtk_combobox_set_value(cmbACodec,1,value); } } - + public string audio_mode{ - owned get { + owned get { return gtk_combobox_get_value(cmbAudioMode,1,"vbr"); } - set { + set { gtk_combobox_set_value(cmbAudioMode, 1, value); } } - + public string audio_opus_optimize{ - owned get { + owned get { return gtk_combobox_get_value(cmbOpusOptimize,1,"none"); } - set { + set { gtk_combobox_set_value(cmbOpusOptimize, 1, value); } } - + public string audio_bitrate{ - owned get { - return spinAudioBitrate.get_value().to_string(); + owned get { + return spinAudioBitrate.get_value().to_string(); } - set { + set { spinAudioBitrate.set_value(double.parse(value)); } } - + public string audio_quality{ - owned get { - return "%.1f".printf(spinAudioQuality.get_value()); + owned get { + return "%.1f".printf(spinAudioQuality.get_value()); } - set { + set { spinAudioQuality.set_value(double.parse(value)); } } - + public string audio_channels{ - owned get { + owned get { return gtk_combobox_get_value(cmbAudioChannels,1,"disable"); } - set { + set { gtk_combobox_set_value(cmbAudioChannels, 1, value); } } - + public string audio_sampling{ - owned get { + owned get { return gtk_combobox_get_value(cmbAudioSampleRate,1,"disable"); } - set { + set { gtk_combobox_set_value(cmbAudioSampleRate, 1, value); } } public bool sox_enabled{ - get { - return switchSox.active; + get { + return switchSox.active; } - set { + set { switchSox.set_active((bool)value); } } - + public string sox_bass{ - owned get { + owned get { return scaleBass.get_value().to_string(); } - set { + set { scaleBass.set_value(double.parse(value)); } } public string sox_treble{ - owned get { + owned get { return scaleTreble.get_value().to_string(); } - set { + set { scaleTreble.set_value(double.parse(value)); } } public string sox_pitch{ - owned get { + owned get { return "%.1f".printf(scalePitch.get_value()/100); } - set { + set { scalePitch.set_value(double.parse(value) * 100); } } public string sox_tempo{ - owned get { + owned get { return "%.1f".printf(scaleTempo.get_value()/100); } - set { + set { scaleTempo.set_value(double.parse(value) * 100); } } public string sox_fade_in{ - owned get { + owned get { return spinFadeIn.get_value().to_string(); } - set { + set { spinFadeIn.set_value(double.parse(value)); } } public string sox_fade_out{ - owned get { + owned get { return spinFadeOut.get_value().to_string(); } - set { + set { spinFadeOut.set_value(double.parse(value)); } } public string sox_fade_type{ - owned get { + owned get { return gtk_combobox_get_value(cmbFadeType,1,"l"); } - set { + set { gtk_combobox_set_value(cmbFadeType, 1, value); } } - + public bool sox_normalize{ - get { - return switchNormalize.active; + get { + return switchNormalize.active; } - set { + set { switchNormalize.set_active((bool)value); } } public bool sox_earwax{ - get { - return switchEarWax.active; + get { + return switchEarWax.active; } - set { + set { switchEarWax.set_active((bool)value); } } - + public string subtitle_mode{ - owned get { + owned get { return gtk_combobox_get_value(cmbSubtitleMode,1,"disable"); } - set { + set { gtk_combobox_set_value(cmbSubtitleMode, 1, value); } }
View file
selene_2.5.2~185~ubuntu15.04.1.tar.xz/src/EncoderStatusWindow.vala -> selene_2.5.8~198~ubuntu15.10.1.tar.xz/src/EncoderStatusWindow.vala
Changed
@@ -1,26 +1,26 @@ /* * FileInfoWindow.vala - * + * * Copyright 2012 Tony George <teejee2008@gmail.com> - * + * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. - * + * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. - * + * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, * MA 02110-1301, USA. - * - * + * + * */ - + using Gtk; using TeeJee.Logging; @@ -40,11 +40,11 @@ private Button btnRefesh; private TreeView tv; private ScrolledWindow sw; - + public EncoderStatusWindow () { title = _("Encoders"); - set_default_size (450, 400); - + set_default_size (500, 450); + window_position = WindowPosition.CENTER_ON_PARENT; destroy_with_parent = true; skip_taskbar_hint = true; @@ -63,7 +63,7 @@ tv.get_selection().mode = SelectionMode.NONE; tv.headers_visible = true; tv.set_rules_hint (true); - + sw = new ScrolledWindow(null, null); sw.set_shadow_type (ShadowType.ETCHED_IN); sw.add (tv); @@ -74,11 +74,11 @@ //col_icon.title = _(""); col_icon.resizable = true; tv.append_column(col_icon); - + CellRendererPixbuf cell_icon = new CellRendererPixbuf (); col_icon.pack_start (cell_icon, false); col_icon.set_attributes(cell_icon, "pixbuf", 3); - + TreeViewColumn col_cmd = new TreeViewColumn(); col_cmd.title = " " + _("Encoding Tool") + " "; tv.append_column(col_cmd); @@ -86,43 +86,43 @@ CellRendererText cell_cmd = new CellRendererText (); col_cmd.pack_start (cell_cmd, false); col_cmd.set_attributes(cell_cmd, "text", 0); - + TreeViewColumn col_desc = new TreeViewColumn(); col_desc.title = " " + _("Description") + " "; tv.append_column(col_desc); - + CellRendererText cell_desc = new CellRendererText (); col_desc.pack_start (cell_desc, false); col_desc.set_attributes(cell_desc, "text", 1); - + TreeViewColumn col_status = new TreeViewColumn(); col_status.title = " " + _("Status") + " "; tv.append_column(col_status); - + CellRendererText cell_status = new CellRendererText (); col_status.pack_start (cell_status, false); col_status.set_attributes(cell_status, "text", 2); - + tv_refresh(); - + //btnRefesh btnRefesh = new Button.with_label(" " + _("Refresh") + " "); vbox_actions.add(btnRefesh); btnRefesh.clicked.connect(()=>{ gtk_set_busy(true,this); - App.check_all_encoders(); + App.check_all_encoders(); tv_refresh(); gtk_set_busy(false,this); }); - + //btnOk btnOk = (Button) add_button ("gtk-ok", Gtk.ResponseType.ACCEPT); btnOk.clicked.connect (() => { destroy(); }); } - + public void tv_refresh(){ TreeStore store = new TreeStore (4, typeof (string), typeof (string), typeof (string), typeof(Gdk.Pixbuf)); - + //status icons Gdk.Pixbuf pix_ok = null; Gdk.Pixbuf pix_missing = null; @@ -134,7 +134,7 @@ catch(Error e){ log_error (e.message); } - + foreach (Encoder enc in App.Encoders.values){ TreeIter iter; store.append(out iter, null); @@ -143,7 +143,7 @@ store.set(iter, 2, enc.IsAvailable ? _("Found") : _("Missing")); store.set(iter, 3, enc.IsAvailable ? pix_ok : pix_missing); } - + tv.set_model (store); } }
View file
selene_2.5.2~185~ubuntu15.04.1.tar.xz/src/FileInfoWindow.vala -> selene_2.5.8~198~ubuntu15.10.1.tar.xz/src/FileInfoWindow.vala
Changed
@@ -1,26 +1,26 @@ /* * FileInfoWindow.vala - * + * * Copyright 2012 Tony George <teejee2008@gmail.com> - * + * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. - * + * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. - * + * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, * MA 02110-1301, USA. - * - * + * + * */ - + using Gtk; using TeeJee.Logging; @@ -39,25 +39,25 @@ public MediaFile file; private TreeView tvInfo; private ScrolledWindow swInfo; - + public FileInfoWindow (MediaFile _file) { title = _("Properties"); set_default_size (700, 500); - + window_position = WindowPosition.CENTER_ON_PARENT; destroy_with_parent = true; skip_taskbar_hint = true; modal = true; deletable = false; icon = get_app_icon(16); - + //save reference file = _file; - + // get content area vboxMain = get_content_area(); vboxMain.margin = 6; - + //tvInfo tvInfo = new TreeView(); tvInfo.get_selection().mode = SelectionMode.MULTIPLE; @@ -77,10 +77,10 @@ int index = -1; infoStore.append (out iter0, null); //infoStore.remove (ref iter0); - + foreach (string line in file.InfoText.split ("\n")){ if (line.strip() == "") { continue; } - + index = line.index_of (":"); if (index == -1){ @@ -95,7 +95,7 @@ } tvInfo.set_model (infoStore); tvInfo.expand_all(); - + // btnOk btnOk = (Button) add_button ("gtk-ok", Gtk.ResponseType.ACCEPT); btnOk.clicked.connect (() => { destroy(); });
View file
selene_2.5.2~185~ubuntu15.04.1.tar.xz/src/Main.vala -> selene_2.5.8~198~ubuntu15.10.1.tar.xz/src/Main.vala
Changed
@@ -1,24 +1,24 @@ /* * Main.vala - * + * * Copyright 2012 Tony George <teejee2008@gmail.com> - * + * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. - * + * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. - * + * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, * MA 02110-1301, USA. - * - * + * + * */ using GLib; @@ -38,7 +38,7 @@ public Main App; public const string AppName = "Selene"; public const string AppShortName = "selene"; -public const string AppVersion = "2.5.2"; +public const string AppVersion = "2.5.8"; public const string AppAuthor = "Tony George"; public const string AppAuthorEmail = "teejeetech@gmail.com"; @@ -59,8 +59,8 @@ public enum AppStatus{ NOTSTARTED, //initial state - RUNNING, - PAUSED, + RUNNING, + PAUSED, IDLE, //batch completed WAITFILE //waiting for files } @@ -68,7 +68,7 @@ public class Main : GLib.Object{ public Gee.ArrayList<MediaFile> InputFiles; public Gee.HashMap<string,Encoder> Encoders; - + public string ScriptsFolder_Official = ""; public string ScriptsFolder_Custom = ""; public string PresetsFolder_Official = ""; @@ -78,18 +78,19 @@ public string SharedDataDirectory; public string AppConfPath = ""; public string usr_share_dir; - + public string TempDirectory; public string OutputDirectory = ""; public string BackupDirectory = ""; public string InputDirectory = ""; - + public bool TileView = true; + public ScriptFile SelectedScript; public MediaFile CurrentFile; public string CurrentLine; public string StatusLine; public double Progress; - + public bool BatchStarted = false; public bool BatchCompleted = false; public bool Aborted; @@ -103,7 +104,7 @@ public bool BackgroundMode = false; public bool WaitingForShutdown = false; public bool ShowNotificationPopups = false; - + private Regex regex_generic; private Regex regex_mkvmerge; private Regex regex_libav; @@ -116,7 +117,7 @@ private Regex regex_opus; private Regex regex_vpxenc; private Regex regex_neroaacenc; - + private string tempLine; private MatchInfo match; private double dblVal; @@ -126,8 +127,8 @@ private string outLine = ""; private DataInputStream disOut; private DataInputStream disErr; - private DataOutputStream dsLog; - + private DataOutputStream dsLog; + private string blankLine = ""; public static int main (string[] args) { @@ -149,10 +150,10 @@ //init GTK Gtk.init (ref args); - + //init TMP init_tmp(); - + //init app App = new Main(args[0]); @@ -161,7 +162,7 @@ LOG_COLORS = (term == "xterm"); //get command line arguments - for (int k = 1; k < args.length; k++) // Oth arg is app path + for (int k = 1; k < args.length; k++) // Oth arg is app path { switch (args[k].down()){ case "--script": @@ -170,7 +171,7 @@ App.SelectedScript = new ScriptFile(args[k]); } break; - + case "--output-dir": k++; if (k < args.length){ @@ -182,7 +183,7 @@ } } break; - + case "--backup-dir": k++; if (k < args.length){ @@ -194,15 +195,15 @@ } } break; - + case "--console": App.ConsoleMode = true; break; - + case "--debug": App.DebugMode = true; break; - + case "--shutdown": if (App.AdminMode) { App.Shutdown = true; @@ -212,7 +213,7 @@ log_error (_("Warning: User does not have Admin priviledges. '--shutdown' will be ignored.")); } break; - + case "--background": App.BackgroundMode = true; App.set_priority(); @@ -223,11 +224,11 @@ break; } } - + //check UI mode if ((App.SelectedScript == null)||(App.InputFiles.size == 0)) App.ConsoleMode = false; - + //show window if (App.ConsoleMode){ if (App.InputFiles.size == 0){ @@ -244,14 +245,14 @@ } Gtk.main(); - + return 0; } public static string help_message(){ string msg = "\n" + AppName + " v" + AppVersion + " by Tony George (teejee2008@gmail.com)" + "\n"; msg += Environment.get_prgname() + " [options] <input-file-list>"; - msg += + msg += """ Options: @@ -259,26 +260,26 @@ --output-dir <string> Set output directory 'none' - Save files in input location - + --backup-dir <string> Set backup directory 'none' - Do not move files - + --console Console mode - GUI will not be loaded --shutdown Shutdown system after completion (disabled by default) --background Run with low priority (recommended) - + --debug Show additional information - + --help List all options - + Notes: 1) The '--console' option is used for automated encoding. Script should be selected using the '--script' option and input files must be specified on the command line. Conversion will start immediately. - + 2) Default settings will be used if an option is not specified. Default settings can be customized using the 'Settings' button in the main window. @@ -286,21 +287,21 @@ 4) '--background' option will run all processes with lower priority. This allows the user to continue with other tasks while files are converted - in the background. - + in the background. + 5) Running the app as Admin (using 'sudo') will enable some extra GUI options. """; return msg; } - + public Main(string arg0){ InputFiles = new Gee.ArrayList<MediaFile>(); Encoders = new Gee.HashMap<string,Encoder>(); - + //check encoders init_encoder_list(); check_all_encoders(); - + //check critical encoders foreach(string enc in new string[]{"mediainfo","avconv"}){ Encoders[enc].CheckAvailability(); @@ -312,7 +313,7 @@ // check for admin priviledges AdminMode = user_is_admin(); - + // check for notify-send string path = get_cmd_path ("notify-send"); if ((path != null)&&(path != "")){ @@ -321,11 +322,11 @@ // set default directory paths string homeDir = Environment.get_home_dir(); - TempDirectory = Environment.get_tmp_dir() + "/" + Environment.get_prgname(); - create_dir (TempDirectory); + TempDirectory = Environment.get_tmp_dir() + "/" + Environment.get_prgname(); + create_dir (TempDirectory); OutputDirectory = ""; BackupDirectory = ""; - + usr_share_dir = "/usr/share"; SharedDataDirectory = "/usr/share/selene"; UserDataDirectory = homeDir + "/.config/selene"; @@ -336,7 +337,7 @@ PresetsFolder_Official = SharedDataDirectory + "/presets"; PresetsFolder_Custom = UserDataDirectory + "/presets"; SharedImagesFolder = SharedDataDirectory + "/images"; - + AppConfPath = UserDataDirectory + "/selene.json"; create_dir (UserDataDirectory); @@ -344,65 +345,65 @@ create_dir (PresetsFolder_Custom); // create a copy of official scripts & presets on first run - + if (dir_exists (ScriptsFolder_Official)){ rsync(ScriptsFolder_Official, ScriptsFolder_Custom, false, false); rsync(PresetsFolder_Official, PresetsFolder_Custom, false, false); } // additional info - + log_msg (_("Loading scripts from:") + " '%s'".printf(ScriptsFolder_Custom)); log_msg (_("Loading presets from:") + " '%s'".printf(PresetsFolder_Custom)); log_msg (_("Using temp folder:") + " '%s'".printf(TempDirectory)); // init config - + load_config(); - + // init regular expressions - + try{ regex_generic = new Regex("""([0-9.]+)%"""); regex_mkvmerge = new Regex("""Progress: ([0-9.]+)%"""); - + regex_libav = new Regex("""time=[ ]*([0-9:.]+)"""); - + //frame= 82 fps= 23 q=28.0 size= 133kB time=1.42 bitrate= 766.9kbits/s regex_libav_video = new Regex("""frame=[ ]*[0-9]+ fps=[ ]*([0-9]+)[.]?[0-9]* q=[ ]*[0-9]+[.]?[0-9]* size=[ ]*([0-9]+)kB time=[ ]*[0-9:.]+ bitrate=[ ]*([0-9.]+)"""); - - //size= 1590kB time=30.62 bitrate= 425.3kbits/s + + //size= 1590kB time=30.62 bitrate= 425.3kbits/s regex_libav_audio = new Regex("""size=[ ]*([0-9]+)kB time=[ ]*[0-9:.]+ bitrate=[ ]*([0-9.]+)"""); - + //531 frames: 72.90 fps, 1509.18 kb/s regex_x264 = new Regex("""[ ]*([0-9]+) frames:[ ]*([0-9.]+) fps,[ ]*([0-9.]+) kb/s"""); - - // 0:00:00.66 audio: 57kbps video: 404kbps, time elapsed: 00:00:00 + + // 0:00:00.66 audio: 57kbps video: 404kbps, time elapsed: 00:00:00 regex_ffmpeg2theora = new Regex ("""([0-9:.]+)[ ]*audio:[ ]*([0-9]+)kbps[ ]*video:[ ]*([0-9]+)kbps"""); // 0:00:00.92 audio: 98kbps video: 87kbps, ET: 00:00:10, est. size: 0.2 MB regex_ffmpeg2theora2 = new Regex ("""([0-9:.]+)[ ]*audio:[ ]*([0-9]+)kbps[ ]*video:[ ]*([0-9]+)kbps,[ ]*ET:[ ]*([0-9:.]+),[ ]*est. size:[ ]*([0-9.]+)"""); //Scanning first pass pos: 0:00:00.00 ET: 00:00:00 regex_ffmpeg2theora3 = new Regex ("""Scanning first pass pos:[ ]*([0-9:.]+)[ ]*ET:[ ]*([0-9:.]+)"""); - + //[/] 00:00:28.21 16.3x realtime, 60.68kbit/s //[-] 00:01:48.09 16x realtime, 60.7kbit/s regex_opus = new Regex ("""\[.\][ ]*([0-9:.]+)[ ]*([0-9]+)[.]?[0-9]*x realtime,[ ]*([0-9]+)[.]?[0-9]*kbit/s"""); - + //Pass 1/1 frame 2/1 6755B regex_vpxenc = new Regex ("""(Pass[ ]*[0-9]+/[0-9]+)[ ]*frame[ ]*([0-9]+)/[0-9]+[ ]*([0-9]+)B"""); - + //Processed 100 seconds... regex_neroaacenc = new Regex("""Processed[ ]*([0-9.]+)[ ]*seconds"""); } catch (Error e) { log_error (e.message); } - + blankLine = ""; for (int i=0; i<80; i++) blankLine += " "; } - + public void init_encoder_list(){ Encoders["avconv"] = new Encoder("avconv","Libav Encoder","Audio-Video Decoding"); Encoders["ffmpeg2theora"] = new Encoder("ffmpeg2theora","Theora Video Encoder","Theora Output"); @@ -418,7 +419,7 @@ Encoders["x264"] = new Encoder("x264","H.264 / MPEG-4 AVC Video Encoder","H264 Output"); Encoders["x265"] = new Encoder("x264","H.265 / MPEG-H HEVC Video Encoder","H265 Output"); } - + public void check_all_encoders(){ foreach(Encoder enc in Encoders.values){ enc.CheckAvailability(); @@ -427,20 +428,20 @@ public void start_input_thread(){ // start thread for reading user input - + try { Thread.create<void> (wait_for_user_input_thread, true); } catch (ThreadError e) { log_error (e.message); } } - + private void wait_for_user_input_thread(){ while (true){ // loop runs for entire application lifetime wait_for_user_input(); } } - + private void wait_for_user_input(){ int ch = stdin.getc(); @@ -472,41 +473,42 @@ return mf; } } - + return null; } - + public void save_config(){ var config = new Json.Object(); config.set_string_member("input-dir", InputDirectory); config.set_string_member("backup-dir", BackupDirectory); config.set_string_member("output-dir", OutputDirectory); config.set_string_member("last-script", SelectedScript.Path); - + config.set_string_member("tile-view", TileView.to_string()); + if (SelectedScript != null) { config.set_string_member("last-script", SelectedScript.Path); } else { config.set_string_member("last-script", ""); } - + var json = new Json.Generator(); json.pretty = true; json.indent = 2; var node = new Json.Node(NodeType.OBJECT); node.set_object(config); json.set_root(node); - + try{ json.to_file(AppConfPath); } catch (Error e) { log_error (e.message); } } - + public void load_config(){ var f = File.new_for_path(AppConfPath); if (!f.query_exists()) { return; } - + var parser = new Json.Parser(); try{ parser.load_from_file(AppConfPath); @@ -521,7 +523,7 @@ InputDirectory = val; else InputDirectory = ""; - + val = json_get_string(config,"backup-dir", BackupDirectory); if (dir_exists(val)) BackupDirectory = val; @@ -531,30 +533,32 @@ val = json_get_string(config,"output-dir", OutputDirectory); if (dir_exists(val)) OutputDirectory = val; - else + else OutputDirectory = ""; val = json_get_string(config,"last-script", ""); if (val != null && val.length > 0) { SelectedScript = new ScriptFile(val); } + + TileView = json_get_bool(config,"tile-view",true); } - + public void exit_app(){ - save_config(); + save_config(); Gtk.main_quit(); } - + public bool add_file (string filePath){ MediaFile mFile = new MediaFile (filePath); - - if (mFile.IsValid - && mFile.Extension != ".srt" - && mFile.Extension != ".sub" + + if (mFile.IsValid + && mFile.Extension != ".srt" + && mFile.Extension != ".sub" && mFile.Extension != ".idx" && mFile.Extension != ".ssa" ) { - + bool duplicate = false; foreach(MediaFile mf in InputFiles){ if (mf.Path == mFile.Path){ @@ -562,7 +566,7 @@ break; } } - + if (duplicate) { return true; //not an error since file is already added @@ -576,36 +580,36 @@ else{ log_error (_("Unknown format:") + " '%s'".printf (mFile.Path)); } - + return false; } - + public void remove_files (Gee.ArrayList<MediaFile> file_list){ foreach(MediaFile mf in file_list){ InputFiles.remove (mf); log_msg (_("File removed:") + " '%s'".printf (mf.Path)); } } - + public void remove_all(){ InputFiles.clear(); log_msg (_("All files removed")); } //conversion - + public void convert_begin(){ //check for empty list if (InputFiles.size == 0){ log_error (_("Input queue is empty! Please add some files.")); return; } - + log_msg (_("Starting batch of %d file(s):").printf(InputFiles.size), true); - + //check and create output dir - if (OutputDirectory.length > 0) { - create_dir (OutputDirectory); + if (OutputDirectory.length > 0) { + create_dir (OutputDirectory); log_msg (_("Files will be saved in '%s'").printf(OutputDirectory)); } else{ @@ -613,32 +617,32 @@ } //check and create backup dir - if (BackupDirectory.length > 0) { - create_dir (BackupDirectory); + if (BackupDirectory.length > 0) { + create_dir (BackupDirectory); log_msg (_("Source files will be moved to '%s'").printf(BackupDirectory)); - } - + } + //initialize batch control variables BatchStarted = true; BatchCompleted = false; Aborted = false; Status = AppStatus.RUNNING; - + //initialize file status foreach (MediaFile mf in InputFiles) { mf.Status = FileStatus.PENDING; mf.ProgressText = _("Queued"); mf.ProgressPercent = 0; } - + //if(ConsoleMode) //progressTimerID = Timeout.add(500, update_progress); - + //save config and begin save_config(); convert_next(); } - + private void convert_next(){ try { Thread.create<void>(convert_next_thread, true); @@ -649,7 +653,7 @@ private void convert_next_thread(){ MediaFile nextFile = null; - + //find next pending file foreach (MediaFile mf in InputFiles) { if (mf.Status == FileStatus.PENDING){ @@ -657,7 +661,7 @@ break; } } - + //encode the file if (!Aborted && nextFile != null){ convert_file(nextFile); @@ -665,7 +669,7 @@ } else{ Status = AppStatus.IDLE; - + //handle shutdown for console mode if (ConsoleMode){ if (Shutdown){ @@ -677,19 +681,19 @@ //exit app for console mode exit_app(); } - + //shutdown will be handled by GUI window for GUI-mode } } - - public void convert_finish(){ + + public void convert_finish(){ //reset file status foreach(MediaFile mf in InputFiles) { mf.Status = FileStatus.PENDING; mf.ProgressText = _("Queued"); mf.ProgressPercent = 0; } - + //if (ConsoleMode) //Source.remove (progressTimerID); @@ -699,24 +703,24 @@ Aborted = false; Status = AppStatus.NOTSTARTED; } - + private bool convert_file (MediaFile mf){ bool is_success = false; - - if (file_exists (mf.Path) == false) { + + if (file_exists (mf.Path) == false) { mf.Status = FileStatus.ERROR; mf.ProgressText = _("Error: File missing"); mf.ProgressPercent = 0; return false; } - + //prepare file CurrentFile = mf; - CurrentFile.prepare (TempDirectory); + CurrentFile.prepare (TempDirectory); CurrentFile.Status = FileStatus.RUNNING; CurrentFile.ProgressText = null; // (not set) show value as percent CurrentFile.ProgressPercent = 0; - + log_msg (_("Source:") + " '%s'".printf(CurrentFile.Path), true); if ((CurrentFile.SubFile != null) && (CurrentFile.SubFile.length > 0)){ log_msg ((mf.HasVideo) ? _("Subtitles:") : _("Lyrics:") + " '%s'".printf(CurrentFile.SubName)); @@ -724,11 +728,11 @@ else{ log_msg ((mf.HasVideo) ? _("Subtitles:") : _("Lyrics:") + " None"); } - + Progress = 0; StatusLine = ""; CurrentLine = ""; - + //convert file string scriptText = build_script (CurrentFile); string scriptPath = save_script (CurrentFile, scriptText); @@ -745,14 +749,14 @@ return is_success; } - + private string build_script (MediaFile mf){ var script = new StringBuilder(); script.append ("#!/bin/bash\n"); script.append ("\n"); - + // insert variables ----------------- - + script.append ("tempDir='" + escape (mf.TempDirectory) + "'\n"); script.append ("inDir='" + escape (mf.Location) + "'\n"); if (OutputDirectory.length == 0){ @@ -770,7 +774,7 @@ script.append ("hasAudio=" + (mf.HasAudio ? "1" : "0") + "\n"); script.append ("hasVideo=" + (mf.HasVideo ? "1" : "0") + "\n"); script.append ("\n"); - + if (mf.HasAudio){ script.append ("tagTitle='" + escape(mf.TrackName) + "'\n"); script.append ("tagTrackNum='" + escape(mf.TrackNumber) + "'\n"); @@ -781,7 +785,7 @@ script.append ("tagComment='" + escape(mf.Comment) + "'\n"); script.append ("\n"); } - + if (mf.SubFile != null){ script.append ("subFile='" + escape (mf.SubFile) + "'\n"); script.append ("subName='" + escape (mf.SubName) + "'\n"); @@ -796,7 +800,7 @@ script.append ("""scriptDir="$( cd -P "$( dirname "${BASH_SOURCE[0]}" )" && pwd )""""); script.append ("\n"); script.append ("cd \"$scriptDir\"\n"); - + if (SelectedScript.Extension == ".sh") { // read and modify script template --------------- @@ -813,11 +817,11 @@ Regex rxCrop_f2t_right = new Regex ("""ffmpeg2theora.*(--cropright [0-9]+) """); Regex rxCrop_f2t_top = new Regex ("""ffmpeg2theora.*(--croptop [0-9]+) """); Regex rxCrop_f2t_bottom = new Regex ("""ffmpeg2theora.*(--cropbottom [0-9]+) """); - + string line = dis.read_line (null); while (line != null) { line = line.replace ("${audiodec}", """avconv -i "${inFile}" -f wav -acodec pcm_s16le -vn -y -"""); - + if (mf.crop_enabled()){ if (rxCrop_libav.match (line, 0, out match)){ line = line.replace (match.fetch(1), "crop=" + mf.crop_values_libav()); @@ -859,20 +863,20 @@ var config = node.get_object(); script.append (get_preset_commandline (mf, config)); - + //copy preset to temp folder for debugging copy_file(SelectedScript.Path, mf.TempDirectory + "/preset.json"); } - + script.append ("exitCode=$?\n"); script.append ("echo ${exitCode} > ${exitCode}\n"); return script.str; } - + private string escape (string txt){ return txt.replace ("'","'\\''"); } - + private string save_script (MediaFile mf, string scriptText){ try{ // create new script file @@ -884,35 +888,35 @@ // set execute permission chmod (mf.TempScriptFile, "u+x"); - } + } catch (Error e) { log_error (e.message); return ""; } - + return mf.TempScriptFile; } private bool run_script (MediaFile mf, string scriptFile){ bool retVal = true; - + if (ConsoleMode) log_msg (_("Converting: Enter (q) to quit or (p) to pause...")); else log_msg (_("Converting...")); - + string[] argv = new string[1]; argv[0] = scriptFile; - + Pid child_pid; int input_fd; int output_fd; int error_fd; try { - + //execute script file --------------------- - + Process.spawn_async_with_pipes( null, //working dir argv, //argv @@ -923,11 +927,11 @@ out input_fd, out output_fd, out error_fd); - + procID = child_pid; - + set_priority(); - + //create stream readers UnixInputStream uisOut = new UnixInputStream(output_fd, false); UnixInputStream uisErr = new UnixInputStream(error_fd, false); @@ -935,36 +939,36 @@ disErr = new DataInputStream(uisErr); disOut.newline_type = DataStreamNewlineType.ANY; disErr.newline_type = DataStreamNewlineType.ANY; - + //create log file var file = File.new_for_path (mf.LogFile); var file_stream = file.create (FileCreateFlags.REPLACE_DESTINATION); dsLog = new DataOutputStream (file_stream); - + //start another thread for reading error stream - + try { Thread.create<void> (read_std_err, true); } catch (Error e) { log_error (e.message); } - - //start reading output stream in current thread + + //start reading output stream in current thread outLine = disOut.read_line (null); while (outLine != null) { update_progress (outLine.strip()); outLine = disOut.read_line (null); } - + Thread.usleep ((ulong) 0.1 * 1000000); dsLog.close(); - + } catch (Error e) { log_error (e.message); retVal = false; - } - + } + if (ConsoleMode){ //remove the last status line stdout.printf ("\r%s\r", blankLine); @@ -972,10 +976,10 @@ return retVal; } - + private bool check_status (MediaFile mf){ bool retVal = false; - + if (file_exists (mf.TempDirectory + "/0")) { mf.Status = FileStatus.SUCCESS; mf.ProgressText = _("Done"); @@ -991,7 +995,7 @@ mf.ProgressText = _("Error"); mf.ProgressPercent = 0; retVal = false; - + if (ShowNotificationPopups){ notify_send (_("Completed"), mf.Name, 2000, "low", "warning"); } @@ -1006,10 +1010,10 @@ else if (mf.Status == FileStatus.ERROR) { log_msg (_("Failed")); } - + return retVal; } - + private void read_std_err(){ try{ errLine = disErr.read_line (null); @@ -1020,28 +1024,28 @@ } catch (Error e) { log_error (e.message); - } + } } - - public bool update_progress (string line){ + + public bool update_progress (string line){ tempLine = line; if ((tempLine == null)||(tempLine.length == 0)){ return true; } if (tempLine.index_of ("overread, skip") != -1){ return true; } if (tempLine.index_of ("Last message repeated") != -1){ return true; } if (tempLine.index_of ("Converting:") != -1){ return true; } //mkvmerge - + if (regex_libav.match (tempLine, 0, out match)){ - + if (match.fetch(1).contains(":")){ dblVal = parse_time(match.fetch(1)); } else{ dblVal = double.parse(match.fetch(1)); } - + Progress = (dblVal * 1000) / CurrentFile.Duration; - + if (regex_libav_video.match (tempLine, 0, out match)){ StatusLine = "(avconv) %s fps, %s kbps, %s kb".printf(match.fetch(1), match.fetch(3), match.fetch(2)); } @@ -1055,13 +1059,13 @@ else if (regex_x264.match (tempLine, 0, out match)){ dblVal = double.parse(match.fetch(1)); Progress = dblVal / CurrentFile.OutputFrameCount; - + StatusLine = "%s fps, %s kbps".printf(match.fetch(2), match.fetch(3)); } else if (regex_ffmpeg2theora.match (tempLine, 0, out match)){ dblVal = parse_time (match.fetch(1)); Progress = (dblVal * 1000) / CurrentFile.Duration; - + if (regex_ffmpeg2theora2.match (tempLine, 0, out match)){ StatusLine = "(ffmpeg2theora) %s+%s kbps, %s mb, eta %s".printf(match.fetch(2), match.fetch(3), match.fetch(5), match.fetch(4)); } @@ -1112,14 +1116,14 @@ log_error (e.message); } } - + if (Progress < 1) { CurrentFile.ProgressPercent = (int)(Progress * 100); } else{ CurrentFile.ProgressPercent = 100; } - + if (ConsoleMode){ stdout.printf ("\r%s\r", blankLine[0:78]); if (Status == AppStatus.RUNNING){ @@ -1130,85 +1134,85 @@ } stdout.flush(); } - + return true; } - + public void stop_batch(){ // we need to un-freeze the processes before we kill it if (Status == AppStatus.PAUSED){ - resume(); + resume(); } - + Aborted = true; for(int k = InputFiles.index_of(CurrentFile); k < InputFiles.size; k++) { MediaFile mf = InputFiles[k]; mf.ProgressText = _("Cancelled"); } - + process_kill (procID); } - + public void stop_file(){ // we need to un-freeze the processes before we kill them if (Status == AppStatus.PAUSED){ - resume(); + resume(); } - + // Aborted = true; //Do not set Abort flag CurrentFile.Status = FileStatus.SKIPPED; CurrentFile.ProgressText = _("Cancelled"); process_kill (procID); } - + public void pause(){ Pid childPid; foreach (long pid in get_process_children (procID)){ childPid = (Pid) pid; process_pause (childPid); } - + Status = AppStatus.PAUSED; CurrentFile.ProgressText = _("Paused"); - + if (ConsoleMode) log_msg (_("Paused: Enter (r) to resume...")); else log_msg (_("Paused")); } - + public void resume(){ Pid childPid; foreach (long pid in get_process_children (procID)){ childPid = (Pid) pid; process_resume (childPid); } - + Status = AppStatus.RUNNING; CurrentFile.ProgressText = null; - + if (ConsoleMode) log_msg (_("Converting: Enter (q) to quit or (p) to pause...")); else log_msg (_("Converting...")); } - + public void set_priority(){ int prio = 0; if (BackgroundMode) { prio = 5; } - + Pid appPid = Posix.getpid(); process_set_priority (appPid, prio); - + if (Status == AppStatus.RUNNING){ process_set_priority (procID, prio); - + Pid childPid; foreach (long pid in get_process_children (procID)){ childPid = (Pid) pid; - + if (BackgroundMode) process_set_priority (childPid, prio); else @@ -1221,23 +1225,23 @@ shutdown(); return true; } - + //create command string - + private string get_preset_commandline (MediaFile mf, Json.Object settings, out Gee.ArrayList<string>? encoderList = null){ string s = ""; - + //this list is used for returning the list of encoders that is used by the preset encoderList = new Gee.ArrayList<string>(); - + Json.Object general = (Json.Object) settings.get_object_member("general"); Json.Object video = (Json.Object) settings.get_object_member("video"); Json.Object audio = (Json.Object) settings.get_object_member("audio"); //Json.Object subs = (Json.Object) settings.get_object_member("subtitle"); - + //insert temporary file names ------------ - + s += "\n"; s += "outputFile=\"${outDir}/${title}" + general.get_string_member("extension") + "\"\n"; if (mf.HasVideo && video.get_string_member("codec") != "disable"){ @@ -1260,13 +1264,13 @@ } } s += "\n"; - + //create command line -------------- - + string format = general.get_string_member("format"); string acodec = audio.get_string_member("codec"); string vcodec = video.get_string_member("codec"); - + switch (format){ case "mkv": case "mp4v": @@ -1284,7 +1288,7 @@ encoderList.add("avconv"); break; } - + //encode audio if (mf.HasAudio && acodec != "disable") { switch (acodec) { @@ -1311,7 +1315,7 @@ break; } } - + //mux audio, video and subs switch (format){ case "mkv": @@ -1344,12 +1348,12 @@ break; } break; - + case "ogv": s += encode_video_ffmpeg2theora(mf,settings); encoderList.add("ffmpeg2theora"); break; - + case "mp3": s += encode_audio_mp3lame(mf,settings); encoderList.add("lame"); @@ -1357,7 +1361,7 @@ encoderList.add("sox"); }; break; - + case "mp4a": s += encode_audio_neroaac(mf,settings); encoderList.add("neroaacenc"); @@ -1365,7 +1369,7 @@ encoderList.add("sox"); }; break; - + case "opus": s += encode_audio_opus(mf,settings); encoderList.add("opusenc"); @@ -1373,7 +1377,7 @@ encoderList.add("sox"); }; break; - + case "ogg": s += encode_audio_oggenc(mf,settings); encoderList.add("oggenc"); @@ -1392,9 +1396,9 @@ }; break; } - + s += "\n"; - + //set output file path string outpath = ""; if (OutputDirectory.length == 0){ @@ -1403,13 +1407,13 @@ outpath = OutputDirectory; } mf.OutputFilePath = outpath + "/" + mf.Title + general.get_string_member("extension") ; - + return s; } public Gee.ArrayList<string> get_encoder_list(){ var encoderList = new Gee.ArrayList<string>(); - + if (SelectedScript.Extension == ".json") { var parser = new Json.Parser(); try{ @@ -1419,37 +1423,37 @@ } var node = parser.get_root(); var config = node.get_object(); - + get_preset_commandline(InputFiles[0], config, out encoderList); } return encoderList; } - + private string encode_video_x264 (MediaFile mf, Json.Object settings){ string s = ""; - + //Json.Object general = (Json.Object) settings.get_object_member("general"); Json.Object video = (Json.Object) settings.get_object_member("video"); //Json.Object audio = (Json.Object) settings.get_object_member("audio"); string vcodec = video.get_string_member("codec"); - + bool usePiping = true; /* Note: If x264 is compiled without lavf or ffms support then * piping is required. Since this is the most common case, * we will always use piping to ensure that encoding does not fail. * */ - + if (usePiping) { s += decode_video_avconv(mf,settings,true,true,false,false); - - /* Note: + + /* Note: * Resampling with be done by ffmpeg since x264 does not provide this option. * Cropping and scaling will be done by x264 since it provides extra options such as resizing method. * */ } - + switch(vcodec){ case "x264": s += "x264"; @@ -1458,18 +1462,18 @@ s += "x265"; break; } - - + + if (video.get_string_member("mode") == "2pass"){ - s += " --pass {passNumber}"; + s += " --pass {passNumber}"; } - + s += " --preset " + video.get_string_member("preset"); - + if (video.get_string_member("profile").length > 0){ s += " --profile " + video.get_string_member("profile"); } - + switch(video.get_string_member("mode")){ case "vbr": s += " --crf " + video.get_string_member("quality"); @@ -1479,11 +1483,11 @@ s += " --bitrate " + video.get_string_member("bitrate"); break; } - + // filters ---------- - + string vf = ""; - + //cropping if (mf.crop_enabled()) { vf += "/crop:" + mf.crop_values_x264(); @@ -1496,28 +1500,28 @@ string method = video.get_string_member("resizingMethod"); vf += "/resize:width=%d,height=%d,method=%s".printf(w,h,method); } - + if (vf.length > 0){ s += " --vf " + vf[1:vf.length]; } - + //other options if (video.get_string_member("options").strip() != "") { s += " " + video.get_string_member("options").strip(); } - + //add output file path placeholder s += " -o {outputFile}"; - + /* Note: For x264, output is always written to tempVideo and then muxed into outputFile */ - + if (usePiping) { //encode from stdin s += " -"; - + //specify source dimensions s += " --input-res %dx%d".printf(mf.SourceWidth, mf.SourceHeight); - + //specify source FPS int fpsNum = int.parse(video.get_string_member("fpsNum")); int fpsDenom = int.parse(video.get_string_member("fpsDenom")); @@ -1527,7 +1531,7 @@ else{ s += " --fps %.0lf/1000".printf(mf.SourceFrameRate * 1000); } - + } else { //encode from input file @@ -1535,7 +1539,7 @@ } s += "\n"; - + if (video.get_string_member("mode") == "2pass"){ string temp = s.replace("{passNumber}","1").replace("{outputFile}","/dev/null"); temp += s.replace("{passNumber}","2").replace("{outputFile}","\"${tempVideo}\""); @@ -1544,18 +1548,18 @@ else{ s = s.replace("{outputFile}","\"${tempVideo}\""); } - + return s; } - + private string encode_video_ffmpeg2theora (MediaFile mf, Json.Object settings){ string s = ""; - + //Json.Object general = (Json.Object) settings.get_object_member("general"); Json.Object video = (Json.Object) settings.get_object_member("video"); Json.Object audio = (Json.Object) settings.get_object_member("audio"); Json.Object subs = (Json.Object) settings.get_object_member("subtitle"); - + s += "ffmpeg2theora"; s += " \"${inFile}\""; @@ -1570,7 +1574,7 @@ s += " --two-pass --videobitrate " + video.get_string_member("bitrate"); break; } - + //cropping if (mf.crop_enabled()) { s += " --croptop %d --cropbottom %d --cropleft %d --cropright %d".printf(mf.CropT,mf.CropB,mf.CropL,mf.CropR); @@ -1582,7 +1586,7 @@ if (rescale) { s += " --width %d --height %d".printf(w,h); } - + //fps int fpsNum = int.parse(video.get_string_member("fpsNum")); int fpsDenom = int.parse(video.get_string_member("fpsDenom")); @@ -1590,7 +1594,7 @@ s += " --framerate %d/%d".printf(fpsNum,fpsDenom); mf.OutputFrameCount = (long) Math.floor((mf.Duration / 1000.0) * ((float)fpsNum/fpsDenom)); } - + //audio if (mf.HasAudio && audio.get_string_member("codec") != "disable") { //mode @@ -1618,7 +1622,7 @@ else { s += " --noaudio"; } - + //subs if (subs.get_string_member("mode") == "embed") { if (mf.SubExt == ".srt"){ @@ -1628,37 +1632,37 @@ else { s += " --nosubtitles"; } - + //other options if (video.get_string_member("options").strip() != "") { s += " " + video.get_string_member("options").strip(); } - + s += " --output \"${outputFile}\""; s += "\n"; return s; } - + /* private string encode_video_avconv (MediaFile mf, Json.Object settings) { string s = ""; - + Json.Object general = (Json.Object) settings.get_object_member("general"); Json.Object video = (Json.Object) settings.get_object_member("video"); //Json.Object audio = (Json.Object) settings.get_object_member("audio"); - + s += "avconv"; s += " -i \"${inFile}\""; s += " -f " + general.get_string_member("format"); s += " -an -sn -c:v libvpx"; if (video.get_string_member("mode") == "2pass"){ - s += " -pass {passNumber}"; + s += " -pass {passNumber}"; } - + string kbps = video.get_string_member("bitrate"); switch(video.get_string_member("mode")){ case "vbr": @@ -1672,18 +1676,18 @@ s += " -crf %s".printf(video.get_string_member("quality")); break; } - + s += " -deadline " + video.get_string_member("speed"); - + // filters ---------- - + //fps if (video.get_string_member("fpsNum") != "0" && video.get_string_member("fpsDenom") != "0") { s += " -r " + video.get_string_member("fpsNum") + "/" + video.get_string_member("fpsDenom"); } - + string vf = ""; - + //cropping if (mf.crop_enabled()) { vf += ",crop=%s".printf(mf.crop_values_libav()); @@ -1699,19 +1703,19 @@ if (vf.length > 0){ s += " -vf " + vf[1:vf.length]; } - + //--------------- - + //other options if (video.get_string_member("options").strip() != "") { s += " " + video.get_string_member("options").strip(); } - + //add output file path placeholder s += " -y {outputFile}"; - + s += "\n"; - + if (video.get_string_member("mode") == "2pass"){ string temp = s.replace("{passNumber}","1").replace("{outputFile}","/dev/null"); temp += s.replace("{passNumber}","2").replace("{outputFile}","\"${tempVideo}\""); @@ -1721,7 +1725,7 @@ { s = s.replace("{outputFile}","\"${tempVideo}\""); } - + return s; } */ @@ -1729,23 +1733,23 @@ /* * private string encode_video_vpxenc (MediaFile mf, Json.Object settings){ string s = ""; - + //Json.Object general = (Json.Object) settings.get_object_member("general"); Json.Object video = (Json.Object) settings.get_object_member("video"); //Json.Object audio = (Json.Object) settings.get_object_member("audio"); string vcodec = video.get_string_member("codec"); - + s += decode_video_avconv(mf,settings,true); s += "vpxenc"; s += " --codec=" + vcodec; - + if (video.get_string_member("mode") == "2pass"){ - s += " --passes=2 --pass={passNumber} --fpf=stats"; + s += " --passes=2 --pass={passNumber} --fpf=stats"; } else{ s += " --passes=1"; } - + string vquality = "%.0f".printf(double.parse(video.get_string_member("quality"))); switch(video.get_string_member("mode")){ case "vbr": @@ -1759,7 +1763,7 @@ s += " --end-usage=cq --cq-level=" + vquality; break; } - + s += " --good"; switch(video.get_string_member("speed")){ case "good_0": @@ -1783,25 +1787,25 @@ } //--------------- - + //other options if (video.get_string_member("options").strip() != "") { s += " " + video.get_string_member("options").strip(); } - + //specify input dimensions (required) int w,h; calculate_video_resolution(mf, settings, out w, out h); s += " --width=%d --height=%d".printf(w,h); - + //output s += " -o {outputFile}"; - + //input s += " -"; s += "\n"; - + if (video.get_string_member("mode") == "2pass"){ string temp = s.replace("{passNumber}","1").replace("{outputFile}","/dev/null"); temp += s.replace("{passNumber}","2").replace("{outputFile}","\"${tempVideo}\""); @@ -1811,23 +1815,23 @@ { s = s.replace("{outputFile}","\"${tempVideo}\""); } - + return s; }*/ - + private string encode_video_avconv (MediaFile mf, Json.Object settings){ string s = ""; - + Json.Object general = (Json.Object) settings.get_object_member("general"); Json.Object video = (Json.Object) settings.get_object_member("video"); //Json.Object audio = (Json.Object) settings.get_object_member("audio"); string vcodec = video.get_string_member("codec"); string format = general.get_string_member("format"); - + s += "avconv"; s += " -i \"${inFile}\""; s += " -f " + format; - + switch(vcodec){ case "vp8": s += " -c:v libvpx"; @@ -1838,7 +1842,7 @@ } if (video.get_string_member("mode") == "2pass"){ - s += " -pass {passNumber}"; + s += " -pass {passNumber}"; } string vquality = "%.0f".printf(double.parse(video.get_string_member("quality"))); @@ -1858,30 +1862,43 @@ s += " -qmax " + vquality; break; } - - s += " -quality good"; - if (video.has_member("vpx_speed")){ - s += " -speed " + video.get_string_member("vpx_speed"); + + switch(vcodec){ + case "vp8": + case "vp9": + if (video.has_member("vpx_deadline")){ + s += " -deadline " + video.get_string_member("vpx_deadline"); + } + else{ + s += " -deadline good"; + } + if (video.has_member("vpx_speed")){ + s += " -cpu-used " + video.get_string_member("vpx_speed"); + } + else{ + s += " -cpu-used 1"; + } + break; } //--------------- - + //user options if (video.get_string_member("options").strip() != "") { s += " " + video.get_string_member("options").strip(); } - + //resample, crop and resize s += avconv_vf_options(mf,settings); - + //disable audio and subs s += " -an -sn"; - + //output s += " -y {outputFile}"; //no quotes - + s += "\n"; - + if (video.get_string_member("mode") == "2pass"){ string temp = s.replace("{passNumber}","1").replace("{outputFile}","/dev/null"); temp += s.replace("{passNumber}","2").replace("{outputFile}","\"${tempVideo}\""); @@ -1891,36 +1908,36 @@ { s = s.replace("{outputFile}","\"${tempVideo}\""); } - + return s; } - + private bool calculate_video_resolution (MediaFile mf, Json.Object settings, out int OutputWidth, out int OutputHeight){ bool rescale = false; - + OutputWidth = mf.SourceWidth; OutputHeight = mf.SourceHeight; - + Json.Object video = (Json.Object) settings.get_object_member("video"); - + if (mf.crop_enabled()){ OutputWidth -= (mf.CropL + mf.CropR); OutputHeight -= (mf.CropT + mf.CropB); log_msg("Cropped: %.0fx%.0f".printf(OutputWidth,OutputHeight)); } - + int maxw = int.parse(video.get_string_member("frameWidth")); int maxh = int.parse(video.get_string_member("frameHeight")); double iw = OutputWidth; double ow = iw; double ih = OutputHeight; double oh = ih; - + //flags for checking if resizing is actually required bool noResize = false; bool isUpscale = false; bool isSameSize = false; - + if (maxw == 0 && maxh == 0) { //do nothing noResize = true; @@ -1948,14 +1965,14 @@ } else { log_msg("FitToBox is enabled"); - + //fit height if (maxh > 0) { if (oh > maxh) { oh = maxh; } ow = oh * (iw / ih); ow = Math.floor(ow); ow = ow - (ow % 4); - + log_msg("Fit width: %.0f".printf(ow)); rescale = true; } @@ -1980,12 +1997,12 @@ isUpscale = true; } } - + //check if final size is same as original size if ((ow == OutputWidth)&&(oh == OutputHeight)) { isSameSize = true; } - + if (noResize || isUpscale || isSameSize) { //do not resize return false; @@ -1998,14 +2015,14 @@ return true; } } - + private string encode_audio_mp3lame (MediaFile mf, Json.Object settings){ string s = ""; - + //Json.Object general = (Json.Object) settings.get_object_member("general"); Json.Object video = (Json.Object) settings.get_object_member("video"); Json.Object audio = (Json.Object) settings.get_object_member("audio"); - + s += decode_audio_avconv(mf, settings, false); s += "lame --nohist --brief -q 5 --replaygain-fast"; switch (audio.get_string_member("mode")){ @@ -2040,17 +2057,17 @@ s += " \"${outputFile}\""; } s += "\n"; - + return s; } - + private string encode_audio_neroaac (MediaFile mf, Json.Object settings){ string s = ""; - + //Json.Object general = (Json.Object) settings.get_object_member("general"); Json.Object video = (Json.Object) settings.get_object_member("video"); Json.Object audio = (Json.Object) settings.get_object_member("audio"); - + s += decode_audio_avconv(mf, settings, false); s += "neroAacEnc -ignorelength"; switch (audio.get_string_member("mode")){ @@ -2074,7 +2091,7 @@ s += " -of \"${outputFile}\""; } s += "\n"; - + //add tags string tags = ""; string path = get_cmd_path ("neroAacTag"); @@ -2096,17 +2113,17 @@ return s; } - + private string encode_audio_opus (MediaFile mf, Json.Object settings){ string s = ""; - + //Json.Object general = (Json.Object) settings.get_object_member("general"); Json.Object video = (Json.Object) settings.get_object_member("video"); Json.Object audio = (Json.Object) settings.get_object_member("audio"); - + s += decode_audio_avconv(mf, settings, true); s += "opusenc"; - + //tags s += (mf.TrackName.length > 0) ? " --title \"${tagTitle}\"" : ""; s += (mf.TrackNumber.length > 0) ? " --comment=\"track=${tagTrackNum}\"" : ""; @@ -2114,8 +2131,8 @@ s += (mf.Album.length > 0) ? " --comment=\"album=${tagAlbum}\"" : ""; s += (mf.Genre.length > 0) ? " --comment=\"genre=${tagGenre}\"" : ""; s += (mf.RecordedDate.length > 0) ? " --comment=\"year=${tagYear}\"" : ""; - s += (mf.Comment.length > 0) ? " --comment=\"comment=${tagComment}\"" : ""; - + s += (mf.Comment.length > 0) ? " --comment=\"comment=${tagComment}\"" : ""; + //options s += " --bitrate " + audio.get_string_member("bitrate"); switch (audio.get_string_member("mode")){ @@ -2129,7 +2146,7 @@ s += " --hard-cbr"; break; } - + switch (audio.get_string_member("opusOptimize")){ case "none": //do nothing @@ -2141,10 +2158,10 @@ s += " --music"; break; } - + //input s += " -"; - + //output if (mf.HasVideo && video.get_string_member("codec") != "disable") { //encode to tempAudio @@ -2155,20 +2172,20 @@ s += " \"${outputFile}\""; } s += "\n"; - + return s; } - + private string encode_audio_avconv (MediaFile mf, Json.Object settings){ string s = ""; - + Json.Object general = (Json.Object) settings.get_object_member("general"); //Json.Object video = (Json.Object) settings.get_object_member("video"); Json.Object audio = (Json.Object) settings.get_object_member("audio"); string format = general.get_string_member("format"); bool sox_enabled = audio.get_boolean_member("soxEnabled"); - + if (sox_enabled){ s += decode_audio_avconv(mf, settings, true); s += "avconv"; @@ -2192,7 +2209,7 @@ s += " -acodec " + audio.get_string_member("codec"); break; } - + //channels string channels = audio.get_string_member("channels"); if (channels != "disable"){ @@ -2212,26 +2229,26 @@ s += (mf.Album.length > 0) ? " -metadata 'album'=\"${tagAlbum}\"" : ""; s += (mf.Genre.length > 0) ? " -metadata 'genre'=\"${tagGenre}\"" : ""; s += (mf.RecordedDate.length > 0) ? " -metadata 'year'=\"${tagYear}\"" : ""; - s += (mf.Comment.length > 0) ? " -metadata 'comment'=\"${tagComment}\"" : ""; - + s += (mf.Comment.length > 0) ? " -metadata 'comment'=\"${tagComment}\"" : ""; + s += " -vn -sn"; s += " -y \"${outputFile}\""; - + return s; } - + private string encode_audio_oggenc (MediaFile mf, Json.Object settings){ string s = ""; - + //Json.Object general = (Json.Object) settings.get_object_member("general"); Json.Object video = (Json.Object) settings.get_object_member("video"); Json.Object audio = (Json.Object) settings.get_object_member("audio"); Json.Object subs = (Json.Object) settings.get_object_member("subtitle"); - + s += decode_audio_avconv(mf, settings, false); s += "oggenc --quiet"; - + //mode switch (audio.get_string_member("mode")){ case "vbr": @@ -2241,7 +2258,7 @@ s += " --quality " + audio.get_string_member("quality"); break; } - + //tags s += (mf.TrackName.length > 0) ? " --title \"${tagTitle}\"" : ""; s += (mf.TrackNumber.length > 0) ? " --comment=\"track=${tagTrackNum}\"" : ""; @@ -2250,7 +2267,7 @@ s += (mf.Genre.length > 0) ? " --genre \"${tagGenre}\"" : ""; s += (mf.RecordedDate.length > 0) ? " --date \"${tagYear}\"" : ""; s += (mf.Comment.length > 0) ? " --comment='comment=${tagComment}'" : ""; - + //subs if (subs.get_string_member("mode") == "embed") { if (mf.SubExt == ".srt" || mf.SubExt == ".lrc") { @@ -2267,50 +2284,50 @@ //encode to outputFile s += " --output \"${outputFile}\""; } - + //input s += " -"; - + s += "\n"; - + return s; } private string decode_video_avconv (MediaFile mf, Json.Object settings, bool silent, bool resample = true, bool crop = true, bool scale = true){ string s = ""; - + //Json.Object general = (Json.Object) settings.get_object_member("general"); //Json.Object video = (Json.Object) settings.get_object_member("video"); //Json.Object audio = (Json.Object) settings.get_object_member("audio"); //Json.Object subs = (Json.Object) settings.get_object_member("subtitle"); - + s += "avconv"; - + //progress info if (silent){ s += " -nostats"; } //input s += " -i \"${inFile}\""; - + //format s += " -copyinkf -f rawvideo -vcodec rawvideo -pix_fmt yuv420p"; //framerate, crop and resize s += avconv_vf_options(mf,settings, resample, crop, scale); - + //output s += " -an -sn -y - | "; - + return s; } - + private string avconv_vf_options (MediaFile mf, Json.Object settings, bool resample = true, bool crop = true, bool scale = true){ string s = ""; string vf = ""; - + Json.Object video = (Json.Object) settings.get_object_member("video"); - + //resample if (resample){ int fpsNum = int.parse(video.get_string_member("fpsNum")); @@ -2320,14 +2337,14 @@ mf.OutputFrameCount = (long)((mf.Duration / 1000.0) * ((float)fpsNum/fpsDenom)); } } - + //crop if (crop){ if (mf.crop_enabled()) { vf += ",crop=%s".printf(mf.crop_values_libav()); } } - + //scale if (scale){ int w,h; @@ -2340,19 +2357,19 @@ if (vf.length > 0){ s += " -vf " + vf[1:vf.length]; } - + return s; } - + private string decode_audio_avconv(MediaFile mf, Json.Object settings, bool silent){ string s = ""; - + Json.Object audio = (Json.Object) settings.get_object_member("audio"); string acodec = audio.get_string_member("codec"); bool sox_enabled = audio.get_boolean_member("soxEnabled"); - + s += "avconv"; - + //progress info if (silent){ s += " -nostats"; @@ -2360,14 +2377,14 @@ else{ s += " -stats"; } - + //input s += " -i \"${inFile}\""; - + //format s += " -f " + ((sox_enabled) ? "aiff" : "wav"); s += " -acodec pcm_s16le"; - + //channels string channels = audio.get_string_member("channels"); if (channels == "disable"){ @@ -2379,26 +2396,26 @@ else{ s += " -ac " + channels; } - + //sampling string sampling = audio.get_string_member("samplingRate"); if (sampling != "disable"){ s += " -ar " + sampling; } - + //output s += " -vn -y - | "; - + if (sox_enabled){ s += process_audio_sox(mf,settings); } - + return s; } private string process_audio_sox(MediaFile mf, Json.Object settings){ string s = ""; - + Json.Object audio = (Json.Object) settings.get_object_member("audio"); s += "sox"; @@ -2439,41 +2456,41 @@ if (sox_earwax){ s += " earwax"; } - + //pipe s += " | "; - + return s; } - + private string mux_mkvmerge (MediaFile mf, Json.Object settings){ string s = ""; - + Json.Object general = (Json.Object) settings.get_object_member("general"); //Json.Object video = (Json.Object) settings.get_object_member("video"); Json.Object audio = (Json.Object) settings.get_object_member("audio"); Json.Object subs = (Json.Object) settings.get_object_member("subtitle"); - + string format = general.get_string_member("format"); - + s += "mkvmerge"; - + //webm compliance if (format == "webm") { s += " --webm"; } - + //output s += " --output \"${outputFile}\""; - + //add video s += " --compression -1:none \"${tempVideo}\""; - + //add audio if (mf.HasAudio && audio.get_string_member("codec") != "disable") { s += " --compression -1:none \"${tempAudio}\""; } - + //add subs if (format != "webm") { if (subs.get_string_member("mode") == "embed") { @@ -2485,55 +2502,55 @@ else{ //WebM currently does not support subtitles } - + s += "\n"; - + return s; } - + private string mux_mp4box (MediaFile mf, Json.Object settings){ string s = ""; - + //Json.Object general = (Json.Object) settings.get_object_member("general"); //Json.Object video = (Json.Object) settings.get_object_member("video"); Json.Object audio = (Json.Object) settings.get_object_member("audio"); Json.Object subs = (Json.Object) settings.get_object_member("subtitle"); s += "MP4Box -new"; - + if (mf.HasAudio && audio.get_string_member("codec") != "disable") { s += " -add \"${tempAudio}\""; } - + s += " -add \"${tempVideo}\""; - + if (subs.get_string_member("mode") == "embed") { if (mf.SubExt == ".srt" || mf.SubExt == ".sub" || mf.SubExt == ".ttxt" || mf.SubExt == ".xml"){ s += " -add \"${subFile}\""; } } - + s += " \"${outputFile}\""; s += "\n"; - + return s; } - + private string mux_avconv (MediaFile mf, Json.Object settings) { string s = ""; - + Json.Object general = (Json.Object) settings.get_object_member("general"); //Json.Object video = (Json.Object) settings.get_object_member("video"); Json.Object audio = (Json.Object) settings.get_object_member("audio"); string format = general.get_string_member("format"); - + s += "avconv"; if (mf.HasAudio && audio.get_string_member("codec") != "disable") { s += " -i \"${tempAudio}\""; } s += " -i \"${tempVideo}\""; - + switch(format){ case "mp4v": s += " -f mp4"; @@ -2545,7 +2562,7 @@ s += " -c:a copy -c:v copy -sn"; s += " -y \"${outputFile}\""; s += "\n"; - + return s; } } @@ -2556,10 +2573,11 @@ public string Title; public string Extension; public string Location; - + public int64 Size = 0; public long Duration = 0; //in milliseconds - + public string ThumbnailImagePath = ""; + public string SubFile = ""; public string SubName = ""; public string SubExt = ""; @@ -2571,7 +2589,7 @@ public string Genre = ""; public string RecordedDate = ""; public string Comment = ""; - + public int CropW = 0; public int CropH = 0; public int CropL = 0; @@ -2579,44 +2597,49 @@ public int CropT = 0; public int CropB = 0; public bool AutoCropError = false; - + public FileStatus Status = FileStatus.PENDING; public bool IsValid; public string ProgressText = _("Queued"); public int ProgressPercent = 0; - + public string InfoText; public bool HasAudio = false; public bool HasVideo = false; + public bool HasSubs = false; public int SourceWidth = 0; public int SourceHeight = 0; public double SourceFrameRate = 0; public int AudioChannels = 0; - + + public string FileFormat = ""; + public string VideoFormat = ""; + public string AudioFormat = ""; + public string TempScriptFile; public string TempDirectory = ""; public string LogFile = ""; public string OutputFilePath = ""; public long OutputFrameCount = 0; - + public MediaFile(string filePath){ IsValid = false; if (file_exists (filePath) == false) { return; } - + // set file properties ------------ - + File f = File.new_for_path (filePath); File fp = f.get_parent(); - + Path = filePath; Name = f.get_basename(); Title = Name[0: Name.last_index_of(".",0)]; Extension = Name[Name.last_index_of(".",0):Name.length]; Location = fp.get_path(); //stderr.printf(@"file=$filePath, name=$Name, title=$Title, ext=$Extension, dir=$Location\n"); - + FileInfo fi = null; - + try{ fi = f.query_info ("*", FileQueryInfoFlags.NONE, null); Size = fi.get_size(); @@ -2626,12 +2649,12 @@ } // get media information ---------- - + query_mediainfo(); if (Duration == 0) { return; } - + // search for subtitle files --------------- - + try{ var enumerator = fp.enumerate_children ("standard::*", 0); var fileInfo = enumerator.next_file(); @@ -2643,6 +2666,7 @@ SubName = fileInfo.get_name(); SubFile = Location + "/" + SubName; SubExt = SubFile[SubFile.last_index_of(".",0):SubFile.length].down(); + HasSubs = true; //log ("file=%s, name=%s, ext=%s\n".printf(SubFile, SubName, SubExt)); } } @@ -2652,22 +2676,27 @@ catch(Error e){ log_error (e.message); } - + + + // get thumbnail --------- + + generate_thumbnail(); + IsValid = true; } - + public void query_mediainfo(){ InfoText = get_mediainfo (Path); - + if (InfoText == null || InfoText == ""){ return; } - + string sectionType = ""; - + foreach (string line in InfoText.split ("\n")){ if (line == null || line.length == 0) { continue; } - + if (line.contains (":") == false) { if (line.contains ("Audio")){ @@ -2681,14 +2710,18 @@ else if (line.contains ("General")){ sectionType = "general"; } + else if (line.contains ("Text")){ + sectionType = "text"; + HasSubs = true; + } } else{ string[] arr = line.split (": "); if (arr.length != 2) { continue; } - + string key = arr[0].strip(); string val = arr[1].strip(); - + if (sectionType == "general"){ switch (key.down()) { case "duration": @@ -2726,6 +2759,9 @@ case "comment": Comment = val; break; + case "format": + FileFormat = val; + break; } } else if (sectionType == "video"){ @@ -2740,6 +2776,9 @@ case "original frame rate": SourceFrameRate = int.parse(val.replace ("fps","").replace (" ","").strip()); break; + case "format": + VideoFormat = val; + break; } } else if (sectionType == "audio"){ @@ -2747,12 +2786,15 @@ case "channel(s)": AudioChannels = int.parse(val.replace ("channels","").replace ("channel","").strip()); break; + case "format": + AudioFormat = val; + break; } } } } } - + public void prepare (string baseTempDir){ TempDirectory = baseTempDir + "/" + timestamp2() + " - " + Name; LogFile = TempDirectory + "/" + "log.txt"; @@ -2768,13 +2810,21 @@ OutputFrameCount = 0; } } - + + public void generate_thumbnail(){ + int imageWidth = 80; + int imageHeight= 64; + ThumbnailImagePath = get_temp_file_path() + ".png"; + string std_out, std_err; + execute_command_script_sync("avconv -ss 1 -i \"%s\" -y -f image2 -vframes 1 -r 1 -s %dx%d \"%s\"".printf(Path,imageWidth,imageHeight,ThumbnailImagePath), out std_out, out std_err); + } + public bool crop_detect(){ - if (HasVideo == false) { + if (HasVideo == false) { AutoCropError = true; - return false; + return false; } - + string params = get_file_crop_params (Path); string[] arr = params.split (":"); @@ -2784,10 +2834,10 @@ CropL = int.parse (arr[2]); CropT = int.parse (arr[3]); } - + CropR = SourceWidth - CropW - CropL; CropB = SourceHeight - CropH - CropT; - + if ((CropW == 0) && (CropH == 0)){ AutoCropError = true; return false; @@ -2795,14 +2845,14 @@ else return true; } - + public bool crop_enabled(){ if ((CropW == 0)&&(CropH == 0)&&(CropL == 0)&&(CropT == 0)) return false; else return true; } - + public void crop_reset(){ CropW = 0; CropH = 0; @@ -2820,25 +2870,25 @@ else return ""; } - + public string crop_values_libav(){ if (crop_enabled()) return "%i:%i:%i:%i".printf(CropW,CropH,CropL,CropT); else return "iw:ih:0:0"; - } - + } + public string crop_values_x264(){ if (crop_enabled()) return "%i,%i,%i,%i".printf(CropL,CropT,CropR,CropB); else return "0,0,0,0"; } - + public void preview_output(){ string output = ""; string error = ""; - + try { Process.spawn_command_line_sync("avplay -i \"%s\" -vf crop=%s".printf(Path, crop_values_libav()), out output, out error); } @@ -2851,7 +2901,7 @@ if(file_exists(Path)){ string output = ""; string error = ""; - + try { Process.spawn_command_line_sync("avplay -i \"%s\"".printf(Path), out output, out error); } @@ -2860,12 +2910,12 @@ } } } - + public void play_output(){ if(file_exists(OutputFilePath)){ string output = ""; string error = ""; - + try { Process.spawn_command_line_sync("avplay -i \"%s\"".printf(OutputFilePath), out output, out error); } @@ -2882,13 +2932,13 @@ public string Title; public string Extension; public string Folder; - + public ScriptFile(string filePath) { Path = filePath; Name = GLib.Path.get_basename (filePath); Folder = GLib.Path.get_dirname (filePath); - + int index = Name.index_of("."); if (index != -1){ Title = Name[0:Name.last_index_of(".")]; @@ -2906,13 +2956,13 @@ public string Name = ""; public string Description = ""; public bool IsAvailable = false; - + public Encoder(string cmd, string name, string desc){ Command = cmd; Name = name; Description = desc; } - + public bool CheckAvailability(){ bool available = false; string str = get_cmd_path (Command);
View file
selene_2.5.2~185~ubuntu15.04.1.tar.xz/src/MainWindow.vala -> selene_2.5.8~198~ubuntu15.10.1.tar.xz/src/MainWindow.vala
Changed
@@ -1,24 +1,24 @@ /* * MainWindow.vala - * + * * Copyright 2012 Tony George <teejee2008@gmail.com> - * + * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. - * + * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. - * + * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, * MA 02110-1301, USA. - * - * + * + * */ using Gtk; @@ -52,7 +52,7 @@ private ToggleToolButton btnBackground; private SeparatorToolItem separator1; private SeparatorToolItem separator2; - + //preset toolbar private Gtk.Toolbar toolbar2; private ToolButton btnAddPreset; @@ -73,7 +73,7 @@ private Gtk.Menu menuFile; private ImageMenuItem miFileInfo; private ImageMenuItem miFileInfoOutput; - private ImageMenuItem miFileSkip; + private ImageMenuItem miFileSkip; private Gtk.MenuItem miFileCropAuto; private Gtk.MenuItem miFileRemove; private Gtk.MenuItem miFilePreview; @@ -91,7 +91,7 @@ private TreeViewColumn colProgress; private TreeViewColumn colSpacer; private Grid gridConfig; - + private Regex regexGeneric; private Regex regexMkvMerge; private Regex regexFFmpeg; @@ -99,40 +99,59 @@ private Regex regexLibAV_video; private Regex regexLibAV_audio; private Regex regexX264; + private string statusLine; private uint timerID = 0; private uint startupTimer = 0; private uint statusTimer = 0; private uint cpuUsageTimer = 0; + private bool paused = false; private MediaFile lastFile; private const Gtk.TargetEntry[] targets = { { "text/uri-list", 0, 0} }; - + + // initialize window ----------------- + public MainWindow() { set_window_title(); window_position = WindowPosition.CENTER; destroy.connect (Gtk.main_quit); - set_default_size (550, 20); + set_default_size (550, 20); icon = get_app_icon(16); Gtk.drag_dest_set (this,Gtk.DestDefaults.ALL, targets, Gdk.DragAction.COPY); drag_data_received.connect(on_drag_data_received); - - Gdk.RGBA gray = Gdk.RGBA(); - gray.parse ("rgba(200,200,200,1)"); //vboxMain vboxMain = new Box (Orientation.VERTICAL, 0); add (vboxMain); - - //vboxMain2 - vboxMain2 = new Box (Orientation.VERTICAL, 0); - vboxMain2.margin_left = 6; - vboxMain2.margin_right = 6; - + + //main toolbar + init_main_toolbar(); + + //listview + init_list_view(); + refresh_list_view(); + init_list_view_context_menu(); + + //presets + init_preset_toolbar(); + init_preset_dropdowns(); + populate_script_folders(); + select_script(); + + //statusbar + init_statusbar(); + statusbar_default_message(); + + //regex + init_regular_expressions(); + } + + public void init_main_toolbar(){ //toolbar toolbar = new Gtk.Toolbar(); toolbar.toolbar_style = ToolbarStyle.BOTH_HORIZ; @@ -153,14 +172,14 @@ btnRemoveFiles.clicked.connect (btnRemoveFiles_clicked); btnRemoveFiles.set_tooltip_text (_("Remove selected file(s)")); toolbar.add (btnRemoveFiles); - + //btnClearFiles btnClearFiles = new Gtk.ToolButton.from_stock ("gtk-clear"); btnClearFiles.is_important = true; btnClearFiles.clicked.connect (btnClearFiles_clicked); btnClearFiles.set_tooltip_text (_("Remove all file(s)")); toolbar.add (btnClearFiles); - + //separator separator1 = new Gtk.SeparatorToolItem(); toolbar.add(separator1); @@ -172,7 +191,7 @@ btnStart.clicked.connect (start); btnStart.set_tooltip_text (_("Start")); toolbar.add (btnStart); - + //btnPause btnPause = new Gtk.ToolButton.from_stock ("gtk-media-pause"); btnPause.is_important = true; @@ -181,7 +200,7 @@ btnPause.visible = false; btnPause.no_show_all = true; toolbar.add (btnPause); - + //btnStop btnStop = new Gtk.ToolButton.from_stock ("gtk-media-stop"); btnStop.is_important = true; @@ -190,7 +209,7 @@ btnStop.visible = false; btnStop.no_show_all = true; toolbar.add (btnStop); - + //btnFinish btnFinish = new Gtk.ToolButton.from_stock ("gtk-ok"); btnFinish.is_important = true; @@ -200,13 +219,13 @@ btnFinish.visible = false; btnFinish.no_show_all = true; toolbar.add (btnFinish); - + //separator separator2 = new Gtk.SeparatorToolItem(); separator2.set_draw (false); separator2.set_expand (true); toolbar.add (separator2); - + //btnAppSettings btnAppSettings = new Gtk.ToolButton.from_stock ("gtk-preferences"); btnAppSettings.clicked.connect (btnAppSettings_clicked); @@ -218,17 +237,17 @@ btnEncoders.clicked.connect (btnEncoders_clicked); btnEncoders.set_tooltip_text (_("Encoders")); toolbar.add (btnEncoders); - + //btn_donate btnDonate = new Gtk.ToolButton.from_stock ("gtk-dialog-info"); btnDonate.is_important = false; btnDonate.icon_widget = get_shared_icon("donate","donate.svg",24); btnDonate.label = _("Donate"); btnDonate.set_tooltip_text (_("Donate")); - toolbar.add(btnDonate); + //toolbar.add(btnDonate); btnDonate.clicked.connect(btnDonation_clicked); - + //btnAbout btnAbout = new Gtk.ToolButton.from_stock ("gtk-about"); btnAbout.is_important = false; @@ -236,7 +255,7 @@ btnAbout.clicked.connect (btnAbout_clicked); btnAbout.set_tooltip_text (_("About")); toolbar.add (btnAbout); - + //btnShutdown btnShutdown = new Gtk.ToggleToolButton.from_stock ("gtk-quit"); btnShutdown.label = _("Shutdown"); @@ -246,7 +265,7 @@ btnShutdown.clicked.connect (btnShutdown_clicked); btnShutdown.set_tooltip_text (_("Shutdown system after completion")); toolbar.add (btnShutdown); - + //btnBackground btnBackground = new Gtk.ToggleToolButton.from_stock ("gtk-sort-ascending"); btnBackground.label = _("Background"); @@ -256,7 +275,7 @@ btnBackground.clicked.connect (btnBackground_clicked); btnBackground.set_tooltip_text (_("Run processes with lower priority")); toolbar.add (btnBackground); - + //btnOpenOutputFolder btnOpenOutputFolder = new Gtk.ToolButton.from_stock ("gtk-directory"); //btnOpenOutputFolder.is_important = true; @@ -266,11 +285,13 @@ btnOpenOutputFolder.visible = false; btnOpenOutputFolder.no_show_all = true; toolbar.add (btnOpenOutputFolder); - + } + + public void init_list_view(){ //tvFiles tvFiles = new TreeView(); tvFiles.get_selection().mode = SelectionMode.MULTIPLE; - tvFiles.set_tooltip_text (_("File(s) to convert")); + tvFiles.set_tooltip_text (_("Right-click for more options")); tvFiles.set_rules_hint (true); swFiles = new ScrolledWindow(tvFiles.get_hadjustment(), tvFiles.get_vadjustment()); @@ -285,12 +306,63 @@ colName = new TreeViewColumn(); colName.title = _("File"); colName.expand = true; + + CellRendererPixbuf cellThumb = new CellRendererPixbuf (); + colName.pack_start (cellThumb, false); + + CellRendererText cellSpacer = new CellRendererText(); + colName.pack_start (cellSpacer, false); + CellRendererText cellName = new CellRendererText(); cellName.ellipsize = Pango.EllipsizeMode.END; colName.pack_start (cellName, false); - colName.set_attributes(cellName, "text", InputField.FILE_NAME); + + colName.set_cell_data_func (cellThumb, (cell_layout, cell, model, iter)=>{ + string imagePath; + model.get (iter, InputField.FILE_THUMB, out imagePath, -1); + + Gdk.Pixbuf pixThumb = null; + try{ + pixThumb = new Gdk.Pixbuf.from_file (imagePath); + } + catch(Error e){ + log_error (e.message); + } + + if (App.TileView){ + (cell as Gtk.CellRendererPixbuf).pixbuf = pixThumb; + } + else{ + (cell as Gtk.CellRendererPixbuf).pixbuf = null; + } + }); + + colName.set_cell_data_func (cellName, (cell_layout, cell, model, iter)=>{ + string fileName, fileSize, duration, formatInfo, spanStart, spanEnd; + MediaFile mf; + model.get (iter, InputField.FILE_REF, out mf, -1); + model.get (iter, InputField.FILE_NAME, out fileName, -1); + model.get (iter, InputField.FILE_SIZE, out fileSize, -1); + model.get (iter, InputField.FILE_DURATION, out duration, -1); + + spanStart = "<span foreground='#606060'>"; + spanEnd = "</span>"; + fileName = fileName.replace("&","&"); + + formatInfo = ((mf.FileFormat.length > 0) ? ("" + mf.FileFormat) : "") + + ((mf.VideoFormat.length > 0) ? (" - " + mf.VideoFormat) : "") + + ((mf.AudioFormat.length > 0) ? (" - " + mf.AudioFormat) : ""); + + if (App.TileView){ + (cell as Gtk.CellRendererText).markup = "%s\n%s%s | %s\n%s%s".printf(fileName, spanStart, duration, fileSize, formatInfo, spanEnd); + } + else{ + (cell as Gtk.CellRendererText).text = fileName; + } + }); + tvFiles.append_column(colName); - + //colSize colSize = new TreeViewColumn(); colSize.title = _("Size"); @@ -298,7 +370,7 @@ colSize.pack_start (cellSize, false); colSize.set_attributes(cellSize, "text", InputField.FILE_SIZE); tvFiles.append_column(colSize); - + //colDuration colDuration = new TreeViewColumn(); colDuration.title = _("Duration"); @@ -317,7 +389,7 @@ colCrop.pack_start (cellCrop, false); colCrop.set_attributes(cellCrop, "text", InputField.FILE_CROPVAL); tvFiles.append_column(colCrop); - + //colProgress colProgress = new TreeViewColumn(); colProgress.title = _("Status"); @@ -328,25 +400,152 @@ colProgress.pack_start (cellProgress, false); colProgress.set_attributes(cellProgress, "value", InputField.FILE_PROGRESS, "text", InputField.FILE_PROGRESS_TEXT); tvFiles.append_column(colProgress); - + //colSpacer colSpacer = new TreeViewColumn(); colSpacer.expand = false; colSpacer.fixed_width = 10; - CellRendererText cellSpacer = new CellRendererText(); + cellSpacer = new CellRendererText(); colSpacer.pack_start (cellSpacer, false); tvFiles.append_column(colSpacer); - startupTimer = Timeout.add (100,() => - { - colProgress.visible = false; - Source.remove (startupTimer); - return true; + startupTimer = Timeout.add (100,() => + { + colProgress.visible = false; + Source.remove (startupTimer); + return true; }); Gtk.drag_dest_set (tvFiles,Gtk.DestDefaults.ALL, targets, Gdk.DragAction.COPY); tvFiles.drag_data_received.connect(on_drag_data_received); + } + + public void init_list_view_context_menu(){ + Gdk.RGBA gray = Gdk.RGBA(); + gray.parse ("rgba(200,200,200,1)"); + + // menuFile + menuFile = new Gtk.Menu(); + + // miFileSkip + miFileSkip = new ImageMenuItem.from_stock ("gtk-stop", null); + miFileSkip.label = _("Skip File"); + miFileSkip.activate.connect (() => { App.stop_file(); }); + menuFile.append(miFileSkip); + + // miFileCropAuto + miFileCropAuto = new Gtk.MenuItem.with_label (_("AutoCrop Video")); + miFileCropAuto.activate.connect(miFileCropAuto_clicked); + menuFile.append(miFileCropAuto); + + // miFilePreview + miFilePreview = new Gtk.MenuItem.with_label (_("Preview File")); + miFilePreview.activate.connect(miFilePreview_clicked); + menuFile.append(miFilePreview); + + // miFileRemove + miFileRemove = new ImageMenuItem.from_stock("gtk-remove", null); + miFileRemove.activate.connect(miFileRemove_clicked); + menuFile.append(miFileRemove); + + // miFileSeparator1 + miFileSeparator1 = new Gtk.MenuItem(); + miFileSeparator1.override_color (StateFlags.NORMAL, gray); + menuFile.append(miFileSeparator1); + + // miFileOpenTemp + miFileOpenTemp = new ImageMenuItem.from_stock("gtk-directory", null); + miFileOpenTemp.label = _("Open Temp Folder"); + miFileOpenTemp.activate.connect(miFileOpenTemp_clicked); + menuFile.append(miFileOpenTemp); + + // miFileOpenOutput + miFileOpenOutput = new ImageMenuItem.from_stock("gtk-directory", null); + miFileOpenOutput.label = _("Open Output Folder"); + miFileOpenOutput.activate.connect(miFileOpenOutput_clicked); + menuFile.append(miFileOpenOutput); + + // miFileOpenLogFile + miFileOpenLogFile = new ImageMenuItem.from_stock("gtk-info", null); + miFileOpenLogFile.label = _("Open Log File"); + miFileOpenLogFile.activate.connect(miFileOpenLogFile_clicked); + menuFile.append(miFileOpenLogFile); + // miFileSeparator2 + miFileSeparator2 = new Gtk.MenuItem(); + miFileSeparator2.override_color (StateFlags.NORMAL, gray); + menuFile.append(miFileSeparator2); + + // miFilePlaySource + miFilePlaySource = new ImageMenuItem.from_stock("gtk-media-play", null); + miFilePlaySource.label = _("Play File (Source)"); + miFilePlaySource.activate.connect(miFilePlaySource_clicked); + menuFile.append(miFilePlaySource); + + // miFilePlayOutput + miFilePlayOutput = new ImageMenuItem.from_stock("gtk-media-play", null); + miFilePlayOutput.label = _("Play File (Output)"); + miFilePlayOutput.activate.connect(miFilePlayOutput_clicked); + menuFile.append(miFilePlayOutput); + + // miFileInfo + miFileInfo = new ImageMenuItem.from_stock("gtk-properties", null); + miFileInfo.label = _("File Info (Source)"); + miFileInfo.activate.connect(miFileInfo_clicked); + menuFile.append(miFileInfo); + + // miFileInfoOutput + miFileInfoOutput = new ImageMenuItem.from_stock("gtk-properties", null); + miFileInfoOutput.label = _("File Info (Output)"); + miFileInfoOutput.activate.connect(miFileInfoOutput_clicked); + menuFile.append(miFileInfoOutput); + + menuFile.show_all(); + + //connect signal for shift+F10 + tvFiles.popup_menu.connect(() => { return menuFile_popup (menuFile, null); }); + //connect signal for right-click + tvFiles.button_press_event.connect ((w, event) => { + if (event.button == 3) { + return menuFile_popup (menuFile, event); + } + + return false; + }); + } + + private void refresh_list_view (bool refresh_model = true){ + if (refresh_model){ + Gtk.ListStore inputStore = new Gtk.ListStore (10, typeof(MediaFile), typeof (string), typeof (string), typeof (string), typeof (string), typeof (string), typeof (string), typeof (int), typeof (string), typeof (string)); + + TreeIter iter; + foreach(MediaFile mFile in App.InputFiles) { + inputStore.append (out iter); + inputStore.set (iter, InputField.FILE_REF, mFile); + inputStore.set (iter, InputField.FILE_PATH, mFile.Path); + inputStore.set (iter, InputField.FILE_NAME, mFile.Name); + inputStore.set (iter, InputField.FILE_SIZE, format_file_size(mFile.Size)); + inputStore.set (iter, InputField.FILE_DURATION, format_duration(mFile.Duration)); + inputStore.set (iter, InputField.FILE_STATUS, "gtk-media-pause"); + inputStore.set (iter, InputField.FILE_CROPVAL, mFile.crop_values_info()); + inputStore.set (iter, InputField.FILE_PROGRESS, mFile.ProgressPercent); + inputStore.set (iter, InputField.FILE_PROGRESS_TEXT, mFile.ProgressText); + inputStore.set (iter, InputField.FILE_THUMB, mFile.ThumbnailImagePath); + } + + tvFiles.set_model (inputStore); + } + + colSize.visible = !App.TileView; + colDuration.visible = !App.TileView; + colCrop.visible = !App.TileView; + tvFiles.headers_visible = !App.TileView; + + tvFiles.columns_autosize(); + } + + + public void init_preset_toolbar(){ // Preset tool bar -------------------------------------- //toolbar @@ -371,14 +570,14 @@ btnRemovePreset.clicked.connect (btnRemovePreset_clicked); btnRemovePreset.set_tooltip_text (_("Delete Preset")); toolbar2.add (btnRemovePreset); - + /*//btnEditPreset btnEditPreset = new Gtk.ToolButton.from_stock ("gtk-edit"); btnEditPreset.is_important = true; btnEditPreset.clicked.connect (btnEditPreset_clicked); btnEditPreset.set_tooltip_text (_("Edit Preset")); toolbar2.add (btnEditPreset);*/ - + //btnBrowsePresetFolder btnBrowsePresetFolder = new Gtk.ToolButton.from_stock ("gtk-directory"); btnBrowsePresetFolder.is_important = true; @@ -386,13 +585,13 @@ btnBrowsePresetFolder.clicked.connect (btnBrowsePresetFolder_clicked); btnBrowsePresetFolder.set_tooltip_text (_("Open Folder")); toolbar2.add (btnBrowsePresetFolder); - + /*//separator var separator1 = new Gtk.SeparatorToolItem(); separator1.set_draw (false); separator1.set_expand (true); toolbar2.add (separator1);*/ - + //btnPresetInfo btnPresetInfo = new Gtk.ToolButton.from_stock ("gtk-info"); btnPresetInfo.is_important = true; @@ -401,9 +600,13 @@ btnPresetInfo.clicked.connect (btnPresetInfo_clicked); btnPresetInfo.set_tooltip_text (_("Info")); toolbar2.add (btnPresetInfo); + } - //Config --------------------------------------------------- - + public void init_preset_dropdowns(){ + //vboxMain2 + vboxMain2 = new Box (Orientation.VERTICAL, 0); + vboxMain2.margin_left = 6; + vboxMain2.margin_right = 6; vboxMain.add (vboxMain2); //gridConfig @@ -419,8 +622,8 @@ lblScriptFolder = new Gtk.Label(_("Folder")); lblScriptFolder.xalign = (float) 0.0; gridConfig.attach(lblScriptFolder,0,0,1,1); - - //cmbScriptFolder + + //cmbScriptFolder cmbScriptFolder = new ComboBox(); CellRendererText cellScriptFolder = new CellRendererText(); cmbScriptFolder.pack_start( cellScriptFolder, false ); @@ -429,12 +632,12 @@ cmbScriptFolder.set_tooltip_text (_("Folder")); cmbScriptFolder.changed.connect(cmbScriptFolder_changed); gridConfig.attach(cmbScriptFolder,1,0,1,1); - + //lblScriptFile lblScriptFile = new Gtk.Label(_("Preset")); lblScriptFile.xalign = (float) 0.0; gridConfig.attach(lblScriptFile,0,1,1,1); - + //cmbScriptFile cmbScriptFile = new ComboBox(); cmbScriptFile.hexpand = true; @@ -444,7 +647,7 @@ cmbScriptFile.set_tooltip_text (_("Encoding Script or Preset File")); cmbScriptFile.changed.connect(cmbScriptFile_changed); gridConfig.attach(cmbScriptFile,1,1,1,1); - + //btnEditPreset btnEditPreset = new Button.with_label(""); btnEditPreset.always_show_image = true; @@ -454,158 +657,58 @@ btnEditPreset.set_tooltip_text(_("Edit Preset")); btnEditPreset.clicked.connect(btnEditPreset_clicked); gridConfig.attach(btnEditPreset,2,0,1,2); - + } + + public void init_statusbar(){ //lblStatus lblStatus = new Label(""); lblStatus.ellipsize = Pango.EllipsizeMode.END; lblStatus.margin_top = 6; lblStatus.margin_bottom = 6; vboxMain2.add (lblStatus); - - statusbar_default_message(); - - // menuFile - menuFile = new Gtk.Menu(); - - // miFileSkip - miFileSkip = new ImageMenuItem.from_stock ("gtk-stop", null); - miFileSkip.label = _("Skip File"); - miFileSkip.activate.connect (() => { App.stop_file(); }); - menuFile.append(miFileSkip); - - // miFileCropAuto - miFileCropAuto = new Gtk.MenuItem.with_label (_("AutoCrop Video")); - miFileCropAuto.activate.connect(miFileCropAuto_clicked); - menuFile.append(miFileCropAuto); - - // miFilePreview - miFilePreview = new Gtk.MenuItem.with_label (_("Preview File")); - miFilePreview.activate.connect(miFilePreview_clicked); - menuFile.append(miFilePreview); - - // miFileRemove - miFileRemove = new ImageMenuItem.from_stock("gtk-remove", null); - miFileRemove.activate.connect(miFileRemove_clicked); - menuFile.append(miFileRemove); - - // miFileSeparator1 - miFileSeparator1 = new Gtk.MenuItem(); - miFileSeparator1.override_color (StateFlags.NORMAL, gray); - menuFile.append(miFileSeparator1); - - // miFileOpenTemp - miFileOpenTemp = new ImageMenuItem.from_stock("gtk-directory", null); - miFileOpenTemp.label = _("Open Temp Folder"); - miFileOpenTemp.activate.connect(miFileOpenTemp_clicked); - menuFile.append(miFileOpenTemp); - - // miFileOpenOutput - miFileOpenOutput = new ImageMenuItem.from_stock("gtk-directory", null); - miFileOpenOutput.label = _("Open Output Folder"); - miFileOpenOutput.activate.connect(miFileOpenOutput_clicked); - menuFile.append(miFileOpenOutput); - - // miFileOpenLogFile - miFileOpenLogFile = new ImageMenuItem.from_stock("gtk-info", null); - miFileOpenLogFile.label = _("Open Log File"); - miFileOpenLogFile.activate.connect(miFileOpenLogFile_clicked); - menuFile.append(miFileOpenLogFile); - - // miFileSeparator2 - miFileSeparator2 = new Gtk.MenuItem(); - miFileSeparator2.override_color (StateFlags.NORMAL, gray); - menuFile.append(miFileSeparator2); - - // miFilePlaySource - miFilePlaySource = new ImageMenuItem.from_stock("gtk-media-play", null); - miFilePlaySource.label = _("Play File (Source)"); - miFilePlaySource.activate.connect(miFilePlaySource_clicked); - menuFile.append(miFilePlaySource); - - // miFilePlayOutput - miFilePlayOutput = new ImageMenuItem.from_stock("gtk-media-play", null); - miFilePlayOutput.label = _("Play File (Output)"); - miFilePlayOutput.activate.connect(miFilePlayOutput_clicked); - menuFile.append(miFilePlayOutput); - - // miFileInfo - miFileInfo = new ImageMenuItem.from_stock("gtk-properties", null); - miFileInfo.label = _("File Info (Source)"); - miFileInfo.activate.connect(miFileInfo_clicked); - menuFile.append(miFileInfo); - - // miFileInfoOutput - miFileInfoOutput = new ImageMenuItem.from_stock("gtk-properties", null); - miFileInfoOutput.label = _("File Info (Output)"); - miFileInfoOutput.activate.connect(miFileInfoOutput_clicked); - menuFile.append(miFileInfoOutput); - - menuFile.show_all(); - - tvFiles.popup_menu.connect(() => { return menuFile_popup (menuFile, null); }); - tvFiles.button_press_event.connect ((w, event) => { - if (event.button == 3) { - return menuFile_popup (menuFile, event); - } - - return false; - }); + } - refresh_file_list(true); - + public void init_regular_expressions(){ try{ regexGeneric = new Regex("""([0-9]+[.]?[0-9]*)%"""); regexMkvMerge = new Regex("""Progress: ([0-9]+[.]?[0-9]*)%"""); regexFFmpeg = new Regex("""time=([0-9]+[:][0-9]+[:][0-9]+[.]?[0-9]*) """); regexLibAV = new Regex("""time=[ ]*([0-9]+[.]?[0-9]*)[ ]*"""); - + //frame= 82 fps= 23 q=28.0 size= 133kB time=1.42 bitrate= 766.9kbits/s regexLibAV_video = new Regex("""frame=[ ]*[0-9]+[ ]*fps=[ ]*([0-9]+)[.]?[0-9]*[ ]*q=[ ]*[0-9]+[.]?[0-9]*[ ]*size=[ ]*([0-9]+)kB[ ]*time=[ ]*[0-9]+[.]?[0-9]*[ ]*bitrate=[ ]*([0-9]+)[.]?[0-9]*"""); - - //size= 1590kB time=30.62 bitrate= 425.3kbits/s + + //size= 1590kB time=30.62 bitrate= 425.3kbits/s regexLibAV_audio = new Regex("""size=[ ]*([0-9]+)kB[ ]*time=[ ]*[0-9]+[.]?[0-9]*[ ]*bitrate=[ ]*([0-9]+)[.]?[0-9]*"""); - + //[53.4%] 1652/3092 frames, 24.81 fps, 302.88 kb/s, eta 0:00:58 regexX264 = new Regex("""\[[0-9]+[.]?[0-9]*%\][ \t]*[0-9]+/[0-9]+[ \t]*frames,[ \t]*([0-9]+)[.]?[0-9]*[ \t]*fps,[ \t]*([0-9]+)[.]?[0-9]*[ \t]*kb/s,[ \t]*eta ([0-9:]+)"""); } catch (Error e) { stderr.printf ("Error: %s\n", e.message); } - - //populate and select script - populate_script_folders(); - select_script(); } - + public void set_window_title(){ title = AppName + " v" + AppVersion;// + " by " + AppAuthor + " (" + "teejeetech.blogspot.in" + ")"; } - + // script dropdown handlers ----------------------- - + private void populate_script_folders(){ TreeStore model = new TreeStore(2, typeof(string), typeof(string)); cmbScriptFolder.set_model(model); TreeIter iter0; - /*model.append (out iter0, null); - model.set (iter0, 0, App.ScriptsFolder_Official, 1, "Official Scripts"); - iter_append_children (model, iter0, App.ScriptsFolder_Official); - - model.append (out iter0, null); - model.set (iter0, 0, App.PresetsFolder_Official,1, "Official Presets"); - iter_append_children (model, iter0, App.PresetsFolder_Official); - */ - model.append (out iter0, null); model.set (iter0, 0, App.ScriptsFolder_Custom,1, _("scripts")); iter_append_children (model, iter0, App.ScriptsFolder_Custom); - + model.append (out iter0, null); model.set (iter0, 0, App.PresetsFolder_Custom,1, _("presets")); iter_append_children (model, iter0, App.PresetsFolder_Custom); } - + private void iter_append_children (TreeStore model, TreeIter iter0, string path){ try{ var dir = File.parse_name (path); @@ -617,48 +720,48 @@ if (file.get_file_type() == FileType.DIRECTORY){ string dirPath = dir.resolve_relative_path(file.get_name()).get_path(); string dirName = dirPath.replace(App.UserDataDirectory + "/",""); - + model.append(out iter1, null); model.set(iter1, 0, dirPath, 1, dirName); iter_append_children(model, iter1, dir.resolve_relative_path(file.get_name()).get_path()); } - } + } } catch(Error e){ log_error (e.message); } - + } - + private void cmbScriptFolder_changed(){ //create empty model - ListStore model = new ListStore(2, typeof(ScriptFile), typeof(string)); + Gtk.ListStore model = new Gtk.ListStore(2, typeof(ScriptFile), typeof(string)); cmbScriptFile.set_model(model); - + string path = gtk_combobox_get_value(cmbScriptFolder,0,""); - + try { var dir = File.parse_name (path); var enumerator = dir.enumerate_children ("standard::*", 0); Gee.ArrayList<string> files = new Gee.ArrayList<string>(); - + FileInfo file; while ((file = enumerator.next_file()) != null) { files.add(dir.resolve_relative_path(file.get_name()).get_path()); - } - files.sort_with_data((a,b) => { return strcmp((string)a, (string)b); }); - + } + files.sort((a,b) => { return strcmp((string)a, (string)b); }); + foreach(string filePath in files){ string fileName = File.new_for_path(filePath).get_basename(); - + if (file_exists(filePath)){ ScriptFile sh = new ScriptFile(filePath); if (sh.Extension == ".sh" || sh.Extension == ".json") { TreeIter iter; model.append(out iter); model.set(iter, 0, sh, 1, fileName); - + if (App.SelectedScript != null && App.SelectedScript.Path == sh.Path) { cmbScriptFile.set_active_iter(iter); } @@ -674,27 +777,27 @@ log_error (e.message); } } - + private void cmbScriptFile_changed(){ if ((cmbScriptFile == null)||(cmbScriptFile.model == null)||(cmbScriptFile.active < 0)){ return; } - + ScriptFile sh; TreeIter iter; cmbScriptFile.get_active_iter(out iter); cmbScriptFile.model.get (iter, 0, out sh, -1); - + App.SelectedScript = sh; } - + private bool select_script(){ if ((App.SelectedScript == null)||(file_exists(App.SelectedScript.Path) == false)){ cmbScriptFolder.set_active(2); cmbScriptFile.set_active(0); return false; } - + string filePath = App.SelectedScript.Path; - + string dirPath = GLib.Path.get_dirname(filePath); bool retVal = false; TreeIter iter; @@ -718,21 +821,21 @@ //check if selected file is in some other folder if (retVal == false){ //unselect - cmbScriptFolder.set_active(-1); - + cmbScriptFolder.set_active(-1); + //add the selected file - ListStore model1 = new ListStore(2, typeof(ScriptFile), typeof(string)); + Gtk.ListStore model1 = new Gtk.ListStore(2, typeof(ScriptFile), typeof(string)); cmbScriptFile.set_model(model1); ScriptFile sh = new ScriptFile(filePath); model1.append(out iter); model1.set(iter, 0, sh, 1, sh.Title); - + //select it - cmbScriptFile.set_active(0); + cmbScriptFile.set_active(0); } //select file - ListStore model1 = (ListStore) cmbScriptFile.model; + Gtk.ListStore model1 = (Gtk.ListStore) cmbScriptFile.model; for (bool next = model1.get_iter_first (out iter); next; next = model1.iter_next (ref iter)) { ScriptFile sh = new ScriptFile(filePath); model1.get (iter, 0, out sh); @@ -742,23 +845,23 @@ break; } } - + return retVal; } - + private bool select_script_recurse_children (string filePath, TreeIter iter0){ TreeStore model = (TreeStore) cmbScriptFolder.model; string dirPath = GLib.Path.get_dirname(filePath); bool retVal = false; - + TreeIter iter1; int index = 0; - + for (bool next = model.iter_children (out iter1, iter0); next; next = model.iter_nth_child (out iter1, iter0, index)) { - + string path; model.get (iter1, 0, out path); - + if (path == dirPath){ cmbScriptFolder.set_active_iter(iter1); return true; @@ -768,43 +871,43 @@ } index++; } - + return retVal; } - + private void cellScriptFile_render (CellLayout cell_layout, CellRenderer cell, TreeModel model, TreeIter iter){ ScriptFile sh; model.get (iter, 0, out sh, -1); (cell as Gtk.CellRendererText).text = sh.Title; } - + private void cellScriptFolder_render (CellLayout cell_layout, CellRenderer cell, TreeModel model, TreeIter iter){ string name; model.get (iter, 1, out name, -1); (cell as Gtk.CellRendererText).text = name; } - + private void btnBrowsePresetFolder_clicked(){ string path; TreeModel model = (TreeModel) cmbScriptFolder.model; TreeIter iter; cmbScriptFolder.get_active_iter(out iter); model.get (iter, 0, out path, -1); - exo_open_folder (path); + exo_open_folder (path); } - + private void miFileOpenLogFile_clicked(){ TreeSelection selection = tvFiles.get_selection(); - + if (selection.count_selected_rows() > 0){ TreeModel model; GLib.List<TreePath> lst = selection.get_selected_rows (out model); TreePath path = lst.nth_data (0); int index = int.parse (path.to_string()); - + MediaFile mf = App.InputFiles[index]; - exo_open_textfile (mf.LogFile); - } + exo_open_textfile (mf.LogFile); + } } private void preset_create(){ @@ -819,13 +922,13 @@ //App.SelectedScript will be set on click of 'Save' button cmbScriptFolder_changed(); } - + private void preset_edit(){ ScriptFile sh; TreeIter iter; cmbScriptFile.get_active_iter(out iter); cmbScriptFile.model.get (iter, 0, out sh, -1); - + if (sh.Extension == ".json") { var window = new EncoderConfigWindow(); window.set_transient_for(this); @@ -837,23 +940,23 @@ cmbScriptFolder_changed(); } } - + private void script_create(){ string folder = gtk_combobox_get_value(cmbScriptFolder,0,""); - + int k = 0; string new_script = "%s/new_script.sh".printf(folder); while (file_exists(new_script)){ new_script = "%s/new_script_%d.sh".printf(folder,++k); } - + write_file(new_script,""); - exo_open_textfile(new_script); - + exo_open_textfile(new_script); + App.SelectedScript = new ScriptFile(new_script); cmbScriptFolder_changed(); } - + private void script_edit(){ ScriptFile sh; TreeIter iter; @@ -861,10 +964,10 @@ cmbScriptFile.model.get (iter, 0, out sh, -1); if (sh.Extension == ".sh") { - exo_open_textfile(sh.Path); + exo_open_textfile(sh.Path); } } - + private void btnAddPreset_clicked(){ TreeIter iter; string folderName; @@ -885,21 +988,21 @@ TreeIter iter; cmbScriptFile.get_active_iter(out iter); cmbScriptFile.model.get (iter, 0, out sh, -1); - + file_delete(sh.Path); cmbScriptFolder_changed(); - + statusbar_show_message (_("Preset deleted") + ": " + sh.Name + "", true, true); } } - + private void btnEditPreset_clicked(){ if ((cmbScriptFile.model == null)||(cmbScriptFile.active == -1)) { TreeIter iter; string folderName; cmbScriptFolder.get_active_iter(out iter); cmbScriptFolder.model.get (iter, 1, out folderName, -1); - + if (folderName.has_prefix("scripts")){ script_create(); } @@ -908,7 +1011,7 @@ } } else { - + ScriptFile sh; TreeIter iter; cmbScriptFile.get_active_iter(out iter); @@ -922,7 +1025,7 @@ preset_edit(); break; } - } + } } private void btnPresetInfo_clicked(){ @@ -959,36 +1062,36 @@ } // statusbar ------------------- - + private void statusbar_show_message (string message, bool is_error = false, bool timeout = true){ Gdk.RGBA red = Gdk.RGBA(); Gdk.RGBA white = Gdk.RGBA(); red.parse ("rgba(255,0,0,1)"); white.parse ("rgba(0,0,0,1)"); - + if (is_error) lblStatus.override_color (StateFlags.NORMAL, red); else lblStatus.override_color (StateFlags.NORMAL, null); - + lblStatus.label = message; - + if (timeout) statusbar_set_timeout(); } - + private void statusbar_set_timeout(){ //Source.remove (statusTimer); statusTimer = Timeout.add (3000, statusbar_clear); } - + private bool statusbar_clear(){ //Source.remove (statusTimer); lblStatus.label = ""; statusbar_default_message(); return true; } - + private void statusbar_default_message(){ switch (App.Status){ case AppStatus.NOTSTARTED: @@ -997,23 +1100,23 @@ else statusbar_show_message(_("Drag files on this window or click the 'Add' button"), false, false); break; - + case AppStatus.IDLE: statusbar_show_message(_("[Batch completed] Right-click for options or click 'Finish' to continue."), false, false); break; - + case AppStatus.PAUSED: statusbar_show_message(_("[Paused] Click 'Resume' to continue or 'Stop' to abort."), false, false); break; - + case AppStatus.RUNNING: statusbar_show_message(_("Converting: '%s'").printf (App.CurrentFile.Path), false, false); break; } } - - // file list and context menu ------------------------- - + + // list view and context menu ------------------------- + private void on_drag_data_received (Gdk.DragContext drag_context, int x, int y, Gtk.SelectionData data, uint info, uint time) { foreach(string uri in data.get_uris()){ string file = uri.replace("file://","").replace("file:/",""); @@ -1026,20 +1129,20 @@ statusbar_show_message (_("File added: '%s'").printf (file)); } } - - refresh_file_list(true); - + + refresh_list_view(); + Gtk.drag_finish (drag_context, true, false, time); } private bool menuFile_popup (Gtk.Menu popup, Gdk.EventButton? event) { TreeSelection selection = tvFiles.get_selection(); int index = -1; - + if (selection.count_selected_rows() == 0){ return true; } - + if (selection.count_selected_rows() == 1){ TreeModel model; GLib.List<TreePath> lst = selection.get_selected_rows (out model); @@ -1053,7 +1156,7 @@ miFileOpenTemp.visible = false; miFileOpenOutput.visible = false; miFileOpenLogFile.visible = false; - + miFileInfo.visible = true; miFileInfoOutput.visible = false; miFilePreview.visible = true; @@ -1063,23 +1166,23 @@ miFileRemove.visible = true; miFileSeparator1.visible = true; miFileSeparator2.visible = false; - + miFileInfo.sensitive = (selection.count_selected_rows() == 1); miFilePreview.sensitive = (selection.count_selected_rows() == 1); miFilePlaySource.sensitive = (selection.count_selected_rows() == 1); miFileCropAuto.sensitive = (selection.count_selected_rows() > 0); miFileRemove.sensitive = (selection.count_selected_rows() > 0); break; - + case AppStatus.RUNNING: - + miFileSkip.visible = true; miFileSeparator1.visible = true; miFileSeparator2.visible = false; miFileOpenTemp.visible = true; miFileOpenOutput.visible = true; miFileOpenLogFile.visible = false; - + if (selection.count_selected_rows() == 1){ if (App.InputFiles[index].Status == FileStatus.RUNNING){ miFileSkip.sensitive = true; @@ -1109,13 +1212,13 @@ miFileCropAuto.visible = false; miFileRemove.visible = false; break; - + case AppStatus.IDLE: - + miFileOpenTemp.visible = true; miFileOpenOutput.visible = true; miFileOpenLogFile.visible = true; - + if (index != -1){ miFileOpenTemp.sensitive = true; miFileOpenOutput.sensitive = true; @@ -1124,7 +1227,7 @@ miFileOpenTemp.sensitive = false; miFileOpenOutput.sensitive = false; } - + miFileSkip.visible = false; miFileInfo.visible = true; miFileInfoOutput.visible = true; @@ -1135,7 +1238,7 @@ miFileRemove.visible = false; miFileSeparator1.visible = false; miFileSeparator2.visible = true; - + if (selection.count_selected_rows() == 1){ string outpath = App.InputFiles[index].OutputFilePath; if (outpath != null && outpath.length > 0 && file_exists(outpath)){ @@ -1150,7 +1253,7 @@ break; } - + if (event != null) { menuFile.popup (null, null, null, event.button, event.time); } else { @@ -1161,29 +1264,29 @@ private void miFileInfo_clicked() { TreeSelection selection = tvFiles.get_selection(); - + if (selection.count_selected_rows() > 0){ TreeModel model; GLib.List<TreePath> lst = selection.get_selected_rows (out model); TreePath path = lst.nth_data (0); int index = int.parse (path.to_string()); - + var window = new FileInfoWindow(App.InputFiles[index]); window.set_transient_for(this); window.show_all(); window.run(); } } - + private void miFileInfoOutput_clicked() { TreeSelection selection = tvFiles.get_selection(); - + if (selection.count_selected_rows() > 0){ TreeModel model; GLib.List<TreePath> lst = selection.get_selected_rows (out model); TreePath path = lst.nth_data (0); int index = int.parse (path.to_string()); - + MediaFile mf = App.InputFiles[index]; if (file_exists(mf.OutputFilePath)){ @@ -1193,49 +1296,49 @@ window.show_all(); window.run(); } - } + } } - + private void miFileCropAuto_clicked() { TreeSelection selection = tvFiles.get_selection(); if (selection.count_selected_rows() == 0){ return; } - + set_busy (true,this); - + TreeModel model; GLib.List<TreePath> lst = selection.get_selected_rows (out model); - + for(int k=0; k<lst.length(); k++){ TreePath path = lst.nth_data (k); TreeIter iter; model.get_iter (out iter, path); int index = int.parse (path.to_string()); MediaFile file = App.InputFiles[index]; - + if (file.crop_detect()){ - ((ListStore)tvFiles.model).set (iter, InputField.FILE_CROPVAL, file.crop_values_info()); + ((Gtk.ListStore)tvFiles.model).set (iter, InputField.FILE_CROPVAL, file.crop_values_info()); } else{ - ((ListStore)tvFiles.model).set (iter, InputField.FILE_CROPVAL, _("N/A")); - } - + ((Gtk.ListStore)tvFiles.model).set (iter, InputField.FILE_CROPVAL, _("N/A")); + } + do_events(); } set_busy (false,this); } - + private void miFileRemove_clicked() { btnRemoveFiles_clicked(); } - + private void miFileOpenTemp_clicked() { TreeSelection selection = tvFiles.get_selection(); if (selection.count_selected_rows() == 0){ return; } - + TreeModel model; GLib.List<TreePath> lst = selection.get_selected_rows (out model); - + for(int k=0; k<lst.length(); k++){ TreePath path = lst.nth_data (k); TreeIter iter; @@ -1245,21 +1348,21 @@ exo_open_folder (mf.TempDirectory); } } - + private void miFileOpenOutput_clicked() { TreeSelection selection = tvFiles.get_selection(); if (selection.count_selected_rows() == 0){ return; } - + TreeModel model; GLib.List<TreePath> lst = selection.get_selected_rows (out model); - + for(int k=0; k<lst.length(); k++){ TreePath path = lst.nth_data (k); TreeIter iter; model.get_iter (out iter, path); int index = int.parse (path.to_string()); MediaFile mf = App.InputFiles[index]; - + if (App.OutputDirectory.length == 0){ exo_open_folder (mf.Location); } else{ @@ -1267,13 +1370,13 @@ } } } - + private void btnOpenOutputFolder_click(){ if (App.OutputDirectory.length > 0 && dir_exists(App.OutputDirectory)){ exo_open_folder (App.OutputDirectory); } } - + private void set_busy (bool busy, Gtk.Window win) { Gdk.Cursor? cursor = null; @@ -1283,89 +1386,67 @@ else{ cursor = new Gdk.Cursor(Gdk.CursorType.ARROW); } - + var window = win.get_window(); - + if (window != null) { window.set_cursor (cursor); } - + do_events(); } - + private void do_events(){ while(Gtk.events_pending()) Gtk.main_iteration(); } - + private void miFilePreview_clicked() { TreeSelection selection = tvFiles.get_selection(); - + if (selection.count_selected_rows() > 0){ TreeModel model; GLib.List<TreePath> lst = selection.get_selected_rows (out model); TreePath path = lst.nth_data (0); int index = int.parse (path.to_string()); MediaFile mf = App.InputFiles[index]; - + mf.preview_output(); } } - + private void miFilePlayOutput_clicked() { TreeSelection selection = tvFiles.get_selection(); - + if (selection.count_selected_rows() > 0){ TreeModel model; GLib.List<TreePath> lst = selection.get_selected_rows (out model); TreePath path = lst.nth_data (0); int index = int.parse (path.to_string()); MediaFile mf = App.InputFiles[index]; - + mf.play_output(); } } - + private void miFilePlaySource_clicked() { TreeSelection selection = tvFiles.get_selection(); - + if (selection.count_selected_rows() > 0){ TreeModel model; GLib.List<TreePath> lst = selection.get_selected_rows (out model); TreePath path = lst.nth_data (0); int index = int.parse (path.to_string()); MediaFile mf = App.InputFiles[index]; - + mf.play_source(); } } - private void refresh_file_list (bool refresh_model){ - ListStore inputStore = new ListStore (9, typeof(MediaFile), typeof (string), typeof (string), typeof (string), typeof (string), typeof (string), typeof (string), typeof (int), typeof (string)); - - TreeIter iter; - foreach(MediaFile mFile in App.InputFiles) { - inputStore.append (out iter); - inputStore.set (iter, InputField.FILE_REF, mFile); - inputStore.set (iter, InputField.FILE_PATH, mFile.Path); - inputStore.set (iter, InputField.FILE_NAME, mFile.Name); - inputStore.set (iter, InputField.FILE_SIZE, format_file_size(mFile.Size)); - inputStore.set (iter, InputField.FILE_DURATION, format_duration(mFile.Duration)); - inputStore.set (iter, InputField.FILE_STATUS, "gtk-media-pause"); - inputStore.set (iter, InputField.FILE_CROPVAL, mFile.crop_values_info()); - inputStore.set (iter, InputField.FILE_PROGRESS, mFile.ProgressPercent); - inputStore.set (iter, InputField.FILE_PROGRESS_TEXT, mFile.ProgressText); - } - - tvFiles.set_model (inputStore); - - tvFiles.columns_autosize(); - } - public void tvFiles_crop_cell_edited (string path, string new_text) { int index = int.parse (path.to_string()); MediaFile mf = App.InputFiles[index]; - + if (new_text == null || new_text.length == 0){ mf.crop_reset(); } @@ -1380,15 +1461,15 @@ mf.CropH = mf.SourceHeight - mf.CropT - mf.CropB; } } - - ListStore model = (ListStore) tvFiles.model; + + Gtk.ListStore model = (Gtk.ListStore) tvFiles.model; TreeIter iter; model.get_iter (out iter, new TreePath.from_string (path)); model.set (iter, InputField.FILE_CROPVAL, mf.crop_values_info()); } - + // toolbar -------------------------------- - + private void btnAddFiles_clicked(){ var dlgAddFiles = new Gtk.FileChooserDialog(_("Add File(s)"), this, Gtk.FileChooserAction.OPEN, "gtk-cancel", Gtk.ResponseType.CANCEL, @@ -1399,9 +1480,9 @@ if (App.InputDirectory.length > 0) { dlgAddFiles.set_current_folder(App.InputDirectory); } - + if (dlgAddFiles.run() == Gtk.ResponseType.ACCEPT){ - + set_busy(true,dlgAddFiles); foreach (string file in dlgAddFiles.get_filenames()){ @@ -1410,22 +1491,22 @@ statusbar_show_message (_("Format not supported:") + "'" + file + "'", true, true); } } - + App.InputDirectory = dlgAddFiles.get_current_folder(); } - refresh_file_list(true); - + refresh_list_view(); + dlgAddFiles.destroy(); //resets cursor } - + private void btnRemoveFiles_clicked(){ Gee.ArrayList<MediaFile> list = new Gee.ArrayList<MediaFile>(); TreeSelection sel = tvFiles.get_selection(); - + TreeIter iter; bool iterExists = tvFiles.model.get_iter_first (out iter); - while (iterExists) { + while (iterExists) { if (sel.iter_is_selected (iter)){ MediaFile mf; tvFiles.model.get (iter, InputField.FILE_REF, out mf, -1); @@ -1433,37 +1514,37 @@ } iterExists = tvFiles.model.iter_next (ref iter); } - + App.remove_files(list); - refresh_file_list(true); + refresh_list_view(); } - + private void btnClearFiles_clicked(){ App.remove_all(); - refresh_file_list(true); + refresh_list_view(); } - + private void btnAbout_clicked(){ var dialog = new AboutWindow(); dialog.set_transient_for (this); - dialog.authors = { - "Tony George:teejeetech@gmail.com" + dialog.authors = { + "Tony George:teejeetech@gmail.com" }; - + dialog.translators = { "abuyop (Malay):launchpad.net/~abuyop", "B. W. Knight (Korean):launchpad.net/~kbd0651", "Felix Moreno (Spanish):launchpad.net/~felix-justdust" - }; - - dialog.documenters = null; + }; + + dialog.documenters = null; dialog.artists = null; dialog.donations = null; dialog.program_name = AppName; dialog.comments = _("An audio-video converter for Linux"); - dialog.copyright = "Copyright © 2014 Tony George (%s)".printf(AppAuthorEmail); + dialog.copyright = "Copyright © 2015 Tony George (%s)".printf(AppAuthorEmail); dialog.version = AppVersion; dialog.logo = get_app_icon(128); @@ -1474,7 +1555,7 @@ dialog.initialize(); dialog.show_all(); } - + public void btnDonation_clicked(){ var dialog = new DonationWindow(); dialog.set_transient_for(this); @@ -1482,7 +1563,7 @@ dialog.run(); dialog.destroy(); } - + private void btnEncoders_clicked(){ var dialog = new EncoderStatusWindow(); dialog.set_transient_for(this); @@ -1490,17 +1571,19 @@ dialog.run(); dialog.destroy(); } - + private void btnAppSettings_clicked(){ - var window = new AppConfigWindow(); - window.set_transient_for(this); - window.show_all(); - window.run(); + var dialog = new AppConfigWindow(); + dialog.set_transient_for(this); + dialog.show_all(); + dialog.run(); + + refresh_list_view(false); } - + private void btnShutdown_clicked(){ App.Shutdown = btnShutdown.active; - + if (App.Shutdown){ log_msg (_("Shutdown Enabled") + "\n"); } @@ -1508,21 +1591,21 @@ log_msg (_("Shutdown Disabled") + "\n"); } } - + private void btnBackground_clicked(){ App.BackgroundMode = btnBackground.active; App.set_priority(); } - + private void btnPause_clicked(){ // pause or resume based on value of field 'pause' if (App.Status == AppStatus.RUNNING){ - App.pause(); + App.pause(); } else if (App.Status == AppStatus.PAUSED){ - App.resume(); + App.resume(); } - + // set button statepause or resume based on value of field 'pause' switch (App.Status){ case AppStatus.PAUSED: @@ -1530,25 +1613,25 @@ btnPause.stock_id = "gtk-media-play"; btnPause.set_tooltip_text (_("Resume")); statusbar_default_message(); - break; + break; case AppStatus.RUNNING: btnPause.label = _("Pause"); btnPause.stock_id = "gtk-media-pause"; btnPause.set_tooltip_text (_("Pause")); statusbar_default_message(); - break; + break; } - + update_status_all(); } - + private void btnStop_clicked(){ App.stop_batch(); - update_status_all(); + update_status_all(); } - + // encoding ---------------------------------- - + public void start(){ if (App.InputFiles.size == 0){ string msg = _("Input queue is empty!\nPlease add some files.\n"); @@ -1558,17 +1641,17 @@ dlg.set_transient_for(this); dlg.run(); dlg.destroy(); - + return; - } + } + - ScriptFile sh; TreeIter iter; cmbScriptFile.get_active_iter(out iter); cmbScriptFile.model.get (iter, 0, out sh, -1); App.SelectedScript = sh; - + //check if encoders used by preset are available foreach(string enc in App.get_encoder_list()){ App.Encoders[enc].CheckAvailability(); @@ -1580,20 +1663,20 @@ convert_prepare(); App.convert_begin(); - + timerID = Timeout.add (500, update_status); } - + public void convert_prepare(){ toolbar2.visible = false; gridConfig.visible = false; btnShutdown.active = App.Shutdown; - + btnShutdown.visible = App.AdminMode; btnBackground.visible = App.AdminMode; btnBackground.active = App.BackgroundMode; btnOpenOutputFolder.visible = dir_exists(App.OutputDirectory); - + btnStart.visible = false; btnAddFiles.visible = true; btnRemoveFiles.visible = false; @@ -1602,30 +1685,30 @@ btnEncoders.visible = false; btnDonate.visible = false; btnAbout.visible = false; - + btnShutdown.visible = App.AdminMode; btnShutdown.active = App.Shutdown; - + btnPause.visible = true; btnStop.visible = true; btnFinish.visible = false; - + paused = false; btnPause.stock_id = "gtk-media-pause"; - - colCrop.visible = false; + + colCrop.visible = !App.TileView; colProgress.visible = true; - + start_cpu_usage_timer(); - } - + } + public void convert_finish(){ toolbar2.visible = true; gridConfig.visible = true; - colCrop.visible = true; + colCrop.visible = !App.TileView; colProgress.visible = false; - + btnStart.visible = true; btnAddFiles.visible = true; btnRemoveFiles.visible = true; @@ -1634,24 +1717,24 @@ btnEncoders.visible = true; btnDonate.visible = true; btnAbout.visible = true; - + btnShutdown.visible = false; btnBackground.visible = false; btnOpenOutputFolder.visible = false; - + btnPause.visible = false; btnStop.visible = false; btnFinish.visible = false; separator1.visible = true; App.convert_finish(); - + statusbar_default_message(); - } + } public bool update_status(){ TreeIter iter; - ListStore model = (ListStore)tvFiles.model; + Gtk.ListStore model = (Gtk.ListStore)tvFiles.model; switch (App.Status) { case AppStatus.PAUSED: @@ -1659,18 +1742,18 @@ btnPause.active = true; }*/ break; - + case AppStatus.IDLE: // remove progress timers Source.remove (timerID); - + // check shutdown flag if (App.Shutdown){ string msg = _("System will shutdown in one minute!") + "\n"; msg += _("Press 'Cancel' to abort shutdown"); var dialog = new Gtk.MessageDialog(null,Gtk.DialogFlags.MODAL,Gtk.MessageType.INFO, Gtk.ButtonsType.CANCEL, msg); dialog.set_title(_("System shutdown")); - + uint shutdownTimerID = Timeout.add (60000, shutdown); App.WaitingForShutdown = true; if (dialog.run() == Gtk.ResponseType.CANCEL){ @@ -1680,10 +1763,10 @@ dialog.destroy(); } } - + // update status for all files update_status_all(); - + // update UI btnShutdown.visible = false; btnBackground.visible = false; @@ -1693,31 +1776,31 @@ btnAddFiles.visible = false; separator1.visible = false; btnFinish.visible = true; - + // update statusbar message statusbar_default_message(); - + //stop cpu usage display stop_cpu_usage_timer(); set_window_title(); - + break; case AppStatus.RUNNING: statusLine = App.StatusLine; if(statusLine == null){ return false; } - + /*if (btnPause.active){ btnPause.active = false; } */ - + if (lastFile == null) { lastFile = App.CurrentFile; } if (lastFile != App.CurrentFile){ update_status_all(); lastFile = App.CurrentFile; } - + if (model.get_iter_from_string (out iter, App.InputFiles.index_of(App.CurrentFile).to_string())){ model.set (iter, InputField.FILE_PROGRESS, App.CurrentFile.ProgressPercent); model.set (iter, InputField.FILE_PROGRESS_TEXT, null); @@ -1729,32 +1812,32 @@ return true; } - + public void start_cpu_usage_timer(){ cpuUsageTimer = Timeout.add (1000, update_cpu_usage); } - private bool update_cpu_usage(){ + private bool update_cpu_usage(){ this.title = _("CPU: ") + "%.2lf %%".printf(ProcStats.get_cpu_usage()); return true; } - + public void stop_cpu_usage_timer(){ if (cpuUsageTimer != 0){ Source.remove(cpuUsageTimer); cpuUsageTimer = 0; } } - + public void update_status_all(){ - ListStore model = (ListStore)tvFiles.model; + Gtk.ListStore model = (Gtk.ListStore)tvFiles.model; MediaFile mf; int index = -1; TreeIter iter; - + bool iterExists = model.get_iter_first (out iter); index++; - + while (iterExists){ mf = App.InputFiles[index]; model.set (iter, InputField.FILE_PROGRESS, mf.ProgressPercent); @@ -1764,7 +1847,7 @@ index++; } } - + public bool shutdown(){ shutdown(); return true; @@ -1780,5 +1863,6 @@ FILE_STATUS, FILE_CROPVAL, FILE_PROGRESS, - FILE_PROGRESS_TEXT + FILE_PROGRESS_TEXT, + FILE_THUMB }
View file
selene_2.5.2~185~ubuntu15.04.1.tar.xz/src/Utility.vala -> selene_2.5.8~198~ubuntu15.10.1.tar.xz/src/Utility.vala
Changed
@@ -1,24 +1,24 @@ /* * Utility.vala - * + * * Copyright 2012 Tony George <teejee2008@gmail.com> - * + * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. - * + * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. - * + * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, * MA 02110-1301, USA. - * - * + * + * */ using Gtk; @@ -46,13 +46,13 @@ */ namespace TeeJee.Logging{ - + /* Functions for logging messages to console and log files */ using TeeJee.Misc; - + public DataOutputStream dos_log; - + public bool LOG_ENABLE = true; public bool LOG_TIMESTAMP = true; public bool LOG_COLORS = true; @@ -61,32 +61,32 @@ public void log_msg (string message, bool highlight = false){ if (!LOG_ENABLE) { return; } - + string msg = ""; - + if (highlight && LOG_COLORS){ msg += "\033[1;38;5;34m"; } - + if (LOG_TIMESTAMP){ msg += "[" + timestamp() + "] "; } - + msg += message; - + if (highlight && LOG_COLORS){ msg += "\033[0m"; } - + msg += "\n"; - + stdout.printf (msg); - + try { if (dos_log != null){ dos_log.put_string ("[%s] %s\n".printf(timestamp(), message)); } - } + } catch (Error e) { stdout.printf (e.message); } @@ -94,34 +94,34 @@ public void log_error (string message, bool highlight = false, bool is_warning = false){ if (!LOG_ENABLE) { return; } - + string msg = ""; - + if (highlight && LOG_COLORS){ msg += "\033[1;38;5;160m"; } - + if (LOG_TIMESTAMP){ msg += "[" + timestamp() + "] "; } - + string prefix = (is_warning) ? _("Warning") : _("Error"); - + msg += prefix + ": " + message; - + if (highlight && LOG_COLORS){ msg += "\033[0m"; } - + msg += "\n"; - + stdout.printf (msg); - + try { if (dos_log != null){ dos_log.put_string ("[%s] %s: %s\n".printf(timestamp(), prefix, message)); } - } + } catch (Error e) { stdout.printf (e.message); } @@ -129,7 +129,7 @@ public void log_debug (string message){ if (!LOG_ENABLE) { return; } - + if (LOG_DEBUG){ log_msg (message); } @@ -138,7 +138,7 @@ if (dos_log != null){ dos_log.put_string ("[%s] %s\n".printf(timestamp(), message)); } - } + } catch (Error e) { stdout.printf (e.message); } @@ -147,39 +147,39 @@ } namespace TeeJee.FileSystem{ - + /* Convenience functions for handling files and directories */ - + using TeeJee.Logging; using TeeJee.FileSystem; using TeeJee.ProcessManagement; using TeeJee.Misc; - + public void file_delete(string filePath){ - + /* Check and delete file */ - + try { var file = File.new_for_path (filePath); - if (file.query_exists ()) { - file.delete (); + if (file.query_exists ()) { + file.delete (); } } catch (Error e) { log_error (e.message); } } - + public bool file_exists (string filePath){ - + /* Check if file exists */ - + return ( FileUtils.test(filePath, GLib.FileTest.EXISTS) && FileUtils.test(filePath, GLib.FileTest.IS_REGULAR)); } public void file_copy (string src_file, string dest_file){ try{ var file_src = File.new_for_path (src_file); - if (file_src.query_exists()) { + if (file_src.query_exists()) { var file_dest = File.new_for_path (dest_file); file_src.copy(file_dest,FileCopyFlags.OVERWRITE,null,null); } @@ -188,18 +188,18 @@ log_error (e.message); } } - + public bool dir_exists (string filePath){ - + /* Check if directory exists */ - + return ( FileUtils.test(filePath, GLib.FileTest.EXISTS) && FileUtils.test(filePath, GLib.FileTest.IS_DIR)); } - + public bool create_dir (string filePath){ - + /* Creates a directory along with parents */ - + try{ var dir = File.parse_name (filePath); if (dir.query_exists () == false) { @@ -207,66 +207,66 @@ } return true; } - catch (Error e) { - log_error (e.message); + catch (Error e) { + log_error (e.message); return false; } } - + public bool move_file (string sourcePath, string destPath){ - + /* Move file from one location to another */ - + try{ File fromFile = File.new_for_path (sourcePath); File toFile = File.new_for_path (destPath); fromFile.move (toFile, FileCopyFlags.NONE); return true; } - catch (Error e) { - log_error (e.message); + catch (Error e) { + log_error (e.message); return false; } } - + public bool copy_file (string sourcePath, string destPath){ - + /* Copy file from one location to another */ - + try{ File fromFile = File.new_for_path (sourcePath); File toFile = File.new_for_path (destPath); fromFile.copy (toFile, FileCopyFlags.NONE); return true; } - catch (Error e) { - log_error (e.message); + catch (Error e) { + log_error (e.message); return false; } } - + public string? read_file (string file_path){ - + /* Reads text from file */ - + string txt; size_t size; - + try{ GLib.FileUtils.get_contents (file_path, out txt, out size); - return txt; + return txt; } catch (Error e){ log_error (e.message); } - + return null; } - + public bool write_file (string file_path, string contents){ - + /* Write text to file */ - + try{ var file = File.new_for_path (file_path); if (file.query_exists ()) { file.delete (); } @@ -279,63 +279,63 @@ catch (Error e) { log_error (e.message); return false; - } + } } - + public long get_file_count(string path){ - + /* Return total count of files and directories */ - + string cmd = ""; string std_out; string std_err; int ret_val; - + cmd = "find \"%s\" | wc -l".printf(path); ret_val = execute_command_script_sync(cmd, out std_out, out std_err); return long.parse(std_out); } public long get_file_size(string path){ - + /* Returns size of files and directories in KB*/ - + string cmd = ""; string output = ""; - + cmd = "du -s \"%s\"".printf(path); output = execute_command_sync_get_output(cmd); return long.parse(output.split("\t")[0]); } public string get_file_size_formatted(string path){ - + /* Returns size of files and directories in KB*/ - + string cmd = ""; string output = ""; - + cmd = "du -s -h \"%s\"".printf(path); output = execute_command_sync_get_output(cmd); return output.split("\t")[0].strip(); } - + public int chmod (string file, string permission){ - + /* Change file permissions */ - + return execute_command_sync ("chmod " + permission + " \"%s\"".printf(file)); } - + public string resolve_relative_path (string filePath){ - + /* Resolve the full path of given file using 'realpath' command */ - + string filePath2 = filePath; if (filePath2.has_prefix ("~")){ filePath2 = Environment.get_home_dir () + "/" + filePath2[2:filePath2.length]; } - + try { string output = ""; Process.spawn_command_line_sync("realpath \"%s\"".printf(filePath2), out output); @@ -347,14 +347,14 @@ catch(Error e){ log_error (e.message); } - + return filePath2; } - + public int rsync (string sourceDirectory, string destDirectory, bool updateExisting, bool deleteExtra){ - + /* Sync files with rsync */ - + string cmd = "rsync --recursive --perms --chmod=a=rwx"; cmd += updateExisting ? "" : " --ignore-existing"; cmd += deleteExtra ? " --delete" : ""; @@ -365,11 +365,11 @@ } namespace TeeJee.JSON{ - + using TeeJee.Logging; /* Convenience functions for reading and writing JSON files */ - + public string json_get_string(Json.Object jobj, string member, string def_value){ if (jobj.has_member(member)){ return jobj.get_string_member(member); @@ -379,7 +379,7 @@ return def_value; } } - + public bool json_get_bool(Json.Object jobj, string member, bool def_value){ if (jobj.has_member(member)){ return bool.parse(jobj.get_string_member(member)); @@ -389,7 +389,7 @@ return def_value; } } - + public int json_get_int(Json.Object jobj, string member, int def_value){ if (jobj.has_member(member)){ return int.parse(jobj.get_string_member(member)); @@ -399,24 +399,24 @@ return def_value; } } - + } namespace TeeJee.ProcessManagement{ using TeeJee.Logging; using TeeJee.FileSystem; using TeeJee.Misc; - + public string TEMP_DIR; /* Convenience functions for executing commands and managing processes */ - + public static void init_tmp(){ string std_out, std_err; - + TEMP_DIR = Environment.get_tmp_dir() + "/" + AppShortName; create_dir(TEMP_DIR); - + execute_command_script_sync("echo 'ok'",out std_out,out std_err); if ((std_out == null)||(std_out.strip() != "ok")){ TEMP_DIR = Environment.get_home_dir() + "/.temp/" + AppShortName; @@ -426,10 +426,10 @@ } public int execute_command_sync (string cmd){ - - /* Executes single command synchronously and returns exit code + + /* Executes single command synchronously and returns exit code * Pipes and multiple commands are not supported */ - + try { int exitCode; Process.spawn_command_line_sync(cmd, null, null, out exitCode); @@ -440,12 +440,12 @@ return -1; } } - + public string execute_command_sync_get_output (string cmd){ - + /* Executes single command synchronously and returns std_out * Pipes and multiple commands are not supported */ - + try { int exitCode; string std_out; @@ -459,17 +459,17 @@ } public bool execute_command_script_async (string cmd){ - - /* Creates a temporary bash script with given commands and executes it asynchronously + + /* Creates a temporary bash script with given commands and executes it asynchronously * Return value indicates if script was started successfully */ - + try { - + string scriptfile = create_temp_bash_script (cmd); - + string[] argv = new string[1]; argv[0] = scriptfile; - + Pid child_pid; Process.spawn_async_with_pipes( null, //working dir @@ -485,12 +485,12 @@ return false; } } - + public string? create_temp_bash_script (string script_text){ - - /* Creates a temporary bash script with given commands + + /* Creates a temporary bash script with given commands * Returns the script file path */ - + var sh = ""; sh += "#!/bin/bash\n"; sh += script_text; @@ -505,29 +505,29 @@ return null; } } - + public string get_temp_file_path(){ - + /* Generates temporary file path */ - + return TEMP_DIR + "/" + timestamp2() + (new Rand()).next_int().to_string(); } - + public int execute_command_script_sync (string script, out string std_out, out string std_err){ - + /* Executes commands synchronously * Returns exit code, output messages and error messages. * Commands are written to a temporary bash script and executed. */ - + string path = create_temp_bash_script(script); try { - + string[] argv = new string[1]; argv[0] = path; - + int exit_code; - + Process.spawn_sync ( TEMP_DIR, //working dir argv, //argv @@ -538,7 +538,7 @@ out std_err, out exit_code ); - + return exit_code; } catch (Error e){ @@ -546,19 +546,19 @@ return -1; } } - + public bool execute_command_script_in_terminal_sync (string script){ - + /* Executes a command script in a terminal window */ //TODO: Remove this - + try { - + string[] argv = new string[3]; argv[0] = "x-terminal-emulator"; argv[1] = "-e"; argv[2] = script; - + Process.spawn_sync ( TEMP_DIR, //working dir argv, //argv @@ -566,7 +566,7 @@ SpawnFlags.SEARCH_PATH, null // child_setup ); - + return true; } catch (Error e){ @@ -576,54 +576,54 @@ } public int execute_bash_script_fullscreen_sync (string script_file){ - + /* Executes a bash script synchronously. * Script is executed in a fullscreen terminal window */ - + string path; - + path = get_cmd_path ("xfce4-terminal"); if ((path != null)&&(path != "")){ return execute_command_sync ("xfce4-terminal --fullscreen -e \"%s\"".printf(script_file)); } - + path = get_cmd_path ("gnome-terminal"); if ((path != null)&&(path != "")){ return execute_command_sync ("gnome-terminal --full-screen -e \"%s\"".printf(script_file)); } - + path = get_cmd_path ("xterm"); if ((path != null)&&(path != "")){ return execute_command_sync ("xterm --fullscreen -e \"%s\"".printf(script_file)); } - + //default terminal - unknown, normal window path = get_cmd_path ("x-terminal-emulator"); if ((path != null)&&(path != "")){ return execute_command_sync ("x-terminal-emulator -e \"%s\"".printf(script_file)); } - + return -1; } - + public int execute_bash_script_sync (string script_file){ - + /* Executes a bash script synchronously in the default terminal window */ - + string path = get_cmd_path ("x-terminal-emulator"); if ((path != null)&&(path != "")){ return execute_command_sync ("x-terminal-emulator -e \"%s\"".printf(script_file)); } - + return -1; } - + public string get_cmd_path (string cmd){ - + /* Returns the full path to a command */ - + try { - int exitCode; + int exitCode; string stdout, stderr; Process.spawn_command_line_sync("which " + cmd, out stdout, out stderr, out exitCode); return stdout; @@ -635,9 +635,9 @@ } public int get_pid_by_name (string name){ - + /* Get the process ID for a process with given name */ - + try{ string output = ""; Process.spawn_command_line_sync("pidof \"%s\"".printf(name), out output); @@ -647,74 +647,74 @@ return int.parse (arr[0]); } } - } - catch (Error e) { - log_error (e.message); } - + catch (Error e) { + log_error (e.message); + } + return -1; } - + public bool process_is_running(long pid){ - + /* Checks if given process is running */ - + string cmd = ""; string std_out; string std_err; int ret_val; - + try{ cmd = "ps --pid %ld".printf(pid); Process.spawn_command_line_sync(cmd, out std_out, out std_err, out ret_val); } - catch (Error e) { - log_error (e.message); + catch (Error e) { + log_error (e.message); return false; } - + return (ret_val == 0); } public int[] get_process_children (Pid parentPid){ - + /* Returns the list of child processes spawned by given process */ - + string output; - + try { Process.spawn_command_line_sync("ps --ppid %d".printf(parentPid), out output); } catch(Error e){ log_error (e.message); } - + int pid; int[] procList = {}; string[] arr; - + foreach (string line in output.split ("\n")){ arr = line.strip().split (" "); if (arr.length < 1) { continue; } - + pid = 0; pid = int.parse (arr[0]); - + if (pid != 0){ procList += pid; } } return procList; } - - + + public void process_kill(Pid process_pid, bool killChildren = true){ - + /* Kills specified process and its children (optional) */ - + int[] child_pids = get_process_children (process_pid); Posix.kill (process_pid, 15); - + if (killChildren){ Pid childPid; foreach (long pid in child_pids){ @@ -723,28 +723,28 @@ } } } - + public int process_pause (Pid procID){ - + /* Pause/Freeze a process */ - + return execute_command_sync ("kill -STOP %d".printf(procID)); } - + public int process_resume (Pid procID){ - + /* Resume/Un-freeze a process*/ - + return execute_command_sync ("kill -CONT %d".printf(procID)); } public void command_kill(string cmd_name, string cmd){ - + /* Kills a specific command */ string txt = execute_command_sync_get_output ("ps w -C %s".printf(cmd_name)); //use 'ps ew -C conky' for all users - + string pid = ""; foreach(string line in txt.split("\n")){ if (line.index_of(cmd) != -1){ @@ -754,65 +754,65 @@ } } } - - + + public void process_set_priority (Pid procID, int prio){ - + /* Set process priority */ - + if (Posix.getpriority (Posix.PRIO_PROCESS, procID) != prio) Posix.setpriority (Posix.PRIO_PROCESS, procID, prio); } - + public int process_get_priority (Pid procID){ - + /* Get process priority */ - + return Posix.getpriority (Posix.PRIO_PROCESS, procID); } - + public void process_set_priority_normal (Pid procID){ - + /* Set normal priority for process */ - + process_set_priority (procID, 0); } - + public void process_set_priority_low (Pid procID){ - + /* Set low priority for process */ - + process_set_priority (procID, 5); } - + public bool user_is_admin (){ - + /* Check if current application is running with admin priviledges */ - + try{ // create a process string[] argv = { "sleep", "10" }; Pid procId; - Process.spawn_async(null, argv, null, SpawnFlags.SEARCH_PATH, null, out procId); - + Process.spawn_async(null, argv, null, SpawnFlags.SEARCH_PATH, null, out procId); + // try changing the priority Posix.setpriority (Posix.PRIO_PROCESS, procId, -5); - + // check if priority was changed successfully if (Posix.getpriority (Posix.PRIO_PROCESS, procId) == -5) return true; else return false; - } - catch (Error e) { - log_error (e.message); + } + catch (Error e) { + log_error (e.message); return false; } } public string get_user_login(){ - /* + /* Returns Login ID of current user. If running as 'sudo' it will return Login ID of the actual user. */ @@ -822,7 +822,7 @@ string std_err; int ret_val; ret_val = execute_command_script_sync(cmd, out std_out, out std_err); - + string user_name; if ((std_out == null) || (std_out.length == 0)){ user_name = "root"; @@ -830,45 +830,45 @@ else{ user_name = std_out.strip(); } - + return user_name; } public int get_user_id(string user_login){ - /* + /* Returns UID of specified user. */ - + int uid = -1; string cmd = "id %s -u".printf(user_login); string txt = execute_command_sync_get_output(cmd); if ((txt != null) && (txt.length > 0)){ uid = int.parse(txt); } - + return uid; } - - + + public string get_app_path (){ - + /* Get path of current process */ - + try{ - return GLib.FileUtils.read_link ("/proc/self/exe"); + return GLib.FileUtils.read_link ("/proc/self/exe"); } catch (Error e){ log_error (e.message); return ""; } } - + public string get_app_dir (){ - + /* Get parent directory of current process */ - + try{ - return (File.new_for_path (GLib.FileUtils.read_link ("/proc/self/exe"))).get_parent ().get_path (); + return (File.new_for_path (GLib.FileUtils.read_link ("/proc/self/exe"))).get_parent ().get_path (); } catch (Error e){ log_error (e.message); @@ -879,21 +879,21 @@ } namespace TeeJee.GtkHelper{ - + using Gtk; - + public void gtk_do_events (){ - + /* Do pending events */ - + while(Gtk.events_pending ()) Gtk.main_iteration (); } public void gtk_set_busy (bool busy, Gtk.Window win) { - + /* Show or hide busy cursor on window */ - + Gdk.Cursor? cursor = null; if (busy){ @@ -902,18 +902,18 @@ else{ cursor = new Gdk.Cursor(Gdk.CursorType.ARROW); } - + var window = win.get_window (); - + if (window != null) { window.set_cursor (cursor); } - + gtk_do_events (); } - + public void gtk_messagebox(string title, string message, Gtk.Window? parent_win, bool is_error = false){ - + /* Shows a simple message box */ Gtk.MessageType type = Gtk.MessageType.INFO; @@ -923,7 +923,7 @@ else{ type = Gtk.MessageType.INFO; } - + var dlg = new Gtk.MessageDialog.with_markup(null, Gtk.DialogFlags.MODAL, type, Gtk.ButtonsType.OK, message); dlg.title = title; dlg.set_default_size (200, -1); @@ -934,15 +934,15 @@ dlg.run(); dlg.destroy(); } - + public bool gtk_combobox_set_value (ComboBox combo, int index, string val){ - + /* Conveniance function to set combobox value */ - + TreeIter iter; string comboVal; TreeModel model = (TreeModel) combo.model; - + bool iterExists = model.get_iter_first (out iter); while (iterExists){ model.get(iter, 1, out comboVal); @@ -951,45 +951,45 @@ return true; } iterExists = model.iter_next (ref iter); - } - + } + return false; } - + public string gtk_combobox_get_value (ComboBox combo, int index, string default_value){ - + /* Conveniance function to get combobox value */ - + if (combo.model == null) { return default_value; } if (combo.active < 0) { return default_value; } - + TreeIter iter; string val = ""; combo.get_active_iter (out iter); TreeModel model = (TreeModel) combo.model; model.get(iter, index, out val); - + return val; } public class CellRendererProgress2 : Gtk.CellRendererProgress{ public override void render (Cairo.Context cr, Gtk.Widget widget, Gdk.Rectangle background_area, Gdk.Rectangle cell_area, Gtk.CellRendererState flags) { - if (text == "--") + if (text == "--") return; - + int diff = (int) ((cell_area.height - height)/2); - + // Apply the new height into the bar, and center vertically: Gdk.Rectangle new_area = Gdk.Rectangle() ; new_area.x = cell_area.x; new_area.y = cell_area.y + diff; new_area.width = width - 5; new_area.height = height; - + base.render(cr, widget, background_area, new_area, flags); } - } - + } + public Gdk.Pixbuf? get_app_icon(int icon_size, string format = ".png"){ var img_icon = get_shared_icon(AppShortName, AppShortName + format,icon_size,"pixmaps"); if (img_icon != null){ @@ -999,94 +999,94 @@ return null; } } - + public Gtk.Image? get_shared_icon(string icon_name, string fallback_icon_file_name, int icon_size, string icon_directory = AppShortName + "/images"){ Gdk.Pixbuf pix_icon = null; Gtk.Image img_icon = null; - + try { Gtk.IconTheme icon_theme = Gtk.IconTheme.get_default(); pix_icon = icon_theme.load_icon (icon_name, icon_size, 0); } catch (Error e) { //log_error (e.message); } - + string fallback_icon_file_path = "/usr/share/%s/%s".printf(icon_directory, fallback_icon_file_name); - - if (pix_icon == null){ + + if (pix_icon == null){ try { pix_icon = new Gdk.Pixbuf.from_file_at_size (fallback_icon_file_path, icon_size, icon_size); } catch (Error e) { log_error (e.message); } } - - if (pix_icon == null){ + + if (pix_icon == null){ log_error (_("Missing Icon") + ": '%s', '%s'".printf(icon_name, fallback_icon_file_path)); } else{ img_icon = new Gtk.Image.from_pixbuf(pix_icon); } - return img_icon; + return img_icon; } } namespace TeeJee.Multimedia{ - + using TeeJee.Logging; - + /* Functions for working with audio/video files */ - + public long get_file_duration(string filePath){ - + /* Returns the duration of an audio/video file using MediaInfo */ - + string output = "0"; - + try { Process.spawn_command_line_sync("mediainfo \"--Inform=General;%Duration%\" \"" + filePath + "\"", out output); } catch(Error e){ log_error (e.message); } - + return long.parse(output); } - + public string get_file_crop_params (string filePath){ - + /* Returns cropping parameters for a video file using avconv */ - + string output = ""; string error = ""; - + try { Process.spawn_command_line_sync("avconv -i \"%s\" -vf cropdetect=30 -ss 5 -t 5 -f matroska -an -y /dev/null".printf(filePath), out output, out error); } catch(Error e){ log_error (e.message); } - + int w=0,h=0,x=10000,y=10000; int num=0; string key,val; string[] arr; - + foreach (string line in error.split ("\n")){ if (line == null) { continue; } if (line.index_of ("crop=") == -1) { continue; } foreach (string part in line.split (" ")){ if (part == null || part.length == 0) { continue; } - + arr = part.split (":"); if (arr.length != 2) { continue; } - + key = arr[0].strip (); val = arr[1].strip (); - + switch (key){ case "x": num = int.parse (arr[1]); @@ -1107,47 +1107,47 @@ } } } - + if (x == 10000 || y == 10000) return "%i:%i:%i:%i".printf(0,0,0,0); - else + else return "%i:%i:%i:%i".printf(w,h,x,y); } - + public string get_mediainfo (string filePath){ - + /* Returns the multimedia properties of an audio/video file using MediaInfo */ - + string output = ""; - + try { Process.spawn_command_line_sync("mediainfo \"%s\"".printf(filePath), out output); } catch(Error e){ log_error (e.message); } - + return output; } - - + + } namespace TeeJee.System{ - + using TeeJee.ProcessManagement; using TeeJee.Logging; public double get_system_uptime_seconds(){ - + /* Returns the system up-time in seconds */ - + string cmd = ""; string std_out; string std_err; int ret_val; - + try{ cmd = "cat /proc/uptime"; Process.spawn_command_line_sync(cmd, out std_out, out std_err, out ret_val); @@ -1160,18 +1160,18 @@ return 0; } } - + public string get_desktop_name(){ - + /* Return the names of the current Desktop environment */ - + int pid = -1; - + pid = get_pid_by_name("cinnamon"); if (pid > 0){ return "Cinnamon"; } - + pid = get_pid_by_name("xfdesktop"); if (pid > 0){ return "Xfce"; @@ -1186,12 +1186,12 @@ if (pid > 0){ return "Gnome"; } - + pid = get_pid_by_name("wingpanel"); if (pid > 0){ return "Elementary"; } - + pid = get_pid_by_name("unity-panel-service"); if (pid > 0){ return "Unity"; @@ -1201,7 +1201,7 @@ if (pid > 0){ return "KDE"; } - + return "Unknown"; } @@ -1217,22 +1217,22 @@ catch (Error e){ log_error (e.message); } - + return (exit_code == 0); } - + public bool shutdown (){ - + /* Shutdown the system immediately */ - + try{ string[] argv = { "shutdown", "-h", "now" }; Pid procId; - Process.spawn_async(null, argv, null, SpawnFlags.SEARCH_PATH, null, out procId); + Process.spawn_async(null, argv, null, SpawnFlags.SEARCH_PATH, null, out procId); return true; - } - catch (Error e) { - log_error (e.message); + } + catch (Error e) { + log_error (e.message); return false; } } @@ -1245,20 +1245,20 @@ } return false; } - + public bool exo_open_folder (string dir_path, bool xdg_open_try_first = true){ - + /* Tries to open the given directory in a file manager */ /* xdg-open is a desktop-independent tool for configuring the default applications of a user. - Inside a desktop environment (e.g. GNOME, KDE, Xfce), xdg-open simply passes the arguments + Inside a desktop environment (e.g. GNOME, KDE, Xfce), xdg-open simply passes the arguments to that desktop environment's file-opener application (gvfs-open, kde-open, exo-open, respectively). - We will first try using xdg-open and then check for specific file managers if it fails. + We will first try using xdg-open and then check for specific file managers if it fails. */ - + string path; - + if (xdg_open_try_first){ //try using xdg-open path = get_cmd_path ("xdg-open"); @@ -1266,17 +1266,17 @@ return execute_command_script_async ("xdg-open \"" + dir_path + "\""); } } - + path = get_cmd_path ("nemo"); if ((path != null)&&(path != "")){ return execute_command_script_async ("nemo \"" + dir_path + "\""); } - + path = get_cmd_path ("nautilus"); if ((path != null)&&(path != "")){ return execute_command_script_async ("nautilus \"" + dir_path + "\""); } - + path = get_cmd_path ("thunar"); if ((path != null)&&(path != "")){ return execute_command_script_async ("thunar \"" + dir_path + "\""); @@ -1286,7 +1286,7 @@ if ((path != null)&&(path != "")){ return execute_command_script_async ("pantheon-files \"" + dir_path + "\""); } - + path = get_cmd_path ("marlin"); if ((path != null)&&(path != "")){ return execute_command_script_async ("marlin \"" + dir_path + "\""); @@ -1299,16 +1299,16 @@ return execute_command_script_async ("xdg-open \"" + dir_path + "\""); } } - + return false; } public bool exo_open_textfile (string txt){ - + /* Tries to open the given text file in a text editor */ - + string path; - + path = get_cmd_path ("exo-open"); if ((path != null)&&(path != "")){ return execute_command_script_async ("exo-open \"" + txt + "\""); @@ -1323,11 +1323,11 @@ } public bool exo_open_url (string url){ - + /* Tries to open the given text file in a text editor */ - + string path; - + path = get_cmd_path ("exo-open"); if ((path != null)&&(path != "")){ return execute_command_script_async ("exo-open \"" + url + "\""); @@ -1342,19 +1342,19 @@ if ((path != null)&&(path != "")){ return execute_command_script_async ("chromium-browser \"" + url + "\""); } - + return false; } - + private DateTime dt_last_notification = null; private const int NOTIFICATION_INTERVAL = 3; - + public int notify_send (string title, string message, int durationMillis, string urgency, string dialog_type = "info"){ - + /* Displays notification bubble on the desktop */ int retVal = 0; - + switch (dialog_type){ case "error": case "info": @@ -1365,14 +1365,14 @@ dialog_type = "info"; break; } - + long seconds = 9999; if (dt_last_notification != null){ DateTime dt_end = new DateTime.now_local(); TimeSpan elapsed = dt_end.difference(dt_last_notification); seconds = (long)(elapsed * 1.0 / TimeSpan.SECOND); } - + if (seconds > NOTIFICATION_INTERVAL){ string s = "notify-send -t %d -u %s -i %s \"%s\" \"%s\"".printf(durationMillis, urgency, "gtk-dialog-" + dialog_type, title, message); retVal = execute_command_sync (s); @@ -1381,13 +1381,13 @@ return retVal; } - + public bool set_directory_ownership(string dir_name, string login_name){ try { string cmd = "chown %s -R %s".printf(login_name, dir_name); int exit_code; Process.spawn_command_line_sync(cmd, null, null, out exit_code); - + if (exit_code == 0){ //log_msg(_("Ownership changed to '%s' for files in directory '%s'").printf(login_name, dir_name)); return true; @@ -1409,29 +1409,29 @@ public double system = 0; public double idle = 0; public double iowait = 0; - + public double user_delta = 0; public double nice_delta = 0; public double system_delta = 0; public double idle_delta = 0; public double iowait_delta = 0; - + public double usage_percent = 0; - + public static ProcStats stat_prev = null; - + public ProcStats(string line){ string[] arr = line.split(" "); int col = 0; if (arr[col++] == "cpu"){ if (arr[col].length == 0){ col++; }; - + user = double.parse(arr[col++]); nice = double.parse(arr[col++]); system = double.parse(arr[col++]); idle = double.parse(arr[col++]); iowait = double.parse(arr[col++]); - + if (ProcStats.stat_prev != null){ user_delta = user - ProcStats.stat_prev.user; nice_delta = nice - ProcStats.stat_prev.nice; @@ -1443,13 +1443,13 @@ } else{ usage_percent = 0; - + } ProcStats.stat_prev = this; } } - + public static double get_cpu_usage(){ string txt = read_file("/proc/stat"); foreach(string line in txt.split("\n")){ @@ -1462,35 +1462,35 @@ return 0; } } - - + + } namespace TeeJee.Misc { - + /* Various utility functions */ - + using Gtk; using TeeJee.Logging; using TeeJee.FileSystem; using TeeJee.ProcessManagement; - + public class DistInfo : GLib.Object{ - + /* Class for storing information about linux distribution */ - + public string dist_id = ""; public string description = ""; public string release = ""; public string codename = ""; - + public DistInfo(){ dist_id = ""; description = ""; release = ""; codename = ""; } - + public string full_name(){ if (dist_id == ""){ return ""; @@ -1503,14 +1503,14 @@ return val; } } - + public static DistInfo get_dist_info(string root_path){ - - /* Returns information about the Linux distribution + + /* Returns information about the Linux distribution * installed at the given root path */ - + DistInfo info = new DistInfo(); - + string dist_file = root_path + "/etc/lsb-release"; var f = File.new_for_path(dist_file); if (f.query_exists()){ @@ -1521,22 +1521,22 @@ DISTRIB_CODENAME=raring DISTRIB_DESCRIPTION="Ubuntu 13.04" */ - + foreach(string line in read_file(dist_file).split("\n")){ - + if (line.split("=").length != 2){ continue; } - + string key = line.split("=")[0].strip(); string val = line.split("=")[1].strip(); - + if (val.has_prefix("\"")){ val = val[1:val.length]; } - + if (val.has_suffix("\"")){ val = val[0:val.length-1]; } - + switch (key){ case "DISTRIB_ID": info.dist_id = val; @@ -1554,11 +1554,11 @@ } } else{ - + dist_file = root_path + "/etc/os-release"; f = File.new_for_path(dist_file); if (f.query_exists()){ - + /* NAME="Ubuntu" VERSION="13.04, Raring Ringtail" @@ -1570,14 +1570,14 @@ SUPPORT_URL="http://help.ubuntu.com/" BUG_REPORT_URL="http://bugs.launchpad.net/ubuntu/" */ - + foreach(string line in read_file(dist_file).split("\n")){ - + if (line.split("=").length != 2){ continue; } - + string key = line.split("=")[0].strip(); string val = line.split("=")[1].strip(); - + switch (key){ case "ID": info.dist_id = val; @@ -1598,33 +1598,33 @@ return info; } - + } public static Gdk.RGBA hex_to_rgba (string hex_color){ - + /* Converts the color in hex to RGBA */ - + string hex = hex_color.strip().down(); if (hex.has_prefix("#") == false){ hex = "#" + hex; } - + Gdk.RGBA color = Gdk.RGBA(); if(color.parse(hex) == false){ color.parse("#000000"); } color.alpha = 255; - + return color; } - + public static string rgba_to_hex (Gdk.RGBA color, bool alpha = false, bool prefix_hash = true){ - + /* Converts the color in RGBA to hex */ - + string hex = ""; - + if (alpha){ hex = "%02x%02x%02x%02x".printf((uint)(Math.round(color.red*255)), (uint)(Math.round(color.green*255)), @@ -1632,54 +1632,54 @@ (uint)(Math.round(color.alpha*255))) .up(); } - else { + else { hex = "%02x%02x%02x".printf((uint)(Math.round(color.red*255)), (uint)(Math.round(color.green*255)), (uint)(Math.round(color.blue*255))) .up(); - } - + } + if (prefix_hash){ hex = "#" + hex; - } - - return hex; + } + + return hex; } public string timestamp2 (){ - + /* Returns a numeric timestamp string */ - + return "%ld".printf((long) time_t ()); } - - public string timestamp (){ - + + public string timestamp (){ + /* Returns a formatted timestamp string */ - + Time t = Time.local (time_t ()); return t.format ("%H:%M:%S"); } - public string timestamp3 (){ - + public string timestamp3 (){ + /* Returns a formatted timestamp string */ - + Time t = Time.local (time_t ()); return t.format ("%Y-%d-%m_%H-%M-%S"); } - + public string format_file_size (int64 size){ - + /* Format file size in MB */ - + return "%0.1f MB".printf (size / (1024.0 * 1024)); } - + public string format_duration (long millis){ - + /* Converts time in milliseconds to format '00:00:00.0' */ - + double time = millis / 1000.0; // time in seconds double hr = Math.floor(time / (60.0 * 60)); @@ -1687,14 +1687,14 @@ double min = Math.floor(time / 60.0); time = time - (min * 60); double sec = Math.floor(time); - + return "%02.0lf:%02.0lf:%02.0lf".printf (hr, min, sec); } - + public double parse_time (string time){ - + /* Converts time in format '00:00:00.0' to seconds */ - + string[] arr = time.split (":"); double secs = 0; if (arr.length >= 3){ @@ -1704,7 +1704,7 @@ } return secs; } - + public string escape_html(string html){ return html .replace("&","&") @@ -1714,7 +1714,7 @@ .replace(">",">") ; } - + public string unescape_html(string html){ return html .replace("&","&") @@ -1725,4 +1725,3 @@ ; } } -
View file
selene_2.5.2~185~ubuntu15.04.1.tar.xz/src/makefile -> selene_2.5.8~198~ubuntu15.10.1.tar.xz/src/makefile
Changed
@@ -11,7 +11,7 @@ all: #build binaries - valac -X -D'GETTEXT_PACKAGE="${app_name}"' --Xcc="-lm" -X -Wl,-rpath,/usr/share/${app_name}/libs "Main.vala" "Utility.vala" "MainWindow.vala" "AppConfigWindow.vala" "EncoderConfigWindow.vala" "EncoderStatusWindow.vala" "FileInfoWindow.vala" "AboutWindow.vala" "DonationWindow.vala" -o ${app_name} --pkg glib-2.0 --pkg gio-unix-2.0 --pkg posix --pkg gtk+-3.0 --pkg gee-1.0 --pkg json-glib-1.0 + valac -X -D'GETTEXT_PACKAGE="${app_name}"' --Xcc="-lm" -X -Wl,-rpath,/usr/share/${app_name}/libs "Main.vala" "Utility.vala" "MainWindow.vala" "AppConfigWindow.vala" "EncoderConfigWindow.vala" "EncoderStatusWindow.vala" "FileInfoWindow.vala" "AboutWindow.vala" "DonationWindow.vala" -o ${app_name} --pkg glib-2.0 --pkg gio-unix-2.0 --pkg posix --pkg gtk+-3.0 --pkg gee-0.8 --pkg json-glib-1.0 #update translation template xgettext --language=C --keyword=_ --copyright-holder='Tony George (teejee2008@gmail.com)' --package-name='${app_name}' --package-version='2.2' --msgid-bugs-address='teejee2008@gmail.com' --escape --sort-output -o ../${app_name}.pot *.vala @@ -28,21 +28,21 @@ mkdir -p "$(DESTDIR)$(sharedir)/glib-2.0/schemas/" mkdir -p "$(DESTDIR)$(sharedir)/${app_name}" mkdir -p "$(DESTDIR)$(sharedir)/pixmaps" - + #binary install -m 0755 ${app_name} "$(DESTDIR)$(bindir)" install -m 0755 ${app_name}-uninstall "$(DESTDIR)$(bindir)" - + #shared files cp -dpr --no-preserve=ownership -t "$(DESTDIR)$(sharedir)/${app_name}" ./share/${app_name}/* chmod --recursive 0755 $(DESTDIR)$(sharedir)/${app_name}/* - + #launcher install -m 0755 ${app_name}.desktop "$(DESTDIR)$(launcherdir)" - + #app icon install -m 0755 ./share/pixmaps/${app_name}.png "$(DESTDIR)$(sharedir)/pixmaps" - + #translations mkdir -p "$(DESTDIR)$(localedir)/ms/LC_MESSAGES" msgfmt --check --verbose -o "$(DESTDIR)$(localedir)/ms/LC_MESSAGES/${app_name}.mo" ../po/${app_name}-ms.po @@ -50,20 +50,20 @@ msgfmt --check --verbose -o "$(DESTDIR)$(localedir)/ko/LC_MESSAGES/${app_name}.mo" ../po/${app_name}-ko.po mkdir -p "$(DESTDIR)$(localedir)/es/LC_MESSAGES" msgfmt --check --verbose -o "$(DESTDIR)$(localedir)/es/LC_MESSAGES/${app_name}.mo" ../po/${app_name}-es.po - + uninstall: #binary rm -f "$(DESTDIR)$(bindir)/${app_name}" rm -f "$(DESTDIR)$(bindir)/${app_name}-uninstall" - + #shared files rm -rf "$(DESTDIR)$(sharedir)/${app_name}" - + #launcher rm -f "$(DESTDIR)$(launcherdir)/${app_name}.desktop" - + #app icon rm -f "$(DESTDIR)$(sharedir)/pixmaps/${app_name}.png" - + #translations rm -f $(DESTDIR)$(localedir)/*/LC_MESSAGES/${app_name}.mo
Locations
Projects
Search
Status Monitor
Help
Open Build Service
OBS Manuals
API Documentation
OBS Portal
Reporting a Bug
Contact
Mailing List
Forums
Chat (IRC)
Twitter
Open Build Service (OBS)
is an
openSUSE project
.