Update folder

This commit is contained in:
Andros Fenollosa 2023-04-18 14:11:54 +02:00
parent ce516639b7
commit f860b216a8
2 changed files with 50 additions and 6 deletions

View File

@ -21,17 +21,35 @@ sudo apt install inotify-tools ffmpeg
``` sh ``` sh
curl -o dynamic-folders-video-optimizer https://raw.githubusercontent.com/tanrax/dynamic-folders/main/dynamic-folders-video-optimizer.sh && chmod +x dynamic-folders-video-optimizer && sudo mv dynamic-folders-video-optimizer /usr/local/bin curl -o dynamic-folders-video-optimizer https://raw.githubusercontent.com/tanrax/dynamic-folders/main/dynamic-folders-video-optimizer.sh && chmod +x dynamic-folders-video-optimizer && sudo mv dynamic-folders-video-optimizer /usr/local/bin && echo "🎉 Successfully installed! 🎉"
```
Test
``` sh
dynamic-folders-video-optimizer --help
``` ```
### Run ### Run
``` sh ``` sh
dynamic-folders-video-optimizer [folder to watch] dynamic-folders-video-optimizer --folder [folder to watch]
``` ```
Example.
``` sh
mkdir optmizer
dynamic-folders-video-optimizer --folder optimizer
```
And leave a video that you want to optimize in the folder `optimizer`.
### Service ### Service
Create a file in `/etc/systemd/system/dynamic-folders-video-optimizer.service` with the following content.
```ini ```ini
[Unit] [Unit]
Description=Folder that watches when new videos are added to a folder and optimizes them. Description=Folder that watches when new videos are added to a folder and optimizes them.
@ -42,12 +60,41 @@ RestartSec=5
User=[user] User=[user]
Group=[user] Group=[user]
WorkingDirectory=/home/[user] WorkingDirectory=/home/[user]
ExecStart=dynamic-folders-video-optimizer [folder to watch] ExecStart=dynamic-folders-video-optimizer --folder [folder to watch]
[Install] [Install]
WantedBy=multi-user.target WantedBy=multi-user.target
``` ```
Edit it to your needs.
Recharge services.
``` sh
sudo systemctl daemon-reload
```
And activate it.
``` sh
sudo systemctl enable dynamic-folders-video-optimizer
sudo systemctl start dynamic-folders-video-optimizer
```
### Cron
Open.
``` sh
crontab -e
```
Add to document.
``` sh
@reboot dynamic-video-to-mp4.sh >/dev/null 2>&1 &
```
## Development ## Development
### Check syntax ### Check syntax

View File

@ -6,10 +6,7 @@
# Requirements: Install inotify-tools and ffmpeg # Requirements: Install inotify-tools and ffmpeg
# Example Debian: $sudo apt install inotify-tools ffmpeg # Example Debian: $sudo apt install inotify-tools ffmpeg
# -- # --
# Activate a service
# Cron: @reboot dynamic-video-to-mp4.sh >/dev/null 2>&1 & # Cron: @reboot dynamic-video-to-mp4.sh >/dev/null 2>&1 &
# or create a service:
# $sudo nano /etc/systemd/system/dynamic-video-to-mp4.service
# -- # --
# START # START