Confused on my Manga Reader future Development

Development4 min read

Last year, when I develop the new version of my hobby software which is manga reader, I found some weakness in it that I’m not sure on how should I approach this.

First of all, when I first develop manga reader software, I decide to develop it as a website since I only need to develop 1 software and it can work on all devices I own.

Second, I only know how to make desktop or website application. I just entered high school at that time, I only know how to make a desktop application (C++) or website (PHP) but I want to also read on my mobile phone and tablet.

Because of that, the only logical reason is to make it as a website as it gives more benefits for me.

However, right now, I have the ability to develop on any platform I want. I’ve gained more experience and ability as the year passes so it shouldn’t be a problem anymore.

Well, I probably still want to develop it as website though. I don’t want to become too busy developing this side project.

So what’s the problem?

Now the issues I have is about background task.

I have been thinking about this as I develop the version 1.0,

  • “Do I have to hit scans everytime I want to index the manga directory?”.
  • “Do I have to hit scans button if I want the new manga to be available on the website?”.
  • “What about image size? Image consume so much space from my HDD. Is there no way to optimize them all so I can store more?”
  • “What about the update? Do I have to update the website manually?”
  • “Is there no automatic way to do this?”

Since I was using PHP, it’s not possible to implement all of this features.

So, no solution?

It isn’t completely impossible to solve this. It just that the solutions for solving these problems require users to do extra technical tasks.

And I’m not a fan of this. I like my software to be one click install and easy to use. If they are required to do extra steps for something, at least make it very easy (maybe only require clicking button) and not technical (like “run this command”, etc).

This is some solution I’ve been thinking and why I don’t like them:

Cron Job

The way PHP run is different. PHP (in short) is a request-response based application. It only runs its script when it receives a request from users.

Because of that, the background task isn’t possible.

Other web apps like WordPress solve this by relying on cronjob which is time-based job scheduler. It runs a command that basically sends a request to the PHP servers every x seconds, minutes, or hour.

If you want to know, the command is like this: curl http://example.com/wp-cron.php?doing_wp_cron > /dev/null 2>&1

As you can see, it’s very technical.

Second ‘support’ Application

Since PHP can’t do it, I can just make a second application for the jobs that aren’t possible with PHP. The second application can just act as optional software if users want extra convenience features.

This, however, needs a lot of work and time from me.

I mean, this project is only for fun, for a hobby. I don’t want to spend all of my time just to develop this project.

I also feel like the second application will act like DLC. In short:

“Hey, this software is doing this, this and this. Do you need more? Then you need to download this extra content…”

Or something like that.

Using Ajax

As I said before, PHP is a request-response based application. Making interactive website like chat apps is not possible unless refreshed every time to update the client.

Fortunately, there is javascript. It runs on the clients, can modify the client data, and will run as long as the current page is not stopped. It can even make a new request to the server without refreshing the whole page.

With this, it possible to implement a task that can act as a background task that will make a request to the server to run the task.

In fact, the scanning technology (indexing) is using this technique to be able to scan so many files and folder without reaching execution time limit.

However, this script only runs when the user opens the web page. So, if you close it, the script will be terminated.

If you have been using the old version, there is a bug that will break the website data if you stop in the middle of scans. This is because I’m assuming the scans will always be completed or only stopped because of scan failure which is very safe since it predictable when this happens.

This means that you have to keep your browser open or the background task will stop.

This might be is not big deal for some users especially if they run it on the computer.

However, there are some users that run this application using mini-server like NES or raspberry which some of them don’t have GUI or browser even.

And for me, server applications that require having GUI is stupid. It waste of resources.

Conclusion

As you can see, I have the solution but I’m not really satisfied with the solution I have right now.

Because of that, I’m not sure how I should I approach this. There is no perfect solution.

If I have to choose, I will choose the last approach.

Yes, there is some inconvenient introduced if I’m going by that approach. But it gets the job done, not require that much job, and easy to do.