Hacker News new | ask | show | jobs
by kgtm 3688 days ago
First of all, is a web interface absolutely required? It adds a lot of complexity to something that is no more than a couple of lines of Bash glue. For monitoring, you can just keep an SSH session to the Pi.

How i would do it, requiring no user input:

* Designate a hot folder on the NAS, where i put all the videos to be uploaded.

* Establish a list of what has been transferred (nothing initially).

* From the Pi, poll the NAS folder for files that haven't been transferred yet.

* If a file is found, cat file | curl --data-binary @- POST it to YT.

* On success, record the transferred filename.

* Continue polling.

Of course, you can quite easily bolt-on a web interface to this, by exposing some of the steps as API endpoints.

2 comments

Something like this was actually my original idea - just monitor a directory for changes. Then I've still got the issue of running this in the background, constantly, though, so the uploads occur automatically and keep running in background even after user logs out. (Monitoring is not as important as headless uploads)
That shouldn't be an issue, why aren't you using tmux/screen in the first place? It's what most people use to persist sessions across logins (and much more, like terminal multiplexing). I personally use Byobu with the tmux backend on all my servers.

If you don't want to use extra software, a simple cron job running every minute would suffice.

No need to keep the list of files transferred, if you delete them after success.