Skip to content

yuyudhn/FrameinOrder

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 
 
 

Repository files navigation

Every Frame in Order Bot

This is tool i use to run my Every Gotoubun no Hanayome Frame In Order Facebook Fanspage.

Tested in Debian with Python 3.10.8.

Preparation

Since basicly i create this tool for my personal needs, i don't automate all process. There are several steps that must be executed before you can use this tool.

First, you need to extract all frames from video into frames folder. You can use ffmpeg for this.

Example, if you have Gotoubun-Episode4.mp4, you can run this command.

mkdir frames
ffmpeg -i 'Gotoubun-Episode4.mp4' -vf fps=1 ./frames/%04d.png -hide_banner

Frame Extract

Your extracted frames will named 0001.png, 0002.png, etc. Example:

nino@nakano:~$ ls -lha ./frames/ | head -n 8
total 49M
drwxr-xr-x 2 nino nino 4.0K Nov 27 17:51 .
drwxr-xr-x 5 nino nino 4.0K Nov 27 17:51 ..
-rw-r--r-- 1 nino nino 7.0M Nov 27 17:51 0001.png
-rw-r--r-- 1 nino nino 8.1M Nov 27 17:51 0002.png
-rw-r--r-- 1 nino nino 8.2M Nov 27 17:51 0003.png
-rw-r--r-- 1 nino nino 5.5M Nov 27 17:51 0004.png
-rw-r--r-- 1 nino nino 5.5M Nov 27 17:51 0005.png

Frames Folder

If you need to delete opening images, ending images, or some images from frames directory, you need to reorder the file name again. Use this command:

cd frames
ls -v | grep '.png' | cat -n | while read new old; do mv -n "$old" `printf "%04d.png" $new`; done

Setup Application and Token

First, create your apps in Facebook Developer. Next, get your token at Graph API Explorer. And then, extend your token expiration at Access Token Debugger.

Setup Bot

Ok, all frames is ready to upload. Next, ajjust some value from frame-in-order.py.

Change value of ACCESS_TOKEN with your token.

To avoid your application blocked (because of spam detection), i am adding time sleep on every requests (time.sleep(3)) at line 49. You can change to your desired value.

In my case, for 1 Episode of Gotoubun no Hanayome, around 4GB disk will be used for extracted frames. So, this tool will remove every frame that already uploaded to freed your disk space.

Run Bot

After all is completed, just run Frame in Order bot with this command:

python3 frame-in-order.py --start 1

And if you want to continue running again, start from frame 41.

python3 frame-in-order.py --start 41

Example of output: Gotoubun Frames in Order

Default loop value is 40. But you can set loop value using --loop flag. Example:

python3 frame-in-order.py --start 41 -loop 4

Above command will upload frame from 0041.png until 0045.png.

Contact

If you have any question about this Bot, you can contact me directly on Twitter.

Releases

No releases published

Packages

 
 
 

Languages