From c34a98583ef507115236c1226a5631191748f55a Mon Sep 17 00:00:00 2001 From: Ed Bruck Date: Sun, 7 Jul 2019 10:05:51 -0700 Subject: [PATCH] Merged v0.2.6 development branch --- .circleci/config.yml | 64 +++++ CMakeLists.txt | 4 +- README.md | 44 ++-- cmake/rtng_user_agent.hpp.in | 2 +- cmake/user-agent.cmake | 12 +- data/radiotray-ng.desktop | 2 +- data/rtng-bookmark-editor.desktop | 2 +- .../apps/radiotray-ng-notification.png | Bin 0 -> 6958 bytes .../breeze/apps/22}/radiotray-ng-off.svg | 0 .../breeze/apps/22}/radiotray-ng-on.svg | 0 .../apps/48/radiotray-ng-notification.svg | 185 ++++++++++++++ .../hicolor/24x24/apps/radiotray-ng-off.png | Bin .../hicolor/24x24/apps/radiotray-ng-on.png | Bin .../apps/radiotray-ng-notification.png | Bin .../hicolor/256x256/apps/radiotray-ng-off.png | Bin .../hicolor/256x256/apps/radiotray-ng-on.png | Bin .../apps/24/radiotray-ng-off.svg | 0 .../apps/24/radiotray-ng-on.svg | 0 .../apps/24/radiotray-ng-off.svg | 225 ++++++++++++++++++ .../apps/24/radiotray-ng-on.svg | 224 +++++++++++++++++ debian/CMakeLists.txt | 62 ----- debian/postinst | 9 - debian/postrm | 9 - docker/fedora/30/Dockerfile | 6 + docker/rebuild_and_publish.sh | 15 ++ docker/ubuntu/16.04/Dockerfile | 25 ++ docker/ubuntu/18.04/Dockerfile | 24 ++ docker/ubuntu/19.04/Dockerfile | 24 ++ include/radiotray-ng/common.hpp | 4 + include/radiotray-ng/helpers.hpp | 58 +++-- include/radiotray-ng/i_player.hpp | 6 + include/radiotray-ng/i_radiotray_ng.hpp | 2 + include/radiotray-ng/pidfile.hpp | 10 +- package/CMakeLists.txt | 141 +++++++++++ debian/changelog => package/changelog-deb | 13 + package/changelog-rpm | 96 ++++++++ package/conffiles | 1 + {debian => package}/copyright | 0 package/postinst | 15 ++ package/postrm | 15 ++ src/radiotray-ng/bookmarks/CMakeLists.txt | 1 - src/radiotray-ng/config/CMakeLists.txt | 1 - src/radiotray-ng/config/config.cpp | 2 - src/radiotray-ng/event_bus/CMakeLists.txt | 1 - .../extras/rtng_dbus/rtng_dbus.cpp | 16 +- src/radiotray-ng/extras/scripts/rtng-dbus | 23 +- src/radiotray-ng/extras/scripts/rtng-search | 34 +++ src/radiotray-ng/extras/scripts/rtng2xml | 14 +- .../gui/appindicator/CMakeLists.txt | 1 - src/radiotray-ng/gui/editor/editor_app.cpp | 2 +- src/radiotray-ng/gui/ncurses/CMakeLists.txt | 1 - src/radiotray-ng/main.cpp | 81 ++++--- src/radiotray-ng/notification/CMakeLists.txt | 1 - src/radiotray-ng/player/player.cpp | 32 ++- src/radiotray-ng/player/player.hpp | 6 + src/radiotray-ng/playlist/CMakeLists.txt | 1 - src/radiotray-ng/radiotray_ng.cpp | 39 ++- src/radiotray-ng/radiotray_ng.hpp | 3 + 58 files changed, 1362 insertions(+), 196 deletions(-) create mode 100644 .circleci/config.yml create mode 100644 data/themes/Yaru/256x256/apps/radiotray-ng-notification.png rename data/{ubuntu-mono-light/apps/24 => themes/breeze/apps/22}/radiotray-ng-off.svg (100%) rename data/{ubuntu-mono-light/apps/24 => themes/breeze/apps/22}/radiotray-ng-on.svg (100%) create mode 100644 data/themes/breeze/apps/48/radiotray-ng-notification.svg rename data/{ => themes}/hicolor/24x24/apps/radiotray-ng-off.png (100%) rename data/{ => themes}/hicolor/24x24/apps/radiotray-ng-on.png (100%) rename data/{ => themes}/hicolor/256x256/apps/radiotray-ng-notification.png (100%) rename data/{ => themes}/hicolor/256x256/apps/radiotray-ng-off.png (100%) rename data/{ => themes}/hicolor/256x256/apps/radiotray-ng-on.png (100%) rename data/{ => themes}/ubuntu-mono-dark/apps/24/radiotray-ng-off.svg (100%) rename data/{ => themes}/ubuntu-mono-dark/apps/24/radiotray-ng-on.svg (100%) create mode 100644 data/themes/ubuntu-mono-light/apps/24/radiotray-ng-off.svg create mode 100644 data/themes/ubuntu-mono-light/apps/24/radiotray-ng-on.svg delete mode 100644 debian/CMakeLists.txt delete mode 100755 debian/postinst delete mode 100755 debian/postrm create mode 100644 docker/fedora/30/Dockerfile create mode 100755 docker/rebuild_and_publish.sh create mode 100644 docker/ubuntu/16.04/Dockerfile create mode 100644 docker/ubuntu/18.04/Dockerfile create mode 100644 docker/ubuntu/19.04/Dockerfile create mode 100644 package/CMakeLists.txt rename debian/changelog => package/changelog-deb (91%) create mode 100644 package/changelog-rpm create mode 100644 package/conffiles rename {debian => package}/copyright (100%) create mode 100755 package/postinst create mode 100755 package/postrm create mode 100755 src/radiotray-ng/extras/scripts/rtng-search diff --git a/.circleci/config.yml b/.circleci/config.yml new file mode 100644 index 0000000..9b2fd4a --- /dev/null +++ b/.circleci/config.yml @@ -0,0 +1,64 @@ +commonStepsUbuntu: &commonStepsUbuntu + steps: + # Each step starts in the checked-out source directory. + - checkout + - run: git fetch --tags && git tag + - run: + name: Make project + command: 'mkdir build && cd build && cmake .. -DCMAKE_BUILD_TYPE=Release && make package' + - run: + name: Copy artifacts to tmp + command: 'mkdir /artifacts && cd build && cp *.deb /artifacts' + - store_artifacts: + path: /artifacts + +commonStepsFedora: &commonStepsFedora + steps: + # Each step starts in the checked-out source directory. + - checkout + - run: git fetch --tags && git tag + - run: + name: Make project + command: 'mkdir build && cd build && cmake .. -DCMAKE_BUILD_TYPE=Release -DCPACK_GENERATOR=RPM && make package' + - run: + name: Copy artifacts to tmp + command: 'mkdir /artifacts && cd build && cp *.rpm /artifacts' + - store_artifacts: + path: /artifacts + +version: 2.1 + +jobs: + Ubuntu-16_04-build: + <<: *commonStepsUbuntu + docker: + - image: "radiotrayng/circleci:ubuntu-16.04" + environment: + - CI_OS: linux + Ubuntu-18_04-build: + <<: *commonStepsUbuntu + docker: + - image: "radiotrayng/circleci:ubuntu-18.04" + environment: + - CI_OS: linux + Ubuntu-19_04-build: + <<: *commonStepsUbuntu + docker: + - image: "radiotrayng/circleci:ubuntu-19.04" + environment: + - CI_OS: linux + Fedora-30-build: + <<: *commonStepsFedora + docker: + - image: "radiotrayng/circleci:fedora-30" + environment: + - CI_OS: linux + +workflows: + version: 2 + build: + jobs: + - Ubuntu-16_04-build + - Ubuntu-18_04-build + - Ubuntu-19_04-build + - Fedora-30-build diff --git a/CMakeLists.txt b/CMakeLists.txt index fc1b9de..ddba1be 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -13,7 +13,7 @@ endif() # version for user agent creation set(PROJECT_VERSION_MAJOR 0) set(PROJECT_VERSION_MINOR 2) -set(PROJECT_VERSION_PATCH 5) +set(PROJECT_VERSION_PATCH 6) set(PROJECT_VERSION "${PROJECT_VERSION_MAJOR}.${PROJECT_VERSION_MINOR}.${PROJECT_VERSION_PATCH}") # output dir @@ -96,7 +96,7 @@ endif() set(BUILD_SHARED_LIBS NO) -add_subdirectory(debian) +add_subdirectory(package) add_subdirectory(src/radiotray-ng) add_subdirectory(src/radiotray-ng/config) add_subdirectory(src/radiotray-ng/playlist) diff --git a/README.md b/README.md index 8b5335c..813eb39 100644 --- a/README.md +++ b/README.md @@ -1,4 +1,5 @@ # Radiotray-NG: An Internet radio player for Linux # +[![CircleCI](https://circleci.com/gh/ebruck/radiotray-ng/tree/master.svg?style=shield)](https://circleci.com/gh/ebruck/radiotray-ng/tree/master) It became clear as one of the early contributors to the RadioTray project that it was not getting the attention it required and was probably dead. A lot of the @@ -64,6 +65,7 @@ A config (radiotray-ng.json) is created in your ~/.config/radiotray-ng directory "buffer-size" : 320000, "compact-menu" : false, "debug-logging" : false, + "disable-logging" : false, "file-monitor" : true, "file-monitor-interval" : 10, "invert-menu" : false, @@ -100,6 +102,7 @@ A config (radiotray-ng.json) is created in your ~/.config/radiotray-ng directory buffer-duration: number of seconds to buffer compact-menu : enable/disable the use of menu separators debug-logging: enable/disable verbose debug logging + disable-logging: enable/disable logging file-monitor: enable/disable notifcation of bookmark file changes file-monitor-interval: time in seconds to poll for bookmark file changes invert-menu : menu rendered in reverse order @@ -188,20 +191,21 @@ The editor supports all of the typical editor operations including adding, editi ``` Available commands: - volume_up - volume_down - set_volume 'level' - play - play_url 'url' - stop - quit - previous_station - reload_bookmarks - next_station get_bookmarks get_config get_player_state + play play_station 'group' 'station' + play_url 'url' + previous_station + next_station + reload_bookmarks + set_volume 'level' + volume_down + volume_up + mute + stop + quit ``` ``` Example: @@ -213,9 +217,11 @@ $ qdbus com.github.radiotray_ng /com/github/radiotray_ng com.github.radiotray_ng "codec" : "MPEG-1 Layer 3 (MP3)", "group" : "Old Time Radio", "image" : "radiotray-ng-notification", + "mute" : false, "state" : "playing", "station" : "AM 1710 Antioch OTR", "title" : "Jul 15, 1948: Summer Night w/Ida Lupino", + "url" : "http://radio.macinmind.com/listen.m3u", "volume" : "15" } ``` @@ -242,7 +248,7 @@ $ mkdir build $ cd build $ cmake .. -DCMAKE_BUILD_TYPE=Release $ make package -$ sudo dpkg -i ./radiotray-ng_x.y.z_.deb +$ sudo dpkg -i ./radiotray-ng_x.y.z__.deb $ sudo apt-get install -f ``` @@ -254,7 +260,7 @@ $ mkdir build $ cd build $ cmake .. -DBUILD_TESTS=ON -DCMAKE_BUILD_TYPE=Debug $ make package -$ sudo dpkg -i ./radiotray-ng_x.y.z_.deb +$ sudo dpkg -i ./radiotray-ng_x.y.z__.deb $ sudo apt-get install -f ``` @@ -262,7 +268,17 @@ $ sudo apt-get install -f 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 +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 rpm-build +``` + +``` +$ git clone https://github.com/ebruck/radiotray-ng.git +$ cd radiotray-ng +$ mkdir build +$ cd build +$ cmake .. -DCMAKE_BUILD_TYPE=Release +$ make package +$ sudo dnf install ./radiotray-ng_x.y.z__.rpm ``` -### Thank you JetBrains for providing a free open source license for [CLion](https://www.jetbrains.com/clion/). +### Thank you JetBrains for providing a free open source license for [CLion](https://www.jetbrains.com/clion/). diff --git a/cmake/rtng_user_agent.hpp.in b/cmake/rtng_user_agent.hpp.in index 9172f11..ffed097 100644 --- a/cmake/rtng_user_agent.hpp.in +++ b/cmake/rtng_user_agent.hpp.in @@ -1,4 +1,4 @@ -// Copyright 2017 Edward G. Bruck +// Copyright 2019 Edward G. Bruck // // This file is part of Radiotray-NG. // diff --git a/cmake/user-agent.cmake b/cmake/user-agent.cmake index 1681129..293e18c 100644 --- a/cmake/user-agent.cmake +++ b/cmake/user-agent.cmake @@ -11,7 +11,7 @@ else() set(USER_AGENT_DISTRO_CODENAME "El Capitan") execute_process(COMMAND sw_vers -productVersion OUTPUT_VARIABLE USER_AGENT_DISTRO_RELEASE OUTPUT_STRIP_TRAILING_WHITESPACE) else() - message(FATAL_ERROR "lsb_release not found!") + message(AUTHOR_WARNING "lsb_release not found!") endif() endif() @@ -27,10 +27,16 @@ if (NOT RTNG_GIT_VERSION) set(RTNG_GIT_VERSION "v${PROJECT_VERSION}-unknown") endif() -set(RTNG_USER_AGENT "${CMAKE_PROJECT_NAME}/${PROJECT_VERSION} (${CMAKE_SYSTEM_NAME} ${CMAKE_SYSTEM_PROCESSOR}; ${USER_AGENT_DISTRO}/${USER_AGENT_DISTRO_RELEASE} (${USER_AGENT_DISTRO_CODENAME}))") +if (USER_AGENT_DISTRO AND USER_AGENT_DISTRO_RELEASE AND USER_AGENT_DISTRO_CODENAME) + set(RTNG_USER_AGENT "${CMAKE_PROJECT_NAME}/${PROJECT_VERSION} (${CMAKE_SYSTEM_NAME} ${CMAKE_SYSTEM_PROCESSOR}; ${USER_AGENT_DISTRO}/${USER_AGENT_DISTRO_RELEASE} (${USER_AGENT_DISTRO_CODENAME}))") +else() + set(RTNG_USER_AGENT "${CMAKE_PROJECT_NAME}/${PROJECT_VERSION} (${CMAKE_SYSTEM_NAME} ${CMAKE_SYSTEM_PROCESSOR}; Uknown))") +endif() + + configure_file(${PROJECT_SOURCE_DIR}/cmake/rtng_user_agent.hpp.in ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/rtng_user_agent.hpp.tmp) execute_process(COMMAND ${CMAKE_COMMAND} -E copy_if_different ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/rtng_user_agent.hpp.tmp ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/rtng_user_agent.hpp) execute_process(COMMAND ${CMAKE_COMMAND} -E remove ${CMAKE_RUNTIME_OUTPUT_DIRECTORY}/rtng_user_agent.hpp.tmp) -#message(STATUS "user-agent: ${RTNG_USER_AGENT}") +# message(STATUS "user-agent: ${RTNG_USER_AGENT}") diff --git a/data/radiotray-ng.desktop b/data/radiotray-ng.desktop index 4424558..8308efa 100644 --- a/data/radiotray-ng.desktop +++ b/data/radiotray-ng.desktop @@ -3,7 +3,7 @@ Categories=AudioVideo;Audio;Player;GTK; Comment=Internet Radio Player for Linux Exec=/usr/bin/radiotray-ng Hidden=false -Icon=radiotray-ng-notification +Icon=/usr/share/icons/hicolor/256x256/apps/radiotray-ng-notification.png Name=Radiotray-NG StartupNotify=false Terminal=false diff --git a/data/rtng-bookmark-editor.desktop b/data/rtng-bookmark-editor.desktop index d0d6b55..8bd4d19 100644 --- a/data/rtng-bookmark-editor.desktop +++ b/data/rtng-bookmark-editor.desktop @@ -3,7 +3,7 @@ Categories=AudioVideo;Audio;Player;GTK; Comment=Bookmark editor for Radiotray-NG Exec=/usr/bin/rtng-bookmark-editor Hidden=false -Icon=radiotray-ng-notification +Icon=/usr/share/icons/hicolor/256x256/apps/radiotray-ng-notification.png Name=Radiotray-NG Bookmark Editor StartupNotify=false Terminal=false diff --git a/data/themes/Yaru/256x256/apps/radiotray-ng-notification.png b/data/themes/Yaru/256x256/apps/radiotray-ng-notification.png new file mode 100644 index 0000000000000000000000000000000000000000..42729b685f6f16cef17ab441b11da66bb4aeef7b GIT binary patch literal 6958 zcmZW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#Ob?IOR^0o~{HWfN-)s+9RdTzwb6(VaD zmUEMsnQ;Qt#MJ)InIJTa`q(KvWSM$JD?+z2=bTkgu_D6sxQfBk{0jw6G|)!CT@-I% d1i8W!2tx6dl}7=!z#m{BZ4G_(N>#h?{{SMym + + + + + + + image/svg+xml + + + + + + + + + diff --git a/data/hicolor/24x24/apps/radiotray-ng-off.png b/data/themes/hicolor/24x24/apps/radiotray-ng-off.png similarity index 100% rename from data/hicolor/24x24/apps/radiotray-ng-off.png rename to data/themes/hicolor/24x24/apps/radiotray-ng-off.png diff --git a/data/hicolor/24x24/apps/radiotray-ng-on.png b/data/themes/hicolor/24x24/apps/radiotray-ng-on.png similarity index 100% rename from data/hicolor/24x24/apps/radiotray-ng-on.png rename to data/themes/hicolor/24x24/apps/radiotray-ng-on.png diff --git a/data/hicolor/256x256/apps/radiotray-ng-notification.png b/data/themes/hicolor/256x256/apps/radiotray-ng-notification.png similarity index 100% rename from data/hicolor/256x256/apps/radiotray-ng-notification.png rename to data/themes/hicolor/256x256/apps/radiotray-ng-notification.png diff --git a/data/hicolor/256x256/apps/radiotray-ng-off.png b/data/themes/hicolor/256x256/apps/radiotray-ng-off.png similarity index 100% rename from data/hicolor/256x256/apps/radiotray-ng-off.png rename to data/themes/hicolor/256x256/apps/radiotray-ng-off.png diff --git a/data/hicolor/256x256/apps/radiotray-ng-on.png b/data/themes/hicolor/256x256/apps/radiotray-ng-on.png similarity index 100% rename from data/hicolor/256x256/apps/radiotray-ng-on.png rename to data/themes/hicolor/256x256/apps/radiotray-ng-on.png diff --git a/data/ubuntu-mono-dark/apps/24/radiotray-ng-off.svg b/data/themes/ubuntu-mono-dark/apps/24/radiotray-ng-off.svg similarity index 100% rename from data/ubuntu-mono-dark/apps/24/radiotray-ng-off.svg rename to data/themes/ubuntu-mono-dark/apps/24/radiotray-ng-off.svg diff --git a/data/ubuntu-mono-dark/apps/24/radiotray-ng-on.svg b/data/themes/ubuntu-mono-dark/apps/24/radiotray-ng-on.svg similarity index 100% rename from data/ubuntu-mono-dark/apps/24/radiotray-ng-on.svg rename to data/themes/ubuntu-mono-dark/apps/24/radiotray-ng-on.svg diff --git a/data/themes/ubuntu-mono-light/apps/24/radiotray-ng-off.svg b/data/themes/ubuntu-mono-light/apps/24/radiotray-ng-off.svg new file mode 100644 index 0000000..59b9b2f --- /dev/null +++ b/data/themes/ubuntu-mono-light/apps/24/radiotray-ng-off.svg @@ -0,0 +1,225 @@ + + + + + + + + image/svg+xml + + + + + + + + + diff --git a/data/themes/ubuntu-mono-light/apps/24/radiotray-ng-on.svg b/data/themes/ubuntu-mono-light/apps/24/radiotray-ng-on.svg new file mode 100644 index 0000000..9240a7b --- /dev/null +++ b/data/themes/ubuntu-mono-light/apps/24/radiotray-ng-on.svg @@ -0,0 +1,224 @@ + + + + + + + + image/svg+xml + + + + + + + + + diff --git a/debian/CMakeLists.txt b/debian/CMakeLists.txt deleted file mode 100644 index 56778a0..0000000 --- a/debian/CMakeLists.txt +++ /dev/null @@ -1,62 +0,0 @@ -message( "Building version: ${PROJECT_VERSION}..." ) - -set(BOOST_DEB_VERSION "${Boost_MAJOR_VERSION}.${Boost_MINOR_VERSION}.${Boost_SUBMINOR_VERSION}") - -set(CPACK_PACKAGE_VENDOR "Edward G. Bruck") -set(CPACK_PACKAGE_CONTACT "ed.bruck1@gmail.com") -set(CPACK_PACKAGE_DESCRIPTION_SUMMARY "Simple Internet Radio Player\n Radiotray-NG runs in the system tray allowing you to\n select and play configured radio stations.") -set(CPACK_PACKAGE_NAME "radiotray-ng") -set(CPACK_PACKAGE_VERSION ${PROJECT_VERSION}) -set(CPACK_PACKAGE_VERSION_MAJOR ${PROJECT_VERSION_MAJOR}) -set(CPACK_PACKAGE_VERSION_MINOR ${PROJECT_VERSION_MINOR}) -set(CPACK_PACKAGE_VERSION_PATCH ${PROJECT_VERSION_PATCH}) -set(CPACK_DEBIAN_PACKAGE_SECTION "sound") -set(CPACK_DEBIAN_COMPRESSION_TYPE "xz") - -if (${CMAKE_SIZEOF_VOID_P} EQUAL 4) - set(CPACK_SYSTEM_NAME "i386") - set(CPACK_DEBIAN_PACKAGE_ARCHITECTURE "i386") -else() - set(CPACK_SYSTEM_NAME "amd64") - set(CPACK_DEBIAN_PACKAGE_ARCHITECTURE "amd64") -endif() - -set(CPACK_DEBIAN_PACKAGE_PRIORITY "optional") -set(CPACK_DEBIAN_PACKAGE_MAINTAINER "Edward G. Bruck ") -set(CPACK_DEBIAN_PACKAGE_DEPENDS "libc6, libbsd0, libcurl4, libjsoncpp1, libxdg-basedir1, libnotify4, python2.7, python-lxml, libglibmm-2.4-1v5, libboost-filesystem${BOOST_DEB_VERSION}, libboost-system${BOOST_DEB_VERSION}, libboost-log${BOOST_DEB_VERSION}, libboost-thread${BOOST_DEB_VERSION}, libboost-program-options${BOOST_DEB_VERSION}, libgstreamer1.0-0, libappindicator3-1, gstreamer1.0-plugins-good, gstreamer1.0-plugins-bad, gstreamer1.0-plugins-ugly, libwxgtk3.0-0v5") -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) - -# no libcurl4 on Debian Stretch -execute_process(COMMAND lsb_release -c -s OUTPUT_VARIABLE CODENAME OUTPUT_STRIP_TRAILING_WHITESPACE) -# 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" OR ${CODENAME} STREQUAL "stretch") - string(REPLACE "libcurl4" "libcurl3" CPACK_DEBIAN_PACKAGE_DEPENDS ${CPACK_DEBIAN_PACKAGE_DEPENDS}) -endif() - -include(CPack) - -set(DESTINATION_DIR /usr/share/radiotray-ng) - -execute_process(COMMAND gzip -n -9 -c "${PROJECT_SOURCE_DIR}/debian/changelog" WORKING_DIRECTORY ${PROJECT_BINARY_DIR} OUTPUT_FILE "${PROJECT_BINARY_DIR}/changelog.Debian.gz") - -# for 16.04 -execute_process(COMMAND chmod 755 ${PROJECT_SOURCE_DIR}/debian/postinst) -execute_process(COMMAND chmod 755 ${PROJECT_SOURCE_DIR}/debian/postrm) - -install(DIRECTORY "${PROJECT_SOURCE_DIR}/data/hicolor/256x256/apps/" DESTINATION "/usr/share/icons/hicolor/256x256/apps" FILES_MATCHING PATTERN "*.png") -install(DIRECTORY "${PROJECT_SOURCE_DIR}/data/hicolor/24x24/apps/" DESTINATION "/usr/share/icons/hicolor/24x24/apps" FILES_MATCHING PATTERN "*.png") -install(DIRECTORY "${PROJECT_SOURCE_DIR}/data/ubuntu-mono-dark/apps/24/" DESTINATION "/usr/share/icons/ubuntu-mono-dark/apps/24" FILES_MATCHING PATTERN "*.svg") -install(DIRECTORY "${PROJECT_SOURCE_DIR}/data/ubuntu-mono-light/apps/24/" DESTINATION "/usr/share/icons/ubuntu-mono-light/apps/24" FILES_MATCHING PATTERN "*.svg") -install(FILES "${PROJECT_SOURCE_DIR}/data/about/radiotray-ng.png" DESTINATION ${DESTINATION_DIR}) -install(FILES "${PROJECT_SOURCE_DIR}/data/bookmarks.json" DESTINATION ${DESTINATION_DIR}) -install(PROGRAMS "${PROJECT_SOURCE_DIR}/src/radiotray-ng/extras/scripts/rt2rtng" DESTINATION "/usr/bin/") -install(PROGRAMS "${PROJECT_BINARY_DIR}/radiotray-ng" DESTINATION "/usr/bin/") -install(PROGRAMS "${PROJECT_BINARY_DIR}/rtng-bookmark-editor" DESTINATION "/usr/bin/") -install(FILES "${PROJECT_SOURCE_DIR}/data/radiotray-ng.desktop" DESTINATION "/usr/share/applications/") -install(FILES "${PROJECT_SOURCE_DIR}/data/rtng-bookmark-editor.desktop" DESTINATION "/usr/share/applications/") -install(FILES "${PROJECT_SOURCE_DIR}/data/radiotray-ng.appdata.xml" DESTINATION "/usr/share/metainfo/") -install(FILES "${PROJECT_SOURCE_DIR}/debian/copyright" DESTINATION "/usr/share/doc/${CPACK_PACKAGE_NAME}") -install(FILES "${PROJECT_BINARY_DIR}/changelog.Debian.gz" DESTINATION "/usr/share/doc/${CPACK_PACKAGE_NAME}") diff --git a/debian/postinst b/debian/postinst deleted file mode 100755 index d55ae2e..0000000 --- a/debian/postinst +++ /dev/null @@ -1,9 +0,0 @@ -#!/bin/sh - -set -e - -gtk-update-icon-cache -f -t -q /usr/share/icons/hicolor/ -gtk-update-icon-cache -f -t -q /usr/share/icons/ubuntu-mono-dark/ -gtk-update-icon-cache -f -t -q /usr/share/icons/ubuntu-mono-light/ - -cp -f /usr/share/applications/radiotray-ng.desktop /etc/xdg/autostart/ diff --git a/debian/postrm b/debian/postrm deleted file mode 100755 index 7ad42c5..0000000 --- a/debian/postrm +++ /dev/null @@ -1,9 +0,0 @@ -#!/bin/sh - -set -e - -gtk-update-icon-cache -f -t -q /usr/share/icons/hicolor/ -gtk-update-icon-cache -f -t -q /usr/share/icons/ubuntu-mono-dark/ -gtk-update-icon-cache -f -t -q /usr/share/icons/ubuntu-mono-light/ - -rm -f /etc/xdg/autostart/radiotray-ng.desktop diff --git a/docker/fedora/30/Dockerfile b/docker/fedora/30/Dockerfile new file mode 100644 index 0000000..47131da --- /dev/null +++ b/docker/fedora/30/Dockerfile @@ -0,0 +1,6 @@ +FROM fedora:30 + +RUN set -ex; \ + dnf -y update \ + && dnf -y install git openssh-clients rpm-build 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 \ + && dnf clean all diff --git a/docker/rebuild_and_publish.sh b/docker/rebuild_and_publish.sh new file mode 100755 index 0000000..898564f --- /dev/null +++ b/docker/rebuild_and_publish.sh @@ -0,0 +1,15 @@ +#!/bin/bash + +set -xe + +docker build -t radiotrayng/circleci:ubuntu-16.04 - ; #define DBUS_MSG_TITLE_KEY "title" #define DBUS_MSG_ARTIST_KEY "artist" #define DBUS_MSG_STATION_KEY "station" +#define DBUS_MSG_URL_KEY "url" #define DBUS_MSG_GROUP_KEY "group" #define DBUS_MSG_CODEC_KEY "codec" #define DBUS_MSG_BITRATE_KEY "bitrate" +#define DBUS_MSG_MUTE_KEY "mute" #define DBUS_MSG_IMAGE_KEY "image" // http codes @@ -69,6 +71,7 @@ using playlist_t = std::vector; #define BUFFER_DURATION_KEY "buffer-duration" #define COMPACT_MENU_KEY "compact-menu" #define DEBUG_LOGGING_KEY "debug-logging" +#define DISABLE_LOGGING_KEY "disable-logging" #define FILE_MONITOR_KEY "file-monitor" #define FILE_MONITOR_INTERVAL_KEY "file-monitor-interval" #define HTTP_TIMEOUT_KEY "http-timeout" @@ -120,6 +123,7 @@ using playlist_t = std::vector; #define DEFAULT_BOOKMARK_EDITOR "rtng-bookmark-editor" #define DEFAULT_COMPACT_MENU_VALUE (false) #define DEFAULT_DEBUG_LOGGING_VALUE (false) +#define DEFAULT_DISABLE_LOGGING_VALUE (false) #define DEFAULT_FILE_MONITOR_VALUE (true) #define DEFAULT_FILE_MONITOR_INTERVAL_VALUE (10) #define DEFAULT_HTTP_TIMEOUT_VALUE (15) diff --git a/include/radiotray-ng/helpers.hpp b/include/radiotray-ng/helpers.hpp index ad4e587..cdc71f5 100644 --- a/include/radiotray-ng/helpers.hpp +++ b/include/radiotray-ng/helpers.hpp @@ -53,16 +53,20 @@ namespace radiotray_ng inline std::string word_expand(const std::string& s) { - std::string tmp; - if (!s.empty()) { - wordexp_t exp_result; - wordexp(s.c_str(), &exp_result, 0); - tmp = exp_result.we_wordv[0]; - wordfree(&exp_result); + // any spaces then we can't use wordexp... + if (s.find(' ') == std::string::npos) + { + std::string tmp; + wordexp_t exp_result; + wordexp(s.c_str(), &exp_result, 0); + tmp = exp_result.we_wordv[0]; + wordfree(&exp_result); + return tmp; + } } - return tmp; + return s; } @@ -98,29 +102,41 @@ namespace radiotray_ng } - inline std::string to_upper_copy(std::string s) + inline std::string get_data_dir(const std::string& app_name) { - std::transform(s.begin(), s.end(), s.begin(), ::toupper); - return s; + std::string xdg_data_home_dir = xdgConfigHome(nullptr); + xdg_data_home_dir += std::string("/") + app_name + std::string("/"); + return xdg_data_home_dir; } - inline void load_string_file(const std::string& p, std::string& str) + inline std::string get_cache_dir(const std::string& app_name) { - std::ifstream file; - file.exceptions(std::ifstream::failbit | std::ifstream::badbit); - file.open(p, std::ios_base::binary); - std::size_t sz = static_cast(boost::filesystem::file_size(p)); - str.resize(sz, '\0'); - file.read(&str[0], sz); + std::string xdg_cache_home_dir = xdgCacheHome(nullptr); + xdg_cache_home_dir += std::string("/") + app_name + std::string("/"); + return xdg_cache_home_dir; } - inline std::string get_data_dir(const std::string& app_name) + inline std::string get_runtime_dir() { - std::string xdg_data_home_dir = xdgConfigHome(nullptr); - xdg_data_home_dir += std::string("/") + app_name + std::string("/"); - return xdg_data_home_dir; + xdgHandle xdg_handle; + std::string runtime_dir; + + if (xdgInitHandle(&xdg_handle)) + { + // https://bugs.launchpad.net/ubuntu/+source/libxdg-basedir/+bug/1821670 + // Not sure why non-cached call uses XDG_RUNTIME_DIRECTORY environment + // variable instead of XDG_RUNTIME_DIR... + auto xdg_runtime_dir = xdgRuntimeDirectory(&xdg_handle); + if (xdg_runtime_dir) + { + runtime_dir = xdg_runtime_dir; + } + xdgWipeHandle(&xdg_handle); + } + + return runtime_dir; } diff --git a/include/radiotray-ng/i_player.hpp b/include/radiotray-ng/i_player.hpp index 62d8e5b..5ccdb3d 100644 --- a/include/radiotray-ng/i_player.hpp +++ b/include/radiotray-ng/i_player.hpp @@ -29,4 +29,10 @@ class IPlayer virtual void stop() = 0; virtual void volume(uint32_t percent) = 0; + + virtual void mute() = 0; + + virtual void unmute() = 0; + + virtual bool is_muted() = 0; }; diff --git a/include/radiotray-ng/i_radiotray_ng.hpp b/include/radiotray-ng/i_radiotray_ng.hpp index 4c924b1..a44295e 100644 --- a/include/radiotray-ng/i_radiotray_ng.hpp +++ b/include/radiotray-ng/i_radiotray_ng.hpp @@ -31,6 +31,8 @@ class IRadioTrayNG virtual void play() = 0; + virtual void mute() = 0; + virtual void volume_up() = 0; virtual void volume_up_msg() = 0; diff --git a/include/radiotray-ng/pidfile.hpp b/include/radiotray-ng/pidfile.hpp index c3f43ff..2aaef2b 100644 --- a/include/radiotray-ng/pidfile.hpp +++ b/include/radiotray-ng/pidfile.hpp @@ -35,7 +35,15 @@ namespace radiotray_ng : pfh(nullptr) , already_running(false) { - std::string pid_file{radiotray_ng::get_data_dir(app_name) + "/" + app_name + ".pid"}; + std::string base_dir{radiotray_ng::get_runtime_dir()}; + + // fallback to config dir? + if (base_dir.empty()) + { + base_dir = radiotray_ng::get_data_dir(app_name); + } + + std::string pid_file{base_dir + "/" + app_name + ".pid"}; pid_t otherpid; this->pfh = pidfile_open(pid_file.c_str(), 0600, &otherpid); diff --git a/package/CMakeLists.txt b/package/CMakeLists.txt new file mode 100644 index 0000000..7c48e86 --- /dev/null +++ b/package/CMakeLists.txt @@ -0,0 +1,141 @@ +# gather system info... +find_program(LSB_RELEASE_EXECUTABLE NAMES lsb_release) + +if (LSB_RELEASE_EXECUTABLE) + execute_process(COMMAND lsb_release -c -s OUTPUT_VARIABLE CODENAME OUTPUT_STRIP_TRAILING_WHITESPACE) + execute_process(COMMAND lsb_release -i -s OUTPUT_VARIABLE DISTRIBUTOR_ID OUTPUT_STRIP_TRAILING_WHITESPACE) + execute_process(COMMAND lsb_release -r -s OUTPUT_VARIABLE RELEASE OUTPUT_STRIP_TRAILING_WHITESPACE) + + # default to debian... + string(TOLOWER ${DISTRIBUTOR_ID} DISTRIBUTOR_ID) + if (NOT CPACK_GENERATOR) + if (DISTRIBUTOR_ID STREQUAL "fedora") + set(CPACK_GENERATOR "RPM") + else() + set(CPACK_GENERATOR "DEB") + endif() + endif() + + message( "Building version: ${PROJECT_VERSION} for ${DISTRIBUTOR_ID} ${RELEASE} -- ${CPACK_GENERATOR} packaging..." ) + + set(CPACK_PACKAGE_VENDOR "Edward G. Bruck") + set(CPACK_PACKAGE_CONTACT "ed.bruck1@gmail.com") + set(CPACK_PACKAGE_NAME "radiotray-ng") + set(CPACK_PACKAGE_VERSION ${PROJECT_VERSION}) + set(CPACK_PACKAGE_VERSION_MAJOR ${PROJECT_VERSION_MAJOR}) + set(CPACK_PACKAGE_VERSION_MINOR ${PROJECT_VERSION_MINOR}) + set(CPACK_PACKAGE_VERSION_PATCH ${PROJECT_VERSION_PATCH}) + set(CPACK_PACKAGE_RELOCATABLE FALSE) + set(DESTINATION_DIR /usr/share/radiotray-ng/) + + if (${CMAKE_SIZEOF_VOID_P} EQUAL 4) + set(CPACK_SYSTEM_NAME "i386") + else() + if (DISTRIBUTOR_ID STREQUAL "fedora") + set(CPACK_SYSTEM_NAME "x86_64") + else() + set(CPACK_SYSTEM_NAME "amd64") + endif() + endif() + + set(CPACK_PACKAGE_FILE_NAME ${CPACK_PACKAGE_NAME}_${PROJECT_VERSION}_${DISTRIBUTOR_ID}_${RELEASE}_${CPACK_SYSTEM_NAME}) + + if (CPACK_GENERATOR MATCHES "DEB") + set(CPACK_PACKAGE_DESCRIPTION_SUMMARY "Simple Internet Radio Player\n Radiotray-NG runs in the system tray allowing you to\n select and play configured radio stations.") + set(BOOST_DEB_VERSION "${Boost_MAJOR_VERSION}.${Boost_MINOR_VERSION}.${Boost_SUBMINOR_VERSION}") + set(CPACK_DEBIAN_PACKAGE_SECTION "sound") + set(CPACK_DEBIAN_COMPRESSION_TYPE "xz") + set(CPACK_DEBIAN_PACKAGE_ARCHITECTURE ${CPACK_SYSTEM_NAME}) + set(CPACK_DEBIAN_PACKAGE_PRIORITY "optional") + set(CPACK_DEBIAN_PACKAGE_MAINTAINER "Edward G. Bruck ") + set(CPACK_DEBIAN_PACKAGE_DEPENDS "libc6, libbsd0, libcurl4, libjsoncpp1, libxdg-basedir1, libnotify4, python2.7, python-lxml, libglibmm-2.4-1v5, libboost-filesystem${BOOST_DEB_VERSION}, libboost-system${BOOST_DEB_VERSION}, libboost-log${BOOST_DEB_VERSION}, libboost-thread${BOOST_DEB_VERSION}, libboost-program-options${BOOST_DEB_VERSION}, libgstreamer1.0-0, libappindicator3-1, gstreamer1.0-plugins-good, gstreamer1.0-plugins-bad, gstreamer1.0-plugins-ugly, libwxgtk3.0-0v5") + set(CPACK_DEBIAN_PACKAGE_CONTROL_EXTRA ${PROJECT_SOURCE_DIR}/package/postinst;${PROJECT_SOURCE_DIR}/package/postrm;${PROJECT_SOURCE_DIR}/package/conffiles) + + # no libcurl4 on Debian Stretch + # https://bugs.launchpad.net/ubuntu/+source/curl/+bug/1754294 + if (${RELEASE} STREQUAL "16.04" OR ${CODENAME} STREQUAL "stretch") + string(REPLACE "libcurl4" "libcurl3" CPACK_DEBIAN_PACKAGE_DEPENDS ${CPACK_DEBIAN_PACKAGE_DEPENDS}) + endif() + + execute_process(COMMAND gzip -n -9 -c "${PROJECT_SOURCE_DIR}/package/changelog-deb" WORKING_DIRECTORY ${PROJECT_BINARY_DIR} OUTPUT_FILE "${PROJECT_BINARY_DIR}/changelog.Debian.gz") + + # for 16.04 + execute_process(COMMAND chmod 755 ${PROJECT_SOURCE_DIR}/package/postinst) + execute_process(COMMAND chmod 755 ${PROJECT_SOURCE_DIR}/package/postrm) + execute_process(COMMAND chmod 644 ${PROJECT_SOURCE_DIR}/package/conffiles) + + install(DIRECTORY ${PROJECT_SOURCE_DIR}/data/themes/ubuntu-mono-dark/apps/24/ DESTINATION /usr/share/icons/ubuntu-mono-dark/apps/24 FILES_MATCHING PATTERN *.svg) + install(DIRECTORY ${PROJECT_SOURCE_DIR}/data/themes/ubuntu-mono-light/apps/24/ DESTINATION /usr/share/icons/ubuntu-mono-light/apps/24 FILES_MATCHING PATTERN *.svg) + install(FILES ${PROJECT_SOURCE_DIR}/package/copyright DESTINATION /usr/share/doc/${CPACK_PACKAGE_NAME}) + install(FILES ${PROJECT_BINARY_DIR}/changelog.Debian.gz DESTINATION /usr/share/doc/${CPACK_PACKAGE_NAME}) + endif() + + if (CPACK_GENERATOR MATCHES "RPM") + set(CPACK_PACKAGE_DESCRIPTION_SUMMARY "Simple Internet Radio Player. Radiotray-NG runs in the system tray allowing you to select and play configured radio stations.") + set(CPACK_RPM_PACKAGE_URL "https://www.github.com/ebruck/radiotray-ng") + set(CPACK_RPM_PACKAGE_REQUIRES "glibc, libcurl, jsoncpp, boost, libxdg-basedir, libbsd, libappindicator-gtk3, libnotify, glibmm24, python2-lxml, gstreamer-plugins-base, gstreamer-plugins-good, gstreamer-plugins-bad-free, wxGTK3") + set(CPACK_RPM_PACKAGE_GROUP "Applications/Multimedia") + set(CPACK_RPM_PACKAGE_LICENSE "GPLv3") + set(CPACK_RPM_COMPRESSION_TYPE "xz") + set(CPACK_RPM_POST_INSTALL_SCRIPT_FILE ${PROJECT_SOURCE_DIR}/package/postinst) + set(CPACK_RPM_POST_UNINSTALL_SCRIPT_FILE ${PROJECT_SOURCE_DIR}/package/postrm) + + install(FILES ${PROJECT_SOURCE_DIR}/README.md DESTINATION /usr/share/doc/${CPACK_PACKAGE_NAME}) + install(FILES ${PROJECT_SOURCE_DIR}/AUTHORS DESTINATION /usr/share/doc/${CPACK_PACKAGE_NAME}) + install(FILES ${PROJECT_SOURCE_DIR}/COPYING DESTINATION /usr/share/licences/${CPACK_PACKAGE_NAME}) + + list(APPEND CPACK_RPM_EXCLUDE_FROM_AUTO_FILELIST_ADDITION /usr/share/applications) + list(APPEND CPACK_RPM_EXCLUDE_FROM_AUTO_FILELIST_ADDITION /usr/share/metainfo) + list(APPEND CPACK_RPM_EXCLUDE_FROM_AUTO_FILELIST_ADDITION /usr/share/licences) + list(APPEND CPACK_RPM_EXCLUDE_FROM_AUTO_FILELIST_ADDITION /usr/share/icons) + list(APPEND CPACK_RPM_EXCLUDE_FROM_AUTO_FILELIST_ADDITION /usr/share/icons/hicolor) + list(APPEND CPACK_RPM_EXCLUDE_FROM_AUTO_FILELIST_ADDITION /usr/share/icons/hicolor/24x24) + list(APPEND CPACK_RPM_EXCLUDE_FROM_AUTO_FILELIST_ADDITION /usr/share/icons/hicolor/24x24/apps) + list(APPEND CPACK_RPM_EXCLUDE_FROM_AUTO_FILELIST_ADDITION /usr/share/icons/hicolor/256x256) + list(APPEND CPACK_RPM_EXCLUDE_FROM_AUTO_FILELIST_ADDITION /usr/share/icons/hicolor/256x256/apps) + list(APPEND CPACK_RPM_EXCLUDE_FROM_AUTO_FILELIST_ADDITION /usr/share/icons/breeze) + list(APPEND CPACK_RPM_EXCLUDE_FROM_AUTO_FILELIST_ADDITION /usr/share/icons/breeze/apps) + list(APPEND CPACK_RPM_EXCLUDE_FROM_AUTO_FILELIST_ADDITION /usr/share/icons/breeze/apps/22) + list(APPEND CPACK_RPM_EXCLUDE_FROM_AUTO_FILELIST_ADDITION /usr/share/icons/breeze/apps/48) + list(APPEND CPACK_RPM_EXCLUDE_FROM_AUTO_FILELIST_ADDITION /usr/share/icons/Yaru) + list(APPEND CPACK_RPM_EXCLUDE_FROM_AUTO_FILELIST_ADDITION /usr/share/icons/Yaru/256x256) + list(APPEND CPACK_RPM_EXCLUDE_FROM_AUTO_FILELIST_ADDITION /usr/share/icons/Yaru/256x256/apps) + list(APPEND CPACK_RPM_EXCLUDE_FROM_AUTO_FILELIST_ADDITION /etc/xdg) + list(APPEND CPACK_RPM_EXCLUDE_FROM_AUTO_FILELIST_ADDITION /etc/xdg/autostart) + + set(CPACK_RPM_CHANGELOG_FILE ${PROJECT_SOURCE_DIR}/package/changelog-rpm) + endif() + + install(FILES ${PROJECT_SOURCE_DIR}/data/themes/hicolor/256x256/apps/radiotray-ng-on.png + ${PROJECT_SOURCE_DIR}/data/themes/hicolor/256x256/apps/radiotray-ng-off.png + ${PROJECT_SOURCE_DIR}/data/themes/hicolor/256x256/apps/radiotray-ng-notification.png + DESTINATION /usr/share/icons/hicolor/256x256/apps) + + install(FILES ${PROJECT_SOURCE_DIR}/data/themes/hicolor/24x24/apps/radiotray-ng-on.png + ${PROJECT_SOURCE_DIR}/data/themes/hicolor/24x24/apps/radiotray-ng-off.png + DESTINATION /usr/share/icons/hicolor/24x24/apps) + + install(FILES ${PROJECT_SOURCE_DIR}/data/themes/Yaru/256x256/apps/radiotray-ng-notification.png + DESTINATION /usr/share/icons/Yaru/256x256/apps) + + install(FILES ${PROJECT_SOURCE_DIR}/data/themes/breeze/apps/22/radiotray-ng-on.svg + ${PROJECT_SOURCE_DIR}/data/themes/breeze/apps/22/radiotray-ng-off.svg + DESTINATION /usr/share/icons/breeze/apps/22) + + install(FILES ${PROJECT_SOURCE_DIR}/data/themes/breeze/apps/48/radiotray-ng-notification.svg + DESTINATION /usr/share/icons/breeze/apps/48) + + install(FILES ${PROJECT_SOURCE_DIR}/data/about/radiotray-ng.png DESTINATION ${DESTINATION_DIR}) + install(FILES ${PROJECT_SOURCE_DIR}/data/bookmarks.json DESTINATION ${DESTINATION_DIR}) + install(FILES ${PROJECT_SOURCE_DIR}/data/radiotray-ng.desktop DESTINATION /usr/share/applications/) + install(FILES ${PROJECT_SOURCE_DIR}/data/rtng-bookmark-editor.desktop DESTINATION /usr/share/applications/) + install(FILES ${PROJECT_SOURCE_DIR}/data/radiotray-ng.appdata.xml DESTINATION /usr/share/metainfo/) + install(FILES ${PROJECT_SOURCE_DIR}/data/radiotray-ng.desktop DESTINATION /etc/xdg/autostart/) + install(PROGRAMS ${PROJECT_SOURCE_DIR}/src/radiotray-ng/extras/scripts/rt2rtng DESTINATION /usr/bin/) + install(PROGRAMS ${PROJECT_BINARY_DIR}/radiotray-ng DESTINATION /usr/bin/) + install(PROGRAMS ${PROJECT_BINARY_DIR}/rtng-bookmark-editor DESTINATION /usr/bin/) + + include(CPack) +else() + message(AUTHOR_WARNING "lsb_release not found! -- packaging disabled") +endif() diff --git a/debian/changelog b/package/changelog-deb similarity index 91% rename from debian/changelog rename to package/changelog-deb index 1073feb..a29321f 100644 --- a/debian/changelog +++ b/package/changelog-deb @@ -1,3 +1,16 @@ +radiotray-ng (0.2.6) unstable; urgency=low + + * Added disable-logging config option + * Added Yaru & Breeze icons + * Log & pid files now written to standard xdg locations + * RPM packaging + * get_player_state dbus now includes url information + * Added dbus mute method + * Minor build changes & bug fixes + + -- Edward G. Bruck Sun, 07 Jul 2019 09:30:14 -0700 + + radiotray-ng (0.2.5) unstable; urgency=low * Updated & added new stations diff --git a/package/changelog-rpm b/package/changelog-rpm new file mode 100644 index 0000000..0c6b0ac --- /dev/null +++ b/package/changelog-rpm @@ -0,0 +1,96 @@ +* Sun Jul 07 2019 Edward G. Bruck - 0.2.6 +- Added disable-logging config option +- Added Yaru & Breeze icons +- Log & pid files now written to standard xdg locations +- RPM packaging +- get_player_state dbus now includes url information +- Added dbus mute method +- Minor build changes & bug fixes + +* Fri Mar 15 2019 Edward G. Bruck - 0.2.5 +- Updated & added new stations +- Added dbus play_url method +- Added initial m3u8 support +- Various dbus & editor bug fixes +- Added rtng-dbus & rtng2xml scripts + +* Wed Oct 17 2018 Edward G. Bruck - 0.2.4 +- Added dbus set_volume method +- Added root-group-bottom-pos config option +- Notification icon visibility on light backgrounds improved +- Minor build changes & bug fixes + +* Fri Jul 13 2018 Edward G. Bruck - 0.2.3 +- Fixed playlist line ending type detection +- Added wrap-track-info & wrap-track-info-len config options +- Better handling of text/uri-list & text/html playlists +- Minor build changes + +* Tue Apr 24 2018 Edward G. Bruck - 0.2.2 +- Added copying title & artist to clipboard config option +- Added per station notification option & editor support +- Added dbus reload_bookmarks & quit methods +- Minor build changes + +* Sat Feb 17 2018 Edward G. Bruck - 0.2.1 +- Fixed editor group & station reordering +- Added BUILD_TESTS cmake option +- Added dbus get_config method + +* Sat Dec 30 2017 Edward G. Bruck - 0.2.0 +- Added contributed Bookmark Editor (Thanks Mike!) +- Added iHeartRadio tag parsing +- Added buffer-duration config option +- Fixed jsoncpp build warnings breaking Arch builds +- Minor bug fixes + +* Sat Oct 07 2017 Edward G. Bruck - 0.1.8 +- Added icon middle click support for starting/stopping playback +- Added command line help etc. +- Added invert-menu configuration option for bottom dock users +- Added Bluegrass station to default bookmark file +- Fixed wrong api used for menu separators +- Fixed output not using autoaudiosink +- Reduced notifications if player buffers + +* Sat Sep 02 2017 Edward G. Bruck - 0.1.7 +- Added dbus interface +- Added --play option for resuming playback on startup +- Added optional notification of external bookmark file changes +- Updated to libappindicator3 + +* Wed Jun 28 2017 Edward G. Bruck - 0.1.6 +- new icon config overrides +- sleep timer dialog added +- support for gnome-settings-daemon media key api changes +- added Fedora build instructions + +* Sat Apr 22 2017 Edward G. Bruck - 0.1.5 +- Fixed startup crash seen on some systems using gcc 6.x +- Added compact-menu option to disable the use of menu separators +- Removed ncurses requirement if appindicator library is found +- Notification uses station name if artist tag is missing +- Smarter boost dependency detection +- Added rt2rtng script for converting RadioTray bookmarks +- Fixed user-agent and release build issues +- Logging & aboutbox now include git commit used to generate binary +- Added optional mapping of media keys for previous/next station etc + +* Thu Feb 23 2017 Edward G. Bruck - 0.1.4 +- Disabling notifications prevented stopping of player +- Fixed lintian package errors + +* Sat Feb 18 2017 Edward G. Bruck - 0.1.3 +- Support building on 32bit architectures +- Added 24x24 icons and pid file to prevent multiple instances from + running + +* Wed Feb 15 2017 Edward G. Bruck - 0.1.2 +- Fixed gdk threading not being initialized before calling gtk_init +- Don't overwrite bad bookmarks file on startup + +* Sun Feb 12 2017 Edward G. Bruck - 0.1.1 +- Fixed word_wrap infinite loop + +* Sat Feb 11 2017 Edward G. Bruck - 0.1.0 +- Initial release. diff --git a/package/conffiles b/package/conffiles new file mode 100644 index 0000000..143a47e --- /dev/null +++ b/package/conffiles @@ -0,0 +1 @@ +/etc/xdg/autostart/radiotray-ng.desktop diff --git a/debian/copyright b/package/copyright similarity index 100% rename from debian/copyright rename to package/copyright diff --git a/package/postinst b/package/postinst new file mode 100755 index 0000000..24f2e82 --- /dev/null +++ b/package/postinst @@ -0,0 +1,15 @@ +#!/bin/sh + +set -e + +gtk-update-icon-cache -f -t -q /usr/share/icons/breeze/ +gtk-update-icon-cache -f -t -q /usr/share/icons/hicolor/ +gtk-update-icon-cache -f -t -q /usr/share/icons/Yaru/ + +if [ -d "/usr/share/icons/ubuntu-mono-light" ]; then + gtk-update-icon-cache -f -t -q /usr/share/icons/ubuntu-mono-light/ +fi + +if [ -d "/usr/share/icons/ubuntu-mono-dark" ]; then + gtk-update-icon-cache -f -t -q /usr/share/icons/ubuntu-mono-dark/ +fi diff --git a/package/postrm b/package/postrm new file mode 100755 index 0000000..24f2e82 --- /dev/null +++ b/package/postrm @@ -0,0 +1,15 @@ +#!/bin/sh + +set -e + +gtk-update-icon-cache -f -t -q /usr/share/icons/breeze/ +gtk-update-icon-cache -f -t -q /usr/share/icons/hicolor/ +gtk-update-icon-cache -f -t -q /usr/share/icons/Yaru/ + +if [ -d "/usr/share/icons/ubuntu-mono-light" ]; then + gtk-update-icon-cache -f -t -q /usr/share/icons/ubuntu-mono-light/ +fi + +if [ -d "/usr/share/icons/ubuntu-mono-dark" ]; then + gtk-update-icon-cache -f -t -q /usr/share/icons/ubuntu-mono-dark/ +fi diff --git a/src/radiotray-ng/bookmarks/CMakeLists.txt b/src/radiotray-ng/bookmarks/CMakeLists.txt index e3051fa..4466a08 100644 --- a/src/radiotray-ng/bookmarks/CMakeLists.txt +++ b/src/radiotray-ng/bookmarks/CMakeLists.txt @@ -1,2 +1 @@ add_library(bookmarks STATIC bookmarks.cpp bookmarks.hpp) -target_link_libraries(bookmarks) diff --git a/src/radiotray-ng/config/CMakeLists.txt b/src/radiotray-ng/config/CMakeLists.txt index 9a94a4f..99ffb18 100644 --- a/src/radiotray-ng/config/CMakeLists.txt +++ b/src/radiotray-ng/config/CMakeLists.txt @@ -1,2 +1 @@ add_library(config STATIC config.cpp config.hpp) -target_link_libraries(config) diff --git a/src/radiotray-ng/config/config.cpp b/src/radiotray-ng/config/config.cpp index 6547856..96973d8 100644 --- a/src/radiotray-ng/config/config.cpp +++ b/src/radiotray-ng/config/config.cpp @@ -26,8 +26,6 @@ Config::Config(const std::string& config_file) bool Config::load() { - LOG(debug) << "loading: " << this->config_file; - try { std::ifstream ifile(this->config_file); diff --git a/src/radiotray-ng/event_bus/CMakeLists.txt b/src/radiotray-ng/event_bus/CMakeLists.txt index 9d8d14d..fe366fc 100644 --- a/src/radiotray-ng/event_bus/CMakeLists.txt +++ b/src/radiotray-ng/event_bus/CMakeLists.txt @@ -1,2 +1 @@ add_library(event_bus STATIC event_bus.cpp event_bus.hpp) -target_link_libraries(event_bus) diff --git a/src/radiotray-ng/extras/rtng_dbus/rtng_dbus.cpp b/src/radiotray-ng/extras/rtng_dbus/rtng_dbus.cpp index c556c90..7f7bb71 100644 --- a/src/radiotray-ng/extras/rtng_dbus/rtng_dbus.cpp +++ b/src/radiotray-ng/extras/rtng_dbus/rtng_dbus.cpp @@ -32,7 +32,9 @@ namespace " " " " " " - " " + " " + " " + " " " " " " " " @@ -104,6 +106,13 @@ void RtngDbus::on_method_call(const Glib::RefPtr& /*conne return; } + if (method_name == "mute") + { + this->radiotray_ng->mute(); + invocation->return_value(Glib::VariantContainerBase()); + return; + } + if (method_name == "stop") { if (this->radiotray_ng->get_state() != STATE_STOPPED) @@ -265,7 +274,10 @@ void RtngDbus::dbus_setup() Gio::DBus::SlotNameAcquired(), [this](const Glib::RefPtr& connection, const Glib::ustring&) { - connection->unregister_object(this->registered_id); + if (connection) + { + connection->unregister_object(this->registered_id); + } }); } diff --git a/src/radiotray-ng/extras/scripts/rtng-dbus b/src/radiotray-ng/extras/scripts/rtng-dbus index 42aeee8..bbfca23 100755 --- a/src/radiotray-ng/extras/scripts/rtng-dbus +++ b/src/radiotray-ng/extras/scripts/rtng-dbus @@ -1,5 +1,5 @@ #!/bin/bash -# + # Copyright 2019 Edward G. Bruck # # This file is part of Radiotray-NG. @@ -26,6 +26,7 @@ # get_bookmarks # get_config # get_player_state +# mute # next_station # play # play_station 'group' 'station' @@ -38,21 +39,19 @@ # volume_down # volume_up -QDBUS=/usr/bin/qdbus -DESKTOP=gnome-shell - -PID=$(pgrep -u $(whoami) $DESKTOP -x) - -if [ ! -z "${PID}" ]; then - if [ "$#" -gt 0 ]; then +if [ "$#" -gt 0 ]; then + if [ -z "${DBUS_SESSION_BUS_ADDRESS}" ]; then export $(dbus-launch) + DBUS_SESSION_BUS_ADDRESS=unix:path=/run/user/$(id -u)/bus + fi + + QDBUS_CMD="qdbus com.github.radiotray_ng /com/github/radiotray_ng com.github.radiotray_ng.$1" - DBUS_SESSION_BUS_ADDRESS=$(cat /proc/$PID/environ | tr '\0' '\n' | awk -FDBUS_SESSION_BUS_ADDRESS= '/DBUS_SESSION_BUS_ADDRESS=/ {print $2}') - QDBUS_CMD="$QDBUS com.github.radiotray_ng /com/github/radiotray_ng com.github.radiotray_ng.$1" + for arg in "${@:2}"; do ARGS="$ARGS '$arg'"; done - for arg in "${@:2}"; do ARGS="$ARGS '$arg'"; done + eval $QDBUS_CMD $ARGS - eval $QDBUS_CMD $ARGS + if [ ! -z "${DBUS_SESSION_BUS_PID}" ]; then kill $DBUS_SESSION_BUS_PID fi fi diff --git a/src/radiotray-ng/extras/scripts/rtng-search b/src/radiotray-ng/extras/scripts/rtng-search new file mode 100755 index 0000000..21febab --- /dev/null +++ b/src/radiotray-ng/extras/scripts/rtng-search @@ -0,0 +1,34 @@ +#!/usr/bin/env python3 +# +# Copyright 2019 Edward G. Bruck +# +# This file is part of Radiotray-NG. +# +# Radiotray-NG 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 3 of the License, or +# (at your option) any later version. +# +# Radiotray-NG 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 Radiotray-NG. If not, see . + +import dbus +import json +import os +import urllib.parse + +try: + radiotray_ng = dbus.SessionBus().get_object('com.github.radiotray_ng', '/com/github/radiotray_ng') + player_state = json.loads(radiotray_ng.get_dbus_method('get_player_state', 'com.github.radiotray_ng')()) + + if player_state['state'] == "playing": + if len(player_state['artist']) or len(player_state['title']): + os.system('xdg-open http://www.google.com/search?q=' + + urllib.parse.quote(player_state['artist'] + ', ' + player_state['title']) + ' > /dev/null 2>&1') +except Exception as msg: + print(msg) diff --git a/src/radiotray-ng/extras/scripts/rtng2xml b/src/radiotray-ng/extras/scripts/rtng2xml index 1a9add2..2fefb24 100755 --- a/src/radiotray-ng/extras/scripts/rtng2xml +++ b/src/radiotray-ng/extras/scripts/rtng2xml @@ -21,6 +21,7 @@ import json import os +import re import sys from xml.sax.saxutils import escape @@ -43,7 +44,8 @@ def generate_xml_playlist(bookmarks): playlist_xml += '\t\t\tName{}\n'.format(escape(station['name'])) playlist_xml += '\t\t\tKindInternet audio stream\n' playlist_xml += '\t\t\tTrack TypeURL\n' - playlist_xml += '\t\t\tLocation{}\n'.format(escape(station['url'])) + playlist_xml += '\t\t\tLocation{}\n'.format( + escape(re.sub('^http', 'itals', station['url']) if station['url'].endswith('.m3u8') else station['url'])) playlist_xml += '\t\t\n' playlist_xml += '\t\n' @@ -57,7 +59,7 @@ def generate_xml_playlist(bookmarks): playlist_xml += '\t\tDescriptionRadiotray-NG\n' playlist_xml += '\t\tPlaylist Items\n' playlist_xml += '\t\t\n' - for station in group["stations"]: + for _ in range(len(group['stations'])): track_id += 1 playlist_xml += '\t\t\t\n' playlist_xml += '\t\t\t\tTrack ID{}\n'.format(track_id) @@ -72,12 +74,12 @@ def generate_xml_playlist(bookmarks): return playlist_xml -if __name__ == "__main__": +if __name__ == '__main__': if len(sys.argv) != 2: - print("usage: rtng2xml ") + print('usage: rtng2xml ') exit(1) if os.path.exists(sys.argv[1]): - print(generate_xml_playlist(json.load(open(sys.argv[1]))).expandtabs(4)) + print(generate_xml_playlist(json.load(open(sys.argv[1])))) else: - print(sys.argv[1], "not found!") + print(sys.argv[1], 'not found!') diff --git a/src/radiotray-ng/gui/appindicator/CMakeLists.txt b/src/radiotray-ng/gui/appindicator/CMakeLists.txt index e508257..6e6b125 100644 --- a/src/radiotray-ng/gui/appindicator/CMakeLists.txt +++ b/src/radiotray-ng/gui/appindicator/CMakeLists.txt @@ -1,6 +1,5 @@ add_library(appindicator_gui STATIC appindicator_gui.cpp appindicator_gui.hpp) add_dependencies(appindicator_gui user-agent) -target_link_libraries(appindicator_gui) target_compile_definitions(appindicator_gui PRIVATE APPINDICATOR_GUI) target_include_directories(appindicator_gui SYSTEM PRIVATE ${APPINDICATOR_INCLUDE_DIRS}) diff --git a/src/radiotray-ng/gui/editor/editor_app.cpp b/src/radiotray-ng/gui/editor/editor_app.cpp index 848c37d..c670524 100644 --- a/src/radiotray-ng/gui/editor/editor_app.cpp +++ b/src/radiotray-ng/gui/editor/editor_app.cpp @@ -65,7 +65,7 @@ EditorApp::OnCmdLineParsed(wxCmdLineParser& parser) bool EditorApp::OnInit() { - this->instance_checker = std::make_unique(APPLICATION_PID_NAME, radiotray_ng::get_data_dir(APP_NAME)); + this->instance_checker = std::make_unique(APPLICATION_PID_NAME, radiotray_ng::get_runtime_dir()); if (this->instance_checker->IsAnotherRunning()) { wxLogError(_("Another instance is already running, aborting.")); diff --git a/src/radiotray-ng/gui/ncurses/CMakeLists.txt b/src/radiotray-ng/gui/ncurses/CMakeLists.txt index d5fb34c..ae13978 100644 --- a/src/radiotray-ng/gui/ncurses/CMakeLists.txt +++ b/src/radiotray-ng/gui/ncurses/CMakeLists.txt @@ -1,2 +1 @@ add_library(ncurses_gui STATIC ncurses_gui.cpp ncurses_gui.hpp) -target_link_libraries(ncurses_gui) diff --git a/src/radiotray-ng/main.cpp b/src/radiotray-ng/main.cpp index fd49825..0fcb19e 100644 --- a/src/radiotray-ng/main.cpp +++ b/src/radiotray-ng/main.cpp @@ -42,38 +42,45 @@ #include -void init_logging() +void init_logging(std::shared_ptr config) { - std::string xdg_data_home_dir = radiotray_ng::get_data_dir(APP_NAME); - - namespace keywords = boost::log::keywords; - - auto sink = boost::log::add_file_log - ( - keywords::file_name = xdg_data_home_dir + "logs/radiotray-ng-%5N.log", - keywords::rotation_size = 1024 * 64, // 64K logs - keywords::open_mode = std::ios_base::app, - keywords::auto_flush = true, - keywords::format = - ( - boost::log::expressions::stream - << boost::log::expressions::format_date_time< boost::posix_time::ptime >("TimeStamp", "[%Y-%m-%d %H:%M:%S.%f]") - << " [" << boost::log::expressions::attr< boost::log::attributes::current_thread_id::value_type >("ThreadID") - << "] [" << std::setw(5) << std::left << boost::log::trivial::severity << "] " << boost::log::expressions::smessage - ) - ); - - boost::log::add_common_attributes(); - - sink->locked_backend()->set_file_collector(boost::log::sinks::file::make_collector - ( - keywords::target = xdg_data_home_dir + "logs/", - keywords::max_size = 1024 * 512 // ~512K of logs - )); - - sink->locked_backend()->scan_for_files(); - - boost::log::core::get()->add_sink(sink); + if (config->get_bool(DISABLE_LOGGING_KEY, DEFAULT_DISABLE_LOGGING_VALUE)) + { + boost::log::core::get()->set_logging_enabled(false); + } + else + { + std::string xdg_cache_home_dir = radiotray_ng::get_cache_dir(APP_NAME); + + namespace keywords = boost::log::keywords; + + auto sink = boost::log::add_file_log + ( + keywords::file_name = xdg_cache_home_dir + "radiotray-ng-%5N.log", + keywords::rotation_size = 1024 * 64, // 64K logs + keywords::open_mode = std::ios_base::app, + keywords::auto_flush = true, + keywords::format = + ( + boost::log::expressions::stream + << boost::log::expressions::format_date_time("TimeStamp", "[%Y-%m-%d %H:%M:%S.%f]") + << " [" << boost::log::expressions::attr("ThreadID") + << "] [" << std::setw(5) << std::left << boost::log::trivial::severity << "] " << boost::log::expressions::smessage + ) + ); + + boost::log::add_common_attributes(); + + sink->locked_backend()->set_file_collector(boost::log::sinks::file::make_collector + ( + keywords::target = xdg_cache_home_dir, + keywords::max_size = 1024 * 512 // ~512K of logs + )); + + sink->locked_backend()->scan_for_files(); + + boost::log::core::get()->add_sink(sink); + } } @@ -241,12 +248,6 @@ int main(int argc, char* argv[]) return 1; } - init_logging(); - - LOG(info) << APP_NAME << " (" << RTNG_GIT_VERSION << ") starting up"; - - LOG(info) << RTNG_USER_AGENT; - auto config = std::make_shared(config_path + RTNG_CONFIG_FILE); // load config or create a new one @@ -256,6 +257,12 @@ int main(int argc, char* argv[]) set_config_defaults(config, argv[0], config_path); } + init_logging(config); + + LOG(info) << APP_NAME << " (" << RTNG_GIT_VERSION << ") starting up"; + + LOG(info) << RTNG_USER_AGENT; + // adjust logging level... set_logging_level(config); diff --git a/src/radiotray-ng/notification/CMakeLists.txt b/src/radiotray-ng/notification/CMakeLists.txt index d926406..3ab15f2 100644 --- a/src/radiotray-ng/notification/CMakeLists.txt +++ b/src/radiotray-ng/notification/CMakeLists.txt @@ -5,6 +5,5 @@ else() endif() add_library(notification STATIC ${SRC_FILES}) -target_link_libraries(notification) target_include_directories(notification PRIVATE ${NOTIFY_INCLUDE_DIRS}) diff --git a/src/radiotray-ng/player/player.cpp b/src/radiotray-ng/player/player.cpp index 39833a4..316a185 100644 --- a/src/radiotray-ng/player/player.cpp +++ b/src/radiotray-ng/player/player.cpp @@ -146,6 +146,28 @@ void Player::volume(const uint32_t percent) } +void Player::mute() +{ + g_object_set(G_OBJECT(this->pipeline), "mute", TRUE, NULL); +} + + +void Player::unmute() +{ + g_object_set(G_OBJECT(this->pipeline), "mute", FALSE, NULL); +} + + +bool Player::is_muted() +{ + gboolean muted{}; + + g_object_get(G_OBJECT(this->pipeline), "mute", &muted, NULL); + + return !!muted; +} + + void Player::notify_source_cb(GObject* obj, GParamSpec* /*param*/, gpointer /*user_data*/) { // set our user-agent... @@ -357,7 +379,15 @@ void Player::for_each_tag_cb(const GstTagList* list, const gchar* tag, gpointer str = g_strdup_value_contents(gst_tag_list_get_value_index(list, tag, i)); } - event_data[gst_tag_get_nick(tag)] = str; + // todo: for now ignore anything that looks encoded... + if (std::string(str).find("title; value[DBUS_MSG_ARTIST_KEY] = this->artist; value[DBUS_MSG_STATION_KEY] = this->station; + value[DBUS_MSG_URL_KEY] = this->url; value[DBUS_MSG_GROUP_KEY] = (this->group != this->play_url_group) ? this->group : ""; value[DBUS_MSG_CODEC_KEY] = this->codec; value[DBUS_MSG_BITRATE_KEY] = this->bitrate; + value[DBUS_MSG_MUTE_KEY] = this->player->is_muted(); value[DBUS_MSG_IMAGE_KEY] = radiotray_ng::word_expand(this->notification_image); return value.toStyledString(); @@ -521,6 +523,8 @@ void RadiotrayNG::play(const std::string& group, const std::string& station) if (this->player->play(pls)) { + this->url = std.url; + this->config->save(); return; } @@ -580,6 +584,29 @@ void RadiotrayNG::volume_down_msg() } +void RadiotrayNG::mute() +{ + std::string msg{"Volume: " + this->volume + "% "}; + + if (!this->player->is_muted()) + { + this->player->mute(); + + msg += "(Mute)"; + } + else + { + this->player->unmute(); + } + + if (this->config->get_bool(NOTIFICATION_KEY, DEFAULT_NOTIFICATION_VALUE)) + { + this->notification.notify(msg, APP_NAME_DISPLAY, + radiotray_ng::word_expand(this->config->get_string(RADIOTRAY_NG_NOTIFICATION_KEY, DEFAULT_RADIOTRAY_NG_NOTIFICATION_VALUE))); + } +} + + void RadiotrayNG::set_and_save_volume(uint32_t new_volume) { const uint32_t volume(this->config->get_uint32(VOLUME_LEVEL_KEY, DEFAULT_VOLUME_LEVEL_VALUE)); @@ -596,13 +623,17 @@ void RadiotrayNG::set_and_save_volume(uint32_t new_volume) } } + void RadiotrayNG::display_volume_level() { - // Always show since media keys don't repeat, which makes it hard to tell if the volume is changing... - std::string volume_str = "Volume: " + std::to_string(this->config->get_uint32(VOLUME_LEVEL_KEY, DEFAULT_VOLUME_LEVEL_VALUE)) + "%"; + if (this->config->get_bool(NOTIFICATION_KEY, DEFAULT_NOTIFICATION_VALUE)) + { + std::string volume_str = + "Volume: " + std::to_string(this->config->get_uint32(VOLUME_LEVEL_KEY, DEFAULT_VOLUME_LEVEL_VALUE)) + "%"; - this->notification.notify(volume_str, APP_NAME_DISPLAY, - radiotray_ng::word_expand(this->config->get_string(RADIOTRAY_NG_NOTIFICATION_KEY, DEFAULT_RADIOTRAY_NG_NOTIFICATION_VALUE))); + this->notification.notify(volume_str, APP_NAME_DISPLAY, + radiotray_ng::word_expand(this->config->get_string(RADIOTRAY_NG_NOTIFICATION_KEY, DEFAULT_RADIOTRAY_NG_NOTIFICATION_VALUE))); + } } diff --git a/src/radiotray-ng/radiotray_ng.hpp b/src/radiotray-ng/radiotray_ng.hpp index e0d970d..dabf1bd 100644 --- a/src/radiotray-ng/radiotray_ng.hpp +++ b/src/radiotray-ng/radiotray_ng.hpp @@ -48,6 +48,8 @@ class RadiotrayNG final : public IRadioTrayNG void play(); + void mute(); + void volume_up(); void volume_up_msg(); @@ -113,6 +115,7 @@ class RadiotrayNG final : public IRadioTrayNG std::string artist; std::string group; std::string station; + std::string url; std::string state; std::string bitrate; std::string codec;