Auto update files on commit!

You'd never believe I spent all day on this! (Well, in between doing actual work)

After trying a whole bunch of different libraries and scripts, and trying unsuccessfully to learn CURL to use with github's api, I finally found a library that does what I need: https://github.com/KnpLabs/php-github-api

I can use it to get a list of commits, and compare the sha of the most recent one to one I saved earlier in a text file, so if there is a commit, then run getfileurls.php and update all the links :-)

I'd love to find a way to send myself a notification if there's ever a new page linked where I need to input a direct file link for the first time, but it doesn't look like there's any way to send web-based SMS messages for free. Maybe I can find a robot to send me messages in a Slack or Hangouts chat room. Email would be easy but there's no point, I don't check my email more than 1-3 times a day.

My program has a message area to put messages associated with the files (eg for an initial test I set the messages for every file whose path is /luma/payloads to "delete the files in /luma/payloads not ending in .bin and rename the .bin file according to the guide" so all I need to do is make a page to display the contents of the database and be able to edit it without opening up CPanel (so I can fix things on mobile), and make a button on the program to report errors, then I'll go alpha :-D Then, if all the wrong data gets fixed up, and people are actually interested in using it, I'll make a pull request to add the divs to the what you need sections, and it can run off the REAL guide!
  • Like
Reactions: 2 people

Comments

This sounds interesting. If I followed it right, it's a web app that'll always download the latest needed files from Plailect's guide and now you found a way for it to update automatically whenever new commits are done to the guide?
 
Yep :-) If I had failed at being able to do that it would make it less useful. An alternative is to just have the file updater script run regularly, but then there's a balance between how often to run it and how much of a time period to tell the program (eg all files with a timestamp within five minutes of the most recent one count as active). If this time period is too short then some files might not make it, if the script ran slowly. But if the script runs less regularly and the time period is longer then there's a higher risk someone might download an outdated file.

Something else I'll do later is get the list of files changed in the commit and only update the files on those. So the script will take a few seconds or a minute, not several minutes like now (since its recursively visiting every single page in the guide). The faster it runs the tinier the chance is someone could download something outdated :-)
 

Blog entry information

Author
Quantumcat
Views
140
Comments
6
Last update

More entries in Personal Blogs

  • I WON
    "ALPHADREAM IS DEAD SO NO MORE MARIO AND LUIGI GAMES (insert nerd emoji...
  • 4: Reddit
    Finally, number 4! Never thought this day would come, did you? Uhh...
  • books
    1. I am cool as hell, have one million dollars 2. I am banned from...
  • Syncthing is fun!
    Having been kinda active in an Android forum I quickly got sick about...
  • Feeling at home here
    Not much to say this time. I'm depressed. Like almost always. Trying to...

More entries from Quantumcat

Share this entry

General chit-chat
Help Users
  • K3Nv2 @ K3Nv2:
    I avoid lemonaids if I can
  • SylverReZ @ SylverReZ:
    AncientBoi's minding his own business.
  • K3Nv2 @ K3Nv2:
    Ancientboi is the one in the middle of that old grandpa photo
    +1
  • Psionic Roshambo @ Psionic Roshambo:
    Meatspin is Kens desktop background lol
    +1
  • K3Nv2 @ K3Nv2:
    Yes uremum didn't tell me about her transition and begged me to make it my background
  • K3Nv2 @ K3Nv2:
    I couldn't hurt his or hers feelings
  • TechieSaru tempBOT:
    TechieSaru has joined the room.
  • SylverReZ @ SylverReZ:
    @K3Nv2, Don't ask him where to get lemonade. ;)
  • K3Nv2 @ K3Nv2:
    Psi fondles big red lemons to make lemonaides
    +1
  • K3Nv2 @ K3Nv2:
    Always wanting my lemons he can't have them
  • K3Nv2 @ K3Nv2:
    Jeb stole bigonyas pants
    +1
  • BigOnYa @ BigOnYa:
    Jokes on you, I don't have any on.... "Cause I'm free.... Free ballin'"
  • SylverReZ @ SylverReZ:
    @BigOnYa, Sounds like you and AncientBoi get along together TOO well.
    +1
  • BigOnYa @ BigOnYa:
    Thank God we are 20 states away from each tho. Kenny's almost neighbors with him.
  • K3Nv2 @ K3Nv2:
    I live in kc you dingus
  • BigOnYa @ BigOnYa:
    Ok still closer to him than me, perv boi
  • BigOnYa @ BigOnYa:
    Not to mention you guys share the same last name.
  • K3Nv2 @ K3Nv2:
    I thought you were Mrs.bigboi
    +1
  • BigOnYa @ BigOnYa:
    Nuh twice divorced, I took my maiden name
  • K3Nv2 @ K3Nv2:
    Mrs. bigancientboi?
    +1
    K3Nv2 @ K3Nv2: Mrs. bigancientboi? +1