Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

New runtime #15

Closed
wants to merge 10 commits into from
Closed
Show file tree
Hide file tree
Changes from 6 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
50 changes: 50 additions & 0 deletions 0001-Use-standard-icon-names.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
From ce29381d7e4be91ddd341a04f6619a6a71bd4278 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Ball=C3=B3=20Gy=C3=B6rgy?= <[email protected]>
Date: Wed, 8 Jul 2020 11:13:12 +0200
Subject: [PATCH] Use standard icon names

---
src/Controllers/ConverterController.vala | 8 ++++----
src/Widgets/DialogConvertFile.vala | 2 +-
2 files changed, 5 insertions(+), 5 deletions(-)

diff --git a/src/Controllers/ConverterController.vala b/src/Controllers/ConverterController.vala
index b639d11..9740fad 100644
--- a/src/Controllers/ConverterController.vala
+++ b/src/Controllers/ConverterController.vala
@@ -439,16 +439,16 @@ namespace Ciano.Controllers {

switch (item.type_item) {
case TypeItemEnum.VIDEO:
- icon = "media-video";
+ icon = "video-x-generic";
break;
case TypeItemEnum.MUSIC:
icon = "audio-x-generic";
break;
case TypeItemEnum.IMAGE:
- icon = "image";
+ icon = "image-x-generic";
break;
default:
- icon = "file";
+ icon = "text-x-generic";
break;
}

diff --git a/src/Widgets/DialogConvertFile.vala b/src/Widgets/DialogConvertFile.vala
index 3f7d44c..ba1be41 100644
--- a/src/Widgets/DialogConvertFile.vala
+++ b/src/Widgets/DialogConvertFile.vala
@@ -175,7 +175,7 @@ namespace Ciano.Widgets {
toolbar.get_style_context ().add_class (Gtk.STYLE_CLASS_INLINE_TOOLBAR);
toolbar.set_icon_size (Gtk.IconSize.SMALL_TOOLBAR);

- var button_add_file = new Gtk.ToolButton (new Gtk.Image.from_icon_name ("application-add-symbolic", Gtk.IconSize.SMALL_TOOLBAR), null);
+ var button_add_file = new Gtk.ToolButton (new Gtk.Image.from_icon_name ("list-add-symbolic", Gtk.IconSize.SMALL_TOOLBAR), null);
button_add_file.tooltip_text = Properties.TEXT_ADD_FILE;
button_add_file.clicked.connect (() => {
this.converter_controller.on_activate_button_add_file (
--
2.27.0

122 changes: 122 additions & 0 deletions ConverterController.vala.patch
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

is this patch submitted upstream ?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

No. I don't know if it's the most aesthetic solution. I'll mention it in the respective bug report, so the developer can fix it.

Original file line number Diff line number Diff line change
@@ -0,0 +1,122 @@
--- a/src/Controllers/ConverterController.vala 2020-07-12 08:45:41.000000000 -0500
+++ b/src/Controllers/ConverterController.vala 2024-09-26 12:16:48.657352442 -0500
@@ -140,14 +140,22 @@
if (chooser_file.run () == Gtk.ResponseType.OK) {

SList<string> uris = chooser_file.get_filenames ();
-
+
foreach (unowned string uri in uris) {

- var file = File.new_for_uri (uri);
- int index = file.get_basename ().last_index_of("/");
- string name = file.get_basename ().substring(index + 1, -1);
- string directory = file.get_basename ().substring(0, index + 1);
-
+ File *file;
+
+ if(uri[0] == '/'){
+ file = File.new_for_path (uri);
+ } else {
+ file = File.new_for_uri (uri);
+ }
+
+
+ string name = file->get_basename ();
+ int index = file->get_path ().last_index_of("/");
+ string directory = file->get_path ().substring(0, index + 1);
+
list_store.append (out iter);
list_store.set (iter, 0, name, 1, directory);
tree_view.expand_all ();
@@ -454,6 +462,40 @@

return icon;
}
+
+ private string[] get_key_value (string str_cc, string key){
+
+ string cont = "0";
+ string str_ = "";
+
+ if(str_cc.contains (key)){
+
+ cont = "1";
+
+ int index = str_cc.index_of (key);
+ int len = (int)str_cc.size();
+
+ index = index + (int)key.size();
+
+
+ string str_tmp = str_cc.substring (index, len - index);
+
+ int mark = len;
+ for(int i = 0; i < str_tmp.length; i++){
+
+ if(str_tmp[i] == ' '){ mark = i; }
+ if(str_tmp[i] == '='){ break; }
+ }
+
+
+ str_ = str_cc.substring (index, mark);
+
+ var regex = new Regex (" ");
+ str_ = regex.replace (str_, -1, 0, "");
+ }
+
+ return {cont, str_};
+ }

/**
* Responsible for processing the returned row and validate the return and execution of actions accordingly.
@@ -476,25 +518,36 @@
string bitrate = StringUtil.EMPTY;

if (str_return.contains ("Duration:")) {
+
int index = str_return.index_of ("Duration:");
string duration = str_return.substring (index + 10, 11);

total = TimeUtil.duration_in_seconds (duration);
}

- if (str_return.contains ("time=") && str_return.contains ("size=") && str_return.contains ("bitrate=") ) {
- int index_time = str_return.index_of ("time=");
- time = str_return.substring ( index_time + 5, 11);
-
- int loading = TimeUtil.duration_in_seconds (time);
- double progress = (100 * loading) / total;
- row.progress_bar.set_fraction (progress / 100);
-
- int index_size = str_return.index_of ("size=");
- size = str_return.substring ( index_size + 5, 11);
-
- int index_bitrate = str_return.index_of ("bitrate=");
- bitrate = str_return.substring ( index_bitrate + 8, 11);
+ string[] time_ = get_key_value (str_return, "time=");
+ string[] size_ = get_key_value (str_return, "size=");
+ string[] bitrate_ = get_key_value (str_return, "bitrate=");
+
+ if (time_[0] == "1" && size_[0] == "1" && bitrate_[0] == "1" ) {
+
+ var regex_time = new Regex ("^[0-9]{2}:[0-9]{2}:[0-9.]{2,4}");
+ double progress = 0;
+
+ if( regex_time.match(time_[1]) ){
+
+ int loading = TimeUtil.duration_in_seconds (time_[1]);
+ progress = (100 * loading) / total;
+ row.progress_bar.set_fraction (progress / 100);
+
+ }else{
+
+ row.progress_bar.set_fraction (0);
+ }
+
+ time = time_[1];
+ size = size_[1];
+ bitrate = bitrate_[1];

row.status.label = Properties.TEXT_PERCENTAGE + progress.to_string() + "%" + Properties.TEXT_SIZE_CUSTOM + size.strip () + Properties.TEXT_TIME_CUSTOM + time.strip () + Properties.TEXT_BITRATE_CUSTOM + bitrate.strip ();
}
29 changes: 29 additions & 0 deletions com.github.robertsanseries.ciano.appdata.xml.in.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
--- a/data/com.github.robertsanseries.ciano.appdata.xml.in 2024-09-22 11:49:28.181541667 -0500
+++ b/data/com.github.robertsanseries.ciano.appdata.xml.in 2024-09-22 14:23:21.412870482 -0500
@@ -2,6 +2,7 @@
<!-- Copyright 2017 Robert San <[email protected]> -->
<component type="desktop-application">
<id>com.github.robertsanseries.ciano</id>
+ <launchable type="desktop-id">com.github.robertsanseries.ciano.desktop</launchable>
<metadata_license>CC0-1.0</metadata_license>
<project_license>GPL-3.0+</project_license>
<name>Ciano</name>
@@ -10,6 +11,7 @@
<provides>
<binary>com.github.robertsanseries.ciano</binary>
</provides>
+ <translation type="gettext">ciano</translation>
<screenshots>
<screenshot type="default">
<image>https://raw.githubusercontent.com/robertsanseries/ciano/master/data/screenshot.png</image>
@@ -131,6 +133,10 @@
</description>
</release>
</releases>
+ <categories>
+ <category>Utility</category>
+ <category>AudioVideo</category>
+ </categories>
<content_rating type="oars-1.1">
<content_attribute id="violence-cartoon">none</content_attribute>
<content_attribute id="violence-fantasy">none</content_attribute>
130 changes: 99 additions & 31 deletions com.github.robertsanseries.ciano.json
Original file line number Diff line number Diff line change
@@ -1,16 +1,18 @@
{
"app-id": "com.github.robertsanseries.ciano",
"runtime": "org.freedesktop.Platform",
"runtime-version": "20.08",
"runtime-version": "23.08",
"sdk": "org.freedesktop.Sdk",
"command": "com.github.robertsanseries.ciano",
"base": "io.elementary.BaseApp",
"base-version": "juno-20.08",
"base-version": "juno-23.08",
"command": "com.github.robertsanseries.ciano",
"finish-args": [
"--share=ipc",
"--socket=x11",
"--socket=wayland",
"--filesystem=home",
"--device=dri",
"--env=GTK_THEME=/app/share/themes",
bztd marked this conversation as resolved.
Show resolved Hide resolved
"--metadata=X-DConf=migrate-path=/com/github/robertsanseries/ciano/"
],
"cleanup": [
Expand Down Expand Up @@ -54,24 +56,75 @@
"--without-xml",
"--without-zlib"
],
"sources": [
{
"type": "archive",
"url": "https://github.com/ImageMagick/ImageMagick/archive/7.0.11-6.tar.gz",
"sha256": "8adc1605784653b078572b825e8cd1d3d54f8a1b4ba86b32ca253c038f7e4c37"
}
]
"sources": [{
"type": "git",
"url": "https://github.com/ImageMagick/ImageMagick.git",
"tag": "7.1.1-38",
"commit": "b0ab92265bab638e6ecd2f18b45977c38771c671"
}]
},
{
"name": "chrpath",
"cleanup": ["*"],
"sources": [
{
"type": "archive",
"url": "http://deb.debian.org/debian/pool/main/c/chrpath/chrpath_0.16.orig.tar.gz",
"sha256": "bb0d4c54bac2990e1bdf8132f2c9477ae752859d523e141e72b3b11a12c26e7b"
}
]
"sources": [{
"type": "archive",
"url": "http://deb.debian.org/debian/pool/main/c/chrpath/chrpath_0.16.orig.tar.gz",
"sha256": "bb0d4c54bac2990e1bdf8132f2c9477ae752859d523e141e72b3b11a12c26e7b"
}]
},
{
"name": "x264",
"buildsystem": "autotools",
"config-opts": [
"--enable-static",
"--enable-pic"
],
"sources": [{
"type": "archive",
"url": "http://deb.debian.org/debian/pool/main/x/x264/x264_0.164.3108+git31e19f9.orig.tar.gz",
"sha256": "41606cb8e788a7f8c4514290646d4ba5c7bc68d9e1ccd1a73f446a90546913eb"
}]
},
{
"name": "aac",
"buildsystem": "simple",
"build-commands": [
"autoreconf -fiv",
"./configure --prefix=/app --disable-shared",
"make",
"make install"
],
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This should use autotools instead of simple, you can add autoreconf -fiv as a shell source https://docs.flatpak.org/en/latest/module-sources.html#shell-and-script-sources

"sources": [{
"type": "git",
"url": "https://github.com/mstorsjo/fdk-aac.git",
"tag": "v2.0.3",
"commit": "716f4394641d53f0d79c9ddac3fa93b03a49f278"
}]
},
{
"name": "opus",
"buildsystem": "autotools",
"sources": [{
"type": "archive",
"url": "https://github.com/xiph/opus/releases/download/v1.5.2/opus-1.5.2.tar.gz",
"sha256": "65c1d2f78b9f2fb20082c38cbe47c951ad5839345876e46941612ee87f9a7ce1"
}]
},
{
"name": "libvpx",
"buildsystem": "autotools",
"config-opts": [
"--disable-examples",
"--disable-unit-tests",
"--enable-vp9-highbitdepth",
"--as=nasm"
],
"sources": [{
"type": "git",
"url": "https://chromium.googlesource.com/webm/libvpx.git",
"tag": "v1.14.1",
"commit": "3688b17187d40a71f9a7de4bfac92201f3e4a533"
}]
},
{
"name": "ffmpeg",
Expand All @@ -81,8 +134,15 @@
"/share/ffmpeg/examples"
],
"config-opts": [
"--enable-shared",
"--disable-static",
"--enable-gnutls",
"--enable-nonfree",
"--enable-static",
"--enable-libx264",
"--enable-gpl",
"--enable-libfdk-aac",
"--enable-libvorbis",
"--enable-libopus",
"--enable-libvpx",
"--disable-ffplay",
"--disable-ffprobe",
"--disable-doc",
Expand All @@ -91,30 +151,38 @@
"post-install": [
"chrpath -d /app/bin/ffmpeg"
],
"sources": [
{
"type": "archive",
"url": "https://ffmpeg.org/releases/ffmpeg-4.4.tar.xz",
"sha256": "06b10a183ce5371f915c6bb15b7b1fffbe046e8275099c96affc29e17645d909"
}
]
"sources": [{
"type": "archive",
"url": "https://ffmpeg.org/releases/ffmpeg-7.0.2.tar.xz",
"sha256": "8646515b638a3ad303e23af6a3587734447cb8fc0a0c064ecdb8e95c4fd8b389"
}]
},
{
"name": "ciano",
"buildsystem": "meson",
"config-opts": [
"--buildtype=release"
],
"post-install": [
"cp -u -r /app/share/icons/hicolor/24x24/* /app/share/icons/hicolor/scalable/",
"rm -r /app/share/icons/hicolor/[0-9]*"

],
"sources": [
{
"type":"git",
"type":"git",
"url":"https://github.com/robertsanseries/ciano.git",
"tag":"0.2.4",
"commit": "e7dd4bd4f9eaff4e6a247fc8ced7f358cde6da63"
},
{
"type": "patch",
"path": "elementary-theme.patch"
},
{
"type": "patch",
"paths": [
"elementary-theme.patch",
"0001-Use-standard-icon-names.patch",
"com.github.robertsanseries.ciano.appdata.xml.in.patch",
"ConverterController.vala.patch"
]
}
]
}
Expand Down
Loading