aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authordec05eba <dec05eba@protonmail.com>2025-03-04 23:28:19 +0100
committerdec05eba <dec05eba@protonmail.com>2025-03-04 23:28:19 +0100
commitcf9955dbc35e8e3bb9ac8febbec76cfecd7e739b (patch)
treeb2e0b2237c63f4aea27d2e23d61fbbbcd76d1b47
parent3003cf04c015a3a847a5d598e3a3b0521ff6bdf9 (diff)
Convert to meson project
-rw-r--r--README.md4
-rw-r--r--TODO3
m---------depends/html-parser0
m---------depends/html-search0
m---------depends/jsoncpp0
m---------depends/mglpp0
-rwxr-xr-xinstall.sh36
-rw-r--r--meson.build128
-rwxr-xr-xmeson_post_install.sh6
-rw-r--r--src/AsyncImageLoader.cpp1
-rw-r--r--src/FileAnalyzer.cpp2
-rw-r--r--src/main.cpp2
-rw-r--r--uninstall.sh10
m---------video_player/jsoncpp0
14 files changed, 158 insertions, 34 deletions
diff --git a/README.md b/README.md
index 70c94e1..1db226e 100644
--- a/README.md
+++ b/README.md
@@ -24,9 +24,8 @@ EXAMPLES:
tabbed -c -k quickmedia launcher -e
```
## Installation
-If you are running arch linux then you can install QuickMedia from aur: [https://aur.archlinux.org/packages/quickmedia-git/](https://aur.archlinux.org/packages/quickmedia-git/), otherwise you will need to first install [sibs](https://git.dec05eba.com/sibs/) and then run `./install.sh` as root.\
+If you are running arch linux then you can install QuickMedia from aur: [https://aur.archlinux.org/packages/quickmedia-git/](https://aur.archlinux.org/packages/quickmedia-git/), otherwise you will need to run `./install.sh` as root.\
`tar` and curl needs to be installed to run the `install.sh` script.\
-Installing `lld` (the LLVM linker) can improve compile times.\
There is also an unofficial ebuild for gentoo users. On gentoo you can install QuickMedia by running these commands:
```bash
eselect repository add overlay-from-plan9 git https://git.plan9.rocks/cat/overlay-from-plan9
@@ -34,6 +33,7 @@ emerge --sync overlay-from-plan9
emerge -av quickmedia
```
## Dependencies
+Meson needs to be installed to run the build script.
### Libraries
`libglvnd (LibGL.so)`, `libx11`, `libxrandr`, `libmpv`
### Executables
diff --git a/TODO b/TODO
index 0d7af13..2e2a2ba 100644
--- a/TODO
+++ b/TODO
@@ -298,4 +298,5 @@ Use DPMSInfoNotify.
Use stb_image_resize2.h
Youtube audio only download if audio stream not available, also for youtube-dl fallback.
Make history (local-manga and others) use relative path to the downloads directory for thumbnails. Otherwise the thumbnails wont show when moving the download directory.
-Keep the rooms that we were kicked/banned from so we can still read them and re-read the reason for why we were kicked/banned. Or add a list of historical rooms with leave reason. \ No newline at end of file
+Keep the rooms that we were kicked/banned from so we can still read them and re-read the reason for why we were kicked/banned. Or add a list of historical rooms with leave reason.
+Fix youtube broken (always falls back to low quality yt-dlp).
diff --git a/depends/html-parser b/depends/html-parser
-Subproject ec0e71c259d5aa8be7b8456509b5617d27742b6
+Subproject 3cf44ec7fba308a4b33b0486545b33e334bed74
diff --git a/depends/html-search b/depends/html-search
-Subproject 68989816f43ceda8655c2dbdc0d581971e645fc
+Subproject a77706c37d3b6df3049f658dd220b813fe1834b
diff --git a/depends/jsoncpp b/depends/jsoncpp
-Subproject f23fb32fd9d9c3d01fa67afa0d75f7ff227647e
+Subproject 98e28b38ffbae24c0e69e620bf18f8a0c5c6f20
diff --git a/depends/mglpp b/depends/mglpp
-Subproject 1a2a6ad8ef354f62bdf9adcfef73af1e5d03695
+Subproject 9634e4fef56016f59d45b0cb530087ab36f0171
diff --git a/install.sh b/install.sh
index 64ee28f..e8743e4 100755
--- a/install.sh
+++ b/install.sh
@@ -5,35 +5,9 @@ cd "$script_dir"
[ $(id -u) -ne 0 ] && echo "You need root privileges to run the install script" && exit 1
-curl -sfL 'https://dec05eba.com/files/twemoji.tar.gz' -o /tmp/twemoji.tar.gz
-mkdir -p /usr/share/quickmedia/emoji
-tar xf /tmp/twemoji.tar.gz --directory=/usr/share/quickmedia/emoji
-rm -f /tmp/twemoji.tar.gz
+rm -rf build
+meson setup build
+meson configure --prefix=/usr --buildtype=release -Dstrip=true build
+ninja -C build install
-sibs build --release video_player
-sibs build --release
-
-install -Dm755 "video_player/sibs-build/$(sibs platform)/release/quickmedia-video-player" "/usr/bin/quickmedia-video-player"
-install -Dm755 "sibs-build/$(sibs platform)/release/quickmedia" "/usr/bin/quickmedia"
-ln -sf "/usr/bin/quickmedia" "/usr/bin/qm"
-install -Dm644 boards.json "/usr/share/quickmedia/boards.json"
-
-install -Dm644 example-config.json "/usr/share/quickmedia/example-config.json"
-install -Dm644 README.md "/usr/share/quickmedia/README.md"
-
-install -Dm644 mpv/fonts/Material-Design-Iconic-Font.ttf "/usr/share/quickmedia/mpv/fonts/Material-Design-Iconic-Font.ttf"
-install -Dm644 mpv/scripts/mordenx.lua "/usr/share/quickmedia/mpv/scripts/mordenx.lua"
-install -Dm644 mpv/scripts/ytdl_hook.lua "/usr/share/quickmedia/mpv/scripts/ytdl_hook.lua"
-install -Dm644 mpv/input.conf "/usr/share/quickmedia/mpv/input.conf"
-install -Dm644 mpv/mpv.conf "/usr/share/quickmedia/mpv/mpv.conf"
-
-for file in images/* icons/* shaders/* themes/*; do
- install -Dm644 "$file" "/usr/share/quickmedia/$file"
-done
-
-for file in launcher/*; do
- filename=$(basename "$file")
- install -Dm644 "$file" "/usr/share/applications/$filename"
-done
-
-echo "Successfully installed QuickMedia"
+echo "Successfully installed quickmedia" \ No newline at end of file
diff --git a/meson.build b/meson.build
new file mode 100644
index 0000000..dd192bb
--- /dev/null
+++ b/meson.build
@@ -0,0 +1,128 @@
+project('quickmedia', ['c', 'cpp'], version : '1.0.0', default_options : ['warning_level=2', 'cpp_std=c++17'], subproject_dir : 'depends')
+
+if get_option('buildtype') == 'debug'
+ add_project_arguments('-g3', language : ['c', 'cpp'])
+elif get_option('buildtype') == 'release'
+ add_project_arguments('-DNDEBUG', language : ['c', 'cpp'])
+endif
+
+src = [
+ 'external/hash-library/sha256.cpp',
+ 'generated/Tlds.cpp',
+ 'generated/Emoji.cpp',
+ 'src/plugins/utils/aes.c',
+ 'src/plugins/Fourchan.cpp',
+ 'src/plugins/Mangadex.cpp',
+ 'src/plugins/ImageBoard.cpp',
+ 'src/plugins/MangaCombined.cpp',
+ 'src/plugins/Manga.cpp',
+ 'src/plugins/Lbry.cpp',
+ 'src/plugins/NyaaSi.cpp',
+ 'src/plugins/HotExamples.cpp',
+ 'src/plugins/FileManager.cpp',
+ 'src/plugins/MediaGeneric.cpp',
+ 'src/plugins/Matrix.cpp',
+ 'src/plugins/Plugin.cpp',
+ 'src/plugins/MangaGeneric.cpp',
+ 'src/plugins/Pipe.cpp',
+ 'src/plugins/Manganelo.cpp',
+ 'src/plugins/LocalManga.cpp',
+ 'src/plugins/Page.cpp',
+ 'src/plugins/Peertube.cpp',
+ 'src/plugins/LocalAnime.cpp',
+ 'src/plugins/AniList.cpp',
+ 'src/plugins/DramaCool.cpp',
+ 'src/plugins/utils/UniqueProcess.cpp',
+ 'src/plugins/utils/WatchProgress.cpp',
+ 'src/plugins/utils/EpisodeNameParser.cpp',
+ 'src/plugins/Info.cpp',
+ 'src/plugins/Youtube.cpp',
+ 'src/plugins/Saucenao.cpp',
+ 'src/plugins/Soundcloud.cpp',
+ 'src/Theme.cpp',
+ 'src/Storage.cpp',
+ 'src/Text.cpp',
+ 'src/Config.cpp',
+ 'src/DownloadUtils.cpp',
+ 'src/Json.cpp',
+ 'src/gui/Button.cpp',
+ 'src/SearchBar.cpp',
+ 'src/RoundedRectangle.cpp',
+ 'src/Entry.cpp',
+ 'src/Notification.cpp',
+ 'src/AsyncImageLoader.cpp',
+ 'src/ImageViewer.cpp',
+ 'src/Body.cpp',
+ 'src/Program.cpp',
+ 'src/main.cpp',
+ 'src/ImageUtils.cpp',
+ 'src/NetUtils.cpp',
+ 'src/BodyItem.cpp',
+ 'src/Downloader.cpp',
+ 'src/ResourceLoader.cpp',
+ 'src/VideoPlayer.cpp',
+ 'src/Tabs.cpp',
+ 'src/FileAnalyzer.cpp',
+ 'src/QuickMedia.cpp',
+ 'src/M3U8.cpp',
+ 'src/Utils.cpp',
+ 'src/StringUtils.cpp',
+]
+
+mglpp_proj = subproject('mglpp')
+mglpp_dep = mglpp_proj.get_variable('mglpp_dep')
+
+jsoncpp_proj = subproject('jsoncpp')
+jsoncpp_dep = jsoncpp_proj.get_variable('jsoncpp_dep')
+
+html_parser_proj = subproject('html-parser')
+html_parser_dep = html_parser_proj.get_variable('html_parser_dep')
+
+html_search_proj = subproject('html-search')
+html_search_dep = html_search_proj.get_variable('html_search_dep')
+
+prefix = get_option('prefix')
+datadir = get_option('datadir')
+qm_resources_path = join_paths(prefix, datadir, 'quickmedia')
+
+add_project_arguments('-march=native', language: ['c', 'cpp'])
+
+executable(
+ meson.project_name(),
+ src,
+ install : true,
+ dependencies : [
+ mglpp_dep,
+ jsoncpp_dep,
+ html_parser_dep,
+ html_search_dep,
+ dependency('threads'),
+ ],
+)
+
+executable(
+ 'quickmedia-video-player',
+ [
+ 'video_player/src/main.cpp'
+ ],
+ install : true,
+ dependencies : [
+ jsoncpp_dep,
+ dependency('mpv'),
+ ],
+)
+
+install_subdir('mpv', install_dir : qm_resources_path)
+install_subdir('images', install_dir : qm_resources_path)
+install_subdir('icons', install_dir : qm_resources_path)
+install_subdir('shaders', install_dir : qm_resources_path)
+install_subdir('themes', install_dir : qm_resources_path)
+install_subdir('launcher', install_dir : join_paths(prefix, datadir, 'applications'))
+
+install_data(files('boards.json'), install_dir : qm_resources_path)
+install_data(files('example-config.json'), install_dir : qm_resources_path)
+install_data(files('README.md'), install_dir : qm_resources_path)
+
+install_symlink('qm', install_dir : join_paths(prefix, 'bin'), pointing_to: join_paths(prefix, 'bin', meson.project_name()))
+
+meson.add_install_script('meson_post_install.sh') \ No newline at end of file
diff --git a/meson_post_install.sh b/meson_post_install.sh
new file mode 100755
index 0000000..1c87f9f
--- /dev/null
+++ b/meson_post_install.sh
@@ -0,0 +1,6 @@
+#!/bin/sh
+
+curl -sfL 'https://dec05eba.com/files/twemoji.tar.gz' -o /tmp/twemoji.tar.gz
+mkdir -p "${MESON_INSTALL_DESTDIR_PREFIX}/share/quickmedia/emoji"
+tar xf /tmp/twemoji.tar.gz --directory="${MESON_INSTALL_DESTDIR_PREFIX}/share/quickmedia/emoji"
+rm -f /tmp/twemoji.tar.gz \ No newline at end of file
diff --git a/src/AsyncImageLoader.cpp b/src/AsyncImageLoader.cpp
index 14cfe6a..a6706f5 100644
--- a/src/AsyncImageLoader.cpp
+++ b/src/AsyncImageLoader.cpp
@@ -27,6 +27,7 @@
namespace QuickMedia {
bool ffmpeg_convert_image_format(const Path &thumbnail_path, const Path &destination_path) {
+ // TODO: Dont output as jpg, ffmpeg jpg is very slow
const char *args[] = { "ffmpeg", "-y", "-v", "quiet", "-i", thumbnail_path.data.c_str(), "--", destination_path.data.c_str(), nullptr};
return exec_program(args, nullptr, nullptr) == 0;
}
diff --git a/src/FileAnalyzer.cpp b/src/FileAnalyzer.cpp
index 4deb8c3..1d24c5f 100644
--- a/src/FileAnalyzer.cpp
+++ b/src/FileAnalyzer.cpp
@@ -157,6 +157,7 @@ namespace QuickMedia {
char size_arg_str[512];
snprintf(size_arg_str, sizeof(size_arg_str), "scale=%d:%d:force_original_aspect_ratio=decrease", width, height);
+ // TODO: Dont output as jpg, ffmpeg jpg is very slow
const char *program_args[] = { "ffmpeg", "-y", "-v", "quiet", "-ss", seconds_str, "-i", file.get_filepath().c_str(), "-frames:v", "1", "-vf", size_arg_str, "--", destination_path_tmp.data.c_str(), nullptr };
if(exec_program(program_args, nullptr, nullptr, allowed_exit_status, 2) != 0) {
fprintf(stderr, "Failed to execute ffmpeg, maybe its not installed?\n");
@@ -168,6 +169,7 @@ namespace QuickMedia {
if(fallback_first_frame && get_file_type(destination_path_tmp) == FileType::FILE_NOT_FOUND)
return video_get_frame(file, destination_path, width, height, 0, false);
} else {
+ // TODO: Dont output as jpg, ffmpeg jpg is very slow
const char *program_args[] = { "ffmpeg", "-y", "-v", "quiet", "-ss", seconds_str, "-i", file.get_filepath().c_str(), "-frames:v", "1", "--", destination_path_tmp.data.c_str(), nullptr };
if(exec_program(program_args, nullptr, nullptr, allowed_exit_status, 2) != 0) {
fprintf(stderr, "Failed to execute ffmpeg, maybe its not installed?\n");
diff --git a/src/main.cpp b/src/main.cpp
index ef0568b..b09cf14 100644
--- a/src/main.cpp
+++ b/src/main.cpp
@@ -1,8 +1,10 @@
#include "../include/QuickMedia.hpp"
#include <locale.h>
+#include <malloc.h>
int main(int argc, char **argv) {
setlocale(LC_ALL, "C"); // Sigh... stupid C
+ // mallopt(M_MMAP_THRESHOLD, 65536);
QuickMedia::Program program;
return program.run(argc, argv);
}
diff --git a/uninstall.sh b/uninstall.sh
new file mode 100644
index 0000000..a1acbbf
--- /dev/null
+++ b/uninstall.sh
@@ -0,0 +1,10 @@
+#!/bin/sh -e
+
+script_dir=$(dirname "$0")
+cd "$script_dir"
+
+[ $(id -u) -ne 0 ] && echo "You need root privileges to run the uninstall script" && exit 1
+
+ninja -C build uninstall
+
+echo "Successfully uninstalled quickmedia" \ No newline at end of file
diff --git a/video_player/jsoncpp b/video_player/jsoncpp
-Subproject f23fb32fd9d9c3d01fa67afa0d75f7ff227647e
+Subproject 98e28b38ffbae24c0e69e620bf18f8a0c5c6f20