NoMore201 / playmaker

Fdroid repository manager fetching apps from Play Store
285 stars 37 forks source link

Feature request: automatic update for apps & repository #13

Closed j5k closed 6 years ago

j5k commented 7 years ago

It would be nice, if playmaker can update the apps and repository periodically itself. Or is there an option to run it for example with crontab?

But nice project! I love it ;-)

NoMore201 commented 6 years ago

I was thinking about it, a lot of options came to my mind.

First option seems better, but first we should figure out what to do with credentials, since some people asked (in issue #12 ) to save credentials rather than typing them every launch.

j5k commented 6 years ago

I think more than one option isn't that bad. But first it would be nice if at least one option exists.

Until the question about the saved credentials is solved, the automatic update is initially only possible during running service. I would prefer a timer, which can be set in a settings page.

Thanks a lot.

jcgruenhage commented 6 years ago

I'd prefer option 1, and I'd oppose more than one option for this, because that would add unnecessary bulk.

juppin commented 6 years ago

This is my crontab for updating apps and fdroid once a day.

-s for no output -d "" for a post request with data length null (without this, a get request is made and this doesn't work)

0 6 * * * /usr/bin/curl http://127.0.0.1:5000/api/check -s -d "" && /usr/bin/curl http://127.0.0.1:5000/api/fdroid -s -d ""

Note: Doesn't work -> next post

NoMore201 commented 6 years ago

/api/check call does not update apps, it returns IDs of the apps that needs to be updated. So basically your script does not update apps, https://github.com/NoMore201/playmaker/blob/b4be55c8e4aad94c3796b6270d8932abae3e56ff/playmaker/static/app.module.js#L106-L128 You should parse /api/check response, which is a JSON array, and the call /api/download for each ID in the array. It's possible to build a complete script for this, but IMO it's better to implement it inside code, maybe with another call.

juppin commented 6 years ago

I only had used wireshark with an unsecure http connection to for this... The json sad only SUCCESS and i saw an activity within top. I should have looked in the code.

My preferred option is the second with an additional api call.

NoMore201 commented 6 years ago

I managed to implement auto-update using tornado-crontab. tornado-crontab is a library that lets you schedule tasks in a tornado application using a crontab string.

By default playmaker will schedule auto-update every night at 2AM, but you can control the behaviour using an environment variable CRONTAB_STRING, like this:

# custom crontab string, every 10 minutes
docker run -d --name playmaker -e CRONTAB_STRING='*/10 * * * *' -p 5000:5000 -v /srv/fdroid:/data/fdroid nomore201/playmaker

I pushed changes into the dev branch, if you want to test wait for the image to be built and pull it: https://hub.docker.com/r/nomore201/playmaker/builds/

Yannik commented 6 years ago

@NoMore201 Does this both download new app versions and update the repo afterwards? Or is a manual repo update still required?

NoMore201 commented 6 years ago

If at least one app got updated, it will update also fdroid repository. If no update is available for apps, fdroid update is skipped

juppin commented 6 years ago

Thank you very much for your work