summaryrefslogtreecommitdiff
path: root/plugins
diff options
context:
space:
mode:
authorGravatar Alexey Yakovenko <wakeroid@gmail.com>2009-11-11 22:10:55 +0100
committerGravatar Alexey Yakovenko <wakeroid@gmail.com>2009-11-11 22:10:55 +0100
commit692ceb95e184f15a91f67bae4dbde565b1287f36 (patch)
tree08300d4f15620ab89cca4b2d50f8c831357a138f /plugins
parent76b5d753192aba0ed20e8eaff81a3c22a7f7025f (diff)
finished moving gtk-related code to plugin
Diffstat (limited to 'plugins')
-rw-r--r--plugins/gtkui/Makefile.am2
-rw-r--r--plugins/gtkui/gtkplaylist.c10
-rw-r--r--plugins/gtkui/gtkui.c141
-rw-r--r--plugins/gtkui/progress.c83
-rw-r--r--plugins/gtkui/progress.h40
-rw-r--r--plugins/gtkui/search.c189
-rw-r--r--plugins/gtkui/search.h31
-rw-r--r--plugins/lastfm/lastfm.c24
-rw-r--r--plugins/vorbis/vorbis.c4
9 files changed, 474 insertions, 50 deletions
diff --git a/plugins/gtkui/Makefile.am b/plugins/gtkui/Makefile.am
index 13ace983..9eba3da8 100644
--- a/plugins/gtkui/Makefile.am
+++ b/plugins/gtkui/Makefile.am
@@ -5,6 +5,8 @@
# callbacks.c interface.c support.c callbacks.h interface.h support.h\
# gtkplaylist.c gtkplaylist.h\
# drawing.h gdkdrawing.c\
+# progress.c progress.h\
+# search.c search.h\
# gtksession.c
#
#
diff --git a/plugins/gtkui/gtkplaylist.c b/plugins/gtkui/gtkplaylist.c
index 65334248..62cfe610 100644
--- a/plugins/gtkui/gtkplaylist.c
+++ b/plugins/gtkui/gtkplaylist.c
@@ -932,14 +932,16 @@ gtkpl_hscroll (gtkplaylist_t *ps, int newscroll) {
void
gtkpl_randomsong (void) {
- p_stop ();
- pl_randomsong ();
+// <deprecated>
+// p_stop ();
+// pl_randomsong ();
}
void
gtkpl_playsongnum (int idx) {
- p_stop ();
- streamer_set_nextsong (idx, 1);
+// <deprecated>
+// p_stop ();
+// streamer_set_nextsong (idx, 1);
}
void
diff --git a/plugins/gtkui/gtkui.c b/plugins/gtkui/gtkui.c
index 32c58e95..ab849882 100644
--- a/plugins/gtkui/gtkui.c
+++ b/plugins/gtkui/gtkui.c
@@ -235,18 +235,6 @@ guiplug_start_current_track (void) {
GDK_THREADS_LEAVE();
}
}
-void
-guiplug_track_changed (int idx) {
- playItem_t *it = pl_get_for_idx (idx);
- if (it) {
- GDK_THREADS_ENTER();
- gtkpl_redraw_pl_row (&main_playlist, idx, it);
- if (it == playlist_current_ptr) {
- gtkpl_current_track_changed (it);
- }
- GDK_THREADS_LEAVE();
- }
-}
void
guiplug_start_track (int idx) {
@@ -256,17 +244,9 @@ guiplug_start_track (int idx) {
}
void
-guiplug_track_paused (int idx) {
- GDK_THREADS_ENTER();
- gtkpl_redraw_pl_row (&main_playlist, idx, pl_get_for_idx (idx));
- GDK_THREADS_LEAVE();
-}
-
-void
guiplug_start_random (void) {
- GDK_THREADS_ENTER();
- gtkpl_randomsong ();
- GDK_THREADS_LEAVE();
+ // <deprecated>
+ assert (0);
}
void
@@ -300,10 +280,8 @@ guiplug_open_files (GSList *files) {
void
guiplug_refresh_playlist (void) {
- GDK_THREADS_ENTER();
- playlist_refresh ();
- search_refresh ();
- GDK_THREADS_LEAVE();
+ // <deprecated>
+ assert (0);
}
void
@@ -311,11 +289,6 @@ guiplug_add_fm_dropped_files (char *files, int p1, int p2) {
gtkpl_add_fm_dropped_files (&main_playlist, (char *)ctx, p1, p2);
}
-void
-guiplug_frameupdate (void) {
- update_songinfo ();
-}
-
static int
gtkui_on_activate (DB_event_t *ev, uintptr_t data) {
GDK_THREADS_ENTER();
@@ -325,14 +298,110 @@ gtkui_on_activate (DB_event_t *ev, uintptr_t data) {
}
static int
-gtkui_on_songchanged (DB_event_song_t *ev, uintptr_t data) {
+gtkui_on_songchanged (DB_event_songchange_t *ev, uintptr_t data) {
gtkpl_songchanged_wrapper (from, to);
}
static int
+gtkui_on_trackinfochanged (DB_event_track_t *ev, uintptr_t data) {
+ GDK_THREADS_ENTER();
+ gtkpl_redraw_pl_row (&main_playlist, ev->index, ev->track);
+ if (ev->track == playlist_current_ptr) {
+ gtkpl_current_track_changed (ev->track);
+ }
+ GDK_THREADS_LEAVE();
+}
+
+static int
+gtkui_on_paused (DB_event_state_t *ev, uintptr_t data) {
+ GDK_THREADS_ENTER();
+ gtkpl_redraw_pl_row (&main_playlist, pl_get_idx_of (playlist_current_ptr), playlist_current_ptr);
+ GDK_THREADS_LEAVE();
+}
+
+static int
+gtkui_on_playlistchanged (DB_event_t *ev, uintptr_t data) {
+ GDK_THREADS_ENTER();
+ playlist_refresh ();
+ search_refresh ();
+ GDK_THREADS_LEAVE();
+}
+
+static int
+gtkui_on_frameupdate (DB_event_t *ev, uintptr_t data) {
+ update_songinfo ();
+}
+
+static int
+gtkui_on_volumechanged (DB_event_t *ev, uintptr_t data) {
+ void volumebar_notify_changed (void); // FIXME: do it properly
+ volumebar_notify_changed ();
+}
+
+static int
gtkui_start (void) {
+ // let's start some gtk
+ g_thread_init (NULL);
+ add_pixmap_directory (PREFIX "/share/deadbeef/pixmaps");
+ gdk_threads_init ();
+ gdk_threads_enter ();
+ gtk_set_locale ();
+ gtk_init (&argc, &argv);
+
+ // system tray icon
+ traymenu = create_traymenu ();
+ GdkPixbuf *trayicon_pixbuf = create_pixbuf ("play_24.png");
+ trayicon = gtk_status_icon_new_from_pixbuf (trayicon_pixbuf);
+ set_tray_tooltip ("DeaDBeeF");
+ //gtk_status_icon_set_title (GTK_STATUS_ICON (trayicon), "DeaDBeeF");
+#if GTK_MINOR_VERSION <= 14
+ g_signal_connect ((gpointer)trayicon, "activate", G_CALLBACK (on_trayicon_activate), NULL);
+#else
+ g_signal_connect ((gpointer)trayicon, "scroll_event", G_CALLBACK (on_trayicon_scroll_event), NULL);
+ g_signal_connect ((gpointer)trayicon, "button_press_event", G_CALLBACK (on_trayicon_button_press_event), NULL);
+#endif
+ g_signal_connect ((gpointer)trayicon, "popup_menu", G_CALLBACK (on_trayicon_popup_menu), NULL);
+
+ gtkpl_init ();
+
+ mainwin = create_mainwin ();
+ GdkPixbuf *mainwin_icon_pixbuf;
+ mainwin_icon_pixbuf = create_pixbuf ("play_24.png");
+ if (mainwin_icon_pixbuf)
+ {
+ gtk_window_set_icon (GTK_WINDOW (mainwin), mainwin_icon_pixbuf);
+ gdk_pixbuf_unref (mainwin_icon_pixbuf);
+ }
+ session_restore_window_attrs ((uintptr_t)mainwin);
+ // order and looping
+ const char *orderwidgets[3] = { "order_linear", "order_shuffle", "order_random" };
+ const char *loopingwidgets[3] = { "loop_all", "loop_disable", "loop_single" };
+ const char *w;
+ w = orderwidgets[conf_get_int ("playback.order", 0)];
+ gtk_check_menu_item_set_active (GTK_CHECK_MENU_ITEM (lookup_widget (mainwin, w)), TRUE);
+ w = loopingwidgets[conf_get_int ("playback.loop", 0)];
+ gtk_check_menu_item_set_active (GTK_CHECK_MENU_ITEM (lookup_widget (mainwin, w)), TRUE);
+ gtk_check_menu_item_set_active (GTK_CHECK_MENU_ITEM (lookup_widget (mainwin, "scroll_follows_playback")), conf_get_int ("playlist.scroll.followplayback", 0) ? TRUE : FALSE);
+
+ searchwin = create_searchwin ();
+ gtk_window_set_transient_for (GTK_WINDOW (searchwin), GTK_WINDOW (mainwin));
+ extern void main_playlist_init (GtkWidget *widget);
+ main_playlist_init (lookup_widget (mainwin, "playlist"));
+ extern void search_playlist_init (GtkWidget *widget);
+ search_playlist_init (lookup_widget (searchwin, "searchlist"));
+
+ progress_init ();
+ gtk_widget_show (mainwin);
+
deadbeef->ev_subscribe (DB_PLUGIN (&plugin), DB_EV_ACTIVATE, DB_CALLBACK (gtkui_on_activate), 0);
deadbeef->ev_subscribe (DB_PLUGIN (&plugin), DB_EV_SONGCHANGED, DB_CALLBACK (gtkui_on_songchanged), 0);
+ deadbeef->ev_subscribe (DB_PLUGIN (&plugin), DB_EV_TRACKINFOCHANGED, DB_CALLBACK (gtkui_on_trackinfochanged), 0);
+ deadbeef->ev_subscribe (DB_PLUGIN (&plugin), DB_EV_PAUSED, DB_CALLBACK (gtkui_on_paused), 0);
+ deadbeef->ev_subscribe (DB_PLUGIN (&plugin), DB_EV_PLAYLISTCHANGED, DB_CALLBACK (gtkui_on_playlistchanged), 0);
+ deadbeef->ev_subscribe (DB_PLUGIN (&plugin), DB_EV_FRAMEUPDATE, DB_CALLBACK (gtkui_on_frameupdate), 0);
+ deadbeef->ev_subscribe (DB_PLUGIN (&plugin), DB_EV_VOLUMECHANGED, DB_CALLBACK (gtkui_on_volumechanged), 0);
+ gtk_main ();
+
return 0;
}
@@ -340,6 +409,14 @@ static int
gtkui_stop (void) {
deadbeef->ev_unsubscribe (DB_PLUGIN (&plugin), DB_EV_ACTIVATE, DB_CALLBACK (gtkui_on_activate), 0);
deadbeef->ev_unsubscribe (DB_PLUGIN (&plugin), DB_EV_SONGCHANGED, DB_CALLBACK (gtkui_on_songchanged), 0);
+ deadbeef->ev_unsubscribe (DB_PLUGIN (&plugin), DB_EV_TRACKINFOCHANGED, DB_CALLBACK (gtkui_on_trackinfochanged), 0);
+ deadbeef->ev_unsubscribe (DB_PLUGIN (&plugin), DB_EV_PAUSED, DB_CALLBACK (gtkui_on_paused), 0);
+ deadbeef->ev_unsubscribe (DB_PLUGIN (&plugin), DB_EV_PLAYLISTCHANGED, DB_CALLBACK (gtkui_on_playlistchanged), 0);
+ deadbeef->ev_unsubscribe (DB_PLUGIN (&plugin), DB_EV_FRAMEUPDATE, DB_CALLBACK (gtkui_on_frameupdate), 0);
+ deadbeef->ev_unsubscribe (DB_PLUGIN (&plugin), DB_EV_VOLUMECHANGED, DB_CALLBACK (gtkui_on_volumechanged), 0);
+ gtkpl_free (&main_playlist);
+ gtkpl_free (&search_playlist);
+ gdk_threads_leave ();
return 0;
}
diff --git a/plugins/gtkui/progress.c b/plugins/gtkui/progress.c
new file mode 100644
index 00000000..4c413dfc
--- /dev/null
+++ b/plugins/gtkui/progress.c
@@ -0,0 +1,83 @@
+/*
+ DeaDBeeF - ultimate music player for GNU/Linux systems with X11
+ Copyright (C) 2009 Alexey Yakovenko
+
+ This program is free software: you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation, either version 2 of the License, or
+ (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program. If not, see <http://www.gnu.org/licenses/>.
+*/
+#include <gtk/gtk.h>
+#include <stdio.h>
+#include <stdint.h>
+#include <string.h>
+#include <stdlib.h>
+#include "interface.h"
+#include "callbacks.h"
+#include "support.h"
+#include "progress.h"
+
+static GtkWidget *progressdlg;
+static GtkWidget *progressitem;
+static int progress_aborted;
+
+void
+progress_init (void) {
+ extern GtkWidget *mainwin;
+ progressdlg = create_addprogress ();
+ gtk_window_set_transient_for (GTK_WINDOW (progressdlg), GTK_WINDOW (mainwin));
+ progressitem = lookup_widget (progressdlg, "progresstitle");
+}
+
+void
+progress_show (void) {
+ progress_aborted = 0;
+ progress_settext ("Initializing...");
+ gtk_widget_show_all (progressdlg);
+ gtk_window_present (GTK_WINDOW (progressdlg));
+}
+
+void
+progress_hide (void) {
+ gtk_widget_hide (progressdlg);
+}
+
+void
+progress_settext (const char *text) {
+ gtk_entry_set_text (GTK_ENTRY (progressitem), text);
+}
+
+void
+progress_abort (void) {
+ progress_aborted = 1;
+}
+
+void
+on_progress_abort (GtkButton *button,
+ gpointer user_data)
+{
+ progress_aborted = 1;
+}
+
+int
+progress_is_aborted (void) {
+ return progress_aborted;
+}
+
+
+gboolean
+on_addprogress_delete_event (GtkWidget *widget,
+ GdkEvent *event,
+ gpointer user_data)
+{
+ progress_aborted = 1;
+ return gtk_widget_hide_on_delete (widget);
+}
diff --git a/plugins/gtkui/progress.h b/plugins/gtkui/progress.h
new file mode 100644
index 00000000..e4de0e8e
--- /dev/null
+++ b/plugins/gtkui/progress.h
@@ -0,0 +1,40 @@
+/*
+ DeaDBeeF - ultimate music player for GNU/Linux systems with X11
+ Copyright (C) 2009 Alexey Yakovenko
+
+ This program is free software: you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation, either version 2 of the License, or
+ (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program. If not, see <http://www.gnu.org/licenses/>.
+*/
+
+#ifndef __PROGRESS_H
+#define __PROGRESS_H
+
+void
+progress_init (void);
+
+void
+progress_show (void);
+
+void
+progress_hide (void);
+
+void
+progress_settext (const char *text);
+
+int
+progress_is_aborted (void);
+
+void
+progress_abort (void);
+
+#endif // __PROGRESS_H
diff --git a/plugins/gtkui/search.c b/plugins/gtkui/search.c
new file mode 100644
index 00000000..1ce99edd
--- /dev/null
+++ b/plugins/gtkui/search.c
@@ -0,0 +1,189 @@
+/*
+ DeaDBeeF - ultimate music player for GNU/Linux systems with X11
+ Copyright (C) 2009 Alexey Yakovenko
+
+ This program is free software: you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation, either version 2 of the License, or
+ (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program. If not, see <http://www.gnu.org/licenses/>.
+*/
+#ifdef HAVE_CONFIG_H
+# include <config.h>
+#endif
+
+#include <gtk/gtk.h>
+#include <gdk/gdkkeysyms.h>
+#include <math.h>
+#include <stdlib.h>
+#include <string.h>
+
+#include "callbacks.h"
+#include "interface.h"
+#include "support.h"
+
+#include "common.h"
+#include "search.h"
+#include "gtkplaylist.h"
+#include "messagepump.h"
+#include "utf8.h"
+#include "deadbeef.h"
+
+extern GtkWidget *searchwin;
+struct playItem_s *search_current = NULL;
+int search_count = 0;
+
+void
+search_start (void) {
+ gtk_entry_set_text (GTK_ENTRY (lookup_widget (searchwin, "searchentry")), "");
+ gtk_widget_show (searchwin);
+ gtk_window_present (GTK_WINDOW (searchwin));
+}
+
+void
+on_searchentry_changed (GtkEditable *editable,
+ gpointer user_data)
+{
+ // final implementation must work in separate thread, and catch up when
+ // value was changed
+ // but for alpha, let's do it in GTK thread
+
+ // walk playlist starting with playlist_head, and populate list starting
+ // with search_head
+
+ const gchar *text = gtk_entry_get_text (GTK_ENTRY (editable));
+
+ playlist_head[PL_SEARCH] = NULL;
+ playlist_tail[PL_SEARCH] = NULL;
+ search_count = 0;
+ if (*text) {
+ for (playItem_t *it = playlist_head[PL_MAIN]; it; it = it->next[PL_MAIN]) {
+ for (metaInfo_t *m = it->meta; m; m = m->next) {
+// if (strcasestr (m->value, text)) {
+ if (utfcasestr (m->value, text)) {
+ // add to list
+ it->next[PL_SEARCH] = NULL;
+ if (playlist_tail[PL_SEARCH]) {
+ playlist_tail[PL_SEARCH]->next[PL_SEARCH] = it;
+ playlist_tail[PL_SEARCH] = it;
+ }
+ else {
+ playlist_head[PL_SEARCH] = playlist_tail[PL_SEARCH] = it;
+ }
+ search_count++;
+ break;
+ }
+ }
+ }
+ }
+
+ extern gtkplaylist_t search_playlist;
+ gtkplaylist_t *ps = &search_playlist;
+ gtkpl_setup_scrollbar (ps);
+ //memset (ps->fmtcache, 0, sizeof (int16_t) * 3 * pl_ncolumns * ps->nvisiblerows);
+ gtkpl_draw_playlist (ps, 0, 0, ps->playlist->allocation.width, ps->playlist->allocation.height);
+ gtkpl_expose (ps, 0, 0, ps->playlist->allocation.width, ps->playlist->allocation.height);
+}
+
+void
+search_refresh (void) {
+ if (searchwin) {
+ on_searchentry_changed (GTK_EDITABLE (lookup_widget (searchwin, "searchentry")), NULL);
+ }
+}
+
+///////// searchwin header handlers
+
+gboolean
+on_searchheader_button_press_event (GtkWidget *widget,
+ GdkEventButton *event,
+ gpointer user_data)
+{
+
+ return FALSE;
+}
+
+
+gboolean
+on_searchheader_button_release_event (GtkWidget *widget,
+ GdkEventButton *event,
+ gpointer user_data)
+{
+
+ return FALSE;
+}
+
+
+gboolean
+on_searchheader_configure_event (GtkWidget *widget,
+ GdkEventConfigure *event,
+ gpointer user_data)
+{
+ return FALSE;
+}
+
+
+gboolean
+on_searchheader_expose_event (GtkWidget *widget,
+ GdkEventExpose *event,
+ gpointer user_data)
+{
+
+ return FALSE;
+}
+
+
+gboolean
+on_searchheader_motion_notify_event (GtkWidget *widget,
+ GdkEventMotion *event,
+ gpointer user_data)
+{
+
+ return FALSE;
+}
+
+
+///////// searchwin playlist navigation and rendering
+
+gboolean
+on_searchwin_key_press_event (GtkWidget *widget,
+ GdkEventKey *event,
+ gpointer user_data)
+{
+ // that's for when user attempts to navigate list while entry has focus
+ if (event->keyval == GDK_Escape) {
+ gtk_widget_hide (widget);
+ }
+ else if (event->keyval == GDK_Return) {
+ extern gtkplaylist_t search_playlist;
+ gtkplaylist_t *ps = &search_playlist;
+ if (search_count > 0) {
+ playItem_t *it = gtkpl_get_for_idx (ps, max (ps->row, 0));
+ if (it) {
+ messagepump_push (M_PLAYSONGNUM, 0, pl_get_idx_of (it), 0);
+ }
+ }
+ }
+ return FALSE;
+}
+
+
+
+gboolean
+on_searchlist_configure_event (GtkWidget *widget,
+ GdkEventConfigure *event,
+ gpointer user_data)
+{
+ GTKPL_PROLOGUE;
+ gtkpl_configure (ps);
+ return FALSE;
+}
+
+
diff --git a/plugins/gtkui/search.h b/plugins/gtkui/search.h
new file mode 100644
index 00000000..32d45e07
--- /dev/null
+++ b/plugins/gtkui/search.h
@@ -0,0 +1,31 @@
+/*
+ DeaDBeeF - ultimate music player for GNU/Linux systems with X11
+ Copyright (C) 2009 Alexey Yakovenko
+
+ This program is free software: you can redistribute it and/or modify
+ it under the terms of the GNU General Public License as published by
+ the Free Software Foundation, either version 2 of the License, or
+ (at your option) any later version.
+
+ This program is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ GNU General Public License for more details.
+
+ You should have received a copy of the GNU General Public License
+ along with this program. If not, see <http://www.gnu.org/licenses/>.
+*/
+#ifndef __SEARCH_H
+#define __SEARCH_H
+
+extern struct playItem_s *search_current;
+extern int search_count;
+
+void
+search_start (void);
+
+// should be called whenever playlist was changed
+void
+search_refresh (void);
+
+#endif // __SEARCH_H
diff --git a/plugins/lastfm/lastfm.c b/plugins/lastfm/lastfm.c
index 776e2bbe..773a8fa3 100644
--- a/plugins/lastfm/lastfm.c
+++ b/plugins/lastfm/lastfm.c
@@ -445,9 +445,9 @@ lfm_format_uri (int subm, DB_playItem_t *song, char *out, int outl) {
}
static int
-lastfm_songstarted (DB_event_song_t *ev, uintptr_t data) {
+lastfm_songstarted (DB_event_track_t *ev, uintptr_t data) {
deadbeef->mutex_lock (lfm_mutex);
- if (lfm_format_uri (-1, ev->song, lfm_nowplaying, sizeof (lfm_nowplaying)) < 0) {
+ if (lfm_format_uri (-1, ev->track, lfm_nowplaying, sizeof (lfm_nowplaying)) < 0) {
lfm_nowplaying[0] = 0;
}
// trace ("%s\n", lfm_nowplaying);
@@ -460,28 +460,28 @@ lastfm_songstarted (DB_event_song_t *ev, uintptr_t data) {
}
static int
-lastfm_songfinished (DB_event_song_t *ev, uintptr_t data) {
+lastfm_songfinished (DB_event_track_t *ev, uintptr_t data) {
trace ("lfm songfinished\n");
#if !LFM_IGNORE_RULES
// check submission rules
// duration must be >= 30 sec
- if (deadbeef->pl_get_item_duration (ev->song) < 30) {
- trace ("song duration is %f seconds. not eligible for submission\n", ev->song->duration);
+ if (deadbeef->pl_get_item_duration (ev->track) < 30) {
+ trace ("track duration is %f seconds. not eligible for submission\n", ev->song->duration);
return 0;
}
// must be played for >=240sec of half the total time
- if (ev->song->playtime < 240 && ev->song->playtime < deadbeef->pl_get_item_duration (ev->song)/2) {
- trace ("song playtime=%f seconds. not eligible for submission\n", ev->song->playtime);
+ if (ev->track->playtime < 240 && ev->track->playtime < deadbeef->pl_get_item_duration (ev->track)/2) {
+ trace ("track playtime=%f seconds. not eligible for submission\n", ev->track->playtime);
return 0;
}
#endif
- if (!deadbeef->pl_find_meta (ev->song, "artist")
- || !deadbeef->pl_find_meta (ev->song, "title")
-// || !deadbeef->pl_find_meta (ev->song, "album")
+ if (!deadbeef->pl_find_meta (ev->track, "artist")
+ || !deadbeef->pl_find_meta (ev->track, "title")
+// || !deadbeef->pl_find_meta (ev->track, "album")
) {
- trace ("lfm: not enough metadata for submission, artist=%s, title=%s, album=%s\n", deadbeef->pl_find_meta (ev->song, "artist"), deadbeef->pl_find_meta (ev->song, "title"), deadbeef->pl_find_meta (ev->song, "album"));
+ trace ("lfm: not enough metadata for submission, artist=%s, title=%s, album=%s\n", deadbeef->pl_find_meta (ev->track, "artist"), deadbeef->pl_find_meta (ev->track, "title"), deadbeef->pl_find_meta (ev->track, "album"));
return 0;
}
deadbeef->mutex_lock (lfm_mutex);
@@ -490,7 +490,7 @@ lastfm_songfinished (DB_event_song_t *ev, uintptr_t data) {
if (!lfm_subm_queue[i]) {
trace ("lfm: song is now in queue for submission\n");
lfm_subm_queue[i] = deadbeef->pl_item_alloc ();
- deadbeef->pl_item_copy (lfm_subm_queue[i], ev->song);
+ deadbeef->pl_item_copy (lfm_subm_queue[i], ev->track);
break;
}
}
diff --git a/plugins/vorbis/vorbis.c b/plugins/vorbis/vorbis.c
index 31e252eb..2a10322c 100644
--- a/plugins/vorbis/vorbis.c
+++ b/plugins/vorbis/vorbis.c
@@ -354,8 +354,8 @@ cvorbis_insert (DB_playItem_t *after, const char *fname) {
}
static int
-vorbis_trackdeleted (DB_event_song_t *ev, uintptr_t data) {
- if (ev->song == ptrack) {
+vorbis_trackdeleted (DB_event_track_t *ev, uintptr_t data) {
+ if (ev->track == ptrack) {
ptrack = NULL;
}
return 0;