Script 'mail_helper' called by obssrc
Hello community,

here is the log from the commit of package kew for openSUSE:Factory checked in 
at 2024-07-02 18:19:22
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Comparing /work/SRC/openSUSE:Factory/kew (Old)
 and      /work/SRC/openSUSE:Factory/.kew.new.18349 (New)
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Package is "kew"

Tue Jul  2 18:19:22 2024 rev:18 rq:1184843 version:2.5.1

Changes:
--------
--- /work/SRC/openSUSE:Factory/kew/kew.changes  2024-06-17 19:30:40.356840197 
+0200
+++ /work/SRC/openSUSE:Factory/.kew.new.18349/kew.changes       2024-07-02 
18:19:27.630029487 +0200
@@ -1,0 +2,11 @@
+Tue Jul  2 11:23:54 UTC 2024 - Muhammad Akbar Yanuar Mantari <mantari...@pm.me>
+
+- Update to version 2.5.1
+  * Fixed bug where desktop notifications could lead to a short
+    stall of the app at startup if notify-send wasn't installed.
+  * Search: Removed duplicate search result name variable. This
+    means search results will now have a very low memory footprint.
+  * Symlinked directories should work better now. Works best if 
+    the symlink and the destination directory has the same name.
+
+-------------------------------------------------------------------

Old:
----
  kew-2.5.0.tar.gz

New:
----
  kew-2.5.1.tar.gz

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

Other differences:
------------------
++++++ kew.spec ++++++
--- /var/tmp/diff_new_pack.YiPpZH/_old  2024-07-02 18:19:29.566100325 +0200
+++ /var/tmp/diff_new_pack.YiPpZH/_new  2024-07-02 18:19:29.566100325 +0200
@@ -17,7 +17,7 @@
 
 
 Name:           kew
-Version:        2.5.0
+Version:        2.5.1
 Release:        0
 Summary:        A command-line music player
 License:        GPL-2.0-only

++++++ kew-2.5.0.tar.gz -> kew-2.5.1.tar.gz ++++++
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/kew-2.5.0/README.md new/kew-2.5.1/README.md
--- old/kew-2.5.0/README.md     2024-06-17 03:53:53.000000000 +0200
+++ new/kew-2.5.1/README.md     2024-07-01 14:49:05.000000000 +0200
@@ -4,12 +4,9 @@
 
 Listen to music in the terminal.
 
-<div align="center">
-    <img src="kew-screenshot.png" />
-       </br>
-       <i>Example screenshot: Jenova 7: Lost Sci-Fi Movie Themes.</i>
-        </br>
-</div>
+![Example screenshot](kew-screenshot.png)  
+*Example screenshot running in Konsole: [Jenova 7: Lost Sci-Fi Movie 
Themes](https://jenova7.bandcamp.com/album/lost-sci-fi-movie-themes).*
+
 
   
   \
@@ -202,7 +199,7 @@
 * number +<kbd>G</kbd>, <kbd>g</kbd> or <kbd>Enter</kbd>, go to specific song 
number in the playlist.
 * <kbd>g</kbd> go to last song.
 * . to add current song to kew.m3u (run with "kew .").
-* <kbd>q</kbd> to quit.
+* <kbd>Esc</kbd> to quit.
 
 ## Configuration
 
Binary files old/kew-2.5.0/kew-screenshot.png and 
new/kew-2.5.1/kew-screenshot.png differ
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/kew-2.5.0/src/file.c new/kew-2.5.1/src/file.c
--- old/kew-2.5.0/src/file.c    2024-06-17 03:53:53.000000000 +0200
+++ new/kew-2.5.1/src/file.c    2024-07-01 14:49:05.000000000 +0200
@@ -127,7 +127,7 @@
                 }
 
                 char entryPath[MAXPATHLEN];
-                char *currentDir = getcwd(NULL, 0);
+                char *currentDir = get_current_dir_name();
                 snprintf(entryPath, sizeof(entryPath), "%s/%s", currentDir, 
dir->d_name);
                 free(currentDir);
 
@@ -141,7 +141,7 @@
                         if (((exactSearch && (strcasecmp(dir->d_name, 
searching) == 0)) || (!exactSearch && c_strcasestr(dir->d_name, searching) != 
NULL)) &&
                             (searchType != FileOnly) && (searchType != 
SearchPlayList))
                         {
-                                char *curDir = getcwd(NULL, 0);
+                                char *curDir = get_current_dir_name();
                                 snprintf(result, MAXPATHLEN, "%s/%s", curDir, 
dir->d_name);
                                 free(curDir);
                                 copyresult = true;
@@ -187,7 +187,7 @@
 
                         if ((exactSearch && (strcasecmp(dir->d_name, 
searching) == 0)) || (!exactSearch && c_strcasestr(dir->d_name, searching) != 
NULL))
                         {
-                                char *curDir = getcwd(NULL, 0);
+                                char *curDir = get_current_dir_name();
                                 snprintf(result, MAXPATHLEN, "%s/%s", curDir, 
dir->d_name);
                                 copyresult = true;
                                 free(curDir);
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/kew-2.5.0/src/file.h new/kew-2.5.1/src/file.h
--- old/kew-2.5.0/src/file.h    2024-06-17 03:53:53.000000000 +0200
+++ new/kew-2.5.1/src/file.h    2024-07-01 14:49:05.000000000 +0200
@@ -13,6 +13,7 @@
 #include <sys/stat.h>
 #include <sys/types.h>
 #include <time.h>
+#define __USE_GNU
 #include <unistd.h>
 #include "utils.h"
 
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/kew-2.5.0/src/kew.c new/kew-2.5.1/src/kew.c
--- old/kew-2.5.0/src/kew.c     2024-06-17 03:53:53.000000000 +0200
+++ new/kew-2.5.1/src/kew.c     2024-07-01 14:49:05.000000000 +0200
@@ -173,7 +173,7 @@
                         fuzzySearch(getLibrary(), fuzzySearchThreshold);
                         event.type = EVENT_SEARCH;
                 }
-        }         
+        }
 
         // Map keys to events
         EventMapping keyMappings[] = {{settings.scrollUpAlt, EVENT_SCROLLPREV},
@@ -214,12 +214,12 @@
                                       {settings.hardShowTrackAlt, 
EVENT_SHOWTRACK},
                                       {settings.hardShowLibrary, 
EVENT_SHOWLIBRARY},
                                       {settings.hardShowLibraryAlt, 
EVENT_SHOWLIBRARY},
-                                      {settings.hardShowSearchAlt,  
EVENT_SHOWSEARCH},
+                                      {settings.hardShowSearchAlt, 
EVENT_SHOWSEARCH},
                                       {settings.hardNextPage, EVENT_NEXTPAGE},
                                       {settings.hardPrevPage, EVENT_PREVPAGE},
                                       {settings.hardRemove, EVENT_REMOVE}};
 
-        int numKeyMappings = sizeof(keyMappings) / sizeof(EventMapping);       
      
+        int numKeyMappings = sizeof(keyMappings) / sizeof(EventMapping);
 
         // Set event for pressed key
         for (int i = 0; i < numKeyMappings; i++)
@@ -236,7 +236,7 @@
                         event.type = keyMappings[i].eventType;
                         break;
                 }
-        }        
+        }
 
         // Handle gg
         if (event.key[0] == 'g' && event.type == EVENT_NONE)
@@ -448,7 +448,7 @@
 
                 enqueueSongs(getCurrentSearchEntry());
 
-                pthread_mutex_unlock(&(playlist.mutex));                
+                pthread_mutex_unlock(&(playlist.mutex));
         }
         else
         {
@@ -799,47 +799,49 @@
         (void)data;
 
         calcElapsedTime();
-        handleInput();
-
-        // Process GDBus events in the global_main_context
-        while (g_main_context_pending(global_main_context))
-        {
-                g_main_context_iteration(global_main_context, FALSE);
-        }
+        
+        handleInput();        
 
         updateCounter++;
-        if (updateCounter % 2 == 0 || appState.currentView != SONG_VIEW) // 
Update every other time or if searching
+        
+        // Update every other time or if searching (search needs to update 
often to detect keypresses)
+        if (updateCounter % 2 == 0 || appState.currentView == SEARCH_VIEW) 
         {
+                // Process GDBus events in the global_main_context
+                while (g_main_context_pending(global_main_context))
+                {
+                        g_main_context_iteration(global_main_context, FALSE);
+                }
+                
                 updatePlayer();
-        }
 
-        if (playlist.head != NULL)
-        {
-                if (loadingAudioData == false && (skipFromStopped || 
!loadedNextSong || nextSongNeedsRebuilding) && !audioData.endOfListReached)
+                if (playlist.head != NULL)
                 {
-                        handleSkipFromStopped();
-                        loadAudioData();
-                }
+                        if (loadingAudioData == false && (skipFromStopped || 
!loadedNextSong || nextSongNeedsRebuilding) && !audioData.endOfListReached)
+                        {
+                                handleSkipFromStopped();
+                                loadAudioData();
+                        }
 
-                if (songHasErrors)
-                        tryLoadNext();
+                        if (songHasErrors)
+                                tryLoadNext();
 
-                if (isPlaybackDone())
-                {
-                        updateLastSongSwitchTime();
-                        prepareNextSong();
+                        if (isPlaybackDone())
+                        {
+                                updateLastSongSwitchTime();
+                                prepareNextSong();
 
-                        if (!doQuit)
-                                switchAudioImplementation();
+                                if (!doQuit)
+                                        switchAudioImplementation();
+                        }
                 }
-        }
 
-        if (doQuit)
-        {
-                g_main_loop_quit(main_loop);
-                return FALSE;
+                if (doQuit)
+                {
+                        g_main_loop_quit(main_loop);
+                        return FALSE;
+                }
         }
-
         return TRUE;
 }
 
@@ -866,6 +868,7 @@
 
                 if (res >= 0)
                 {
+                        logTime("createAudioDevice()");
                         res = createAudioDevice(&userData);
                 }
 
@@ -889,12 +892,14 @@
 
         g_unix_signal_add(SIGINT, on_sigint, main_loop);
 
+        logTime("emitStartPlayingMpris()");
         if (song != NULL)
                 emitStartPlayingMpris();
         else
                 emitPlaybackStoppedMpris();
 
         g_timeout_add(50, mainloop_callback, NULL);
+        logTime("g_main_loop_run()");
         g_main_loop_run(main_loop);
         g_main_loop_unref(main_loop);
 }
@@ -965,6 +970,7 @@
 {
         if (originalPlaylist == NULL)
         {
+                logTime("deepCopyPlayList()");
                 originalPlaylist = malloc(sizeof(PlayList));
                 *originalPlaylist = deepCopyPlayList(&playlist);
         }
@@ -1006,6 +1012,7 @@
         pthread_mutex_init(&(loadingdata.mutex), NULL);
         pthread_mutex_init(&(playlist.mutex), NULL);
         nerdFontsEnabled = hasNerdFonts();
+        logTime("createLibrary");
         createLibrary(&settings);
         setlocale(LC_ALL, "");
         fflush(stdout);
@@ -1049,12 +1056,15 @@
 
 void playAll()
 {
+        logTime("init()");
         init();
+        logTime("createPlayListFromFileSystemEntry()");
         createPlayListFromFileSystemEntry(library, &playlist, MAX_FILES);
         if (playlist.count == 0)
         {
                 exit(0);
-        }
+        }      
+        logTime("shufflePlaylist()");  
         shufflePlaylist(&playlist);
         run();
 }
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/kew-2.5.0/src/player.c new/kew-2.5.1/src/player.c
--- old/kew-2.5.0/src/player.c  2024-06-17 03:53:53.000000000 +0200
+++ new/kew-2.5.1/src/player.c  2024-07-01 14:49:05.000000000 +0200
@@ -22,7 +22,7 @@
 } PixelData;
 #endif
 
-const char VERSION[] = "2.5.0";
+const char VERSION[] = "2.5.1";
 const int ABSOLUTE_MIN_WIDTH = 68;
 bool visualizerEnabled = true;
 bool coverEnabled = true;
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/kew-2.5.0/src/playerops.c 
new/kew-2.5.1/src/playerops.c
--- old/kew-2.5.0/src/playerops.c       2024-06-17 03:53:53.000000000 +0200
+++ new/kew-2.5.1/src/playerops.c       2024-07-01 14:49:05.000000000 +0200
@@ -1335,6 +1335,8 @@
 {
         pthread_t threadId;
 
+        freeSearchResults();
+
         if (pthread_create(&threadId, NULL, updateLibraryThread, path) != 0)
         {
                 perror("Failed to create thread");
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/kew-2.5.0/src/search_ui.c 
new/kew-2.5.1/src/search_ui.c
--- old/kew-2.5.0/src/search_ui.c       2024-06-17 03:53:53.000000000 +0200
+++ new/kew-2.5.1/src/search_ui.c       2024-07-01 14:49:05.000000000 +0200
@@ -7,7 +7,6 @@
 
 typedef struct SearchResult
 {
-        char *term;
         FileSystemEntry *entry;
         int distance;
 } SearchResult;
@@ -40,7 +39,6 @@
                 resultsCapacity = resultsCapacity == 0 ? 10 : resultsCapacity 
* 2;
                 results = realloc(results, resultsCapacity * 
sizeof(SearchResult));
         }
-        results[resultsCount].term = strdup(entry->name);
         results[resultsCount].distance = distance;
         results[resultsCount].entry = entry;
         resultsCount++;
@@ -55,12 +53,7 @@
 // Free allocated memory from previous search
 void freeSearchResults()
 {
-        for (size_t i = 0; i < resultsCount; i++)
-        {
-                free(results[i].term);
-        }
-
-        if (resultsCount > 0)
+        if (results != NULL)
         {
                 free(results);
                 results = NULL;
@@ -286,11 +279,11 @@
                 name[0] = '\0';
                 if (results[i].entry->isDirectory)
                 {
-                        snprintf(name, maxNameWidth + 1, "[%s]", 
results[i].term);        
+                        snprintf(name, maxNameWidth + 1, "[%s]", 
results[i].entry->name);        
                 }       
                 else
                 {         
-                        snprintf(name, maxNameWidth + 1, "%s", 
results[i].term);
+                        snprintf(name, maxNameWidth + 1, "%s", 
results[i].entry->name);
                 }
                 printf("%s\n", name);
         }
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/kew-2.5.0/src/sound.c new/kew-2.5.1/src/sound.c
--- old/kew-2.5.0/src/sound.c   2024-06-17 03:53:53.000000000 +0200
+++ new/kew-2.5.1/src/sound.c   2024-07-01 14:49:05.000000000 +0200
@@ -468,17 +468,22 @@
 
 int createAudioDevice(UserData *userData)
 {
+        logTime("ma_context_init");
         ma_context_init(NULL, 0, NULL, &context);
+
+        logTime("switchAudioImplementation");
         if (switchAudioImplementation() >= 0)
         {
                 SongData *currentSongData = userData->currentSongData;
 
                 if (currentSongData != NULL && currentSongData->hasErrors == 0 
&& currentSongData->metadata && strlen(currentSongData->metadata->title) > 0)
                 {
+                        logTime("displaySongNotification");
                         
displaySongNotification(currentSongData->metadata->artist, 
currentSongData->metadata->title, currentSongData->coverArtPath);
 
                         gint64 length = 
getLengthInSec(currentSongData->duration);
                         // update mpris
+                        logTime("emitMetadataChanged");
                         emitMetadataChanged(
                             currentSongData->metadata->title,
                             currentSongData->metadata->artist,
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/kew-2.5.0/src/soundcommon.c 
new/kew-2.5.1/src/soundcommon.c
--- old/kew-2.5.0/src/soundcommon.c     2024-06-17 03:53:53.000000000 +0200
+++ new/kew-2.5.1/src/soundcommon.c     2024-07-01 14:49:05.000000000 +0200
@@ -54,6 +54,14 @@
 int opusDecoderIndex = -1;
 int vorbisDecoderIndex = -1;
 
+void logTime(const char *message)
+{
+        (void)message;
+        // struct timespec ts;
+        // clock_gettime(CLOCK_REALTIME, &ts);
+        // printf("[%ld.%09ld] %s\n", ts.tv_sec, ts.tv_nsec, message);
+}
+
 enum AudioImplementation getCurrentImplementationType()
 {
         return currentImplementation;
@@ -1098,12 +1106,14 @@
         sanitized[j] = '\0';
 }
 
-char *remove_blacklisted_chars(const char *input, const char *blacklist)
+char *removeBlacklistedChars(const char *input, const char *blacklist)
 {
         if (!input || !blacklist)
+        {
                 return NULL;
+        }
 
-        char *output = malloc(strlen(input) + 1);
+        char *output = calloc(strlen(input) + 1, sizeof(char));
         if (!output)
         {
                 perror("Failed to allocate memory");
@@ -1121,7 +1131,6 @@
                 }
                 in_ptr++;
         }
-        *out_ptr = '\0';
 
         return output;
 }
@@ -1131,48 +1140,61 @@
         return floor(llround(duration * G_USEC_PER_SEC));
 }
 
-int displaySongNotification(const char *artist, const char *title, const char 
*cover) {
-    if (!allowNotifications)
-        return 0;
+int displaySongNotification(const char *artist, const char *title, const char 
*cover)
+{
+        if (!allowNotifications)
+        {
+                return 0;
+        }
 
-    char sanitized_cover[MAXPATHLEN];
+        char sanitized_cover[MAXPATHLEN];
+        const char *blacklist = "&;`|*~<>^()[]{}$\\\"";
+        char *sanitizedArtist = removeBlacklistedChars(artist, blacklist);
+        char *sanitizedTitle = removeBlacklistedChars(title, blacklist);
 
-    const char *blacklist = "&;`|*~<>^()[]{}$\\\"";
-    char *sanitizedArtist = remove_blacklisted_chars(artist, blacklist);
-    char *sanitizedTitle = remove_blacklisted_chars(title, blacklist);
-
-    sanitize_filepath(cover, sanitized_cover, sizeof(sanitized_cover));
-
-    char message[MAXPATHLEN + 1024];
-    if (strlen(artist) > 0) {
-        snprintf(message, sizeof(message), "%s - %s", sanitizedArtist, 
sanitizedTitle);
-    } else {
-        snprintf(message, sizeof(message), "%s", sanitizedTitle);
-    }
-
-    char *args[] = {"/usr/bin/notify-send", "-a", "kew", message, "--icon", 
sanitized_cover, NULL};
-
-    pid_t pid = fork();
-    if (pid == -1) {
-        // Handle error
-        perror("fork");
-    } else if (pid > 0) {
-        // Parent process
-        int status;
-        waitpid(pid, &status, 0);
-    } else {
-        // Child process
-        extern char **environ;
-        if (execve("/usr/bin/notify-send", args, environ) == -1) {
+        if (!sanitizedArtist || !sanitizedTitle)
+        {
+                free(sanitizedArtist);
+                free(sanitizedTitle);
+                return -1;
+        }
 
-            _Exit(EXIT_FAILURE);
+        sanitize_filepath(cover, sanitized_cover, sizeof(sanitized_cover));
+
+        char message[MAXPATHLEN + 1024];
+        if (strlen(artist) > 0)
+        {
+                snprintf(message, sizeof(message), "%s - %s", sanitizedArtist, 
sanitizedTitle);
+        }
+        else
+        {
+                snprintf(message, sizeof(message), "%s", sanitizedTitle);
+        }
+
+        char *args[] = {"/usr/bin/notify-send", "-a", "kew", message, 
"--icon", sanitized_cover, NULL};
+
+        pid_t pid = vfork();
+        if (pid == -1)
+        {
+                perror("vfork");
+                free(sanitizedArtist);
+                free(sanitizedTitle);
+                return -1;
+        }
+        else if (pid == 0)
+        {
+                // Child process
+                execv(args[0], args);
+                // If execv fails
+                perror("execv");
+                _Exit(EXIT_FAILURE);
         }
-    }
 
-    free(sanitizedArtist);
-    free(sanitizedTitle);
+        // Parent process
+        free(sanitizedArtist);
+        free(sanitizedTitle);
 
-    return 0;
+        return 0;
 }
 
 void executeSwitch(AudioData *pAudioData)
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/kew-2.5.0/src/soundcommon.h 
new/kew-2.5.1/src/soundcommon.h
--- old/kew-2.5.0/src/soundcommon.h     2024-06-17 03:53:53.000000000 +0200
+++ new/kew-2.5.1/src/soundcommon.h     2024-07-01 14:49:05.000000000 +0200
@@ -351,4 +351,6 @@
 
 void vorbis_on_audio_frames(ma_device *pDevice, void *pFramesOut, const void 
*pFramesIn, ma_uint32 frameCount);
 
+void logTime(const char *message);
+
 #endif

Reply via email to