Hello community,

here is the log from the commit of package mpclient for openSUSE:Factory 
checked in at 2019-11-07 23:18:52
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Comparing /work/SRC/openSUSE:Factory/mpclient (Old)
 and      /work/SRC/openSUSE:Factory/.mpclient.new.2990 (New)
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Package is "mpclient"

Thu Nov  7 23:18:52 2019 rev:4 rq:746048 version:0.33

Changes:
--------
--- /work/SRC/openSUSE:Factory/mpclient/mpclient.changes        2019-10-11 
15:16:41.832205850 +0200
+++ /work/SRC/openSUSE:Factory/.mpclient.new.2990/mpclient.changes      
2019-11-07 23:18:55.772691045 +0100
@@ -1,0 +2,8 @@
+Wed Nov  6 15:51:04 UTC 2019 - Илья Индиго <i...@ilya.pp.ua>
+
+- Update to 0.33
+  * https://raw.githubusercontent.com/MusicPlayerDaemon/mpc/v0.33/NEWS
+  * fix off-by-one bug in "prio" command
+  * reduce network transfer for "playlist", "ls", "listall"
+
+-------------------------------------------------------------------

Old:
----
  mpc-0.32.tar.xz

New:
----
  mpc-0.33.tar.xz

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

Other differences:
------------------
++++++ mpclient.spec ++++++
--- /var/tmp/diff_new_pack.ugeB9G/_old  2019-11-07 23:18:56.360691676 +0100
+++ /var/tmp/diff_new_pack.ugeB9G/_new  2019-11-07 23:18:56.360691676 +0100
@@ -18,7 +18,7 @@
 
 
 Name:           mpclient
-Version:        0.32
+Version:        0.33
 Release:        0
 Summary:        A minimalist command line interface to MPD
 License:        GPL-2.0-or-later
@@ -46,7 +46,6 @@
 %meson_install
 install -m 0755 contrib/mpd-pls-handler.sh 
%{buildroot}%{_bindir}/mpd-pls-handler
 install -m 0755 contrib/mpd-m3u-handler.sh 
%{buildroot}%{_bindir}/mpd-m3u-handler
-
 install -Dm 0644 contrib/mpc-completion.bash 
%{buildroot}%{_datadir}/bash-completion/completions/%{name}
 rm -r %{buildroot}%{_datadir}/doc
 

++++++ mpc-0.32.tar.xz -> mpc-0.33.tar.xz ++++++
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/mpc-0.32/NEWS new/mpc-0.33/NEWS
--- old/mpc-0.32/NEWS   2019-06-11 18:02:54.000000000 +0200
+++ new/mpc-0.33/NEWS   2019-10-31 16:01:59.000000000 +0100
@@ -1,3 +1,7 @@
+0.33 (2019/10/31)
+* fix off-by-one bug in "prio" command
+* reduce network transfer for "playlist", "ls", "listall"
+
 0.32 (2019/06/11)
 * add command "listneighbors"
 * reduce network transfer for "search"
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/mpc-0.32/doc/conf.py new/mpc-0.33/doc/conf.py
--- old/mpc-0.32/doc/conf.py    2019-06-11 18:02:54.000000000 +0200
+++ new/mpc-0.33/doc/conf.py    2019-10-31 16:01:59.000000000 +0100
@@ -38,7 +38,7 @@
 # built documents.
 #
 # The short X.Y version.
-version = '0.32'
+version = '0.33'
 # The full version, including alpha/beta/rc tags.
 release = version
 
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/mpc-0.32/meson.build new/mpc-0.33/meson.build
--- old/mpc-0.32/meson.build    2019-06-11 18:02:54.000000000 +0200
+++ new/mpc-0.33/meson.build    2019-10-31 16:01:59.000000000 +0100
@@ -1,5 +1,5 @@
 project('mpc', 'c',
-  version: '0.32',
+  version: '0.33',
   meson_version: '>= 0.47',
   default_options: [
     'c_std=c99',
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/mpc-0.32/src/command.c new/mpc-0.33/src/command.c
--- old/mpc-0.32/src/command.c  2019-06-11 18:02:54.000000000 +0200
+++ new/mpc-0.33/src/command.c  2019-10-31 16:01:59.000000000 +0100
@@ -25,6 +25,7 @@
 #include "args.h"
 #include "search.h"
 #include "status.h"
+#include "tags.h"
 #include "path.h"
 #include "Compiler.h"
 
@@ -579,10 +580,29 @@
                strip_trailing_slash(tmp);
 
                if (options.custom_format) {
+                       bool command_list = false;
+
+#if LIBMPDCLIENT_CHECK_VERSION(2,12,0)
+                       /* ask MPD to omit the tags which are not used
+                          by the `--format` to reduce network
+                          transfer for tag values we're not going to
+                          use anyway (requires MPD 0.21 and
+                          libmpdclient 2.12) */
+                       if (mpd_connection_cmp_server_version(conn, 0, 21, 0) 
>= 0) {
+                               if (!mpd_command_list_begin(conn, false) ||
+                                   !send_tag_types_for_format(conn, 
options.format))
+                                       printErrorAndExit(conn);
+                               command_list = true;
+                       }
+#endif
+
                        if (!mpd_send_list_all_meta(conn, tmp))
                                printErrorAndExit(conn);
 
-                       print_entity_list(conn, MPD_ENTITY_TYPE_SONG);
+                       if (command_list && !mpd_command_list_end(conn))
+                               printErrorAndExit(conn);
+
+                       print_entity_list(conn, MPD_ENTITY_TYPE_SONG, true);
                } else {
                        if (!mpd_send_list_all(conn, tmp))
                                printErrorAndExit(conn);
@@ -689,11 +709,25 @@
        if (argc > 0)
                ls = charset_to_utf8(argv[i]);
 
+#if LIBMPDCLIENT_CHECK_VERSION(2,12,0)
+       /* ask MPD to omit the tags which are not used by the
+          `--format` to reduce network transfer for tag values we're
+          not going to use anyway (requires MPD 0.21 and libmpdclient
+          2.12) */
+       if (mpd_connection_cmp_server_version(conn, 0, 21, 0) >= 0) {
+               if (!mpd_command_list_begin(conn, false) ||
+                   !send_tag_types_for_format(conn, options.custom_format ? 
options.format : NULL) ||
+                   !mpd_command_list_end(conn))
+                       printErrorAndExit(conn);
+               my_finishCommand(conn);
+       }
+#endif
+
        do {
                if (!mpd_send_list_meta(conn, ls))
                        printErrorAndExit(conn);
 
-               print_entity_list(conn, type);
+               print_entity_list(conn, type, options.custom_format);
                my_finishCommand(conn);
        } while (++i < argc && (ls = charset_to_utf8(argv[i])) != NULL);
 
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/mpc-0.32/src/options.c new/mpc-0.33/src/options.c
--- old/mpc-0.32/src/options.c  2019-06-11 18:02:54.000000000 +0200
+++ new/mpc-0.33/src/options.c  2019-10-31 16:01:59.000000000 +0100
@@ -52,7 +52,7 @@
 static const struct OptionDef option_table[] = {
        { 'v', "verbose", NULL, "Give verbose output" },
        { 'q', "quiet", NULL, "Suppress status message" },
-       { 'q', "no-status", NULL, "synonym for --quiet" },
+       { 0, "no-status", NULL, "synonym for --quiet" },
        { 'h', "host", "<host>", "Connect to server on <host>" },
        { 'P', "password", "<password>", "Connect to server using password 
<password>" },
        { 'p', "port", "<port>", "Connect to server port <port>" },
@@ -186,14 +186,20 @@
 print_option_help(void)
 {
        for (unsigned i = 0; i < option_table_size; i++) {
-               printf("  -%c, ", option_table[i].shortopt);
+               int remaining = 28;
+               if (option_table[i].shortopt) {
+                       printf("  -%c, ", option_table[i].shortopt);
+                       remaining -= 4;
+               } else
+                       printf("  ");
+
                if (option_table[i].argument)
                        printf("--%s=%-*s",
                               option_table[i].longopt,
-                              25 - (int) strlen(option_table[i].longopt),
+                              remaining - (int) 
strlen(option_table[i].longopt),
                               option_table[i].argument);
                else
-                       printf("--%-25s ", option_table[i].longopt);
+                       printf("--%-*s ", remaining, option_table[i].longopt);
                printf("%s\n", option_table[i].description);
        }
 }
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/mpc-0.32/src/queue.c new/mpc-0.33/src/queue.c
--- old/mpc-0.32/src/queue.c    2019-06-11 18:02:54.000000000 +0200
+++ new/mpc-0.33/src/queue.c    2019-10-31 16:01:59.000000000 +0100
@@ -21,6 +21,7 @@
 */
 
 #include "queue.h"
+#include "tags.h"
 #include "args.h"
 #include "charset.h"
 #include "options.h"
@@ -120,17 +121,13 @@
 {
        struct mpd_status *status = getStatus(conn);
 
-       const int plLength = mpd_status_get_queue_length(status);
+       const unsigned plLength = mpd_status_get_queue_length(status);
 
-       char *songsToDel = malloc(plLength);
-       memset(songsToDel,0,plLength);
+       bool *songsToDel = malloc(plLength);
+       memset(songsToDel, false, plLength);
 
-       for (int i = 0; i < argc; ++i) {
-               char *s;
-               if (argv[i][0]=='#')
-                       s = &argv[i][1];
-               else
-                       s = argv[i];
+       for (unsigned i = 0; i < (unsigned)argc; ++i) {
+               const char *const s = argv[i];
 
                char *t;
                int range[2];
@@ -149,7 +146,7 @@
                        range[1] = strtol(t+1, &t2, 10);
                        if(t + 1 == t2 || *t2!='\0')
                                DIE("error parsing range from: %s\n", argv[i]);
-               } else if (*t == ')' || *t=='\0')
+               } else if (*t=='\0')
                        range[1] = range[0];
                else
                        DIE("error parsing song numbers from: %s\n", argv[i]);
@@ -166,18 +163,17 @@
                if (range[1] < range[0])
                        DIE("song range must be from low to high: %i to 
%i\n",range[0],range[1]);
 
-               if (range[1] > plLength)
+               if ((unsigned)range[1] > plLength)
                        DIE("song number does not exist: %i\n",range[1]);
 
-               for (int j = range[0]; j <= range[1]; j++)
-                       songsToDel[j - 1] = 1;
+               memset(songsToDel + range[0] - 1, true, range[1] - range[0] + 
1);
        }
 
        if (!mpd_command_list_begin(conn, false))
                printErrorAndExit(conn);
 
        int songsDeleted = 0;
-       for (int i = 0; i < plLength; ++i) {
+       for (unsigned i = 0; i < plLength; ++i) {
                if (songsToDel[i]) {
                        mpd_send_delete(conn, i - songsDeleted);
                        ++songsDeleted;
@@ -195,6 +191,21 @@
 int
 cmd_playlist(int argc, char **argv, struct mpd_connection *conn)
 {
+       bool command_list = false;
+
+#if LIBMPDCLIENT_CHECK_VERSION(2,12,0)
+       /* ask MPD to omit the tags which are not used by the
+          `--format` to reduce network transfer for tag values we're
+          not going to use anyway (requires MPD 0.21 and libmpdclient
+          2.12) */
+       if (mpd_connection_cmp_server_version(conn, 0, 21, 0) >= 0) {
+               if (!mpd_command_list_begin(conn, false) ||
+                   !send_tag_types_for_format(conn, options.format))
+                       printErrorAndExit(conn);
+               command_list = true;
+       }
+#endif
+
        bool ret = argc > 0
                ? mpd_send_list_playlist_meta(conn, argv[0])
                : mpd_send_list_queue_meta(conn);
@@ -202,13 +213,10 @@
        if (ret == false)
                printErrorAndExit(conn);
 
-       struct mpd_song *song;
-       while ((song = mpd_recv_song(conn)) != NULL) {
-               pretty_print_song(song);
-               mpd_song_free(song);
-               printf("\n");
-       }
+       if (command_list && !mpd_command_list_end(conn))
+               printErrorAndExit(conn);
 
+       print_entity_list(conn, MPD_ENTITY_TYPE_SONG, true);
        my_finishCommand(conn);
        return 0;
 }
@@ -279,14 +287,31 @@
 int
 cmd_prio(int argc, char **argv, struct mpd_connection *conn)
 {
+       char *endptr;
        int i = 0;
-       const char *prio = argv[i++];
+       const char *s = argv[i++];
+       int prio = strtol(s, &endptr, 10);
+       if (endptr == s || *endptr != 0)
+               DIE("Failed to parse number: %s\n", s);
+       if (prio < 0 || prio > 255)
+               DIE("Priority must be between 0 and 255: %s\n", s);
 
        if (!mpd_command_list_begin(conn, false))
                printErrorAndExit(conn);
 
        while (i < argc) {
-               if (!mpd_send_command(conn, "prio", prio, argv[i++], NULL))
+               s = argv[i++];
+               int position = strtol(s, &endptr, 10);
+               if (endptr == s || *endptr != 0)
+                       DIE("Failed to parse number: %s\n", s);
+               if (position < 1)
+                       DIE("Invalid song position: %s\n", s);
+
+               /* mpc's song positions are 1-based, but MPD uses
+                  0-based positions */
+               --position;
+
+               if (!mpd_send_prio(conn, prio, position))
                        break;
        }
 
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/mpc-0.32/src/search.c new/mpc-0.33/src/search.c
--- old/mpc-0.32/src/search.c   2019-06-11 18:02:54.000000000 +0200
+++ new/mpc-0.33/src/search.c   2019-10-31 16:01:59.000000000 +0100
@@ -175,7 +175,7 @@
        if (command_list && !mpd_command_list_end(conn))
                printErrorAndExit(conn);
 
-       print_entity_list(conn, MPD_ENTITY_TYPE_SONG);
+       print_entity_list(conn, MPD_ENTITY_TYPE_SONG, options.custom_format);
 
        my_finishCommand(conn);
 
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/mpc-0.32/src/util.c new/mpc-0.33/src/util.c
--- old/mpc-0.32/src/util.c     2019-06-11 18:02:54.000000000 +0200
+++ new/mpc-0.33/src/util.c     2019-10-31 16:01:59.000000000 +0100
@@ -82,7 +82,8 @@
 }
 
 void
-print_entity_list(struct mpd_connection *c, enum mpd_entity_type filter_type)
+print_entity_list(struct mpd_connection *c, enum mpd_entity_type filter_type,
+                 bool pretty)
 {
        struct mpd_entity *entity;
        while ((entity = mpd_recv_entity(c)) != NULL) {
@@ -106,7 +107,7 @@
 
                case MPD_ENTITY_TYPE_SONG:
                        song = mpd_entity_get_song(entity);
-                       if (options.custom_format) {
+                       if (pretty) {
                                pretty_print_song(song);
                                puts("");
                        } else
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/mpc-0.32/src/util.h new/mpc-0.33/src/util.h
--- old/mpc-0.32/src/util.h     2019-06-11 18:02:54.000000000 +0200
+++ new/mpc-0.33/src/util.h     2019-10-31 16:01:59.000000000 +0100
@@ -59,8 +59,13 @@
 void
 pretty_print_song(const struct mpd_song *song);
 
+/**
+ * @param pretty pretty-print songs (with the song format) or print
+ * just the URI?
+ */
 void
-print_entity_list(struct mpd_connection *c, enum mpd_entity_type filter_type);
+print_entity_list(struct mpd_connection *c, enum mpd_entity_type filter_type,
+                 bool pretty);
 
 void
 print_filenames(struct mpd_connection *conn);


Reply via email to