Downloading Dictionaries (e.g. for Android): how does it work ?

Started by Gert, 19. November 2010, 21:19:57

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

Gert

Specifically to Achim and Jacob,

I lost the status on your work concerning downloading dictionaries (using MySQL database etc.).

Is your your approach ready to use ?

I'd like to use that download approach for the 'HTML5' version of DictionaryForMIDs (I'll just abbreviate that 'HTML5' version as 'htmlApp').

Well, currently I postponed my original plans to store the dictionaries in the htmlApp's Web Storage, due to lack of information in this area (see http://dictionarymid.sourceforge.net/forum/index.php?topic=263.0 and http://dictionarymid.sourceforge.net/forum/index.php?topic=262.0).

So now I plan that the htmlApp will be based on the HTML5 'application cache' feature. I will upload an first version with minimal user interface soon (note that I myself do not have the time to develop the user interface of the htmlApp; we need to find a developer for developing the user interface in HTML5).

My current plan is to create a separate Java tool which does
- download the dictionary from the sourceforge server; preferably using exactly the same mechanism as Android
- create the required files for the htmlApp
- upload all those files to a web server; users can start the application from there by entering the corresponding URL
That Java tool will be run by an administrator; or by the dictionary publisher.

Well, how can I download the dictionaries from that Java tool ? Is there a database that can be queried for existing dictionaries ? Ideally, is there a Java interface (jar file) that can be used ? Maybe even with a nice API that could contain methods such as 'enumerateDictionaries' and 'downloadDictionary' ?

Please just enlighten me there ... !

Thank you !
Gert

jn0101

Hi Gert, long time no see!

My understanding is that Achim would like to do the server part and SF hosting part, in PHP.
This is very fine for me as PHP and SF hosting isnt anyhing I know much about.

I don't know about the progress, sorry

Yours,
Jacob

axin

Hi Gert,

I'm quite busy these days, so only a quick answer here. By the way, great idea to have a HTML5 version!

Quote from: Gert on 19. November 2010, 21:19:57
Well, how can I download the dictionaries from that Java tool ? Is there a database that can be queried for existing dictionaries ? Ideally, is there a Java interface (jar file) that can be used ? Maybe even with a nice API that could contain methods such as 'enumerateDictionaries' and 'downloadDictionary' ?

Right now we have a database with all information about the dictionaries. It includes data like

  • a unique id per dictionary
  • dictionary name
  • url to zip file
  • size of zip file
  • url to jar file (currently missing for most dictionaries)
  • size of jar file (currently missing for most dictionaries)
  • other meta information... (you can also add more columns to the database if needed)

As different platforms need a different format to display the data (e.g. JSON for Android, HTML for JavaME), you can create a class that extends ota/Data.php and register it in ota/DataFactory.java. If you need to do special queries, you can implement them in ota/DataLoader.php and call them in your class (e.g. to get a special entry only you can overwrite the load function and call something like DataLoader::getDictionary(7) to load the dictionary 7). If you want to see some examples, check ota/AndroidData.php and ota/JavaMeData.php

Querying of the system uses parameters in the url. There is only one that is fixed: p standing for a platform id (as registered in ota/DataFactory.php) tells the ota system what Data-class to load. For Android, I pass the version of the app because different versions require different formats. The link is than:
http://dictionarymid.sourceforge.net/ota.php?p=1&v=80
For JavaME:
http://dictionarymid.sourceforge.net/ota.php?p=2

Hope that helps for the moment. I'll still try to add a more complete documentation on the website... Feel free to ask me if you encounter any problems.

Achim

Gert

Achim,

thanks for that information !! For me that really reads very well designed !

I need to look closer at this ... unfortunately also me I am rather busy the following weeks so it may take a bit.

QuoteFeel free to ask me if you encounter any problems.
Great !

Thanks again !
Gert