Script 'mail_helper' called by obssrc
Hello community,

here is the log from the commit of package mpvpaper for openSUSE:Factory 
checked in at 2021-11-18 10:34:01
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Comparing /work/SRC/openSUSE:Factory/mpvpaper (Old)
 and      /work/SRC/openSUSE:Factory/.mpvpaper.new.1895 (New)
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Package is "mpvpaper"

Thu Nov 18 10:34:01 2021 rev:4 rq:931992 version:1.2

Changes:
--------
--- /work/SRC/openSUSE:Factory/mpvpaper/mpvpaper.changes        2021-07-30 
23:22:52.743590113 +0200
+++ /work/SRC/openSUSE:Factory/.mpvpaper.new.1895/mpvpaper.changes      
2021-11-18 10:34:02.183918726 +0100
@@ -1,0 +2,9 @@
+Wed Nov 17 15:53:15 UTC 2021 - Michael Vetter <[email protected]>
+
+- Update to 1.2:
+  * New man page
+  * New "--slideshow/-n" option
+  * Improve usage text
+  * Various fixes 2ebddae d8e5f23 275410e
+
+-------------------------------------------------------------------

Old:
----
  1.1.tar.gz

New:
----
  1.2.tar.gz

++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Other differences:
------------------
++++++ mpvpaper.spec ++++++
--- /var/tmp/diff_new_pack.dWw5gM/_old  2021-11-18 10:34:02.595919109 +0100
+++ /var/tmp/diff_new_pack.dWw5gM/_new  2021-11-18 10:34:02.599919112 +0100
@@ -17,7 +17,7 @@
 
 
 Name:           mpvpaper
-Version:        1.1
+Version:        1.2
 Release:        0
 Summary:        A video wallpaper program for wlroots based wayland compositors
 License:        GPL-3.0-or-later
@@ -44,11 +44,13 @@
 
 %install
 %meson_install
+install -Dm644 %{name}.man "%{buildroot}%{_mandir}/man1/%{name}.1"
 
 %files
 %license LICENSE
 %doc README.md
 %{_bindir}/mpvpaper
 %{_bindir}/mpvpaper-holder
+%{_mandir}/man1/mpvpaper.1%{?ext_man}
 
 %changelog

++++++ 1.1.tar.gz -> 1.2.tar.gz ++++++
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/mpvpaper-1.1/README.md new/mpvpaper-1.2/README.md
--- old/mpvpaper-1.1/README.md  2020-12-05 02:16:06.000000000 +0100
+++ new/mpvpaper-1.2/README.md  2021-11-15 16:30:05.000000000 +0100
@@ -20,7 +20,7 @@
 Build:
 ```
 cd mpvpaper
-meson build --prefix=/usr
+meson build --prefix=/usr/local
 ninja -C build
 ```
 Install:
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/mpvpaper-1.1/mpvpaper.man 
new/mpvpaper-1.2/mpvpaper.man
--- old/mpvpaper-1.1/mpvpaper.man       1970-01-01 01:00:00.000000000 +0100
+++ new/mpvpaper-1.2/mpvpaper.man       2021-11-15 16:30:05.000000000 +0100
@@ -0,0 +1,154 @@
+.TH MPVPAPER 1 "November 2021" "mpvpaper 1.2" "User Manual"
+.SH NAME
+mpvpaper \- video wallpaper player using mpv for wlroots
+.SH SYNOPSIS
+mpvpaper [options] <output> <url|path filename>
+
+.SH DESCRIPTION
+.P
+\fBmpvpaper\fR is a wallpaper program for wlroots based Wayland compositors, 
such as Sway. 
+That allows you to play videos with \fBmpv\fR as your wallpaper.
+
+To see display outputs names, check the "not selected" error messages of:
+.RS
+mpvpaper -v a a
+.RE
+
+.SH OPTIONS
+.TP
+\fB\-h\fR, \fB\-\-help\fR
+Displays usage options
+.TP
+\fB\-v\fR, \fB\-\-verbose\fR
+Be more verbose
+.TP
+\fB\-f\fR, \fB\-\-fork\fR
+Forks mpvpaper so you can close the terminal
+.TP
+\fB\-p\fR, \fB\-\-auto-pause\fR
+Automagically pause mpv when the wallpaper is hidden*
+
+This saves CPU usage, more or less, seamlessly
+.TP
+\fB\-s\fR, \fB\-\-auto-stop\fR
+Automagically stop mpv when the wallpaper is hidden*
+
+This saves CPU/RAM usage, although more abruptly
+.TP
+\fB\-n\fR, \fB\-\-slideshow\fR <seconds>
+Slideshow mode plays the next video in a playlist every \fI\<seconds>\fR
+
+And passes mpv options "loop loop-playlist" for convenience
+.TP
+\fB\-l\fR, \fB\-\-layer\fR <layer>
+Specifies shell surface \fI\<layer>\fR to run on (background by default)
+.TP
+\fB\-o\fR, \fB\-\-mpv-options\fR <"options">
+Forwards mpv \fI\<"options">\fR
+
+Must be within quotes if multiple options are passed
+
+.SH EXAMPLES
+Simple example:
+.RS
+mpvpaper DP-2 /path/to/video
+.RE
+
+Forward mpv options by passing "--mpv-options" or "-o" like so:
+.RS
+mpvpaper -o "no-audio --loop-playlist shuffle" HDMI-A-1 www.url/to/playlist
+.RE
+
+You can also control mpvpaper just like \fBmpv\fR in the terminal with 
keyboard bindings. But if you
+would like to control mpvpaper while it's forked, you could use a mpv 
input-ipc-server like this:
+.RS
+mpvpaper -o "input-ipc-server=/tmp/mpv-socket-DP-1" DP-1 /path/to/video
+.RE
+
+Then input commands with \fBsocat\fR. For example, toggle pause:
+.RS
+echo 'cycle pause' | socat - /tmp/mpv-socket-DP-1
+.RE
+
+For more commands read:
+.UR https://mpv.io/manual/master/#command-interface
+.UE
+
+.SH FILES
+
+These files(watch lists) contain lists of program names that, if found running 
with \fBpidof\fR, 
+will cause mpvpaper to pause/stop and must be created manually**
+
+.RS
+.I ~/.config/mpvpaper/pauselist
+.RS
+List of program names that will cause mpvpaper to pause
+.RE
+
+.I ~/.config/mpvpaper/stoplist
+.RS
+List of program names that will cause mpvpaper to stop
+.RE .RE
+
+Add programs that can be found with the \fBpidof\fR command into the list and 
separate by spaces or newlines.
+ For example: "firefox steam obs" or:
+.RS
+ "firefox 
+  steam 
+  obs"
+.RE
+
+.SH NOTES
+
+*Limitations of automagic:
+.RS
+.P
+mpvpaper manipulates a feature of Wayland called a "surface frame callback"
+.P
+This feature of Wayland allows mpvpaper to draw/render only when it makes 
sense to do so.
+And one reason mpvpaper might not draw/render is if it's "hidden".
+This is the magic behind the automagic pause/stop options.
+.P
+Whatever "hidden" means is up to compositor. As for Sway, "hidden" is if there 
is a fullscreen window
+in the way of the wallpaper. mpvpaper will still draw/render even if there is 
a normal window
+blocking the wallpaper view entirely.
+.RE
+
+**More on lists:
+.RS
+\(bu mpvpaper will automatically resume only after all the programs
+in the watch lists are no longer running
+
+\(bu If there are programs running from both lists, stopping will always win 
out
+
+\(bu Programs added into a list at runtime will be ignored, unless restarted 
or "stopped"
+.RE
+
+Extra notes:
+.RS
+\(bu When mpvpaper is resuming after "stopping", mpvpaper should begin where 
it left off.
+Both in terms of time position and playlist position(if not shuffled)
+    
+\(bu There is a small time delay(1-2 secs.) with the automagic options
+as it uses time to calculate when to act
+    
+\(bu mpv user configs are loaded from 
+.I ~/.config/mpv/
+
+.RE
+
+
+.SH AUTHOR
+Created by GhostNaN 
+
+.SM Inspired by scoopta's \fBglpaper\fR
+
+Code Repository:
+.UR https://github.com/GhostNaN/mpvpaper/ 
+.UE
+
+.SH SEE ALSO
+
+mpv (1)
+
+
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/mpvpaper-1.1/src/holder.c 
new/mpvpaper-1.2/src/holder.c
--- old/mpvpaper-1.1/src/holder.c       2020-12-05 02:16:06.000000000 +0100
+++ new/mpvpaper-1.2/src/holder.c       2021-11-15 16:30:05.000000000 +0100
@@ -12,6 +12,8 @@
 #include "wlr-layer-shell-unstable-v1-client-protocol.h"
 #include "xdg-output-unstable-v1-client-protocol.h"
 
+typedef unsigned int uint;
+
 struct wl_state {
     struct wl_display *display;
     struct wl_compositor *compositor;
@@ -307,6 +309,7 @@
         {"fork", no_argument, NULL, 'f'},
         {"auto-pause", no_argument, NULL, 'p'},
         {"auto-stop", no_argument, NULL, 's'},
+        {"slideshow", required_argument, NULL, 'n'},
         {"layer", required_argument, NULL, 'l'},
         {"mpv-options", required_argument, NULL, 'o'},
         {0, 0, 0, 0}
@@ -314,18 +317,18 @@
 
     const char *usage =
         "Usage: mpvpaper-holder <mpvpaper options>\n"
-        "Descrition:\n"
+        "Description:\n"
         "mpvpaper-holder acts as a lean gate keeper before mpvpaper can run\n"
         "\n"
         "It's sole purpose is to check if there is:\n"
-        "Any program is that running from the stoplist file\n"
+        "Any program that is running from the stoplist file\n"
         "- Set in \"~/.config/mpvpaper/stoplist\"\n"
-        "If the wallpaper needs to be seen when drawn\n"
+        "And if the wallpaper needs to be seen when drawn\n"
         "- Set with \"-s\" or \"--auto-stop\" mpvpaper option\n";
 
     if(argc > 2) {
         char opt;
-        while((opt = getopt_long(argc, argv, "hvfpsl:o:Z:", long_options, 
NULL)) != -1) {
+        while((opt = getopt_long(argc, argv, "hvfpsn:l:o:Z:", long_options, 
NULL)) != -1) {
 
             switch (opt) {
                 case 'h':
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/mpvpaper-1.1/src/main.c new/mpvpaper-1.2/src/main.c
--- old/mpvpaper-1.1/src/main.c 2020-12-05 02:16:06.000000000 +0100
+++ new/mpvpaper-1.2/src/main.c 2021-11-15 16:30:05.000000000 +0100
@@ -21,6 +21,7 @@
 
 #include <cflogprinter.h>
 
+typedef unsigned int uint;
 
 struct wl_state {
     struct wl_display *display;
@@ -57,6 +58,7 @@
 static mpv_handle *mpv;
 static mpv_render_context *mpv_glcontext;
 static char *video_path;
+static char *opt_config_path;
 
 static struct {
     char **pauselist;
@@ -76,6 +78,7 @@
 
 static pthread_t threads[5];
 
+static uint SLIDESHOW_TIME = 0;
 static bool VERBOSE = 0;
 
 static void nop() {}
@@ -341,8 +344,16 @@
 static void *handle_mpv_events() {
     pthread_setcancelstate(PTHREAD_CANCEL_DISABLE, NULL);
     bool mpv_paused = 0;
+    time_t start_time = time(NULL);
 
     while (!halt_info.kill_render_loop) {
+        if (SLIDESHOW_TIME) {
+            if ((time(NULL) - start_time) >= SLIDESHOW_TIME) {
+                mpv_command_async(mpv, 0, (const char*[]) {"playlist-next", 
NULL});
+                start_time = time(NULL);
+            }
+        }
+
         mpv_event* event = mpv_wait_event(mpv, 0);
         if (event->event_id == MPV_EVENT_SHUTDOWN || event->event_id == 
MPV_EVENT_IDLE)
             exit_mpvpaper(0);
@@ -393,19 +404,7 @@
     }
 }
 
-static void *get_proc_address_mpv(void *ctx, const char *name){
-    (void) ctx;
-    return eglGetProcAddress(name);
-}
-
-static void init_mpv(struct display_output *output) {
-
-    mpv = mpv_create();
-    if (!mpv) {
-        cflp_error("Failed creating mpv context");
-        exit_mpvpaper(1);
-    }
-
+static void set_init_mpv_options() {
     // Enable user control through terminal by default
     mpv_set_option_string(mpv, "input-default-bindings", "yes");
     mpv_set_option_string(mpv, "input-terminal", "yes");
@@ -432,14 +431,45 @@
     if (VERBOSE && strcmp(loaded_configs, ""))
         cflp_info("Loaded [ %s] user configs from \"~/.config/mpv/\"", 
loaded_configs);
 
+    // Convenience options passed for slideshow mode
+    if (SLIDESHOW_TIME != 0) {
+        mpv_set_option_string(mpv, "loop", "yes");
+        mpv_set_option_string(mpv, "loop-playlist", "yes");
+    }
+
     // Set mpv_options passed
-    mpv_load_config_file(mpv, "/tmp/mpvpaper.conf");
-    remove("/tmp/mpvpaper.conf");
+    mpv_load_config_file(mpv, opt_config_path);
+    remove(opt_config_path);
+
+}
+
+static void *get_proc_address_mpv(void *ctx, const char *name){
+    (void) ctx;
+    return eglGetProcAddress(name);
+}
+
+static void init_mpv(struct display_output *output) {
+
+    mpv = mpv_create();
+    if (!mpv) {
+        cflp_error("Failed creating mpv context");
+        exit_mpvpaper(1);
+    }
+
+    set_init_mpv_options();
 
     if (mpv_initialize(mpv) < 0) {
         cflp_error("mpv init failed");
         exit_mpvpaper(1);
     }
+
+    // Force libmpv vo as nothing else will work
+    char *vo_option = mpv_get_property_string(mpv, "options/vo");
+    if (strcmp(vo_option, "libmpv") != 0 && strcmp(vo_option, "") != 0) {
+        cflp_warning("mpvpaper does not support any other vo than \"libmpv\"");
+        mpv_set_option_string(mpv, "vo", "libmpv");
+    }
+
     // Have mpv render onto egl context
     mpv_render_param params[] = {
         {MPV_RENDER_PARAM_WL_DISPLAY, output->state->display},
@@ -502,7 +532,7 @@
     eglChooseConfig(egl_display, win_attrib, &config, 1, &config_len);
 
     if (!egl_context) {
-        // Check for OpenGL combatiblity for creating egl context
+        // Check for OpenGL compatibility for creating egl context
         static const struct { int major, minor; } gl_versions[] = {
             {4, 6}, {4, 5}, {4, 4}, {4, 3}, {4, 2}, {4, 1}, {4, 0},
             {3, 3}, {3, 2}, {3, 1}, {3, 0},
@@ -766,6 +796,7 @@
         {"fork", no_argument, NULL, 'f'},
         {"auto-pause", no_argument, NULL, 'p'},
         {"auto-stop", no_argument, NULL, 's'},
+        {"slideshow", required_argument, NULL, 'n'},
         {"layer", required_argument, NULL, 'l'},
         {"mpv-options", required_argument, NULL, 'o'},
         {0, 0, 0, 0}
@@ -773,25 +804,31 @@
 
     const char *usage =
         "Usage: mpvpaper [options] <output> <url|path filename>\n"
-        "Example: mpvpaper -o \"no-audio loop\" DP-2 /path/to/video\n"
+        "\n"
+        "Example: mpvpaper -vs -o \"no-audio loop\" DP-2 /path/to/video\n"
+        "\n"
         "Options:\n"
-        "--help         -h    Displays this help message\n"
-        "--verbose      -v    Be more verbose\n"
-        "--fork         -f    Forks mpvpaper so you can close the terminal\n"
-        "--auto-pause   -p    Automagically pause mpv when the wallpaper is 
hidden\n"
-        "                     This saves CPU usage, more or less, seamlessly\n"
-        "--auto-stop    -s    Automagically stop mpv when the wallpaper is 
hidden\n"
-        "                     This saves CPU/RAM usage, although more 
abruptly\n"
-        "--layer        -l    Specifies shell surface layer to run on 
(background by default)\n"
-        "--mpv-options  -o    Forwards mpv options (Must be within 
quotes\"\")\n";
-
+        "--help         -h              Displays this help message\n"
+        "--verbose      -v              Be more verbose\n"
+        "--fork         -f              Forks mpvpaper so you can close the 
terminal\n"
+        "--auto-pause   -p              Automagically* pause mpv when the 
wallpaper is hidden\n"
+        "                               This saves CPU usage, more or less, 
seamlessly\n"
+        "--auto-stop    -s              Automagically* stop mpv when the 
wallpaper is hidden\n"
+        "                               This saves CPU/RAM usage, although 
more abruptly\n"
+        "--slideshow    -n SECS         Slideshow mode plays the next video in 
a playlist every ? seconds\n"
+        "                               And passes mpv options \"loop 
loop-playlist\" for convenience\n"
+        "--layer        -l LAYER        Specifies shell surface layer to run 
on (background by default)\n"
+        "--mpv-options  -o \"OPTIONS\"    Forwards mpv options (Must be within 
quotes\"\")\n"
+        "\n"
+        "* See man page for more details\n"
+        ;
 
     if(argc > 2) {
         char *layer_name;
-        char *mpv_options;
+        char *mpv_options = NULL;
 
         char opt;
-        while((opt = getopt_long(argc, argv, "hvfpsl:o:Z:", long_options, 
NULL)) != -1) {
+        while((opt = getopt_long(argc, argv, "hvfpsn:l:o:Z:", long_options, 
NULL)) != -1) {
 
             switch (opt) {
             case 'h':
@@ -816,6 +853,12 @@
                 halt_info.auto_stop = 1;
                 halt_info.auto_pause = 0;
                 break;
+            case 'n':
+                SLIDESHOW_TIME = atoi(optarg);
+                if (SLIDESHOW_TIME == 0) 
+                    cflp_warning("0 or invalid time set for slideshow\n"
+                                 "Please use a positive integer");
+                break;
             case 'l':
                 layer_name = strdup(optarg);
                 if(layer_name == NULL) {
@@ -836,14 +879,6 @@
                 break;
             case 'o':
                 mpv_options = strdup(optarg);
-                // Forward to a tmp file so mpv can parse options
-                for (int i = 0; i < (int)strlen(mpv_options); i++) {
-                    if (mpv_options[i] == ' ')
-                        mpv_options[i] = '\n';
-                }
-                FILE* file = fopen("/tmp/mpvpaper.conf", "w");
-                fputs(mpv_options, file);
-                fclose(file);
                 break;
 
             case 'Z': // Hidden option to recover video pos after stopping
@@ -856,14 +891,31 @@
             exit(EXIT_FAILURE);
         }
         state->monitor = strdup(argv[optind]);
-
         video_path = strdup(argv[optind+1]);
 
+        // Forward options to a tmp file so mpv can parse options
+        if(mpv_options) {
+            for (int i = 0; i < (int)strlen(mpv_options); i++) {
+                if (mpv_options[i] == ' ')
+                    mpv_options[i] = '\n';
+            }
+            // Create config file name
+            opt_config_path = calloc(strlen("/tmp/mpvpaper.config")+1 + 
strlen(state->monitor)+1, sizeof(char));
+            strcpy(opt_config_path, "/tmp/mpvpaper");
+            strcat(opt_config_path, state->monitor);
+            strcat(opt_config_path, ".config");
+            // Put options into config file
+            FILE* file = fopen(opt_config_path, "w");
+            fputs(mpv_options, file);
+            fclose(file);
+        }
+
         if(!system("pidof swaybg > /dev/null")) {
             cflp_warning("swaybg is running. This may block mpvpaper from 
being seen.");
         }
     }
     else {
+        cflp_error("Not enough args passed");
         fprintf(stderr, "%s", usage);
         exit(EXIT_FAILURE);
     }

Reply via email to