Skip to content

Latest commit

 

History

History
257 lines (193 loc) · 12.2 KB

GUIDE.md

File metadata and controls

257 lines (193 loc) · 12.2 KB

Tutorial

This section tells how to make it work in Step-by-Step process and in more detailed way.

Table of Contents

Note

Grammatical Errors ahead, we're not native english speaker so please bear with us.

Setup Facebook Token

Click Here to Show

To set up a Facebook long-lived access token, follow these steps:

  • Go to Facebook Developer
  • Click My Apps

    Screenshot

  • Click Create App

    Screenshot

  • Click Business and Next(Business has more perks, than others so pick it)

    image

  • This is very Self Explanatory, I guess you already know what to do.

    Screenshot

  • Hover through tools and Click Graph Api Explorer

    Screenshot

  • Grant Permissions for token, Click Add a Permission, Then click Events Groups Pages click all the following Screenshot

The scopes should be color black as the image shows, If it shows color green it means it's not yet applied to the token. (Repeat the proccess if the next step doesn't work)

  • Click on User Token and choose the page you want.

    Screenshot

  • There's gonna popup there, just give the App Permissions and Authorize it.
  • Now Click Generate Access Token and set the User Token to the page you want, then copy the Short-Lived-Token

    Screenshot

  • Go back to Dashboard Again. Then hover through tools and click Access Token Debugger

    Screenshot

  • Insert the Token you copied earlier and Click Extend Access Token

    Screenshot Screenshot

  • Now Copy it and Save it Somewhere

    Screenshot


Setup the Frames

Click Here to Show

tip You can use a graphical interface to extract frames, Frame Chopper or follow the steps below.

You need to use Windows PowerShell to install and use FFMPEG

Before installing FFMPEG, we need to install Scoop, a package manager for Windows

Step 1: Open Windows Powershell:

  • Click the Windows Button (Start Menu).
  • And Search for Windows Powershell then Right-Click and click Run as Administrator

Step 2: Set the Execution Policy (First Time Only)

  • If this is your first time running remote scripts, you'll need to allow PowerShell to execute them. Run the following command to set the execution policy
Set-ExecutionPolicy RemoteSigned -scope CurrentUser

If you encounter an error, re-run the command above, and then proceed with the next steps

Step 3: Install Scoop

  • Now, install Scoop by running this command:
iwr -useb get.scoop.sh | iex

Step 4: Install FFMPEG and GIT Once Scoop is installed, run the following command:

scoop install ffmpeg git

After succeeding, Now run these commands:

md "$($env:USERPROFILE)\Desktop\frames"
cd "$($env:USERPROFILE)\Desktop\frames"

This folder will appear on your Desktop, And thats where you will replace your video you want to chop

image

Now chop the video by running this command:

ffmpeg -i "video.mkv" -vf "fps=2" -fps_mode vfr -q:v 3 frame_%00d.jpg
  • -i "video.mkv" Specifies the input video file
  • -vf "fps=2" is the frames chopped per second (needed in config.conf)
  • -fps_mode vfr Ensures variable frame rate is used to match the input video
  • -q:v 3 Defines the output image quality (lower numbers mean higher quality)
  • frame_%00d.jpg Specifies the output file naming pattern (e.g., frame_1.jpg, frame_2.jpg)

Wait until it finished...

This is getting this info is deprecated, no need for you to gather it.

Then, we're gonna gather the infos of Video and Make sure to Take note all the infos needed.

To get the total frames of the video. (You can see this info too while chopping the frames)

ffprobe -v error -select_streams v:0 -count_packets -show_entries stream=nb_read_packets -of csv=p=0 video.mkv

To get the frame rate of the video (If you get fractions "24/1" omit "/1")

ffprobe -v error -select_streams v:0 -show_entries stream=r_frame_rate -of default=noprint_wrappers=1:nokey=1 video.mkv

Create your own clone of the repository. And click Create a new Repository, You will be redirected to create the name of your repository. And the steps of creating one should be self-explanatory.

Screenshot

Then now we're gonna upload the frames to GitHub. Open your Windows Powershell and Run the Command below:

cd ..
git clone https://github.com/{your_username_here}/{repo_name}

{repo_name} stands for the name of your repo you created for this template.

Now, Run this command:

cd {repo_name}
Copy-Item -Path "$($env:USERPROFILE)\Desktop\frames\frame_*.jpg" -Destination frames -Recurse
git init
git add .
git commit -m "frames, update"

Provide your Git Infos, Must be the same as your username and email (it will not display it on public):

git config --global user.name "<your-username>"
git config --global user.email <[email protected]>

Now get your GitHub token, refer to this tutorial...

  • And finally, Push the changes to the repository:
git remote set-url origin https://{your_username}:{your_token_here}@github.com/{your_username}/{repo_name}
git push origin master

Setup your BOT

Click Here to Show

  • Add subtitle file (only supported *.ass/*.ssa, *.srt subtitles)
  • Insert all the infos needed in config.conf file.
    season="1"
    episode="01"
    total_frame="4000" # total frames cutted
    img_fps="" # the fps of the cutted frames
    page_name="" # (must be exact) this is used for checking if the token is valid
  • And push it to master.

We need to setup our repo secret variables too...

  • To setup it, first go to Settings on your GitHub Repo.

    image

  • Under the Secrets and Variables section, Click Actions

    Screenshot

  • Then click New Repository Secret

    Screenshot

  • The name must be TOK_FB, And Paste your Long-Live Facebook you save earlier, Then click Add Secret.

    Screenshot

    • (Optional) You can add the GIF token too by creating again, and it is named TOK_GIF

  • Add also your GitHub token on Repository Secrets named GIT_TOK


How to make your Content Public

Important

All the contents you post will not be shown to public if its NOT set to Live

Click Here to Show

  • Go to Settings > Basic

    Screenshot

  • And Change your Privacy Policy URL to https://google.com, Then click Save Changes at the bottom of the page.

    Screenshot Screenshot

  • Then go back to the Dashboard and Switch your Transparency from Development to Live

    Screenshot


How to Run the Bot Manually

Click Here to Show

  • Click on Actions

    image

  • Click on Trigger, And click Run Workflow

    Screenshot

We prefer not doing this (The BOT is already running), because it will cause to run the workflow twice when the automatic run was executed. it'll cause duplication. Instead do Manually Disable Workflow. Make sure you know what you're doing. (This is helpful if you want to run the posting after you enable the workflow)


How to Manually Enable/Disable the Posting

Click Here to Show

  • Click on Actions

    image

  • Click on Trigger, and click the three dots ···. Then finally, click on Disable Workflow

    Screenshot

Enabling it pretty much the same procedure, It will appear the enable button at the top.


How to Change the Interval execution of Posting

Click Here to Show

  • Firstly, go to .github/workflows/process.yml Screenshot

  • And change the cron syntax 0 */2 * * *, this cron syntax stands for every 2 hrs, so you can just change the 2 based on your likings. Or you can make your own cron here.

: Make sure you know what you're doing, This might cause duplications and errors on posting. And before you adjust it, make sure the product of fph and mins mustn't exceed to the number of hours you set on cron. Assume you have fph=50 and mins=5, so the product of it is: 50 * 5 = 250, then divide it with 60 to know the number of hours: 250 / 60 = 4.16 hrs