Last active
June 23, 2017 14:22
-
-
Save alastair/7459a5a9fe6540fec585efd9ff3405e6 to your computer and use it in GitHub Desktop.
last.fm incremental import
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
psuedo code - last.fm import js: | |
get last import date from server | |
for page in all_scrobbles: | |
store newest scrobble date in the list | |
send page | |
if earliest item in page < last import date: | |
stop submitting | |
submit 'last import date' to server, which is the date of the most recent scrobble (or now) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
psuedo code - last.fm import js: | |
get last import date from server | |
get total number of pages in all scrobbles | |
do some sort of binary search to find the page which contains the last imported item | |
for page in all_scrobbles, reversed from the page which we found: | |
submit page | |
[sever] stores most recent date in this submission as last import date | |
-> client doesn't need to submit last import date, can be stopped and restarted at any time |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment