• If you're here for vtubers, I highly recommend you go to The Virtual Asylum instead.
    They'll love you there

Useful scripts

Thread Description
Scripts that can be of use to some

YakuInTheFlesh

varishangout.com
Regular
I though about making a thread to post some useful scripts that might be helpful to some of you.

Here is one I just used again recently:
For what: amiami.com
What does it do: It highlights figures that are under a certain price point and goes to the next page if none are present. I'm using it for the used figurines section.
How to use: Copy the code into the browser console while on amiami.com. If results are found you can press 'N' to go to the next page. If none are found it'll continue automatically.
JavaScript:
let priceGood = 1000;
let priceOk = 2500;

(() => {
    setInterval(() => {
        let prices = document.querySelectorAll(['.newly-added-items__item__price'])
        let statusOfOrders = document.querySelectorAll(['.newly-added-items__item__tag-list'])
        let closed = 0

        for (let s of statusOfOrders) {
            if (s.lastChild.innerText === "Order Closed" &&
               s.lastChild.style.display !== 'none') {
                ++closed
            } else {
                let priceInfos = (s.parentElement.lastChild.lastChild.innerText ?? '').split(' ')
                let p = +priceInfos[0].replace(',', '')

                if (!(p > 0 && p < priceOk)) {
                    ++closed
                }
            }
        }

        if (closed === 20) {
            closed = 0
            document.querySelector('.pager__next').firstChild.click()
        }

        for (let price of prices) {
            let priceInfos = price.innerText.split(' ')
            let p = +priceInfos[0].replace(',', '')

            if (p < priceGood) {
                price.parentElement.parentElement.style.background = '#77ff77'
            } else if (p < priceOk) {
                price.parentElement.parentElement.style.background = '#ffff77'
            }
        }

        for (let status of statusOfOrders) {
            if (status.lastChild.innerText === "Order Closed" &&
               status.lastChild.style.display !== 'none') {
                status.parentElement.style.background = "#ff4444"
            }
        }
    }, 1000)
    document.addEventListener('keypress', (e) => {
        if (e.code === 'KeyN') {
            document.querySelector('.pager__next').firstChild.click()
        }
    })
})()

I whipped this one up in a couple of minutes and it seems to work.
I use it to have some variation in my figurines and sell the ones I no longer want (often for a profit) and then use this script to quickly find new ones.
Now I might be stupid and simple did not see the price range selector though so this script could also be completely useless. Let me know though.
 

Halo

varishangout.com
Regular
I whipped this one up in a couple of minutes and it seems to work.
I use it to have some variation in my figurines and sell the ones I no longer want (often for a profit) and then use this script to quickly find new ones.
Now I might be stupid and simple did not see the price range selector though so this script could also be completely useless. Let me know though.
I was wondering how it was possible the site didn't have a price range selector and went to check and to my surprise it actually doesn't.

weird how they missed that (or y'know kept it out as some psychological way to get people to buy more while they're scrolling and trying to find something in their price range)

Anyway, nice work nonetheless
 

YakuInTheFlesh

varishangout.com
Regular
I was wondering how it was possible the site didn't have a price range selector and went to check and to my surprise it actually doesn't.
Yeah I just went back and checked again. I really don't know what they are thinking. It might be a Japanese thing. Japanese webdev and web design is wildly different for some reason.

Anyway, nice work nonetheless
:yukari-salute:
 

YakuInTheFlesh

varishangout.com
Regular
A simple bash script for HEVC encoding:
For what: Linux / bash
What does it do: It encodes every file with the given extension into a HEVC dir and the OLD into a dir named as such.
How to use: Copy this into a file. In the terminal type ./{file} {extension} or to use it everywhere put it in your path or type {pathToFile}./{file} {extension}. After that let it rip. For the best Quality, use the best Quality files you can get (I usually go for BD rips / rip my own BD).
Bash:
#!/bin/bash

mkdir ./HEVC
mkdir ./OLD

for filename in *.$1; do
    echo $filename
    ffmpeg \
        -i "${filename}" \
        -c:v libx265 \
        -crf 19 \
        -x265-params bframes=8:psy-rd=1:aq-mode=3:aq-strength=0.8:deblock=1,1 \
        -preset slow "./HEVC/${filename}"
    mv "${filename}" "./OLD/${filename}"
done

You can replace libx265 with the encoder you want (if the HW encode for AMD wouldn't suck I would've used that one. I currently get ~21 fps which is plenty for me). Be aware the you might need to adjust the params when you do that.
The used params are very generic and should work for most types of videos and reduces the file size down to roughly 33% to 20%. This means a 100GiB of e.g. Anime can become 20Gib - 33.33GiB. I'm roughly 2/3 through my collection and reduced it by 1TiB so far.

I plan to update it (When I have more time) with some presets like "generic", "action", "SOL", etc. to make the resulting encode be smaller & have better quality. Any tips on the params or on params for specific genres are appreciated. Also I might add some error handling like retrying later on.

Also why not AV1? Because after some testing I decided AV1 is not producing a good enough file size compared to the quality lost. Yes I tried SVTAV1 and yes it's fast, but the quality can be quite bad and the file size is not good enough.
 
Last edited:
Top