Skip to content
This repository has been archived by the owner on Mar 10, 2019. It is now read-only.

Commit

Permalink
Add support for custom RBPlayer implementations. Add Deezer plugin.
Browse files Browse the repository at this point in the history
  • Loading branch information
Martin Ashby committed Jan 22, 2018
1 parent 5f93a66 commit 32e37e9
Show file tree
Hide file tree
Showing 20 changed files with 1,774 additions and 65 deletions.
107 changes: 107 additions & 0 deletions .vscode/c_cpp_properties.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,107 @@
{
"configurations": [
{
"name": "Mac",
"includePath": [
"/usr/include",
"/usr/local/include",
"${workspaceRoot}"
],
"defines": [],
"intelliSenseMode": "clang-x64",
"browse": {
"path": [
"/usr/include",
"/usr/local/include",
"${workspaceRoot}"
],
"limitSymbolsToIncludedHeaders": true,
"databaseFilename": ""
},
"macFrameworkPath": [
"/System/Library/Frameworks",
"/Library/Frameworks"
]
},
{
"name": "Linux",
"includePath": [
"/usr/include/c++/6",
"/usr/include/x86_64-linux-gnu/c++/6",
"/usr/include/c++/6/backward",
"/usr/lib/gcc/x86_64-linux-gnu/6/include",
"/usr/local/include",
"/usr/lib/gcc/x86_64-linux-gnu/6/include-fixed",
"/usr/include/x86_64-linux-gnu",
"/usr/include",
"/usr/include/lirc",
"/usr/include/gstreamer-1.0",
"${workspaceRoot}",
"${workspaceRoot}/backends",
"${workspaceRoot}/rhythmdb",
"${workspaceRoot}/backends/gstreamer",
"/usr/include/libxml2",
"/usr/include/glib-2.0",
"/usr/lib/x86_64-linux-gnu/glib-2.0/include/",
"/usr/include/gdk-pixbuf-2.0",
"/usr/include/gtk-3.0",
"${workspaceRoot}/widgets",
"${workspaceRoot}/lib",
"/usr/include/totem-pl-parser/1/plparser",
"${workspaceRoot}/metadata",
"${workspaceRoot}/sources",
"${workspaceRoot}/podcast",
"/usr/include/pango-1.0",
"/usr/include/cairo",
"/usr/include/atk-1.0",
"${workspaceRoot}/plugins",
"${workspaceRoot}/shell",
"/usr/include/libpeas-1.0",
"/usr/include/gobject-introspection-1.0",
"/usr/include/deezer",
"/usr/include/webkitgtk-4.0",
"/usr/include/libsoup-2.4",
"/usr/include/json-glib-1.0"
],
"defines": [],
"intelliSenseMode": "clang-x64",
"browse": {
"path": [
"/usr/include/c++/6",
"/usr/include/x86_64-linux-gnu/c++/6",
"/usr/include/c++/6/backward",
"/usr/lib/gcc/x86_64-linux-gnu/6/include",
"/usr/local/include",
"/usr/lib/gcc/x86_64-linux-gnu/6/include-fixed",
"/usr/include/x86_64-linux-gnu",
"/usr/include",
"${workspaceRoot}",
"/usr/include/glib-2.0"
],
"limitSymbolsToIncludedHeaders": true,
"databaseFilename": ""
}
},
{
"name": "Win32",
"includePath": [
"C:/Program Files (x86)/Microsoft Visual Studio 14.0/VC/include",
"${workspaceRoot}"
],
"defines": [
"_DEBUG",
"UNICODE"
],
"intelliSenseMode": "msvc-x64",
"browse": {
"path": [
"C:/Program Files (x86)/Microsoft Visual Studio 14.0/VC/include/*",
"${workspaceRoot}"
],
"limitSymbolsToIncludedHeaders": true,
"databaseFilename": ""
}
}
],
"version": 3
}
24 changes: 24 additions & 0 deletions .vscode/settings.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
{
"files.associations": {
"rb-encoder.h": "c",
"rhythmdb.h": "c",
"rb-player.h": "c",
"glib-object.h": "c",
"gtk.h": "c",
"rb-property-view.h": "c",
"gi18n-lib.h": "c",
"glib.h": "c",
"galloca.h": "c",
"gtypes.h": "c",
"deezer-source.h": "c",
"rb-deezer-entry-type.h": "c",
"rhythmdb-entry-type.h": "c",
"rb-deezer-plugin.h": "c",
"deezer-api.h": "c",
"rb-deezer-source.h": "c",
"deezer-player.h": "c",
"deezer-connect.h": "c",
"deezer-track.h": "c",
"json-glib.h": "c"
}
}
24 changes: 24 additions & 0 deletions configure.ac
Original file line number Diff line number Diff line change
Expand Up @@ -621,6 +621,23 @@ if test "x$enable_fm_radio" != xno; then
fi
AM_CONDITIONAL(ENABLE_FM_RADIO, test "x$enable_fm_radio" != xno)

dnl ================================================================
dnl Deezer
dnl ================================================================
AC_MSG_CHECKING([whether deezer support is requested])
have_deezer=no
AC_ARG_ENABLE([deezer],
AC_HELP_STRING([--disable-deezer],[Disable Deezer support]),,
enable_deezer=yes)
if test "x$enable_deezer" != xno; then
PKG_CHECK_MODULES(DEEZER, [deezer, webkit2gtk-4.0],
[have_deezer=yes], [have_deezer=no])
if test "x$have_deezer" = "xno" -a "x$enable_deezer" = "xyes"; then
AC_MSG_ERROR([Deezer plugin support explicitly requested, but library not found])
fi
fi
AM_CONDITIONAL(ENABLE_DEEZER, test "x$have_deezer" != xno)


dnl check, for unit tests
PKG_CHECK_MODULES(CHECK, check, have_check=yes, have_check=no)
Expand Down Expand Up @@ -758,6 +775,7 @@ plugins/notification/Makefile
plugins/grilo/Makefile
plugins/soundcloud/Makefile
plugins/webremote/Makefile
plugins/deezer/Makefile
sample-plugins/Makefile
sample-plugins/sample/Makefile
sample-plugins/sample-python/Makefile
Expand Down Expand Up @@ -846,6 +864,12 @@ else
AC_MSG_NOTICE([ FM radio support disabled])
fi

if test "x$have_deezer" != xno; then
AC_MSG_NOTICE([** Deezer support enabled])
else
AC_MSG_NOTICE([ Deezer support disabled])
fi

if test "x$enable_browser_plugin" != xno; then
AC_MSG_NOTICE([** iTunes detection browser plugin (for podcasts) enabled])
else
Expand Down
4 changes: 4 additions & 0 deletions plugins/Makefile.am
Original file line number Diff line number Diff line change
Expand Up @@ -64,3 +64,7 @@ endif
if USE_GUDEV
SUBDIRS += android
endif

if ENABLE_DEEZER
SUBDIRS += deezer
endif
55 changes: 55 additions & 0 deletions plugins/deezer/Makefile.am
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
# plugin library file called libdeezerpl in order not to conflict with libdeezer.so
# as provided by Deezer SDK. Otherwise build will not work.

plugindir = $(PLUGINDIR)/deezer
plugindatadir = $(PLUGINDATADIR)/deezer
plugin_LTLIBRARIES = libdeezerpl.la

libdeezerpl_la_SOURCES = \
rb-deezer-source.h \
rb-deezer-plugin.h \
rb-deezer-source.c \
rb-deezer-plugin.c \
rb-deezer-player.c \
rb-deezer-player.h \
rb-deezer-entry-type.h \
rb-deezer-entry-type.c \
yuarel.c \
yuarel.h

libdeezerpl_la_LDFLAGS = $(PLUGIN_LIBTOOL_FLAGS)
libdeezerpl_la_LIBTOOLFLAGS = --tag=disable-static
libdeezerpl_la_LIBADD = \
$(top_builddir)/shell/librhythmbox-core.la \
$(DEEZER_LIBS)

AM_CPPFLAGS = \
-Wno-error=unused-function \
-DGNOMELOCALEDIR=\""$(datadir)/locale"\" \
-DG_LOG_DOMAIN=\"Rhythmbox\" \
-I$(top_srcdir) \
-I$(top_srcdir)/lib \
-I$(top_srcdir)/metadata \
-I$(top_srcdir)/rhythmdb \
-I$(top_srcdir)/widgets \
-I$(top_srcdir)/sources \
-I$(top_srcdir)/plugins \
-I$(top_srcdir)/shell \
-I$(top_srcdir)/backends \
-DPIXMAP_DIR=\""$(datadir)/pixmaps"\" \
-DSHARE_DIR=\"$(pkgdatadir)\" \
-DDATADIR=\""$(datadir)"\" \
$(RHYTHMBOX_CFLAGS) \
$(DEEZER_CFLAGS) \
-D_DEFAULT_SOURCE \
-std=c11

plugin_in_files = deezer.plugin.in
%.plugin: %.plugin.in $(INTLTOOL_MERGE) $(wildcard $(top_srcdir)/po/*po) ; $(INTLTOOL_MERGE) $(top_srcdir)/po $< $@ -d -u -c $(top_builddir)/po/.intltool-merge-cache

plugin_DATA = $(plugin_in_files:.plugin.in=.plugin)

EXTRA_DIST = $(plugin_in_files)

CLEANFILES = $(plugin_DATA)
DISTCLEANFILES = $(plugin_DATA)
8 changes: 8 additions & 0 deletions plugins/deezer/deezer.plugin.in
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
[Plugin]
Module=deezerpl
IAge=2
_Name=Deezer
_Description=A plugin to play music from Deezer
Authors=Martin Ashby <[email protected]>
Copyright=Copyright © 2018 Martin Ashby
Website=https://mfashby.net
75 changes: 75 additions & 0 deletions plugins/deezer/rb-deezer-entry-type.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,75 @@
#include "rb-deezer-entry-type.h"

enum {
PROP_DZ_ENTRY_NAME = 1,
N_PROPERTIES
};

struct _RBDeezerEntryType {
RhythmDBEntryType parent;
char* name;
};

static void rb_deezer_entry_type_init(RBDeezerEntryType* entry_type) {}

static void rb_deezer_entry_get_prop(GObject* object,
guint property_id,
GValue* value,
GParamSpec* pspec) {

RBDeezerEntryType* entry = RB_DEEZER_ENTRY_TYPE(object);
switch (property_id) {
case PROP_DZ_ENTRY_NAME:
g_value_set_string(value, entry->name);
break;
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID(object, property_id, pspec);
break;
}
}

static void rb_deezer_entry_set_prop(GObject* object,
guint property_id,
const GValue* value,
GParamSpec* pspec) {
RBDeezerEntryType* entry = RB_DEEZER_ENTRY_TYPE(object);
switch (property_id) {
case PROP_DZ_ENTRY_NAME:
g_free(entry->name);
entry->name = g_value_dup_string(value);
break;
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID(object, property_id, pspec);
break;
}
}

static void rb_deezer_entry_type_class_init(RBDeezerEntryTypeClass* entry_type_cls) {
GObjectClass* cls = G_OBJECT_CLASS(entry_type_cls);
cls->get_property = rb_deezer_entry_get_prop;
cls->set_property = rb_deezer_entry_set_prop;

g_object_class_install_property(cls, PROP_DZ_ENTRY_NAME,
g_param_spec_string(
"name",
"Name",
"Name of the entry type",
"",
G_PARAM_READWRITE | G_PARAM_CONSTRUCT_ONLY
)
);
}

static void rb_deezer_entry_type_class_finalize(RBDeezerEntryTypeClass* entry_type_cls) {

}

G_DEFINE_DYNAMIC_TYPE(
RBDeezerEntryType,
rb_deezer_entry_type,
rhythmdb_entry_type_get_type()
)

void _rb_deezer_entry_type_register_type(GTypeModule* type_module) {
rb_deezer_entry_type_register_type(type_module);
}
16 changes: 16 additions & 0 deletions plugins/deezer/rb-deezer-entry-type.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
#ifndef RB_DEEZER_ENTRY_TYPE_H
#define RB_DEEZER_ENTRY_TYPE_H

#include <glib-object.h>
#include "rhythmdb-entry-type.h"

G_DECLARE_FINAL_TYPE (
RBDeezerEntryType,
rb_deezer_entry_type,
RB, DEEZER_ENTRY_TYPE,
RhythmDBEntryType
);

void _rb_deezer_entry_type_register_type(GTypeModule*);

#endif
Loading

0 comments on commit 32e37e9

Please sign in to comment.