diff --git a/README.md b/README.md index 687697e..c923043 100644 --- a/README.md +++ b/README.md @@ -21,17 +21,35 @@ sudo apt install inotify-tools ffmpeg ``` 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 ``` 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 +Create a file in `/etc/systemd/system/dynamic-folders-video-optimizer.service` with the following content. + + ```ini [Unit] Description=Folder that watches when new videos are added to a folder and optimizes them. @@ -42,12 +60,41 @@ RestartSec=5 User=[user] Group=[user] WorkingDirectory=/home/[user] -ExecStart=dynamic-folders-video-optimizer [folder to watch] +ExecStart=dynamic-folders-video-optimizer --folder [folder to watch] [Install] 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 ### Check syntax diff --git a/dynamic-folders-video-optimizer.sh b/dynamic-folders-video-optimizer.sh index f9dd87a..cc7fac5 100755 --- a/dynamic-folders-video-optimizer.sh +++ b/dynamic-folders-video-optimizer.sh @@ -6,10 +6,7 @@ # Requirements: Install inotify-tools and ffmpeg # Example Debian: $sudo apt install inotify-tools ffmpeg # -- -# Activate a service # 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