kiwix / kiwix-android

Kiwix for Android
https://android.kiwix.org
GNU General Public License v3.0
890 stars 447 forks source link

Provide Android content update notification #57

Open mhutti1 opened 7 years ago

mhutti1 commented 7 years ago

From @kelson42 on September 5, 2016 17:52

I have implemented last WE the support of the ZIM metadata "name". The name being a string which is table over ZIM revisions.

This should allow to display a notification to the user if the a content has been updated. I could so in one click download an updated version of the content.

For now, I do not have published officially ZIM files with this metadata, but I have provided a demo file which can be used for dev purposes here: http://tmp.kiwix.org/zim%2bftindex/wikipedia_bm_all_nopic_2016-09.zim.

Copied from original issue: kiwix/kiwix#306

mhutti1 commented 7 years ago

From @kelson42 on September 11, 2016 8:37

The first ZIM files with this new tags have been created and in library.xml.

mhutti1 commented 7 years ago

@kelson42 So one way of finding this out is to download the 6mb file every time we want to check. That isn't very efficient though. It might be a good idea to create a serverside script that we can query to tell us if there is an update. e.g kiwix.org/testscript?zim_name=name&current_version=2016-10 giving either false or the url of the download.

mhutti1 commented 7 years ago

From @kelson42 on January 22, 2017 15:46

@mhutti1 Indeed, we need to have a new version of the library. But I would not force anyway the download of it because of this. Ideally if would be a hook dealing with this (showing the notification) each time the library is updated. On the longer term (6 months), the OPDS implementation will allow to deal with this more elegantly (in a similar way like you propose).

How works the solution you have implemented?

mhutti1 commented 7 years ago

@kelson42 Well i'm to expert but a small piece of server side code (e.g php) running on a server somewhere would cache the library every day and parse it to find the version code and url of the ZIM files in it. Then our app would (at most once a day) when it starts send a request to the server in JSON telling it the versions and names of any ZIM files on the device. The server would then check this with its XML file and return a JSON object containing the names and corresponding download links to any updated files that would then be turned into a notification by our app. (It would also add an update button to the local ZIM list.

mhutti1 commented 7 years ago

From @kelson42 on January 22, 2017 16:10

@mhutti1 Ok, so lets pospone this to the time OPDS will be implemented.

mhutti1 commented 7 years ago

From @tbertels on January 30, 2017 10:41

To lower the server usage, static files could be used instead. They would be created each time a zim is updated and they would contain the last version of their respective zim file. Since that doesn't require to run a server script for each request, it lowers the server load and makes the requests much faster, especially with a lot of concurrent requests. An example of file, for wikipedia_en_all_nopic would be wikipedia_en_all_nopic.ver, containing by example 2016-12 Kiwix would just compare it to its file.

mhutti1 commented 7 years ago

@tbertels This would still require either manual curation or a serverside script to create these static files though.

mhutti1 commented 7 years ago

From @tbertels on January 30, 2017 16:12

Yes, a script that could be run at the end of each zim creation or once everyday.

mhutti1 commented 7 years ago

@kelson42 Will the new content system be in place by 2.3?

kelson42 commented 7 years ago

@mhutti1 No, this won't be ready before this summer.

harshvardhan-takawale commented 6 years ago

@mhutti1 We could ask the user to choose the files he would be interested in, only in case there is an update in that file we would notify him. Also, we can have a job scheduled for the period of 15 days or so from the app so that we would not need a server-side script.

mhutti1 commented 6 years ago

@harshvardhan-takawale The problem is that at the moment using 6 MB of data every x days is not sustainable. We need a way of only returning the ZIM files we are interested in. @kelson42 any update on this?

kelson42 commented 6 years ago

@mhutti1 We have implemented an experimental OPDS backend in kiwix-serve/library.kiwix.org and an experimental client in the libkiwix. The OPDS backend is available at https://library.kiwix.org/meta but I do not have found a lot of documentation. @mgautierfr Do you have writtent something somewhere related to this?

stale[bot] commented 5 years ago

This issue has been automatically marked as stale because it has not had recent activity. It will be now be reviewed manually. Thank you for your contributions.

stale[bot] commented 5 years ago

This issue has been automatically marked as stale because it has not had recent activity. It will be now be reviewed manually. Thank you for your contributions.

stale[bot] commented 5 years ago

This issue has been automatically marked as stale because it has not had recent activity. It will be now be reviewed manually. Thank you for your contributions.

macgills commented 4 years ago

@kelson42 what is the proposal of this ticket now?

Is it that we check for updates to a zim file by using the OPDS endpoint to do a search with the book name and doing a comparison of the returned dates to see if there is a later version?

We could use the workmanager to achieve this, scheduling a task to run every day/week/month while a phone is plugged in and connected to wifi.

Do we do this for all downloaded zims or do we have a system whereby a user marks a book for auto-update?

In an ideal world (from an app perspective) I would envisage an enpoint .../checkUpdates and post a json list of id/name/date objects and get returned a list of name/download links.

Do we issue a notification per book? Do we group notifications when there are multiple?

kelson42 commented 4 years ago

@kelson42 what is the proposal of this ticket now?

Is it that we check for updates to a zim file by using the OPDS endpoint to do a search with the book name and doing a comparison of the returned dates to see if there is a later version?

Yes, but of course this should be a bit smarter as the name is shared between different flavours and you should use the right one.

We could use the workmanager to achieve this, scheduling a task to run every day/week/month while a phone is plugged in and connected to wifi.

Yes

Do we do this for all downloaded zims or do we have a system whereby a user marks a book for auto-update?

All ZIM files (which have a name)

In an ideal world (from an app perspective) I would envisage an enpoint .../checkUpdates and post a json list of id/name/date objects and get returned a list of name/download links.

We don't have that for now... and I'm not really sure this would be a good idea. You probably have to execute one request per ZIM name (in the local library).

Do we issue a notification per book? Do we group notifications when there are multiple?

One notification per name, we the ability of downloading, cancelling, remindmelater.

stale[bot] commented 4 years ago

This issue has been automatically marked as stale because it has not had recent activity. It will be now be reviewed manually. Thank you for your contributions.

stale[bot] commented 4 years ago

This issue has been automatically marked as stale because it has not had recent activity. It will be now be reviewed manually. Thank you for your contributions.

kelson42 commented 1 year ago

Depends on https://github.com/kiwix/libkiwix/issues/638