Closed j5k closed 6 years ago
I was thinking about it, a lot of options came to my mind.
pm-server
executable which updates all the apks and then quits, rather than executing the server. In this way it's possible to define a cronjob/systemd timer by just calling pm-server --update
. The problem is that it will require providing username and password, since playmaker doesn't save credentials/tokens./api/updateAll
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.
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.
I'd prefer option 1, and I'd oppose more than one option for this, because that would add unnecessary bulk.
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
/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.
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.
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/
@NoMore201 Does this both download new app versions and update the repo afterwards? Or is a manual repo update still required?
If at least one app got updated, it will update also fdroid repository. If no update is available for apps, fdroid update is skipped
Thank you very much for your work
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 ;-)