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

Projects
None yet
3 participants
@DaveTBlake
Copy link
Member

commented Apr 5, 2019

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

This comment has been minimized.

Copy link
Member Author

commented Apr 5, 2019

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

This comment has been minimized.

Copy link

commented Apr 6, 2019

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

This comment has been minimized.

Copy link
Member Author

commented Apr 6, 2019

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

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/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

@DaveTBlake DaveTBlake force-pushed the DaveTBlake:ExportSongs branch from 090b04e to 5459d9b Apr 6, 2019

Import music library data on a separate thread from GUI. This allows …
…cancel button on progress dialog to be clicked.

Import song playback history data (play count, lastplayed and ratings) from xml.

@DaveTBlake DaveTBlake force-pushed the DaveTBlake:ExportSongs branch from 5459d9b to f7caf87 Apr 6, 2019

@DaveTBlake DaveTBlake merged commit 4eb34eb into xbmc:master Apr 6, 2019

1 check passed

default You're awesome. Have a cookie
Details
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.