Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Network Remote #1398

Open
wants to merge 24 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -523,6 +523,7 @@ add_subdirectory(dist)
add_subdirectory(ext/libstrawberry-common)
add_subdirectory(ext/libstrawberry-tagreader)
add_subdirectory(ext/strawberry-tagreader)
add_subdirectory(src/networkremote)
if(HAVE_MOODBAR)
add_subdirectory(ext/gstmoodbar)
endif()
Expand Down
1 change: 1 addition & 0 deletions data/icons.qrc
Original file line number Diff line number Diff line change
Expand Up @@ -501,5 +501,6 @@
<file>icons/22x22/somafm.png</file>
<file>icons/22x22/radioparadise.png</file>
<file>icons/22x22/musicbrainz.png</file>
<file>icons/32x32/network-remote.png</file>
</qresource>
</RCC>
Binary file added data/icons/32x32/network-remote.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
64 changes: 64 additions & 0 deletions debian/control
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
Source: strawberry
Section: sound
Priority: optional
Maintainer: Jonas Kvinge <[email protected]>
Build-Depends: debhelper (>= 11),
git,
make,
cmake,
gcc,
g++,
protobuf-compiler,
libglib2.0-dev,
libdbus-1-dev,
libprotobuf-dev,
libboost-dev,
libsqlite3-dev,
libasound2-dev,
libpulse-dev,
libtag1-dev,
libicu-dev,
qt6-base-dev,qt6-base-dev-tools,qt6-tools-dev,qt6-tools-dev-tools,qt6-l10n-tools,
libgstreamer1.0-dev,
libgstreamer-plugins-base1.0-dev,
libcdio-dev,
libgpod-dev,
libmtp-dev,
libchromaprint-dev,
libfftw3-dev,
libebur128-dev
Standards-Version: 4.6.1

Package: strawberry
Architecture: any
Depends: ${shlibs:Depends},
${misc:Depends},
libqt6sql6-sqlite,qt6-qpa-plugins,
gstreamer1.0-plugins-base,
gstreamer1.0-plugins-good,
gstreamer1.0-alsa,
gstreamer1.0-pulseaudio
Homepage: http://www.strawberrymusicplayer.org/
Description: music player and music collection organizer
Strawberry is a music player aimed at music collectors and audiophiles.
.
Features:
- Play and organize music
- Supports WAV, FLAC, WavPack, Ogg Vorbis, Speex, MPC, TrueAudio, AIFF, MP4, MP3 and ASF
- Audio CD playback
- Native desktop notifications
- Playlist management and playlists in multiple formats
- Smart and dynamic playlists
- Advanced audio output and device configuration for bit-perfect playback on Linux
- Edit tags on audio files
- Automatically retrieve tags from MusicBrainz
- Album cover art from Last.fm, Musicbrainz, Discogs, Musixmatch, Deezer, Tidal, Qobuz and Spotify
- Song lyrics from Genius, Musixmatch, ChartLyrics, lyrics.ovh, lololyrics.com, songlyrics.com, azlyrics.com, elyrics.net and lyricsmode.com
- Audio analyzer
- Audio equalizer
- Transfer music to mass-storage USB players, MTP compatible devices and iPod Nano/Classic
- Scrobbler with support for Last.fm, Libre.fm and ListenBrainz
- Streaming support for Subsonic-compatible servers
- Unofficial streaming support for Tidal and Qobuz
.
It is a fork of Clementine. The name is inspired by the band Strawbs.
18 changes: 18 additions & 0 deletions src/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -205,6 +205,7 @@ set(SOURCES
settings/appearancesettingspage.cpp
settings/contextsettingspage.cpp
settings/notificationssettingspage.cpp
settings/networkremotesettingspage.cpp

dialogs/about.cpp
dialogs/console.cpp
Expand Down Expand Up @@ -291,6 +292,13 @@ set(SOURCES
organize/organizedialog.cpp
organize/organizeerrordialog.cpp

networkremote/networkremote.cpp
networkremote/tcpserver.cpp
networkremote/remotesettings.cpp
networkremote/client.cpp
networkremote/clientmanager.cpp
networkremote/incomingmsg.cpp
networkremote/outgoingmsg.cpp
)

set(HEADERS
Expand Down Expand Up @@ -446,6 +454,7 @@ set(HEADERS
settings/appearancesettingspage.h
settings/contextsettingspage.h
settings/notificationssettingspage.h
settings/networkremotesettingspage.h

dialogs/about.h
dialogs/errordialog.h
Expand Down Expand Up @@ -527,6 +536,13 @@ set(HEADERS
organize/organizedialog.h
organize/organizeerrordialog.h

networkremote/networkremote.h
networkremote/tcpserver.h
networkremote/remotesettings.h
networkremote/client.h
networkremote/clientmanager.h
networkremote/incomingmsg.h
networkremote/outgoingmsg.h
)

set(UI
Expand Down Expand Up @@ -571,6 +587,7 @@ set(UI
settings/networkproxysettingspage.ui
settings/appearancesettingspage.ui
settings/notificationssettingspage.ui
settings/networkremotesettingspage.ui

equalizer/equalizer.ui
equalizer/equalizerslider.ui
Expand Down Expand Up @@ -1111,6 +1128,7 @@ target_link_libraries(strawberry_lib PUBLIC
${SINGLEAPPLICATION_LIBRARIES}
libstrawberry-common
libstrawberry-tagreader
lib-networkremote
)

if(HAVE_DBUS)
Expand Down
18 changes: 15 additions & 3 deletions src/core/application.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -102,6 +102,8 @@
#include "radios/radioservices.h"
#include "radios/radiobackend.h"

#include "networkremote/networkremote.h"

using std::make_shared;
using namespace std::chrono_literals;

Expand Down Expand Up @@ -201,8 +203,13 @@ class ApplicationImpl {
moodbar_loader_([app]() { return new MoodbarLoader(app); }),
moodbar_controller_([app]() { return new MoodbarController(app); }),
#endif
lastfm_import_([app]() { return new LastFMImport(app->network()); })
{}
lastfm_import_([app]() { return new LastFMImport(app->network()); }),
network_remote_([app]() {
NetworkRemote *remote = new NetworkRemote(app);
app->MoveToNewThread(remote);
return remote;
})
{}

Lazy<TagReaderClient> tag_reader_client_;
Lazy<Database> database_;
Expand All @@ -228,6 +235,7 @@ class ApplicationImpl {
Lazy<MoodbarController> moodbar_controller_;
#endif
Lazy<LastFMImport> lastfm_import_;
Lazy<NetworkRemote> network_remote_;

};

Expand All @@ -237,6 +245,7 @@ Application::Application(QObject *parent)
device_finders()->Init();
collection()->Init();
tag_reader_client();
network_remote()->Init();

QObject::connect(&*database(), &Database::Error, this, &Application::ErrorAdded);

Expand Down Expand Up @@ -286,7 +295,8 @@ void Application::Exit() {
<< &*device_manager()
#endif
<< &*internet_services()
<< &*radio_services()->radio_backend();
<< &*radio_services()->radio_backend()
<< &*network_remote();

QObject::connect(&*tag_reader_client(), &TagReaderClient::ExitFinished, this, &Application::ExitReceived);
tag_reader_client()->ExitAsync();
Expand Down Expand Up @@ -355,7 +365,9 @@ SharedPtr<InternetServices> Application::internet_services() const { return p_->
SharedPtr<RadioServices> Application::radio_services() const { return p_->radio_services_.ptr(); }
SharedPtr<AudioScrobbler> Application::scrobbler() const { return p_->scrobbler_.ptr(); }
SharedPtr<LastFMImport> Application::lastfm_import() const { return p_->lastfm_import_.ptr(); }
SharedPtr<NetworkRemote> Application::network_remote() const { return p_->network_remote_.ptr();}
#ifdef HAVE_MOODBAR
SharedPtr<MoodbarController> Application::moodbar_controller() const { return p_->moodbar_controller_.ptr(); }
SharedPtr<MoodbarLoader> Application::moodbar_loader() const { return p_->moodbar_loader_.ptr(); }

#endif
4 changes: 4 additions & 0 deletions src/core/application.h
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,8 @@ class MoodbarController;
class MoodbarLoader;
#endif

class NetworkRemote;

class Application : public QObject {
Q_OBJECT

Expand Down Expand Up @@ -107,6 +109,8 @@ class Application : public QObject {

SharedPtr<LastFMImport> lastfm_import() const;

SharedPtr<NetworkRemote> network_remote() const;

void Exit();

QThread *MoveToNewThread(QObject *object);
Expand Down
32 changes: 32 additions & 0 deletions src/networkremote/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
cmake_minimum_required(VERSION 3.14)

set(SOURCES RemoteMessages.proto)

link_directories(
${GLIB_LIBRARY_DIRS}
${PROTOBUF_LIBRARY_DIRS}
)

add_library(lib-networkremote OBJECT ${PROTO_SOURCES} ${SOURCES})

target_include_directories(lib-networkremote SYSTEM PRIVATE
${GLIB_INCLUDE_DIRS}
${PROTOBUF_INCLUDE_DIRS}
)

target_include_directories(lib-networkremote PRIVATE
${CMAKE_CURRENT_SOURCE_DIR}
${CMAKE_CURRENT_BINARY_DIR}
${CMAKE_SOURCE_DIR}/src
${CMAKE_BINARY_DIR}/src
)

target_link_libraries(lib-networkremote PRIVATE
${GLIB_LIBRARIES}
${Protobuf_LIBRARIES}
Qt${QT_VERSION_MAJOR}::Core
Qt${QT_VERSION_MAJOR}::Network
Qt${QT_VERSION_MAJOR}::Gui
)

protobuf_generate(TARGET lib-networkremote)
131 changes: 131 additions & 0 deletions src/networkremote/RemoteMessages.proto
Original file line number Diff line number Diff line change
@@ -0,0 +1,131 @@
syntax = "proto3";

option optimize_for = LITE_RUNTIME;

package nw.remote;

enum MsgType {
MSG_TYPE_UNSPECIFIED = 0;

// Client message
MSG_TYPE_REQUEST_SONG_INFO = 1;
MSG_TYPE_REQUEST_PLAY = 2;
MSG_TYPE_REQUEST_NEXT = 3;
MSG_TYPE_REQUEST_PREVIOUS = 4;
MSG_TYPE_REQUEST_PAUSE = 5;
MSG_TYPE_REQUEST_STOP = 6;
MSG_TYPE_REQUEST_FINISH = 7;


// Server messages
MSG_TYPE_REPLY_SONG_INFO = 8;
MSG_TYPE_REPLY_PLAY = 9;
MSG_TYPE_REPLY_NEXT = 10;
MSG_TYPE_REPLY_PREVIOUS = 11;
MSG_TYPE_REPLY_PAUSE = 12;
MSG_TYPE_REPLY_STOP = 13;
MSG_TYPE_REPLY_FINISH = 14;
MSG_TYPE_ENGINE_STATE_CHANGE = 15;

// Bidirectional messages
MSG_TYPE_DISCONNECT = 16;
}

enum PlayerState{
PLAYER_STATUS_UNSPECIFIED = 0;
PLAYER_STATUS_PLAYING = 1;
}

enum EngineState {
ENGINE_STATE_EMPTY = 0;
ENGINE_STATE_IDELE = 1;
ENGINE_STATE_PLAYING = 2;
ENGINE_STATE_PAUSED = 3;
}

enum ReasonDisconnect {
REASON_DISCONNECT_SERVER_SHUTDOWN = 0;
REASON_DISCONNECT_CLIENT_SHUTDOWN = 1;
}

message RequestDisconnect {
ReasonDisconnect reason_disconnect = 1;
}

message SongMetadata{
uint32 id = 1;
string title = 2;
string album = 3;
string artist = 4;
string albumartist = 5;
uint32 track = 6;
string stryear = 7;
string genre = 8;
uint32 playcount = 9;
string songlength = 10;
}
message RequestSongMetadata {
bool send = 1;
}

message ResponseSongMetadata {
SongMetadata song_metadata = 1;
PlayerState player_state = 2;
}

message RequestNextTrack {
bool next = 1;
}

message ResponseNextTrack {
bool next = 1;
}

message RequestPreviousTrack {
bool previous = 1;
}

message ResponsePreviousTrack {
bool previous = 1;
}

message RequestPlay {
bool play = 1;
}

message ResponsePlay {
bool play = 1;
}

message RequestPause {
bool pause = 1;
}

message ResponsePause {
bool pause = 1;
}

message RequestStop {
bool stop = 1;
}

message EngineStateChange {
EngineState state = 1;
}
message Message {
MsgType type = 1;
RequestSongMetadata request_song_metadata = 2;
ResponseSongMetadata response_song_metadata = 3;
RequestNextTrack request_next_track = 4;
RequestPreviousTrack request_previous_track = 5;
RequestPlay request_play = 6;
RequestPause request_pause = 7;
RequestStop request_stop = 8;
EngineStateChange engine_state_change = 9;
RequestDisconnect request_disconnect = 10;
ResponseNextTrack response_next_track = 11;
ResponsePreviousTrack response_previous_track = 12;
ResponsePlay response_play = 13;
ResponsePause response_pause = 14;
}

Loading
Loading