-
Notifications
You must be signed in to change notification settings - Fork 66
Load PT database in javascript #35
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
base: master
Are you sure you want to change the base?
Conversation
aardappel
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hey, this seems cool functionality. I have nothing against this living in the main repo, though it does mean you need PRs in the future if you want to update it. Also, if I make changes to the format, I won't promise I'll update this code, though, I can try (it looks pretty straightforward). Alternatively this can live in an external repo and we can point to it in the docs.
tools/js/README.md
Outdated
|
|
||
| - Only tested with the latest PT format (i.e. FILE_FORMAT_VERSION = 10) | ||
| - Following the format https://github.com/aardappel/procrastitracker/blob/master/PT/file_format.txt | ||
| - outout json data has the same strucutre as original PT file (e.g. without accumulation and filering) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
please check spelling (3 errors in this line alone)
|
Also, the demo gives me |
|
yes, you can just put a link in the docs. Otherwise I feel also sorry to make a lot of PR update.... About the error, I will take a look again and try to figure out the possible problem. What kind of browser did you use? |
|
I don't mind PRs, I am just pointing out the consequences :) I'm on Chrome 58.0.3029.110 (64-bit) Windows 10. |
|
I will test it next week on Windows and in the meanwhile I just added some debug log |
|
about URIError: URI malformed: I had also this problem before I decode data into utf8 string. It should be fixed now. About Uncaught TypeError: Failed to execute 'readAsArrayBuffer' on 'FileReader': parameter 1 is not of type 'Blob': I could not reproduce the problem and it shouldn't be file size issue... Anyway I have only PT file with about few hundred kbytes to test.. :) on Chrome Version 59.0.3071.115 (Official Build) (64-bit) Windows 7 |
|
Still get the same error on https://easz.github.io/procrastitracker/tools/js/demo.html |
|
which error? Uncaught TypeError: Failed to execute 'readAsArrayBuffer' on 'FileReader': parameter 1 is not of type 'Blob'? I can open a huge zip file (>4MB) without error. The File input, FileReader and zlib.js should be OK. URIError: URI malformed: I assume the byte data for strings in PT database is encoded as UTF8 Now I make a fail-back to latin1 encoding and give out warning log. It should not break parsing process any more. Could you try the demo again and open web development console to see what errors and warnings are logged? I use decodeURIComponent(escape(str)) to decode string data as UTF8 encoding. On Windows 7 (64 bit). The decoding may fail if there is some string data is not well encoded (or un/escape) in database. Probably link to procrastitracker/src/timercallback.h Line 76 in 68bb9b3
thanks for helping :) |
|
Ok, demo now works. It is indeed UTF-8 |
b3a976e to
937d3ac
Compare
Issue #19
The js lib may let user analyze PT database in a modem way (e.g. html5 tool chain...)
demo https://easz.github.io/procrastitracker/tools/js/demo.html