Skip to content
Closed
Show file tree
Hide file tree
Changes from all 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
1 change: 1 addition & 0 deletions build-aux/dev.geopjr.Tuba.Clapper.json
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@
"mkdir -p /app/lib/ffmpeg"
],
"modules": [
"gtuber.json",
{
"name": "clapper",
"buildsystem": "meson",
Expand Down
29 changes: 29 additions & 0 deletions build-aux/gtuber.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
{
"name": "gtuber",
"buildsystem": "meson",
"config-opts": [
"-Dgst-gtuber=enabled",
"-Dintrospection=enabled",
"-Dvapi=enabled",
"-Dgst-gtuber=enabled",
"-Dbilibili=enabled",
"-Dcrunchyroll=enabled",
"-Dinvidious=enabled",
"-Dniconico=enabled",
"-Dpeertube=enabled",
"-Dpiped=enabled",
"-Dtwitch=enabled",
"-Dyoutube=enabled"
],
"cleanup": [
"/include",
"/lib/pkgconfig"
],
"sources": [
{
"type": "git",
"url": "https://github.com/Rafostar/gtuber.git",
"branch": "main"
}
]
}
8 changes: 7 additions & 1 deletion meson.build
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,7 @@ libspelling = dependency('libspelling-1', required: false)
clapper_dep = dependency('clapper-0.0', required: false)
clapper_gtk_dep = dependency('clapper-gtk-0.0', required: false)
gstreamer_dep = dependency('gstreamer-1.0', required: false)
gtuber = dependency('gtuber-0.0', required: false)

if not libwebp_dep.found ()
warning('WebP support might be missing, please install webp-pixbuf-loader.')
Expand Down Expand Up @@ -114,6 +115,10 @@ if clapper_support and clapper_dep.found () and clapper_dep.version().version_co
if clapper_dep.version().version_compare('>=0.8.0')
add_project_arguments(['--define=CLAPPER_0_8'], language: 'vala')
endif

if gtuber.found ()
add_project_arguments(['--define=GTUBER'], language: 'vala')
endif
endif

sources = files()
Expand All @@ -134,7 +139,8 @@ final_deps = [
meson.get_compiler('c').find_library('m', required: false),
clapper_dep,
clapper_gtk_dep,
gstreamer_dep
gstreamer_dep,
gtuber
]

executable(
Expand Down
34 changes: 27 additions & 7 deletions src/API/Status/PreviewCard.vala
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,8 @@ public class Tuba.API.PreviewCard : Entity, Widgetizable {
BASIC,
PEERTUBE,
FUNKWHALE,
BOOKWYRM;
BOOKWYRM,
GTUBER;

public string to_string () {
switch (this) {
Expand All @@ -13,6 +14,8 @@ public class Tuba.API.PreviewCard : Entity, Widgetizable {
return "Funkwhale";
case BOOKWYRM:
return "BookWyrm";
case GTUBER:
return "Gtuber";
default:
return "";
}
Expand All @@ -30,6 +33,8 @@ public class Tuba.API.PreviewCard : Entity, Widgetizable {
case BOOKWYRM:
// translators: the variable is an external service like "BookWyrm"
return _("You are about to open a %s book").printf (this.to_string ());
case GTUBER:
return _("You are about to open a video");
default:
// translators: the variable is the app name (Tuba)
return _("You are about to leave %s").printf (Build.NAME);
Expand Down Expand Up @@ -121,6 +126,10 @@ public class Tuba.API.PreviewCard : Entity, Widgetizable {
return CardSpecialType.FUNKWHALE;
} else if (is_bookwyrm) {
return CardSpecialType.BOOKWYRM;
#if CLAPPER && GTUBER
} else if (Gtuber.has_plugin_for_uri (this.url, null)) {
return CardSpecialType.GTUBER;
#endif
}

return CardSpecialType.BASIC;
Expand All @@ -140,12 +149,12 @@ public class Tuba.API.PreviewCard : Entity, Widgetizable {

public bool is_peertube {
get {
// Disable PeerTube support for now
// see #253
#if false
#if CLAPPER
bool url_pt = url.last_index_of ("/videos/watch/") > -1;

return kind == "video" && provider_name == "PeerTube" && url_pt;
// Disable PeerTube support for now
// see #253
#else
return false;
#endif
Expand Down Expand Up @@ -174,9 +183,20 @@ public class Tuba.API.PreviewCard : Entity, Widgetizable {
}

public static void open_special_card (CardSpecialType card_special_type, string card_url) {
if (card_special_type.open_special_card (card_url)) {
return;
};
if (card_special_type.open_special_card (card_url)) return;

#if CLAPPER && GTUBER
if (card_special_type == API.PreviewCard.CardSpecialType.GTUBER || card_special_type == API.PreviewCard.CardSpecialType.PEERTUBE) {
string fin_url = card_url;
if (card_special_type == API.PreviewCard.CardSpecialType.PEERTUBE) {
fin_url = fin_url.splice (0, fin_url.index_of_char ('/') + 2, "peertube://");
}

app.main_window.show_media_viewer (fin_url, Tuba.Attachment.MediaType.VIDEO, null, null, false, null, fin_url, null, true);
return;
}
#endif

string special_api_url = "";
string special_host = "";
try {
Expand Down