Skip to content

Python script for running Frame in Order Facebook pages

Notifications You must be signed in to change notification settings

ShirokamiRyzen/Frame-in-Order

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

12 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Every Frame in Order Bot

This is tool i use to run my: Every Charlotte Frame in Order, Every BanG Dream Frame in Order Facebook Fanspage.

Tested in Debian with Python 3.10.8.

Preparation

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

Example, if you have Charlotte_episode2.mp4 on videos folder, you can run this command.

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

Frame Extract

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

ryzen@raspberrypi:~$ ls -lha ./frames/ | head -n 8
total 49M
drwxr-xr-x 2 ryzen ryzen 4.0K Mar 13 17:51 .
drwxr-xr-x 5 ryzen ryzen 4.0K Mar 13 17:51 ..
-rw-r--r-- 1 ryzen ryzen 7.0M Mar 13 17:51 0001.png
-rw-r--r-- 1 ryzen ryzen 8.1M Mar 13 17:51 0002.png
-rw-r--r-- 1 ryzen ryzen 8.2M Mar 13 17:51 0003.png
-rw-r--r-- 1 ryzen ryzen 5.5M Mar 13 17:51 0004.png
-rw-r--r-- 1 ryzen ryzen 5.5M Mar 13 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 run.py.

Change value of ACCESS_TOKEN with your token.

To avoid your application blocked (because of spam detection), i am adding MIN_DELAY and MAX_DELAY on every requests . You can change to your desired value but remember, dont set below 3 min (180 sec) because Facebook can limit your page and flag it as Spam.

In my case, for 1 Episode of Charlotte, around 1.5GB 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 run.py --start 1

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

python3 run.py --start 41

Example of output: Charlotte Frames in Order

Default loop value is unlimited. 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 Facebook.

Releases

No releases published

Packages

No packages published

Languages