Idea: timelines

DiscussãoLibraryThing API Development

Aderi ao LibraryThing para poder publicar.

Idea: timelines

Este tópico está presentemente marcado como "adormecido"—a última mensagem tem mais de 90 dias. Pode acordar o tópico publicando uma resposta.

1igor.kh
Jul 9, 2008, 2:47 am

Once the date retrieval part of the API settles, I think it should be time to bring back the reading timeline functionality.

Oh, wait! LT's own timeline is back. It was broken, dead, and how has been resurrected (just noticed):
http://www.librarything.com/lttl/

Well, the point I was going to make is that it shouldn't be too hard to implement the timeline functionality using the API, and one could have variations on the theme without changing any LT server-side code.

Unfortunately, I can't commit any time to this idea at the moment (perhaps later). But I would be happy if other people decide to play with it as well.

2conceptDawg
Editado: Jul 9, 2008, 7:39 am

Yes, the LT timeline was a kind of "pet" project of mine done on my own time (read: I wasn't paid for writing or maintaining it). Therefore it never really got very far because, well, I'm quite busy enough doing things that actually have to be done.

I think the timeline is a great use of the API data. The timeline code that I used is based on the SIMILE project and it is available for use. It's really easy to throw a timeline together using the library.

3MMcM
Jul 9, 2008, 9:17 am

I also did a Simile-based timeline some time ago. It got the data by screen scraping, so it's mostly a matter of replacing that. It wasn't as nice as the one on the LT site; it was done before that one. Maybe I could merge the two.

4_Zoe_
Jul 9, 2008, 10:24 am

Could someone make a modification of the timeline that shows only books with start or finished dates (no entered/acquired)?

5MMcM
Jul 9, 2008, 11:30 am

Okay, I had a few minutes, so I converted the 08/2006 code from screen scraping and XML to JSON.

http://home.comcast.net/~mmcm/lthacks/ReadingTimeline.htm

It's very rough.
I am limited by not having any dates in my own library and Tim only have a half-dozen.
There is a known bug where end dates aren't in the JSON data (only the end stamps).

Take it and plug in your own key and user id.
If I get more time and access to the lttl PHP, I can see about merging its features in.
If anyone else is excited to do so instead, that's fine with me, too. Use the above code or not, whatever you want.

Oh, and I put a MIT license in that folder, too.

6_Zoe_
Jul 9, 2008, 12:12 pm

Question: What is our key, and where do we find it?

7sabreuse
Jul 9, 2008, 12:23 pm

8_Zoe_
Jul 9, 2008, 12:32 pm

Thanks!

9wimble
Jul 9, 2008, 12:48 pm

> 5

Wow. I thought about that, but I'm so far out of my depth. A few minutes?

I've got a year's worth of dates:
http://mrwolf.afraid.org/~tommy/ReadingTimeline.html

(I did have to change the URL to your JS library, to give the full machine and path, of course!)

10legallypuzzled
Editado: Jul 9, 2008, 7:02 pm

I made slight changes to MMcM's code, as I still don't have finished_date in my data, but a little playing with the not-quite-milliseconds timestamps and a few formatting issues resulted in this:

http://lplibrarything.googlepages.com/ReadingTimeline.htm

(Compare to my original at
http://lplibrarything.googlepages.com/timeline.htm
).

11MMcM
Editado: Jul 9, 2008, 8:51 pm

Would a tag to color map take care of what you did in your original? I could throw that in.

I made the labeller use toLocaleDateString() to get rid of the time portion without the overhead of a regexp. toDateString() was another possibility; would that be better?

I added options to add events for acquired and entered, like the LT one had (but off by default). The example shows how to set them in the HTML file between loading scripts and loading LT data.

I added some styles too, to show how to do that. The fonts are now closer to lttl, but without interfering with other things on the page.

Anything else?

12KeyMasterOfGozer
Jul 10, 2008, 12:00 am

I am looking at:
http://www.librarything.com/lttl/

Is there a way to add a parameter to point it to my particular user? I see that it must read a cookie to determine who the user is now, I guess.

I'm trying to wrap that page on my own website.

13MMcM
Jul 10, 2008, 12:32 am

Look at the scripts in the source for that page. You will see a scriptURL that contains your userid, which you can change to any public library to load the events from it. You will also see how to loadXML() it to get the events on the timeline widget.

Unfortunately, some browsers don't allow XMLHttpRequest to a different host, in order to avoid XSS exposure. It works from lttl because it's the same domain.

For that reason, you are better off using one of the user-developed scripts discussed in this topic. They load a script at top-level on the page, thus avoiding the problem. Also, they are more likely to be maintains, since there are more of us.

14KeyMasterOfGozer
Jul 10, 2008, 12:41 am

Actually, I picked around and found a parameter that works.
view=username

Like this:
http://www.librarything.com/lttl/?view=KeyMasterOfGozer

15MMcM
Jul 10, 2008, 12:41 am

If we wanted to provide async loading of the timeline, I believe we would need:
(1) A way of omitting all libraries and the callback function name and the semi-colon. &libraries= works today for the first. &callback= uses the default today, as if it were omitted. It's unnecessary, but harmless, to include the parens.
(2) Hosting of the script on the librarything.com domain to avoid security errors.
See the onLoadAsync function in ReadingTimeline.js.

It may not be worth doing this, since a top-level script does work and usually only takes a few seconds, but I record it here as something to think about.

16KeyMasterOfGozer
Jul 10, 2008, 2:26 am

ok, I'm playing around with the API version now as well. So far, its pretty much just legallypuzzled's version tweaked a bit, but now I think Iam getting the idea. Here is my version:
http://www.oldforest.net/apps/BookTimeLine/BookTimeLine.html

And here it is embedded in my own site (a joomla site):
http://oldforest.net/index.php?option=com_content&task=view&id=52&It...

17KeyMasterOfGozer
Jul 10, 2008, 11:05 am

@ MMcM #11

I don't see Tags listed in the JSON data, so I'm not sure how to go about using tags to color code. Am I missing something? (I'm always missing something :) the better question is "what")

18MMcM
Jul 10, 2008, 11:11 am

Tags are included if booktags is added to the resultsets parameter.

19KeyMasterOfGozer
Editado: Jul 10, 2008, 3:25 pm

Thanks!

I'm not very JavaScripty, but I have mine hardcoded to Color the Bar green if the Book has the Tag "Borrowed". I'm not sure I see an easy way off hand to make a Tag-to-Color map, but at least I can make some things happen.

This is fun!

edit:
ok, I now color books that have a start, but no Finish = Red for have not yet finished, and I set the end date to now.

20igor.kh
Jul 10, 2008, 10:45 pm

You guys are working quick and doing a good job!

Now, how about showing the rating and a review snippet (if available) next to the cover when clicking on the book?

21MMcM
Jul 11, 2008, 12:45 pm

In my new version:

- I took KeyMasterOfGozer (#19)'s idea of (optionally) setting the end of unfinished reads to now.

- Coloring by tags using an ordered list of maps. (Also optional coloring of unfinished.)

- Multiple queries are merged together into one timeline. (Add a few of your latest acquisitions to the end.)

- Events from reviews.

- Add rating and/or review, if present (needs to be included in resultsets), per #20.

22KeyMasterOfGozer
Editado: Jul 14, 2008, 11:19 am

Awesome job MMcM. One thing I tried to incorporate, but could not get to work is that yellowish "Today" Bar that is in the original lttl one. Do you have time to look at that?

23MMcM
Jul 14, 2008, 12:16 pm

> 22 yellowish "Today" Bar
I'll be honest: I'm not a big fan of that. But it's easy to add, so I did. I moved it to the right (more space) and only put it on the top band. But from the new code, you should be able to see how to adjust it in various ways and see whether you can come up with something you like. Note that you do not have control over the font size (300%) or weight (bold); they're built into the Timeline code.

24KeyMasterOfGozer
Editado: Ago 11, 2008, 1:34 pm

Sorry it took me so long to get back to this. Life happens. Anyway, I'd like to thank you, MMcM for your help. I adopted your code, and made a few changes for my own purposes.

1) I included the Tags in the book bubble.
2) I changed it so that the color for "Unfinished" trumps the tag/color matrix.
3) I put the today line without text on the bottom band as well.
4) I resized the top/bottom bands to 80%/20%, because that fits my data better.
5) I resized the bars in the bottom band, and added a line to force their layout to match the top band, so the bottom looks like an overview of the top for fast scrolling.

Once again, thanks so much for your help.

25cweller
Jan 7, 2009, 7:37 pm

I've been playing around trying to get this to work. KeyMasterOfGozer I've utilized your code as a starting point. The issue I'm running into is that the data does not display unless I move back to around 1999 and then the data will appear and I can then see the information for all timeframes. The data is not consistent either. I've added the max to be 1000, but not all of the reading events display and if I refresh the data will be different. Any ideas? You can view it here

http://www.intudev.com/lttl.html

26bigcurlyloz
Jan 9, 2009, 9:22 am

I have no idea about programming, APIs, java etc, but I know I miss my librarything timeline working!

Is anyone willing to explain (simply!) to me how to get one of the above modified timelines working? I've tried to fiddle around and read things but it seems a bit beyond me!

27legallypuzzled
Jan 9, 2009, 9:20 pm

>26 bigcurlyloz:

I've made some notes on my wiki page.

http://www.librarything.com/wiki/index.php/User:Legallypuzzled/timeline

You can start with the three files listed there, and then modify them based on what others have done on this page.

28Mantra
Jan 10, 2009, 12:07 am

Hi.
I'm very computer literate but I don't understand the javascript I guess.
I understand the notes from the wiki page, but what I don't understand is -
If I browse one of the examples above, like KeyMasterofGozer's page and save the webpage I see the data as in readingtimeline.js from the wiki, but if I view source of the page I see instead a line near the bottom with the key and view=user -
it appears that the onLoad function should dynamically retrieve the data from LibraryThing when the page loads.
I changed the key and user to my info and load the page, but it doesn't seem to retrieve the data - I get the timeline but no data.
What is causing it to not load the data dynamically. I would seriously not want to generate that readingtimeline.js every time I read a new book.

Dan

29bigcurlyloz
Jan 11, 2009, 9:18 am

>27 legallypuzzled:

Thank you! The newer/easier version of Googlepages doesn't seem to allow javascript, so I have to figure out how to access my ISP space. Will have a go and see how I get on.

30eltahelawimoney
Jan 12, 2009, 3:18 pm

Mensagem removida.

31legallypuzzled
Jan 12, 2009, 8:20 pm

>29 bigcurlyloz:

Hmmm. You're right in pointing out that Google Sites (a poor replacement for Google Pages, but the latter is being closed down) doesn't allow JavaScript. There are a few places that show a complicated way of creating an iGoogle gadget to get around it, but checking with your ISP is likely to be much easier. I'll fix that in the wiki.

>28 Mantra:

My LT-provided data doesn't do anything either. When I check my timeline (see link in message 1), it stops with several errors. Other people don't have this problem. Since I can't access the data as it gets pulled through, I don't know what's causing the problem. So I create my own data feed, which is that third file. It's extremely duplicative of the data I'm inputting into LT, but the APIs seem to have been tossed out with little followup. As collections gets ever closer, most of the development focuses on that, not the complicated internals that very few people ever figure out how to use.

32Mantra
Set 17, 2009, 5:11 pm

has anyone ever really figured this stuff out?
I got KeyMasterOfGozer's scripts and with his id/username they work, when I change it
to my id/username I get nothing!
If I hit the www.librarything.com/lttl link it works fine, lots of data.
I could go with legallypuzzled's solution of building my own data file but I've got thousands of books, don't want to do that, plus would have to continually update it manually.

I'd really like to add this to my website but can NOT figure out why it won't work.

dan

33legallypuzzled
Set 17, 2009, 5:21 pm

There have been a few posts hinting at more information coming through an API, but nothing seems to have been finalized (or perhaps a better word: "promised").

34_Zoe_
Set 17, 2009, 6:21 pm

My first issue with this is that I have nowhere to put it. Can anyone recommend a free website service that allows JavaScript?

35conceptDawg
Set 17, 2009, 10:12 pm

What types of specific things to people want out of the timeline that it doesn't do now? Not that I have tons of time on my hands,
just curious.

36_Zoe_
Set 17, 2009, 10:23 pm

Vertical scrolling, and a way to show only start and end dates, not entered dates. Basically I just want a plain reading timeline that I can see in its entirety.

37conceptDawg
Set 17, 2009, 11:46 pm

Well, you can do the second with an option to the URL. I can't remember it right now (on my other computer) but I'll look it up for you.

Vertical scrolling is a little harder since the Simile framework isn't designed to do that (or it wasn't...it's been a while since I looked at it). I could certainly make it taller by default.

39conceptDawg
Set 19, 2009, 11:23 pm

Cool. Thanks for the link. I'll check it out in my expansive free time. ;)

40_Zoe_
Set 20, 2009, 9:25 am

>37 conceptDawg: Thanks! Is that new? This is what you'd told me last time I asked about it:

Regardless, the timeline only has two optional arguments
view=USERNAME which allows you to view another user's timeline
tlmode=x (where x=0 or 1)
tlmode=0 shows dates based on start/finish in the record, or, if none, date purchased
tlmode=1 shows entry date into LT


Whereas I want books without a start/finish date not to appear at all.

41conceptDawg
Set 20, 2009, 4:34 pm

Ah..ok. Yeah. Nothing's changed. So that's a feature request from you. Check.

42birder4106
Set 22, 2009, 5:42 am

I would like to support _Zoe_ and >38 legallypuzzled:.

- If I start timeline with: http://www.librarything.de/lttl/?view=birder4106&tlmode=0 I got timeline with the acquisitions and reading dates. I would like to have the start reading date and the end of reading date instead.

- As I mentioned at end the of June (message #282: http://www.librarything.de/topic/66613) the following error still appears twice: "Caught exeption: objekt Error"

LT is really great. But I would like it even more with a working timeline.

Thanks for all your work and support
Martin

43jjmcgaffey
Jan 3, 2012, 2:02 am

I got the code from KeyMasterofGozer's page - the first link in Msg 16. It worked, kind of (after I replaced the userid and key, of course), but I had to scroll back to 2009 before anything showed up and then if I scrolled forward to mid-2010 everything would disappear again. Grump, but fun - so I went to the link in Msg 38 about getting a vertical scrollbar and added the line

.timeline-container {
overflow-x:hidden; overflow-y:scroll; position: relative;

(the .timeline-container was already there, about line 250).

Now...well, it's not perfect, the years bar runs across the middle rather than the bottom, and I'm not sure whether it's covering up books. But I have both a vertical scrollbar _and_ all my data, instantly, and up to today. I have no idea why that worked - it shouldn't have had any effect - but it does.

Hmmm, yes, the bar is covering up books. I need to do more fiddling.