Updated Import collection library and playlists data from Clementine (markdown)

Jonas Kvinge 2020-12-11 19:29:03 +01:00
parent b496d25622
commit 73d41f00cd
1 changed files with 78 additions and 81 deletions

@ -6,7 +6,7 @@ The following guide is only briefly tested.
On a terminal and type:
`sqlite3`
sqlite3
You will then get a command prompt where you can manually perform SQL queries.
@ -14,94 +14,92 @@ Replace username with your own.
Type the following commands to attach both databases;
`ATTACH '/home/username/.local/share/strawberry/strawberry/strawberry.db' AS strawberry;`
ATTACH '/home/username/.local/share/strawberry/strawberry/strawberry.db' AS strawberry;
ATTACH '/home/username/.config/Clementine/clementine.db' AS clementine;
`ATTACH '/home/username/.config/Clementine/clementine.db' AS clementine;`
-- Delete all existing songs, playlists and playlist items in the strawberry.db:
`-- Delete all existing songs, playlists and playlist items in the strawberry.db:`
-- This must be done when importing all data from Clementine because playlists are based on ROWIDs.
`-- This must be done when importing all data from Clementine because playlists are based on ROWIDs.`
DELETE FROM strawberry.directories;
`DELETE FROM strawberry.directories;`
DELETE FROM strawberry.subdirectories;
`DELETE FROM strawberry.subdirectories;`
DELETE FROM strawberry.songs;
`DELETE FROM strawberry.songs;`
DELETE FROM strawberry.playlists;
`DELETE FROM strawberry.playlists;`
DELETE FROM strawberry.playlist_items;
`DELETE FROM strawberry.playlist_items;`
-- Import all data from the collection library songs:
`-- Import all data from the collection library songs:`
INSERT INTO strawberry.directories (path, subdirs) SELECT path, subdirs FROM clementine.directories;
`INSERT INTO strawberry.directories (path, subdirs) SELECT path, subdirs FROM clementine.directories;`
INSERT INTO strawberry.subdirectories (directory_id, path, mtime) SELECT directory, path, mtime FROM clementine.subdirectories;
`INSERT INTO strawberry.subdirectories (directory_id, path, mtime) SELECT directory, path, mtime FROM clementine.subdirectories;`
INSERT INTO strawberry.songs (ROWID, title, album, artist, albumartist, track, disc, year, originalyear, genre, compilation, composer, performer, grouping, comment, lyrics, beginning, length, bitrate, samplerate, directory_id, url, filetype, filesize, mtime, ctime, unavailable, playcount, skipcount, lastplayed, compilation_detected, compilation_on, compilation_off, compilation_effective, art_automatic, art_manual, effective_albumartist, effective_originalyear, cue_path, rating)
SELECT ROWID, title, album, artist, albumartist, track, disc, year, originalyear, genre, compilation, composer, performer, grouping, comment, lyrics, beginning, length, bitrate, samplerate, directory, filename, filetype, filesize, mtime, ctime, unavailable, playcount, skipcount, lastplayed, sampler, forced_compilation_on, forced_compilation_off, effective_compilation, art_automatic, art_manual, effective_albumartist, effective_originalyear, cue_path, rating FROM clementine.songs WHERE unavailable = 0;
`INSERT INTO strawberry.songs (ROWID, title, album, artist, albumartist, track, disc, year, originalyear, genre, compilation, composer, performer, grouping, comment, lyrics, beginning, length, bitrate, samplerate, directory_id, url, filetype, filesize, mtime, ctime, unavailable, playcount, skipcount, lastplayed, compilation_detected, compilation_on, compilation_off, compilation_effective, art_automatic, art_manual, effective_albumartist, effective_originalyear, cue_path, rating)`
`SELECT ROWID, title, album, artist, albumartist, track, disc, year, originalyear, genre, compilation, composer, performer, grouping, comment, lyrics, beginning, length, bitrate, samplerate, directory, filename, filetype, filesize, mtime, ctime, unavailable, playcount, skipcount, lastplayed, sampler, forced_compilation_on, forced_compilation_off, effective_compilation, art_automatic, art_manual, effective_albumartist, effective_originalyear, cue_path, rating FROM clementine.songs WHERE unavailable = 0;`
UPDATE strawberry.songs SET source = 2;
`UPDATE strawberry.songs SET source = 2;`
UPDATE strawberry.songs SET artist_id = "";
`UPDATE strawberry.songs SET artist_id = "";`
UPDATE strawberry.songs SET album_id = "";
`UPDATE strawberry.songs SET album_id = "";`
UPDATE strawberry.songs SET song_id = "";
`UPDATE strawberry.songs SET song_id = "";`
-- Import playlists:
`-- Import playlists:`
INSERT INTO strawberry.playlists (ROWID, name, last_played, special_type, ui_path, is_favorite, dynamic_playlist_type, dynamic_playlist_data, dynamic_playlist_backend)
SELECT ROWID, name, last_played, special_type, ui_path, is_favorite, dynamic_playlist_type, dynamic_playlist_data, dynamic_playlist_backend FROM clementine.playlists WHERE dynamic_playlist_type ISNULL;
`INSERT INTO strawberry.playlists (ROWID, name, last_played, special_type, ui_path, is_favorite, dynamic_playlist_type, dynamic_playlist_data, dynamic_playlist_backend)`
`SELECT ROWID, name, last_played, special_type, ui_path, is_favorite, dynamic_playlist_type, dynamic_playlist_data, dynamic_playlist_backend FROM clementine.playlists WHERE dynamic_playlist_type ISNULL;`
-- Import playlist items:
`-- Import playlist items:`
`
INSERT INTO strawberry.playlist_items
(ROWID,
playlist,
collection_id,
title,
album,
artist,
albumartist,
track,
disc,
year,
originalyear,
genre,
compilation,
composer,
performer,
grouping,
comment,
lyrics,
beginning,
length,
bitrate,
samplerate,
directory_id,
url,
filetype,
filesize,
mtime,
ctime,
unavailable,
playcount,
skipcount,
lastplayed,
compilation_detected,
compilation_on,
compilation_off,
compilation_effective,
art_automatic,
art_manual,
effective_albumartist,
effective_originalyear,
cue_path,
rating
)
SELECT ROWID,
INSERT INTO strawberry.playlist_items
(ROWID,
playlist,
collection_id,
title,
album,
artist,
albumartist,
track,
disc,
year,
originalyear,
genre,
compilation,
composer,
performer,
grouping,
comment,
lyrics,
beginning,
length,
bitrate,
samplerate,
directory_id,
url,
filetype,
filesize,
mtime,
ctime,
unavailable,
playcount,
skipcount,
lastplayed,
compilation_detected,
compilation_on,
compilation_off,
compilation_effective,
art_automatic,
art_manual,
effective_albumartist,
effective_originalyear,
cue_path,
rating
)
SELECT ROWID,
playlist,
library_id,
title,
@ -143,25 +141,24 @@ SELECT ROWID,
effective_originalyear,
cue_path,
rating FROM clementine.playlist_items WHERE type = 'Library';
`
`UPDATE strawberry.playlist_items SET source = 2;`
UPDATE strawberry.playlist_items SET source = 2;
`UPDATE strawberry.playlist_items SET type = 2;`
UPDATE strawberry.playlist_items SET type = 2;
`UPDATE strawberry.playlist_items SET artist_id = "";`
UPDATE strawberry.playlist_items SET artist_id = "";
`UPDATE strawberry.playlist_items SET album_id = "";`
UPDATE strawberry.playlist_items SET album_id = "";
`UPDATE strawberry.playlist_items SET song_id = "";`
UPDATE strawberry.playlist_items SET song_id = "";
`DELETE FROM strawberry.songs_fts;`
DELETE FROM strawberry.songs_fts;
`INSERT INTO strawberry.songs_fts (ROWID, ftstitle, ftsalbum, ftsartist, ftsalbumartist, ftscomposer, ftsperformer, ftsgrouping, ftsgenre, ftscomment)`
`SELECT ROWID, title, album, artist, albumartist, composer, performer, grouping, genre, comment`
`FROM strawberry.songs;`
INSERT INTO strawberry.songs_fts (ROWID, ftstitle, ftsalbum, ftsartist, ftsalbumartist, ftscomposer, ftsperformer, ftsgrouping, ftsgenre, ftscomment)
SELECT ROWID, title, album, artist, albumartist, composer, performer, grouping, genre, comment
FROM strawberry.songs;
Use the following command to restore all album covers cached in Clementine:
`cp ~/.config/Clementine/albumcovers/* ~/.local/share/strawberry/strawberry/collectionalbumcovers/`
cp ~/.config/Clementine/albumcovers/* ~/.local/share/strawberry/strawberry/collectionalbumcovers/