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

Music lib export/import songs playback history on separate thread from GUI #15864

Merged
merged 2 commits into from
Apr 6, 2019

Conversation

DaveTBlake
Copy link
Member

Fix music import facility to work on separate thread from GUI, hence actually be able to cancel it in the way export works.

Add facility to backup the song playback history e.g. play count, lastplayed date, rating, votes and userrating - all the dynamic data that can change during playback and is not held in the music file itself - to xml file. This means that if users need to remove music sources or move music files to new location they can subsequently restore their playback history, a facility that has been needed fo a long time.

Tested on both SQLite and MySQL music databases with a variety of music collections.

This is low risk and yet offers significant improvement so I would like to get it into v18.

@DaveTBlake DaveTBlake added Type: Fix non-breaking change which fixes an issue Type: Improvement non-breaking change which improves existing functionality Component: Music v18 Leia labels Apr 5, 2019
@DaveTBlake DaveTBlake added this to the Leia 18.2-rc1 milestone Apr 5, 2019
@DaveTBlake
Copy link
Member Author

Win64 test build here http://mirrors.kodi.tv/test-builds/windows/win64/KodiSetup-20190405-3b94caf8-PR15864-merge-x64.exe

Export: With single file kind of export, "songs" can be selected from the list of items to export. All songs that have been palyed or have a rating will be exported to xml file.

Import: Such an xml file can be used to populate the playcount and rating values of any music library with some or all of the same songs. Say remove the music source, move the files, clean libary and then add a new source. Playback history can be restored from the xml.

The import process can also be cancelled.

@KarellenX
Copy link
Member

A long awaited feature! Thanks @DaveTBlake

I have tested this on my library of approx 300 albums and 2000 songs using your test build.

I artificially increased the play counts, ratings, votes etc in the DB and ran the export. Though I did not check every single line, a quick calculation of line counts and word search count confirms all song, album and artist data was exported.

I cleared the database and re-imported the exported single file xml and all song fields were correctly populated.

I removed Source, renamed it and added it back. Ran the Import again, and all imported correctly.

I stripped away the Album and Artist data out of the XML file, leaving only the song data. This imported correctly into the database, obviously only populating the dynamic song data and not touching anything else.

All good :)

@DaveTBlake
Copy link
Member Author

Thanks @KarellenX, Scott has tested too and reported positive results https://forum.kodi.tv/showthread.php?tid=334059&pid=2842938#pid2842938

xbmc/music/MusicDatabase.cpp Outdated Show resolved Hide resolved
xbmc/music/MusicDatabase.cpp Outdated Show resolved Hide resolved
xbmc/music/MusicDatabase.cpp Outdated Show resolved Hide resolved
xbmc/music/MusicDatabase.cpp Outdated Show resolved Hide resolved
xbmc/music/MusicDatabase.cpp Outdated Show resolved Hide resolved
xbmc/music/MusicLibraryQueue.h Outdated Show resolved Hide resolved
xbmc/music/jobs/MusicLibraryImportJob.cpp Outdated Show resolved Hide resolved
xbmc/music/jobs/MusicLibraryImportJob.cpp Outdated Show resolved Hide resolved
xbmc/music/jobs/MusicLibraryImportJob.cpp Outdated Show resolved Hide resolved
xbmc/music/jobs/MusicLibraryImportJob.cpp Outdated Show resolved Hide resolved
…cancel button on progress dialog to be clicked.

Import song playback history data (play count, lastplayed and ratings) from xml.
@DaveTBlake DaveTBlake merged commit 4eb34eb into xbmc:master Apr 6, 2019
@DaveTBlake DaveTBlake deleted the ExportSongs branch November 20, 2019 13:12
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Component: Music Type: Fix non-breaking change which fixes an issue Type: Improvement non-breaking change which improves existing functionality v18 Leia
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants