Angular.js search app

Comments about LibriVox? Suggestions to improve things? News?
Post Reply
pkosenko
Posts: 21
Joined: December 6th, 2013, 3:34 pm
Location: Santa Monica, California, USA
Contact:

Post by pkosenko »

Has anyone attempted to build an Angular.js search app for Librivox? I haven't turned one up on a search of the forum, but I have been thinking about doing it. Here's the initial Controller code for grabbing the data. It is different, obviously, from the JQuery method of accessing jsonp, since angular has its own http.jsonp() method. Also note the format of the jsonp callback at the end of the URL. It has to be exactly "&callback=JSON_CALLBACK" in caps. In any case . . . I am just starting on it. This grabs the data, if anyone else is interested.

var librivoxSearch = angular.module('librivoxSearch', []);
librivoxSearch.controller('librivoxSearchController', function ($scope, $http) {
$http.jsonp('http://librivox.org/api/feed/audiobooks/author/Melville?format=jsonp&callback=JSON_CALLBACK').success(function (data) {
$scope.data = data;
});
});
ekzemplaro
Posts: 2027
Joined: December 31st, 2011, 7:17 am
Location: Tochigi,Japan
Contact:

Post by ekzemplaro »

Hello,

My catalog (URL is in my signature) is written by Javascript. I use jQuery.
The code & data (JSON) are at GitHub. I hope it will give you some suggestion.
This should be https.
I just checked the URL using wget.
There are 3 authors.
Melville , Herman
Post , Melville Davisson
Melville , Velma Caldwell

Cheers,
Masa
pkosenko
Posts: 21
Joined: December 6th, 2013, 3:34 pm
Location: Santa Monica, California, USA
Contact:

Post by pkosenko »

I have a good working model of the app created. You are right that the jsonp call should be https: rather than http:

I haven't put it up on a web site or posted it to Github yet.

One of the issues that I notice is that there doesn't seem to be much detailed error reporting in the API. If an author does not exist, JSON returns 404, and the same for most other errors that are not server-related. JSON server errors usually return 500, but I haven't encountered any yet.

It would be nice to include a JPEG of the app here, but I don't see that pics are allowed in posts.

I will probably working on prettifying it a bit (styling it) before I post it live.

It is an author search with title filtering in Angular.
annise
LibriVox Admin Team
Posts: 38572
Joined: April 3rd, 2008, 3:55 am
Location: Melbourne,Australia

Post by annise »

you can post a link to an image if it is stored somewhere else

Anne
ekzemplaro
Posts: 2027
Joined: December 31st, 2011, 7:17 am
Location: Tochigi,Japan
Contact:

Post by ekzemplaro »

Hello pkosenko san,

Let me show what is a bottle neck for app & catalog developpers.

Can your program search this author ?
Shiki Masaoka
https://librivox.org/author/10072/

Masaoka Shiki is a famous haiku writer. There are 3 recordings at LibriVox.
But for the moment most of apps & catalogs can't search his recordings.

I suppose there are lots of authors, whose recordings are not searched by apps & catalogs.

Cheers,
Masa
pkosenko
Posts: 21
Joined: December 6th, 2013, 3:34 pm
Location: Santa Monica, California, USA
Contact:

Post by pkosenko »

You are right that "Masaoka" returns nothing on an author search, but I wonder why that would be. Is the name ONLY in a Japanese language table and the API searches ONLY English? Hmmm . . .

I posted an image on Facebook, but it isn't an image URL. So you may have to click on the URL to see it: https://fbcdn-sphotos-h-a.akamaihd.net/hphotos-ak-xap1/v/t1.0-9/10888959_10205786237277515_7927415603702086084_n.jpg?oh=6244e1e60007c29bfad0f9fa3ae2baa9&oe=5524666E&__gda__=1429847099_03495b1320244841f9a1032228159385

I am still getting ready to post the code on github today or tomorrow.
pkosenko
Posts: 21
Joined: December 6th, 2013, 3:34 pm
Location: Santa Monica, California, USA
Contact:

Post by pkosenko »

I just pushed it to Github:

https://github.com/pkosenko/librivox-search

You should be able to clone it to a local test web and run it while you are online.

It's nothing great, but a start.
ekzemplaro
Posts: 2027
Joined: December 31st, 2011, 7:17 am
Location: Tochigi,Japan
Contact:

Post by ekzemplaro »

Hello pkosenko san,
pkosenko wrote:You are right that "Masaoka" returns nothing on an author search, but I wonder why that would be. Is the name ONLY in a Japanese language table and the API searches ONLY English?
Here're another examples.

Miekichi Suzuki
https://librivox.org/author/3095/
Fumiko Hayashi
https://librivox.org/author/3548/
Kiyoshi Miki
https://librivox.org/author/9480/
Doppo Kunikida
https://librivox.org/author/9640/
Takashi Nagatsuka
https://librivox.org/author/10073/

The above authors are all Japanese. But I don't think it's relating to the language.
They are just read in collections.

For the moment to fix this problem, you need to reconstruct the database. But I suppose nobody has done it yet.
Needless to say you can't find the above authors using my catalog.

Cheers,
Masa
pkosenko
Posts: 21
Joined: December 6th, 2013, 3:34 pm
Location: Santa Monica, California, USA
Contact:

Post by pkosenko »

It LOOKS to me like you may be right that Librivox API is CACHING names in a special table that needs to be REBUILT MANUALLY. Someone could probably write a Chron script for that update.

Well . . . that is unfortunate. It seems that Librivox could use some backend help with the database and the API code. But since it a volunteer site, I bet that it's hard to find enough programmers who have enough time to donate. And even then, careful coordination would be required to maintain integrity.

It's hard to tell what the problems are unless one has the ability to inspect the code that is running the API. But it sounds to me like you have made a good guess.
ekzemplaro
Posts: 2027
Joined: December 31st, 2011, 7:17 am
Location: Tochigi,Japan
Contact:

Post by ekzemplaro »

Hello pkosenko san,
pkosenko wrote:Someone could probably write a Chron script for that update.
Right.
Now you understand the current problem.
Several people are working to do this. One approach is to parse 'Web page'.
Scott san is doing this approach.
Let's continue to exchange information.

Cheers,
Masa
pkosenko
Posts: 21
Joined: December 6th, 2013, 3:34 pm
Location: Santa Monica, California, USA
Contact:

Post by pkosenko »

I have updated the Angular App. It now has two variants.

1. An author search with title filter.
2. An abbreviated author/title search listing (with filter) that displays all data from a selected title in a separate panel.

https://github.com/pkosenko/librivox-search
pkosenko
Posts: 21
Joined: December 6th, 2013, 3:34 pm
Location: Santa Monica, California, USA
Contact:

Post by pkosenko »

I have posted a new update to the Angular App.

Version #2, which displays individual book data in a separate panel, has been updated to use an angular factory service to cache data between the two controllers so that the app no longer has to repeat a query to librivox to get individual book data for display. Individual book data display uses the data cached from the original search.

https://github.com/pkosenko/librivox-search
Post Reply