Skip to content

Conversation

@easz
Copy link

@easz easz commented Jun 24, 2017

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

Copy link
Owner

@aardappel aardappel left a 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.


- 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)
Copy link
Owner

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)

@aardappel
Copy link
Owner

Also, the demo gives me URIError: URI malformed when loading one of my file. And Uncaught TypeError: Failed to execute 'readAsArrayBuffer' on 'FileReader': parameter 1 is not of type 'Blob'. at HTMLInputElement.<anonymous> (demo.html:59). .PT file I am loading is about 1 meg.

@easz
Copy link
Author

easz commented Jun 24, 2017

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?

@aardappel
Copy link
Owner

I don't mind PRs, I am just pointing out the consequences :)

I'm on Chrome 58.0.3029.110 (64-bit) Windows 10.

@easz
Copy link
Author

easz commented Jun 24, 2017

I will test it next week on Windows and in the meanwhile I just added some debug log

@easz
Copy link
Author

easz commented Jun 28, 2017

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

@aardappel
Copy link
Owner

Still get the same error on https://easz.github.io/procrastitracker/tools/js/demo.html

@easz
Copy link
Author

easz commented Jun 29, 2017

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

// TODO: can we get a UTF-8 URL out of this somehow, if the URL contains percent encoded

thanks for helping :)

@aardappel
Copy link
Owner

Ok, demo now works. It is indeed UTF-8

@aardappel aardappel force-pushed the master branch 4 times, most recently from b3a976e to 937d3ac Compare May 24, 2020 19:18
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants