Skip to content

Commit

Permalink
Merged v0.2.4 development branch
Browse files Browse the repository at this point in the history
  • Loading branch information
ebruck committed Oct 18, 2018
1 parent ae51649 commit 6b54d50
Show file tree
Hide file tree
Showing 25 changed files with 161 additions and 141 deletions.
22 changes: 13 additions & 9 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
cmake_minimum_required(VERSION 3.5.1 FATAL_ERROR)
cmake_minimum_required(VERSION 3.10)

project(radiotray-ng CXX)
project(radiotray-ng VERSION 0.2.4 LANGUAGES CXX)

# workaround for Eclipse
if (${CMAKE_EXTRA_GENERATOR} MATCHES "Eclipse CDT4")
Expand All @@ -13,7 +13,7 @@ endif()
# version for user agent creation
set(PROJECT_VERSION_MAJOR 0)
set(PROJECT_VERSION_MINOR 2)
set(PROJECT_VERSION_PATCH 3)
set(PROJECT_VERSION_PATCH 4)
set(PROJECT_VERSION "${PROJECT_VERSION_MAJOR}.${PROJECT_VERSION_MINOR}.${PROJECT_VERSION_PATCH}")

# output dir
Expand Down Expand Up @@ -74,16 +74,18 @@ if (BUILD_TESTS)

ExternalProject_Add(googletest
PREFIX "${CMAKE_CURRENT_BINARY_DIR}/googletest"
GIT_REPOSITORY https://github.com/google/googletest.git
INSTALL_COMMAND ""
GIT_TAG release-1.8.0
GIT_SHALLOW true)
URL https://github.com/google/googletest/archive/release-1.8.1.tar.gz
URL_HASH SHA256=9bf1fe5182a604b4135edc1a425ae356c9ad15e9b23f9f12a02e80184c3a249c
TIMEOUT 30
DOWNLOAD_NO_PROGRESS true
INSTALL_COMMAND "")

ExternalProject_Get_Property(googletest SOURCE_DIR)
include_directories(${SOURCE_DIR}/googlemock/include ${SOURCE_DIR}/googletest/include)
ExternalProject_Get_Property(googletest BINARY_DIR)
link_directories(${BINARY_DIR}/googlemock)
set(GMOCK_BOTH_LIBRARIES gmock_main gmock)
link_directories(${BINARY_DIR}/googlemock ${BINARY_DIR}/googlemock/gtest)
set(GMOCK_BOTH_LIBRARIES gmock_main gmock gtest)
set_property(DIRECTORY PROPERTY CLEAN_NO_CUSTOM "${CMAKE_CURRENT_BINARY_DIR}/googletest")
unset(SOURCE_DIR)
unset(BINARY_DIR)

Expand All @@ -92,6 +94,8 @@ if (BUILD_TESTS)
add_subdirectory(tests/runners/)
endif()

set(BUILD_SHARED_LIBS NO)

add_subdirectory(debian)
add_subdirectory(src/radiotray-ng)
add_subdirectory(src/radiotray-ng/config)
Expand Down
38 changes: 27 additions & 11 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -54,13 +54,6 @@ The version here is what "I" wanted out of RadioTray.
![Screenshot](images/screenshot_5.png)


## Install ##

Download the latest Debian package from the repo's release page.

https://github.com/ebruck/radiotray-ng/releases


## Config File ##

A config (radiotray-ng.json) is created in your ~/.config/radiotray-ng directory with the following defaults:
Expand Down Expand Up @@ -96,7 +89,8 @@ A config (radiotray-ng.json) is created in your ~/.config/radiotray-ng directory
"media-keys-old-dbus-name" : false,
"radiotray-ng-on" : "radiotray-ng-on",
"radiotray-ng-off" : "radiotray-ng-off",
"radiotray-ng-notification" : "radiotray-ng-notification"
"radiotray-ng-notification" : "radiotray-ng-notification",
"root-group-bottom-pos" : true
}
```
* **Installed config will only include commonly edited entries, all others are using default values shown above.**
Expand Down Expand Up @@ -129,6 +123,7 @@ media-key-previous-station: media key to use for previous station within current
radiotray-ng-on: installed theme icon name for "on" or path to image
radiotray-ng-off: installed theme icon name for "off" or path to image
radiotray-ng-notification: installed theme icon name for "notification" or path to image
root-group-bottom-pos: render root group stations at bottom or top of menu
```
* Do not edit the config while Radiotray-NG is running or your changes will be lost.
Expand Down Expand Up @@ -196,6 +191,7 @@ Available commands:
volume_up
volume_down
set_volume 'level'
play
stop
quit
Expand Down Expand Up @@ -224,27 +220,47 @@ $ qdbus com.github.radiotray_ng /com/github/radiotray_ng com.github.radiotray_ng
}
```

## Install ##

Download a release or clone the repo and build the latest Debian package.

https://github.com/ebruck/radiotray-ng/releases


## To Build on Ubuntu: ##

Install these packages:
```
libcurl4-openssl-dev libjsoncpp-dev libxdg-basedir-dev libnotify-dev libboost-filesystem-dev libgstreamer1.0-dev libappindicator3-dev libboost-log-dev libboost-program-options-dev libgtk-3-dev libnotify-dev lsb-release libbsd-dev libncurses5-dev libglibmm-2.4-dev libwxgtk3.0-dev libwxgtk3.0-0v5 cmake
lsb-release libcurl4-openssl-dev libjsoncpp-dev libxdg-basedir-dev libnotify-dev libboost-filesystem-dev libgstreamer1.0-dev libappindicator3-dev libboost-log-dev libboost-program-options-dev libgtk-3-dev libnotify-dev lsb-release libbsd-dev libncurses5-dev libglibmm-2.4-dev libwxgtk3.0-dev libwxgtk3.0-0v5 cmake
```

## Build Radiotray-NG & Debian Package ##
```
$ cmake <path-to-source>/radiotray-ng -DCMAKE_BUILD_TYPE=Release
$ git clone https://github.com/ebruck/radiotray-ng.git
$ cd radiotray-ng
$ mkdir build
$ cd build
$ cmake .. -DCMAKE_BUILD_TYPE=Release
$ make package
$ sudo dpkg -i ./radiotray-ng_x.y.z_<i386|amd64>.deb
$ sudo apt-get install -f
```

## Build Radiotray-NG + Tests & Debian Package ##
```
$ git clone https://github.com/ebruck/radiotray-ng.git
$ cd radiotray-ng
$ mkdir build
$ cd build
$ cmake <path-to-source>/radiotray-ng -DBUILD_TESTS=ON -DCMAKE_BUILD_TYPE=Debug
$ cmake .. -DBUILD_TESTS=ON -DCMAKE_BUILD_TYPE=Debug
$ make package
$ sudo dpkg -i ./radiotray-ng_x.y.z_<i386|amd64>.deb
$ sudo apt-get install -f
```

## To Build on Fedora: ##

Install these packages:
```
redhat-lsb cmake libcurl-devel boost-devel wxGTK3-devel jsoncpp-devel gstreamer1-devel libxdg-basedir-devel libbsd-devel libappindicator-gtk3-devel libnotify-devel glibmm24-devel
```
2 changes: 1 addition & 1 deletion data/bookmarks.json
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,7 @@
{
"image" : null,
"name" : "AM 600",
"url" : "http://206.190.133.196:7013/listen.pls"
"url" : "http://www.conyersradio.net/listen.m3u"
},
{
"image" : null,
Expand Down
Binary file modified data/hicolor/256x256/apps/radiotray-ng-notification.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
6 changes: 6 additions & 0 deletions debian/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,12 @@ set(CPACK_GENERATOR "DEB")
set(CPACK_PACKAGE_FILE_NAME ${CPACK_PACKAGE_NAME}_${PROJECT_VERSION}_${CPACK_DEBIAN_PACKAGE_ARCHITECTURE})
set(CPACK_DEBIAN_PACKAGE_CONTROL_EXTRA ${PROJECT_SOURCE_DIR}/debian/postinst;${PROJECT_SOURCE_DIR}/debian/postrm)

# https://bugs.launchpad.net/ubuntu/+source/curl/+bug/1754294
execute_process(COMMAND lsb_release -r -s OUTPUT_VARIABLE RELEASE OUTPUT_STRIP_TRAILING_WHITESPACE)
if (${RELEASE} STREQUAL "16.04")
string(REPLACE "libcurl4" "libcurl3" CPACK_DEBIAN_PACKAGE_DEPENDS ${CPACK_DEBIAN_PACKAGE_DEPENDS})
endif()

include(CPack)

set(DESTINATION_DIR /usr/share/radiotray-ng)
Expand Down
10 changes: 10 additions & 0 deletions debian/changelog
Original file line number Diff line number Diff line change
@@ -1,3 +1,13 @@
radiotray-ng (0.2.4) unstable; urgency=low

* Added dbus set_volume method
* Added root-group-bottom-pos config option
* Notification icon visibility on light backgrounds improved
* Minor build changes & bug fixes

-- Edward G. Bruck <ed.bruck1@gmail.com> Wed, 17 Oct 2018 21:19:49 -0700


radiotray-ng (0.2.3) unstable; urgency=low

* Fixed playlist line ending type detection
Expand Down
2 changes: 1 addition & 1 deletion debian/copyright
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
Files: *
Copyright: 2017 Edward G. Bruck <ed.bruck1@gmail.com>
Copyright: 2017-2018 Edward G. Bruck <ed.bruck1@gmail.com>
License: GPL+
The full text of the GPL is distributed as in
/usr/share/common-licenses/GPL on Debian systems.
2 changes: 2 additions & 0 deletions include/radiotray-ng/common.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -88,6 +88,7 @@ using playlist_t = std::vector<std::string>;
#define RADIOTRAY_NG_ICON_ON_KEY "radiotray-ng-on"
#define RADIOTRAY_NG_ICON_OFF_KEY "radiotray-ng-off"
#define RADIOTRAY_NG_NOTIFICATION_KEY "radiotray-ng-notification"
#define ROOT_GROUP_BOTTOM_POS_KEY "root-group-bottom-pos"
#define SLEEP_TIMER_KEY "sleep-timer"
#define SPLIT_TITLE_KEY "split-title"
#define IHR_TITLE_KEY "ihr-title"
Expand Down Expand Up @@ -132,6 +133,7 @@ using playlist_t = std::vector<std::string>;
#define DEFAULT_RADIOTRAY_NG_ICON_ON_VALUE "radiotray-ng-on"
#define DEFAULT_RADIOTRAY_NG_ICON_OFF_VALUE "radiotray-ng-off"
#define DEFAULT_RADIOTRAY_NG_NOTIFICATION_VALUE "radiotray-ng-notification"
#define DEFAULT_ROOT_GROUP_BOTTOM_POS_VALUE (true)
#define DEFAULT_MEDIA_KEY_OLD_DBUS_NAME_VALUE (false)
#define DEFAULT_NOTIFICATION_VALUE (true)
#define DEFAULT_NOTIFICATION_VERBOSE_VALUE (true)
Expand Down
2 changes: 2 additions & 0 deletions include/radiotray-ng/i_radiotray_ng.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,8 @@ class IRadioTrayNG

virtual void set_volume(const std::string& volume) = 0;

virtual void set_volume_msg(uint32_t volume) = 0;

virtual void previous_station_msg() = 0;

virtual void next_station_msg() = 0;
Expand Down
2 changes: 1 addition & 1 deletion src/radiotray-ng/bookmarks/bookmarks.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -552,5 +552,5 @@ bool Bookmarks::get_station_notifications(const Json::Value& station)
return station[STATION_NOTIFICATIONS_KEY].asBool();
}

return true;
return DEFAULT_STATION_NOTIFICATION_VALUE;
}
27 changes: 3 additions & 24 deletions src/radiotray-ng/config/config.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,6 @@ Config::Config(const std::string& config_file)

bool Config::load()
{
std::lock_guard<std::mutex> lock(this->config_lock);

LOG(debug) << "loading: " << this->config_file;

try
Expand All @@ -54,8 +52,6 @@ bool Config::load()

bool Config::save()
{
std::lock_guard<std::mutex> lock(this->config_lock);

LOG(debug) << "saving: " << this->config_file;

try
Expand All @@ -75,37 +71,26 @@ bool Config::save()
}


template<typename T>
void Config::private_set_value(const std::string& key, const T& value)
{
std::lock_guard<std::mutex> lock(this->config_lock);

this->config[key] = value;
}


void Config::set_string(const std::string& key, const std::string& value)
{
this->private_set_value(key, value);
this->config[key] = value;
}


void Config::set_uint32(const std::string& key, const uint32_t value)
{
this->private_set_value(key, value);
this->config[key] = value;
}


void Config::set_bool(const std::string& key, const bool value)
{
this->private_set_value(key, value);
this->config[key] = value;
}


std::string Config::get_string(const std::string& key, const std::string& default_value)
{
std::lock_guard<std::mutex> lock(this->config_lock);

if (this->config.isMember(key))
{
return this->config[key].asString();
Expand All @@ -117,8 +102,6 @@ std::string Config::get_string(const std::string& key, const std::string& defaul

uint32_t Config::get_uint32(const std::string& key, const uint32_t default_value)
{
std::lock_guard<std::mutex> lock(this->config_lock);

if (this->config.isMember(key))
{
return this->config[key].asUInt();
Expand All @@ -130,8 +113,6 @@ uint32_t Config::get_uint32(const std::string& key, const uint32_t default_value

bool Config::get_bool(const std::string& key, const bool default_value)
{
std::lock_guard<std::mutex> lock(this->config_lock);

if (this->config.isMember(key))
{
return this->config[key].asBool();
Expand All @@ -143,8 +124,6 @@ bool Config::get_bool(const std::string& key, const bool default_value)

bool Config::exists(const std::string& key)
{
std::lock_guard<std::mutex> lock(this->config_lock);

return this->config.isMember(key);
}

Expand Down
4 changes: 0 additions & 4 deletions src/radiotray-ng/config/config.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@
#include <radiotray-ng/common.hpp>
#include <radiotray-ng/i_config.hpp>
#include <json/json.h>
#include <mutex>


class Config final : public IConfig
Expand Down Expand Up @@ -49,9 +48,6 @@ class Config final : public IConfig
std::string dump();

private:
template<typename T> void private_set_value(const std::string& key, const T& value);

std::mutex config_lock;
const std::string config_file;
Json::Value config;
};
4 changes: 0 additions & 4 deletions src/radiotray-ng/event_bus/event_bus.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,6 @@
bool EventBus::subscribe(const IEventBus::event ev, IEventBus::event_callback_t cb,
const IEventBus::event_pos req_pos)
{
std::lock_guard<std::mutex> lock(this->event_map_lock);

switch(req_pos)
{
case IEventBus::event_pos::first:
Expand Down Expand Up @@ -53,8 +51,6 @@ bool EventBus::subscribe(const IEventBus::event ev, IEventBus::event_callback_t

bool EventBus::publish(const IEventBus::event ev, IEventBus::event_data_t& data)
{
std::lock_guard<std::mutex> lock(this->event_map_lock);

if (this->first_pos_map.count(ev))
{
this->first_pos_map[ev](ev, data);
Expand Down
2 changes: 0 additions & 2 deletions src/radiotray-ng/event_bus/event_bus.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@

#include <radiotray-ng/i_event_bus.hpp>
#include <map>
#include <mutex>
#include <vector>


Expand All @@ -40,5 +39,4 @@ class EventBus final : public IEventBus
event_map_list_t default_pos_map;
event_map_t first_pos_map;
event_map_t last_pos_map;
std::mutex event_map_lock;
};
14 changes: 7 additions & 7 deletions src/radiotray-ng/extras/media_keys/linux/media_keys.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -37,16 +37,16 @@ class media_keys_t
if (this->config->get_bool(MEDIA_KEY_MAPPING_KEY, DEFAULT_MEDIA_KEY_MAPPING_VALUE))
{
this->media_keys[radiotray_ng::to_lower(this->config->get_string(MEDIA_KEY_VOLUME_UP_KEY, DEFAULT_MEDIA_KEY_VOLUME_UP_VALUE))] =
std::bind(&IRadioTrayNG::volume_up_msg, this->radiotray_ng.get());
std::bind(&IRadioTrayNG::volume_up_msg, this->radiotray_ng);

this->media_keys[radiotray_ng::to_lower(this->config->get_string(MEDIA_KEY_VOLUME_DOWN_KEY, DEFAULT_MEDIA_KEY_VOLUME_DOWN_VALUE))] =
std::bind(&IRadioTrayNG::volume_down_msg, this->radiotray_ng.get());
std::bind(&IRadioTrayNG::volume_down_msg, this->radiotray_ng);

this->media_keys[radiotray_ng::to_lower(this->config->get_string(MEDIA_KEY_NEXT_STAITON_KEY, DEFAULT_MEDIA_KEY_NEXT_STATION_VALUE))] =
std::bind(&IRadioTrayNG::next_station_msg, this->radiotray_ng.get());
std::bind(&IRadioTrayNG::next_station_msg, this->radiotray_ng);

this->media_keys[radiotray_ng::to_lower(this->config->get_string(MEDIA_KEY_PREVIOUS_STATION_KEY, DEFAULT_MEDIA_KEY_PREVIOUS_STATION_VALUE))] =
std::bind(&IRadioTrayNG::previous_station_msg, this->radiotray_ng.get());
std::bind(&IRadioTrayNG::previous_station_msg, this->radiotray_ng);

this->log_media_keys();
}
Expand Down Expand Up @@ -179,9 +179,9 @@ void media_keys_t::on_gio_signal(GDBusProxy* /*proxy*/, gchar* /*sender_name*/,

void media_keys_t::gio_start()
{
GError* error{nullptr};
GError* error{nullptr};

LOG(info) << "starting media keys";
LOG(debug) << "starting media keys";

this->dbus_proxy = g_dbus_proxy_new_for_bus_sync(G_BUS_TYPE_SESSION,
GDBusProxyFlags{G_DBUS_PROXY_FLAGS_NONE},
Expand Down Expand Up @@ -215,7 +215,7 @@ void media_keys_t::gio_stop()
{
if (this->dbus_proxy)
{
LOG(info) << "stopping media keys";
LOG(debug) << "stopping media keys";

// cleanup
g_dbus_proxy_call(this->dbus_proxy,
Expand Down
Loading

0 comments on commit 6b54d50

Please sign in to comment.