Skip to content

Commit

Permalink
Add dropbox
Browse files Browse the repository at this point in the history
  • Loading branch information
jonaski committed Feb 10, 2025
1 parent 2b52553 commit 1fbd7d5
Show file tree
Hide file tree
Showing 127 changed files with 4,451 additions and 2,732 deletions.
45 changes: 42 additions & 3 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -377,6 +377,14 @@ optional_component(STREAMTAGREADER ON "Stream tagreader"
DEPENDS "sparsehash" LIBSPARSEHASH_FOUND
)

optional_component(DROPBOX ON "Streaming: Dropbox"
DEPENDS "Stream tagreader" HAVE_STREAMTAGREADER
)

optional_component(ONEDRIVE ON "Streaming: OneDrive"
DEPENDS "Stream tagreader" HAVE_STREAMTAGREADER
)

if(HAVE_SONGFINGERPRINTING OR HAVE_MUSICBRAINZ)
set(HAVE_CHROMAPRINT ON)
endif()
Expand Down Expand Up @@ -463,6 +471,9 @@ set(SOURCES
src/core/songmimedata.cpp
src/core/platforminterface.cpp
src/core/standardpaths.cpp
src/core/httpbaserequest.cpp
src/core/jsonbaserequest.cpp
src/core/oauthenticator.cpp

src/utilities/strutils.cpp
src/utilities/envutils.cpp
Expand Down Expand Up @@ -592,6 +603,9 @@ set(SOURCES
src/playlist/playlistfilter.cpp
src/playlist/playlistheader.cpp
src/playlist/playlistitem.cpp
src/playlist/databaseplaylistitem.cpp
src/playlist/songplaylistitem.cpp
src/playlist/streamplaylistitem.cpp
src/playlist/playlistitemmimedata.cpp
src/playlist/playlistlistcontainer.cpp
src/playlist/playlistlistmodel.cpp
Expand All @@ -605,7 +619,6 @@ set(SOURCES
src/playlist/playlistview.cpp
src/playlist/playlistproxystyle.cpp
src/playlist/songloaderinserter.cpp
src/playlist/songplaylistitem.cpp
src/playlist/dynamicplaylistcontrols.cpp
src/playlist/playlistundocommandbase.cpp
src/playlist/playlistundocommandinsertitems.cpp
Expand Down Expand Up @@ -757,7 +770,7 @@ set(SOURCES

src/streaming/streamingservices.cpp
src/streaming/streamingservice.cpp
src/streaming/streamplaylistitem.cpp
src/streaming/streamserviceplaylistitem.cpp
src/streaming/streamingsearchview.cpp
src/streaming/streamingsearchmodel.cpp
src/streaming/streamingsearchsortmodel.cpp
Expand All @@ -768,14 +781,15 @@ set(SOURCES
src/streaming/streamingcollectionviewcontainer.cpp
src/streaming/streamingsearchview.cpp
src/streaming/streamsongmimedata.cpp
src/streaming/cloudstoragestreamingservice.cpp

src/radios/radioservices.cpp
src/radios/radiobackend.cpp
src/radios/radiomodel.cpp
src/radios/radioview.cpp
src/radios/radioviewcontainer.cpp
src/radios/radioservice.cpp
src/radios/radioplaylistitem.cpp
src/radios/radiostreamplaylistitem.cpp
src/radios/radiochannel.cpp
src/radios/somafmservice.cpp
src/radios/radioparadiseservice.cpp
Expand Down Expand Up @@ -857,6 +871,9 @@ set(HEADERS
src/core/stylesheetloader.h
src/core/localredirectserver.h
src/core/songmimedata.h
src/core/httpbaserequest.h
src/core/jsonbaserequest.h
src/core/oauthenticator.h

src/tagreader/tagreaderclient.h
src/tagreader/tagreaderreply.h
Expand Down Expand Up @@ -1053,6 +1070,7 @@ set(HEADERS

src/streaming/streamingservices.h
src/streaming/streamingservice.h
src/streaming/cloudstoragestreamingservice.h
src/streaming/streamsongmimedata.h
src/streaming/streamingsearchmodel.h
src/streaming/streamingsearchsortmodel.h
Expand All @@ -1062,6 +1080,7 @@ set(HEADERS
src/streaming/streamingtabsview.h
src/streaming/streamingcollectionview.h
src/streaming/streamingcollectionviewcontainer.h
src/streaming/cloudstoragestreamingservice.h

src/radios/radioservices.h
src/radios/radiobackend.h
Expand Down Expand Up @@ -1465,6 +1484,26 @@ optional_source(HAVE_QOBUZ
src/settings/qobuzsettingspage.ui
)

optional_source(HAVE_DROPBOX
SOURCES
src/dropbox/dropboxservice.cpp
src/dropbox/dropboxurlhandler.cpp
src/dropbox/dropboxbaserequest.cpp
src/dropbox/dropboxsongsrequest.cpp
src/dropbox/dropboxstreamurlrequest.cpp
src/dropbox/dropboxplaylistitem.cpp
src/settings/dropboxsettingspage.cpp
HEADERS
src/dropbox/dropboxservice.h
src/dropbox/dropboxurlhandler.h
src/dropbox/dropboxbaserequest.h
src/dropbox/dropboxsongsrequest.h
src/dropbox/dropboxstreamurlrequest.h
src/settings/dropboxsettingspage.h
UI
src/settings/dropboxsettingspage.ui
)

qt_wrap_cpp(SOURCES ${HEADERS})
qt_wrap_ui(SOURCES ${UI})
qt_add_resources(SOURCES data/data.qrc data/icons.qrc)
Expand Down
1 change: 1 addition & 0 deletions data/data.qrc
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
<file>schema/schema-18.sql</file>
<file>schema/schema-19.sql</file>
<file>schema/schema-20.sql</file>
<file>schema/schema-21.sql</file>
<file>schema/device-schema.sql</file>
<file>style/strawberry.css</file>
<file>style/smartplaylistsearchterm.css</file>
Expand Down
5 changes: 5 additions & 0 deletions data/icons.qrc
Original file line number Diff line number Diff line change
Expand Up @@ -98,6 +98,7 @@
<file>icons/128x128/somafm.png</file>
<file>icons/128x128/radioparadise.png</file>
<file>icons/128x128/musicbrainz.png</file>
<file>icons/128x128/dropbox.png</file>
<file>icons/64x64/albums.png</file>
<file>icons/64x64/alsa.png</file>
<file>icons/64x64/application-exit.png</file>
Expand Down Expand Up @@ -197,6 +198,7 @@
<file>icons/64x64/somafm.png</file>
<file>icons/64x64/radioparadise.png</file>
<file>icons/64x64/musicbrainz.png</file>
<file>icons/64x64/dropbox.png</file>
<file>icons/48x48/albums.png</file>
<file>icons/48x48/alsa.png</file>
<file>icons/48x48/application-exit.png</file>
Expand Down Expand Up @@ -300,6 +302,7 @@
<file>icons/48x48/somafm.png</file>
<file>icons/48x48/radioparadise.png</file>
<file>icons/48x48/musicbrainz.png</file>
<file>icons/48x48/dropbox.png</file>
<file>icons/32x32/albums.png</file>
<file>icons/32x32/alsa.png</file>
<file>icons/32x32/application-exit.png</file>
Expand Down Expand Up @@ -403,6 +406,7 @@
<file>icons/32x32/somafm.png</file>
<file>icons/32x32/radioparadise.png</file>
<file>icons/32x32/musicbrainz.png</file>
<file>icons/32x32/dropbox.png</file>
<file>icons/22x22/albums.png</file>
<file>icons/22x22/alsa.png</file>
<file>icons/22x22/application-exit.png</file>
Expand Down Expand Up @@ -506,5 +510,6 @@
<file>icons/22x22/somafm.png</file>
<file>icons/22x22/radioparadise.png</file>
<file>icons/22x22/musicbrainz.png</file>
<file>icons/22x22/dropbox.png</file>
</qresource>
</RCC>
Binary file added data/icons/128x128/dropbox.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added data/icons/22x22/dropbox.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added data/icons/32x32/dropbox.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added data/icons/48x48/dropbox.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added data/icons/64x64/dropbox.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added data/icons/full/dropbox.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
82 changes: 82 additions & 0 deletions data/schema/schema-21.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1,82 @@
CREATE TABLE IF NOT EXISTS dropbox_songs (

title TEXT,
album TEXT,
artist TEXT,
albumartist TEXT,
track INTEGER NOT NULL DEFAULT -1,
disc INTEGER NOT NULL DEFAULT -1,
year INTEGER NOT NULL DEFAULT -1,
originalyear INTEGER NOT NULL DEFAULT -1,
genre TEXT,
compilation INTEGER NOT NULL DEFAULT 0,
composer TEXT,
performer TEXT,
grouping TEXT,
comment TEXT,
lyrics TEXT,

artist_id TEXT,
album_id TEXT,
song_id TEXT,

beginning INTEGER NOT NULL DEFAULT 0,
length INTEGER NOT NULL DEFAULT 0,

bitrate INTEGER NOT NULL DEFAULT -1,
samplerate INTEGER NOT NULL DEFAULT -1,
bitdepth INTEGER NOT NULL DEFAULT -1,

source INTEGER NOT NULL DEFAULT 0,
directory_id INTEGER NOT NULL DEFAULT -1,
url TEXT NOT NULL,
filetype INTEGER NOT NULL DEFAULT 0,
filesize INTEGER NOT NULL DEFAULT -1,
mtime INTEGER NOT NULL DEFAULT -1,
ctime INTEGER NOT NULL DEFAULT -1,
unavailable INTEGER DEFAULT 0,

fingerprint TEXT,

playcount INTEGER NOT NULL DEFAULT 0,
skipcount INTEGER NOT NULL DEFAULT 0,
lastplayed INTEGER NOT NULL DEFAULT -1,
lastseen INTEGER NOT NULL DEFAULT -1,

compilation_detected INTEGER DEFAULT 0,
compilation_on INTEGER NOT NULL DEFAULT 0,
compilation_off INTEGER NOT NULL DEFAULT 0,
compilation_effective INTEGER NOT NULL DEFAULT 0,

art_embedded INTEGER DEFAULT 0,
art_automatic TEXT,
art_manual TEXT,
art_unset INTEGER DEFAULT 0,

effective_albumartist TEXT,
effective_originalyear INTEGER NOT NULL DEFAULT 0,

cue_path TEXT,

rating INTEGER DEFAULT -1,

acoustid_id TEXT,
acoustid_fingerprint TEXT,

musicbrainz_album_artist_id TEXT,
musicbrainz_artist_id TEXT,
musicbrainz_original_artist_id TEXT,
musicbrainz_album_id TEXT,
musicbrainz_original_album_id TEXT,
musicbrainz_recording_id TEXT,
musicbrainz_track_id TEXT,
musicbrainz_disc_id TEXT,
musicbrainz_release_group_id TEXT,
musicbrainz_work_id TEXT,

ebur128_integrated_loudness_lufs REAL,
ebur128_loudness_range_lu REAL

);

UPDATE schema_version SET version=21;
83 changes: 82 additions & 1 deletion data/schema/schema.sql
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ CREATE TABLE IF NOT EXISTS schema_version (

DELETE FROM schema_version;

INSERT INTO schema_version (version) VALUES (20);
INSERT INTO schema_version (version) VALUES (21);

CREATE TABLE IF NOT EXISTS directories (
path TEXT NOT NULL,
Expand Down Expand Up @@ -908,6 +908,87 @@ CREATE TABLE IF NOT EXISTS qobuz_songs (

);

CREATE TABLE IF NOT EXISTS dropbox_songs (

title TEXT,
album TEXT,
artist TEXT,
albumartist TEXT,
track INTEGER NOT NULL DEFAULT -1,
disc INTEGER NOT NULL DEFAULT -1,
year INTEGER NOT NULL DEFAULT -1,
originalyear INTEGER NOT NULL DEFAULT -1,
genre TEXT,
compilation INTEGER NOT NULL DEFAULT 0,
composer TEXT,
performer TEXT,
grouping TEXT,
comment TEXT,
lyrics TEXT,

artist_id TEXT,
album_id TEXT,
song_id TEXT,

beginning INTEGER NOT NULL DEFAULT 0,
length INTEGER NOT NULL DEFAULT 0,

bitrate INTEGER NOT NULL DEFAULT -1,
samplerate INTEGER NOT NULL DEFAULT -1,
bitdepth INTEGER NOT NULL DEFAULT -1,

source INTEGER NOT NULL DEFAULT 0,
directory_id INTEGER NOT NULL DEFAULT -1,
url TEXT NOT NULL,
filetype INTEGER NOT NULL DEFAULT 0,
filesize INTEGER NOT NULL DEFAULT -1,
mtime INTEGER NOT NULL DEFAULT -1,
ctime INTEGER NOT NULL DEFAULT -1,
unavailable INTEGER DEFAULT 0,

fingerprint TEXT,

playcount INTEGER NOT NULL DEFAULT 0,
skipcount INTEGER NOT NULL DEFAULT 0,
lastplayed INTEGER NOT NULL DEFAULT -1,
lastseen INTEGER NOT NULL DEFAULT -1,

compilation_detected INTEGER DEFAULT 0,
compilation_on INTEGER NOT NULL DEFAULT 0,
compilation_off INTEGER NOT NULL DEFAULT 0,
compilation_effective INTEGER NOT NULL DEFAULT 0,

art_embedded INTEGER DEFAULT 0,
art_automatic TEXT,
art_manual TEXT,
art_unset INTEGER DEFAULT 0,

effective_albumartist TEXT,
effective_originalyear INTEGER NOT NULL DEFAULT 0,

cue_path TEXT,

rating INTEGER DEFAULT -1,

acoustid_id TEXT,
acoustid_fingerprint TEXT,

musicbrainz_album_artist_id TEXT,
musicbrainz_artist_id TEXT,
musicbrainz_original_artist_id TEXT,
musicbrainz_album_id TEXT,
musicbrainz_original_album_id TEXT,
musicbrainz_recording_id TEXT,
musicbrainz_track_id TEXT,
musicbrainz_disc_id TEXT,
musicbrainz_release_group_id TEXT,
musicbrainz_work_id TEXT,

ebur128_integrated_loudness_lufs REAL,
ebur128_loudness_range_lu REAL

);

CREATE TABLE IF NOT EXISTS playlists (

name TEXT NOT NULL,
Expand Down
17 changes: 17 additions & 0 deletions src/collection/collectionbackend.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -853,6 +853,10 @@ void CollectionBackend::UpdateMTimesOnly(const SongList &songs) {

}

void CollectionBackend::DeleteSongsAsync(const SongList &songs) {
QMetaObject::invokeMethod(this, "DeleteSongs", Qt::QueuedConnection, Q_ARG(SongList, songs));
}

void CollectionBackend::DeleteSongs(const SongList &songs) {

QMutexLocker l(db_->Mutex());
Expand All @@ -879,6 +883,19 @@ void CollectionBackend::DeleteSongs(const SongList &songs) {

}

void CollectionBackend::DeleteSongsByUrlAsync(const QUrl &url) {
QMetaObject::invokeMethod(this, "DeleteSongs", Qt::QueuedConnection, Q_ARG(QUrl, url));
}

void CollectionBackend::DeleteSongsByUrl(const QUrl &url) {

const SongList songs = GetSongsByUrl(url);
if (!songs.isEmpty()) {
DeleteSongs(songs);
}

}

void CollectionBackend::MarkSongsUnavailable(const SongList &songs, const bool unavailable) {

QMutexLocker l(db_->Mutex());
Expand Down
4 changes: 4 additions & 0 deletions src/collection/collectionbackend.h
Original file line number Diff line number Diff line change
Expand Up @@ -234,6 +234,9 @@ class CollectionBackend : public CollectionBackendInterface {
void UpdateSongRatingAsync(const int id, const float rating, const bool save_tags = false);
void UpdateSongsRatingAsync(const QList<int> &ids, const float rating, const bool save_tags = false);

void DeleteSongsAsync(const SongList &songs);
void DeleteSongsByUrlAsync(const QUrl &url);

public Q_SLOTS:
void Exit();
void GetAllSongs(const int id);
Expand All @@ -247,6 +250,7 @@ class CollectionBackend : public CollectionBackendInterface {
void UpdateSongsBySongID(const SongMap &new_songs);
void UpdateMTimesOnly(const SongList &songs);
void DeleteSongs(const SongList &songs);
void DeleteSongsByUrl(const QUrl &url);
void MarkSongsUnavailable(const SongList &songs, const bool unavailable = true);
void AddOrUpdateSubdirs(const CollectionSubdirectoryList &subdirs);
void CompilationsNeedUpdating();
Expand Down
Loading

0 comments on commit 1fbd7d5

Please sign in to comment.