Hello community,
here is the log from the commit of package pragha for openSUSE:Factory checked in at 2014-05-14 10:44:35
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Comparing /work/SRC/openSUSE:Factory/pragha (Old)
and /work/SRC/openSUSE:Factory/.pragha.new (New)
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "pragha"
Changes:
--------
--- /work/SRC/openSUSE:Factory/pragha/pragha.changes 2014-02-12 09:49:41.000000000 +0100
+++ /work/SRC/openSUSE:Factory/.pragha.new/pragha.changes 2014-05-14 10:44:36.000000000 +0200
@@ -1,0 +2,15 @@
+Wed Apr 30 21:17:19 UTC 2014 - lazy.kent@opensuse.org
+
+- Update to 1.2.1.
+ * Create cache folders when init album-art-cache.
+ * Lastfm: Backport some changes from Pragha 1.3.1.
+ + Better protect tags and time_t on threads.
+ + Use diferents time_id to scrobble and update now playing.
+ + Fix submits multiple entries of one song to LastFM.
+ + Betters function names and declare a lot as static.
+ * Show album arts in cache to all songs. But search in folders
+ only to local songs.
+ * Fix Segfault when edit song tags from systray menu.
+ * Not import empty playlists when scan the library.
+
+-------------------------------------------------------------------
Old:
----
pragha-1.2.tar.bz2
New:
----
pragha-1.2.1.tar.bz2
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Other differences:
------------------
++++++ pragha.spec ++++++
--- /var/tmp/diff_new_pack.yn2b1H/_old 2014-05-14 10:44:37.000000000 +0200
+++ /var/tmp/diff_new_pack.yn2b1H/_new 2014-05-14 10:44:37.000000000 +0200
@@ -17,7 +17,7 @@
Name: pragha
-Version: 1.2
+Version: 1.2.1
Release: 0
Summary: Lightweight Music Player
License: GPL-3.0+
++++++ pragha-1.2.tar.bz2 -> pragha-1.2.1.tar.bz2 ++++++
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/pragha-1.2/NEWS new/pragha-1.2.1/NEWS
--- old/pragha-1.2/NEWS 2014-02-08 21:47:03.000000000 +0100
+++ new/pragha-1.2.1/NEWS 2014-04-30 17:57:33.000000000 +0200
@@ -1,17 +1,32 @@
==============================================================
-Overview of changes in Pragha 1.2 since 1.1.2
+Overview of changes in Pragha 1.2.1 since 1.2
+==============================================================
+
+Bugs fixed:
+ Create cache folders when init album-art-cache.
+ Lastfm: Backport some changes from Pragha 1.3.1.
+ * Better protect tags and time_t on threads.
+ * Use diferents time_id to scrobble and update now playing.
+ * Fix submits multiple entries of one song to LastFM.
+ * Betters function names and declare a lot as static.
+ Show album arts in cache to all songs. But search in folders only to local songs.
+ Fix Segfault when edit song tags from systray menu.
+ Not import empty playlists when scan the library.
+
+==============================================================
+OTHERS REALESES:
==============================================================
Pragha V1.2
Bugs fixed:
- Fix thread safety when reading tags.
+ Fix thread safety when reading tags.
Explicitly specified use normal fonts in the library.
Fix seg fault when disable and enable again mpris2.
Updates Translations:
New Korean (Korea) translation thanks to Smallsnail.
New Vietnamese translation thanks to Ppanhh.
- Many other updates.. Thanks to all.
+ Many other updates. Thanks to all.
V1.2.rc
News:
@@ -54,10 +69,6 @@
* To compile with libcdio >= 0.90 use: ./configure CPPFLAGS="-DHAVE_PARANOIA_NEW_INCLUDES"
Remove dbus-1 and dbus-glib-1 requirements.
-==============================================================
-OTHERS REALESES:
-==============================================================
-
V1.1.2
News:
Improved indexing of the library. Also allows continue listening music while analyzing. [1]
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/pragha-1.2/configure new/pragha-1.2.1/configure
--- old/pragha-1.2/configure 2014-02-08 21:49:43.000000000 +0100
+++ new/pragha-1.2.1/configure 2014-04-30 18:09:39.000000000 +0200
@@ -1,6 +1,6 @@
#! /bin/sh
# Guess values for system-dependent variables and create Makefiles.
-# Generated by GNU Autoconf 2.69 for pragha 1.2.
+# Generated by GNU Autoconf 2.69 for pragha 1.2.1.
#
# Report bugs to .
#
@@ -593,8 +593,8 @@
# Identity of this package.
PACKAGE_NAME='pragha'
PACKAGE_TARNAME='pragha'
-PACKAGE_VERSION='1.2'
-PACKAGE_STRING='pragha 1.2'
+PACKAGE_VERSION='1.2.1'
+PACKAGE_STRING='pragha 1.2.1'
PACKAGE_BUGREPORT='mati86dl@gmail.com'
PACKAGE_URL=''
@@ -1472,7 +1472,7 @@
# Omit some internal or obsolete options to make the list less imposing.
# This message is too long to be a string in the A/UX 3.1 sh.
cat <<_ACEOF
-\`configure' configures pragha 1.2 to adapt to many kinds of systems.
+\`configure' configures pragha 1.2.1 to adapt to many kinds of systems.
Usage: $0 [OPTION]... [VAR=VALUE]...
@@ -1542,7 +1542,7 @@
if test -n "$ac_init_help"; then
case $ac_init_help in
- short | recursive ) echo "Configuration of pragha 1.2:";;
+ short | recursive ) echo "Configuration of pragha 1.2.1:";;
esac
cat <<\_ACEOF
@@ -1693,7 +1693,7 @@
test -n "$ac_init_help" && exit $ac_status
if $ac_init_version; then
cat <<\_ACEOF
-pragha configure 1.2
+pragha configure 1.2.1
generated by GNU Autoconf 2.69
Copyright (C) 2012 Free Software Foundation, Inc.
@@ -2065,7 +2065,7 @@
This file contains any messages produced by compilers while
running configure, to aid debugging if configure makes a mistake.
-It was created by pragha $as_me 1.2, which was
+It was created by pragha $as_me 1.2.1, which was
generated by GNU Autoconf 2.69. Invocation command line was
$ $0 $@
@@ -2931,7 +2931,7 @@
# Define the identity of the package.
PACKAGE='pragha'
- VERSION='1.2'
+ VERSION='1.2.1'
cat >>confdefs.h <<_ACEOF
@@ -17778,7 +17778,7 @@
# report actual input values of CONFIG_FILES etc. instead of their
# values after options handling.
ac_log="
-This file was extended by pragha $as_me 1.2, which was
+This file was extended by pragha $as_me 1.2.1, which was
generated by GNU Autoconf 2.69. Invocation command line was
CONFIG_FILES = $CONFIG_FILES
@@ -17844,7 +17844,7 @@
cat >>$CONFIG_STATUS <<_ACEOF || ac_write_fail=1
ac_cs_config="`$as_echo "$ac_configure_args" | sed 's/^ //; s/[\\""\`\$]/\\\\&/g'`"
ac_cs_version="\\
-pragha config.status 1.2
+pragha config.status 1.2.1
configured by $0, generated by GNU Autoconf 2.69,
with options \\"\$ac_cs_config\\"
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/pragha-1.2/configure.ac new/pragha-1.2.1/configure.ac
--- old/pragha-1.2/configure.ac 2014-02-08 21:47:27.000000000 +0100
+++ new/pragha-1.2.1/configure.ac 2014-04-30 18:08:58.000000000 +0200
@@ -6,7 +6,8 @@
dnl Version information
m4_define([pragha_version_major], [1])
m4_define([pragha_version_minor], [2])
-m4_define([pragha_version], [pragha_version_major().pragha_version_minor()])
+m4_define([pragha_version_micro], [1])
+m4_define([pragha_version], [pragha_version_major().pragha_version_minor().pragha_version_micro()])
dnl Initialize autoconf
AC_COPYRIGHT([Copyright (c) 2009-2014
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/pragha-1.2/data/pragha.1 new/pragha-1.2.1/data/pragha.1
--- old/pragha-1.2/data/pragha.1 2014-02-08 21:00:22.000000000 +0100
+++ new/pragha-1.2.1/data/pragha.1 2014-04-30 16:23:59.000000000 +0200
@@ -1,4 +1,4 @@
-.TH "pragha" "1" "1.2.rc" "Matias De lellis" ""
+.TH "pragha" "1" "1.2" "Matias De lellis" ""
.SH "NAME"
.LP
pragha \- A lightweight music player, forked of Consonance Music Manager
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/pragha-1.2/src/pragha-art-cache.c new/pragha-1.2.1/src/pragha-art-cache.c
--- old/pragha-1.2/src/pragha-art-cache.c 2014-02-08 21:00:22.000000000 +0100
+++ new/pragha-1.2.1/src/pragha-art-cache.c 2014-04-30 16:28:23.000000000 +0200
@@ -16,6 +16,8 @@
* along with this program. If not, see http://www.gnu.org/licenses/.
*/
+#include
+
#include "pragha-art-cache.h"
#include "pragha-utils.h"
@@ -28,6 +30,9 @@
{
PraghaArtCache *cache = g_slice_new (PraghaArtCache);
cache->cache_dir = g_build_path (G_DIR_SEPARATOR_S, g_get_user_cache_dir (), "pragha", NULL);
+
+ g_mkdir_with_parents (cache->cache_dir, S_IRWXU);
+
return cache;
}
@@ -43,7 +48,7 @@
{
gchar *artist_escaped = pragha_escape_slashes (artist);
gchar *album_escaped = pragha_escape_slashes (album);
- gchar *result = g_strdup_printf ("%s/album-%s-%s.jpeg", cache->cache_dir, artist_escaped, album_escaped);
+ gchar *result = g_strdup_printf ("%s%salbum-%s-%s.jpeg", cache->cache_dir, G_DIR_SEPARATOR_S, artist_escaped, album_escaped);
g_free (album_escaped);
g_free (artist_escaped);
return result;
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/pragha-1.2/src/pragha-lastfm.c new/pragha-1.2.1/src/pragha-lastfm.c
--- old/pragha-1.2/src/pragha-lastfm.c 2014-02-08 21:00:22.000000000 +0100
+++ new/pragha-1.2.1/src/pragha-lastfm.c 2014-04-30 17:30:39.000000000 +0200
@@ -41,18 +41,21 @@
#include
struct _PraghaLastfm {
+ PraghaApplication *pragha;
+
/* Last session status. */
LASTFM_SESSION *session_id;
enum LASTFM_STATUS_CODES status;
gboolean has_user;
gboolean has_pass;
- /* Elapsed Time*/
- time_t playback_started;
+ /* Song status */
+ PRAGHA_MUTEX (data_mutex);
+ time_t playback_started;
+ PraghaMusicobject *current_mobj;
+ PraghaMusicobject *updated_mobj;
- GtkWidget *ntag_lastfm_button;
- PraghaMusicobject *nmobj;
- PRAGHA_MUTEX (nmobj_mutex);
+ GtkWidget *ntag_lastfm_button;
/* Menu options */
GtkActionGroup *action_group_main_menu;
@@ -61,10 +64,8 @@
GtkActionGroup *action_group_playlist;
guint merge_id_playlist;
- guint timeout_id;
-
- /* Future PraghaAplication */
- PraghaApplication *pragha;
+ guint update_timeout_id;
+ guint scrobble_timeout_id;
};
#define LASTFM_API_KEY "ecdc2d21dbfe1139b1f0da35daca9309"
@@ -219,7 +220,7 @@
gtk_action_set_sensitive (action, sensitive);
}
-void
+static void
pragha_lastfm_update_menu_actions (PraghaLastfm *clastfm)
{
PraghaBackend *backend;
@@ -365,7 +366,7 @@
}
static void
-edit_tags_corrected_by_lastfm (GtkButton *button, PraghaLastfm *clastfm)
+pragha_lastfm_tags_corrected_dialog (GtkButton *button, PraghaLastfm *clastfm)
{
PraghaBackend *backend;
PraghaMusicobject *tmobj, *nmobj;
@@ -393,9 +394,9 @@
/* Get all info of suggestions
* Temp Musicobject to not block tag edit dialog */
- pragha_mutex_lock (clastfm->nmobj_mutex);
- nmobj = pragha_musicobject_dup(clastfm->nmobj);
- pragha_mutex_unlock (clastfm->nmobj_mutex);
+ pragha_mutex_lock (clastfm->data_mutex);
+ nmobj = pragha_musicobject_dup(clastfm->updated_mobj);
+ pragha_mutex_unlock (clastfm->data_mutex);
g_object_get(nmobj,
"title", &ntitle,
@@ -441,14 +442,14 @@
_("Last.fm suggested a tag correction"));
g_signal_connect(G_OBJECT(ntag_lastfm_button), "clicked",
- G_CALLBACK(edit_tags_corrected_by_lastfm), clastfm);
+ G_CALLBACK(pragha_lastfm_tags_corrected_dialog), clastfm);
return ntag_lastfm_button;
}
/* Love and unlove music object */
-gpointer
+static gpointer
do_lastfm_love_mobj (PraghaLastfm *clastfm, const gchar *title, const gchar *artist)
{
gint rv;
@@ -465,7 +466,7 @@
return NULL;
}
-gpointer
+static gpointer
do_lastfm_unlove_mobj (PraghaLastfm *clastfm, const gchar *title, const gchar *artist)
{
gint rv;
@@ -485,7 +486,7 @@
/* Functions related to current playlist. */
-gpointer
+static gpointer
do_lastfm_current_playlist_love (gpointer data)
{
PraghaPlaylist *playlist;
@@ -519,7 +520,7 @@
clastfm);
}
-gpointer
+static gpointer
do_lastfm_current_playlist_unlove (gpointer data)
{
PraghaPlaylist *playlist;
@@ -610,7 +611,7 @@
return FALSE;
}
-gpointer
+static gpointer
do_lastfm_get_similar (PraghaLastfm *clastfm, const gchar *title, const gchar *artist)
{
LFMList *results = NULL, *li;
@@ -645,7 +646,7 @@
return data;
}
-gpointer
+static gpointer
do_lastfm_get_similar_current_playlist_action (gpointer user_data)
{
PraghaPlaylist *playlist;
@@ -783,7 +784,7 @@
gtk_widget_show_all (dialog);
}
-gpointer
+static gpointer
do_lastfm_add_favorites_action (gpointer user_data)
{
PraghaPreferences *preferences;
@@ -971,32 +972,32 @@
}
static gpointer
-do_lastfm_scrob (gpointer data)
+pragha_lastfm_scrobble_thread (gpointer data)
{
- gint rv;
gchar *title = NULL, *artist = NULL, *album = NULL;
- gint track_no, length;
-
- PraghaLastfmAsyncData *lastfm_async_data = data;
+ gint track_no, length, rv;
+ time_t last_time;
- PraghaLastfm *clastfm = lastfm_async_data->clastfm;
- PraghaMusicobject *mobj = lastfm_async_data->mobj;
+ PraghaLastfm *clastfm = data;
CDEBUG(DBG_LASTFM, "Scrobbler thread");
- g_object_get(mobj,
- "title", &title,
- "artist", &artist,
- "album", &album,
- "track-no", &track_no,
- "length", &length,
- NULL);
+ pragha_mutex_lock (clastfm->data_mutex);
+ g_object_get (clastfm->current_mobj,
+ "title", &title,
+ "artist", &artist,
+ "album", &album,
+ "track-no", &track_no,
+ "length", &length,
+ NULL);
+ last_time = clastfm->playback_started;
+ pragha_mutex_unlock (clastfm->data_mutex);
rv = LASTFM_track_scrobble (clastfm->session_id,
title,
album,
artist,
- clastfm->playback_started,
+ last_time,
length,
track_no,
0, NULL);
@@ -1004,7 +1005,6 @@
g_free(title);
g_free(artist);
g_free(album);
- pragha_lastfm_async_data_free(lastfm_async_data);
if (rv != LASTFM_STATUS_OK)
return _("Last.fm submission failed");
@@ -1012,32 +1012,8 @@
return _("Track scrobbled on Last.fm");
}
-gboolean
-lastfm_scrob_handler(gpointer data)
-{
- PraghaBackend *backend;
- PraghaLastfm *clastfm = data;
-
- CDEBUG(DBG_LASTFM, "Scrobbler Handler");
-
- backend = pragha_application_get_backend (clastfm->pragha);
- if(pragha_backend_get_state (backend) == ST_STOPPED)
- return FALSE;
-
- if (clastfm->status != LASTFM_STATUS_OK) {
- pragha_lastfm_no_connection_advice ();
- return FALSE;
- }
-
- pragha_async_launch (do_lastfm_scrob,
- pragha_async_set_idle_message,
- pragha_lastfm_async_data_new (clastfm));
-
- return FALSE;
-}
-
static gboolean
-show_lastfm_sugest_corrrection_button (gpointer user_data)
+pragha_lastfm_show_corrrection_button (gpointer user_data)
{
PraghaToolbar *toolbar;
PraghaBackend *backend;
@@ -1061,11 +1037,11 @@
"file", &cfile,
NULL);
- pragha_mutex_lock (clastfm->nmobj_mutex);
- g_object_get (clastfm->nmobj,
+ pragha_mutex_lock (clastfm->data_mutex);
+ g_object_get (clastfm->updated_mobj,
"file", &nfile,
NULL);
- pragha_mutex_unlock (clastfm->nmobj_mutex);
+ pragha_mutex_unlock (clastfm->data_mutex);
if(g_ascii_strcasecmp(cfile, nfile) == 0)
gtk_widget_show (clastfm->ntag_lastfm_button);
@@ -1077,29 +1053,26 @@
}
static gpointer
-do_lastfm_now_playing (gpointer data)
+pragha_lastfm_now_playing_thread (gpointer data)
{
- PraghaMusicobject *tmobj;
- gchar *title = NULL, *artist = NULL, *album = NULL;
+ gchar *title = NULL, *artist = NULL, *album = NULL;;
gint track_no, length;
LFMList *list = NULL;
LASTFM_TRACK_INFO *ntrack = NULL;
gint changed = 0, rv;
- PraghaLastfmAsyncData *lastfm_async_data = data;
-
- PraghaLastfm *clastfm = lastfm_async_data->clastfm;
- PraghaMusicobject *mobj = lastfm_async_data->mobj;
+ PraghaLastfm *clastfm = data;
CDEBUG(DBG_LASTFM, "Update now playing thread");
-
- g_object_get(mobj,
+ pragha_mutex_lock (clastfm->data_mutex);
+ g_object_get(clastfm->current_mobj,
"title", &title,
"artist", &artist,
"album", &album,
"track-no", &track_no,
"length", &length,
NULL);
+ pragha_mutex_unlock (clastfm->data_mutex);
rv = LASTFM_track_update_now_playing (clastfm->session_id,
title,
@@ -1123,30 +1096,26 @@
}
if (changed) {
- tmobj = g_object_ref(mobj);
+ g_mutex_lock (&clastfm->data_mutex);
+ g_object_unref (clastfm->updated_mobj);
+ clastfm->updated_mobj = pragha_musicobject_dup (clastfm->current_mobj);
if(changed & TAG_TITLE_CHANGED)
- pragha_musicobject_set_title(tmobj, ntrack->name);
+ pragha_musicobject_set_title(clastfm->updated_mobj, ntrack->name);
if(changed & TAG_ARTIST_CHANGED)
- pragha_musicobject_set_artist(tmobj, ntrack->artist);
+ pragha_musicobject_set_artist(clastfm->updated_mobj, ntrack->artist);
if(changed & TAG_ALBUM_CHANGED)
- pragha_musicobject_set_album(tmobj, ntrack->album);
+ pragha_musicobject_set_album(clastfm->updated_mobj, ntrack->album);
+ pragha_mutex_unlock (clastfm->data_mutex);
- pragha_mutex_lock (clastfm->nmobj_mutex);
- g_object_unref (clastfm->nmobj);
- clastfm->nmobj = tmobj;
- pragha_mutex_unlock (clastfm->nmobj_mutex);
-
- g_idle_add (show_lastfm_sugest_corrrection_button, clastfm);
+ g_idle_add (pragha_lastfm_show_corrrection_button, clastfm);
}
}
-
LASTFM_free_track_info_list(list);
g_free(title);
g_free(artist);
g_free(album);
- pragha_lastfm_async_data_free(lastfm_async_data);
if (rv != LASTFM_STATUS_OK)
return _("Update current song on Last.fm failed.");
@@ -1154,74 +1123,57 @@
return NULL;
}
-void
-lastfm_now_playing_handler (PraghaLastfm *clastfm)
+static gboolean
+pragha_lastfm_now_playing_handler (gpointer data)
{
PraghaBackend *backend;
- gchar *title = NULL, *artist = NULL;
- gint length;
+ PraghaMusicobject *mobj = NULL;
+
+ PraghaLastfm *clastfm = data;
CDEBUG(DBG_LASTFM, "Update now playing Handler");
+ clastfm->update_timeout_id = 0;
+
+ /* Set current song info */
backend = pragha_application_get_backend (clastfm->pragha);
+ mobj = pragha_backend_get_musicobject (backend);
- if(pragha_backend_get_state (backend) == ST_STOPPED)
- return;
+ g_mutex_lock (&clastfm->data_mutex);
+ if (clastfm->current_mobj)
+ g_object_unref (clastfm->current_mobj);
+ clastfm->current_mobj = pragha_musicobject_dup (mobj);
- if (!clastfm->has_user || !clastfm->has_pass)
- return;
+ if (clastfm->updated_mobj)
+ g_object_unref (clastfm->updated_mobj);
+ clastfm->updated_mobj = NULL;
- if (clastfm->status != LASTFM_STATUS_OK) {
- pragha_lastfm_no_connection_advice ();
- return;
- }
+ time(&clastfm->playback_started);
+ g_mutex_unlock (&clastfm->data_mutex);
- g_object_get(pragha_backend_get_musicobject (backend),
- "title", &title,
- "artist", &artist,
- "length", &length,
- NULL);
-
- if (string_is_empty(title) || string_is_empty(artist) || (length < 30))
- goto exit;
-
- pragha_async_launch (do_lastfm_now_playing,
+ pragha_async_launch (pragha_lastfm_now_playing_thread,
pragha_async_set_idle_message,
- pragha_lastfm_async_data_new (clastfm));
-
- /* Kick the lastfm scrobbler on
- * Note: Only scrob if tracks is more than 30s.
- * and scrob when track is at 50% or 4mins, whichever comes
- * first */
-
- if((length / 2) > (240 - WAIT_UPDATE)) {
- length = 240 - WAIT_UPDATE;
- }
- else {
- length = (length / 2) - WAIT_UPDATE;
- }
-
- clastfm->timeout_id = g_timeout_add_seconds_full (G_PRIORITY_DEFAULT_IDLE, length,
- lastfm_scrob_handler, clastfm, NULL);
-exit:
- g_free(title);
- g_free(artist);
+ clastfm);
- return;
+ return FALSE;
}
static gboolean
-update_related_handler (gpointer data)
+pragha_lastfm_scrobble_handler (gpointer data)
{
- PraghaPreferences *preferences;
-
PraghaLastfm *clastfm = data;
- CDEBUG(DBG_INFO, "Updating Lastm depending preferences");
+ CDEBUG(DBG_LASTFM, "Scrobbler Handler");
- preferences = pragha_application_get_preferences (clastfm->pragha);
- if (pragha_preferences_get_lastfm_support (preferences))
- lastfm_now_playing_handler (clastfm);
+ clastfm->scrobble_timeout_id = 0;
+ if (clastfm->status != LASTFM_STATUS_OK) {
+ pragha_lastfm_no_connection_advice ();
+ return FALSE;
+ }
+
+ pragha_async_launch (pragha_lastfm_scrobble_thread,
+ pragha_async_set_idle_message,
+ clastfm);
return FALSE;
}
@@ -1229,8 +1181,11 @@
static void
backend_changed_state_cb (PraghaBackend *backend, GParamSpec *pspec, gpointer user_data)
{
+ PraghaPreferences *preferences;
+ PraghaMusicobject *mobj = NULL;
PraghaMusicType file_type = FILE_NONE;
PraghaBackendState state = 0;
+ gint length = 0, dalay_time = 0;
PraghaLastfm *clastfm = user_data;
@@ -1244,9 +1199,13 @@
/* Update thread. */
- if (clastfm->timeout_id) {
- g_source_remove (clastfm->timeout_id);
- clastfm->timeout_id = 0;
+ if (clastfm->update_timeout_id) {
+ g_source_remove (clastfm->update_timeout_id);
+ clastfm->update_timeout_id = 0;
+ }
+ if (clastfm->scrobble_timeout_id) {
+ g_source_remove (clastfm->scrobble_timeout_id);
+ clastfm->scrobble_timeout_id = 0;
}
if (state != ST_PLAYING) {
@@ -1255,16 +1214,43 @@
return;
}
- file_type = pragha_musicobject_get_file_type (pragha_backend_get_musicobject (backend));
+ /*
+ * Check settings, status, file-type, title, artist and length before update.
+ */
+ preferences = pragha_application_get_preferences (clastfm->pragha);
+ if (!pragha_preferences_get_lastfm_support (preferences))
+ return;
+
+ if (!clastfm->has_user || !clastfm->has_pass)
+ return;
+
+ if (clastfm->status != LASTFM_STATUS_OK)
+ return;
+
+ mobj = pragha_backend_get_musicobject (backend);
+ file_type = pragha_musicobject_get_file_type (mobj);
if (file_type == FILE_NONE || file_type == FILE_HTTP)
return;
- if (clastfm->status == LASTFM_STATUS_OK)
- time(&clastfm->playback_started);
+ length = pragha_musicobject_get_length (mobj);
+ if (length < 30)
+ return;
+
+ if (string_is_empty(pragha_musicobject_get_title(mobj)))
+ return;
+ if (string_is_empty(pragha_musicobject_get_artist(mobj)))
+ return;
- clastfm->timeout_id = g_timeout_add_seconds_full (G_PRIORITY_DEFAULT_IDLE, WAIT_UPDATE,
- update_related_handler, clastfm, NULL);
+ /* Now playing delayed handler */
+ clastfm->update_timeout_id =
+ g_timeout_add_seconds_full (G_PRIORITY_DEFAULT_IDLE, WAIT_UPDATE,
+ pragha_lastfm_now_playing_handler, clastfm, NULL);
+ /* Scrobble delayed handler */
+ dalay_time = ((length / 2) > 240) ? 240 : (length / 2);
+ clastfm->scrobble_timeout_id =
+ g_timeout_add_seconds_full (G_PRIORITY_DEFAULT_IDLE, dalay_time,
+ pragha_lastfm_scrobble_handler, clastfm, NULL);
}
static void
@@ -1425,14 +1411,18 @@
clastfm->session_id = NULL;
clastfm->status = LASTFM_STATUS_INVALID;
- clastfm->nmobj = pragha_musicobject_new();
- pragha_mutex_create (clastfm->nmobj_mutex);
+
+ pragha_mutex_create (clastfm->data_mutex);
+ clastfm->updated_mobj = pragha_musicobject_new ();
+ clastfm->current_mobj = pragha_musicobject_new ();
+
clastfm->ntag_lastfm_button = NULL;
clastfm->has_user = FALSE;
clastfm->has_pass = FALSE;
- clastfm->timeout_id = 0;
+ clastfm->update_timeout_id = 0;
+ clastfm->scrobble_timeout_id = 0;
clastfm->pragha = pragha;
@@ -1461,8 +1451,10 @@
{
pragha_lastfm_disconnect (clastfm);
- g_object_unref(clastfm->nmobj);
- pragha_mutex_free(clastfm->nmobj_mutex);
+ g_object_unref (clastfm->updated_mobj);
+ g_object_unref (clastfm->current_mobj);
+
+ pragha_mutex_free(clastfm->data_mutex);
g_slice_free(PraghaLastfm, clastfm);
}
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/pragha-1.2/src/pragha-playback.c new/pragha-1.2.1/src/pragha-playback.c
--- old/pragha-1.2/src/pragha-playback.c 2014-02-08 21:00:22.000000000 +0100
+++ new/pragha-1.2.1/src/pragha-playback.c 2014-04-30 17:34:33.000000000 +0200
@@ -220,9 +220,6 @@
if (G_UNLIKELY(!mobj))
return;
- if (!pragha_musicobject_is_local_file(mobj))
- return;
-
preferences = pragha_application_get_preferences (pragha);
if (!pragha_preferences_get_show_album_art (preferences))
return;
@@ -233,6 +230,9 @@
pragha_musicobject_get_album(mobj));
if (album_path == NULL) {
+ if (!pragha_musicobject_is_local_file(mobj))
+ return;
+
path = g_path_get_dirname(pragha_musicobject_get_file(mobj));
album_path = get_pref_image_path_dir (preferences, path);
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/pragha-1.2/src/pragha-scanner.c new/pragha-1.2.1/src/pragha-scanner.c
--- old/pragha-1.2/src/pragha-scanner.c 2014-02-08 21:00:22.000000000 +0100
+++ new/pragha-1.2.1/src/pragha-scanner.c 2014-04-30 17:42:41.000000000 +0200
@@ -160,9 +160,9 @@
list = pragha_pl_parser_parse_from_file_by_extension (playlist_file);
#endif
- playlist_id = pragha_database_add_new_playlist (database, playlist);
- if(list) {
- for (i=list; i != NULL; i = i->next) {
+ if (list) {
+ playlist_id = pragha_database_add_new_playlist (database, playlist);
+ for (i = list; i != NULL; i = i->next) {
pragha_database_add_playlist_track (database, playlist_id, i->data);
g_free(i->data);
}
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' old/pragha-1.2/src/pragha-statusicon.c new/pragha-1.2.1/src/pragha-statusicon.c
--- old/pragha-1.2/src/pragha-statusicon.c 2014-02-08 21:00:22.000000000 +0100
+++ new/pragha-1.2.1/src/pragha-statusicon.c 2014-04-30 17:37:13.000000000 +0200
@@ -49,6 +49,7 @@
static void systray_stop_action (GtkAction *action, PraghaStatusIcon *status_icon);
static void systray_prev_action (GtkAction *action, PraghaStatusIcon *status_icon);
static void systray_next_action (GtkAction *action, PraghaStatusIcon *status_icon);
+static void systray_edit_action (GtkAction *action, PraghaStatusIcon *status_icon);
static void systray_quit (GtkAction *action, PraghaStatusIcon *status_icon);
static const gchar *systray_menu_xml =
@@ -88,9 +89,9 @@
"", "Stop", G_CALLBACK(systray_stop_action)},
{"Next", GTK_STOCK_MEDIA_NEXT, N_("Next Track"),
"", "Next Track", G_CALLBACK(systray_next_action)},
- {"Edit tags", GTK_STOCK_EDIT, N_("Edit track information"),
- "", "Edit information of current track", G_CALLBACK(edit_tags_playing_action)},
- {"Quit", GTK_STOCK_QUIT, N_("_Quit"),
+ {"Edit tags", NULL, N_("Edit track information"),
+ "", "Edit information of current track", G_CALLBACK(systray_edit_action)},
+ {"Quit", "application-exit", N_("_Quit"),
"", "Quit", G_CALLBACK(systray_quit)}
};
@@ -234,6 +235,12 @@
}
static void
+systray_edit_action (GtkAction *action, PraghaStatusIcon *status_icon)
+{
+ edit_tags_playing_action (NULL, status_icon->pragha);
+}
+
+static void
systray_quit (GtkAction *action, PraghaStatusIcon *status_icon)
{
pragha_application_quit (status_icon->pragha);
--
To unsubscribe, e-mail: opensuse-commit+unsubscribe@opensuse.org
For additional commands, e-mail: opensuse-commit+help@opensuse.org