• 2 Posts
  • 386 Comments
Joined 2 years ago
cake
Cake day: December 14th, 2023

help-circle
  • You’re welcome! It was a fun hyperfixation project. I ended up making the script so easy to use I decided to just scrape every other endpoint too, so if anyone wants it, here’s a full dump of every endpoint, it’s only like 4x bigger:

    https://mega.nz/file/YF4F3bCS#pkS8Ki9QuucMGJF65YwGUE-NQZ78QEWs73fmF71qa18

    And if anyone wants to do their own scraping to get more up to date data later, just pip install:

    python-dotenv==1.2.2
    Requests==2.34.2
    tqdm==4.67.1
    

    Put API keys in .env or export env vars:

    CLIENT_ID=<client_id>
    # Provide to fetch new token
    CLIENT_SECRET=<client_secret>
    # Optional, provide to reuse existing access token, secret will not be used
    ACCESS_TOKEN=<access_token>
    

    And just run python dump.py games or any other endpoint in the api docs like release_dates etc. It outputs the json and a simple log to an output folder wherever you ran it. No error handling or checkpointing so if it fails partway through you don’t get anything, but I didn’t have a single error the whole time.

    usage: dump.py [-h] api_route
    
    IGDB Dump Script
    
    positional arguments:
      api_route   The API route to scrape, eg: games or game_time_to_beats
    
    options:
      -h, --help  show this help message and exit
    

    dump.py:

    import argparse
    import json
    import logging
    import os
    import pathlib
    import time
    from dotenv import dotenv_values
    import requests
    from tqdm import tqdm
    
    API_PAGE_SIZE = 500
    OUT_DIR = "output"
    
    config = {
        **dotenv_values(".env"),
        **os.environ,
    }
    
    # Set up flags / args
    parser = argparse.ArgumentParser(
        prog="dump.py", description="IGDB Dump Script"
    )
    parser.add_argument(
        "api_route",
        help="The API route to scrape, eg: games or game_time_to_beats",
    )
    args = parser.parse_args()
    
    # Create out dir
    pathlib.Path.mkdir(OUT_DIR, parents=False, exist_ok=True)
    
    # Set up logging to the route's file
    tqdmHandler = logging.StreamHandler(tqdm)
    tqdmHandler.terminator = ""
    logging.basicConfig(
        level=logging.INFO,
        format="%(message)s",
        handlers=[
            logging.FileHandler(f"{OUT_DIR}/{args.api_route}.log"),
            tqdmHandler
        ],
    )
    
    # Check for existing json to prevent overwriting existing dumps
    outFile = f"{OUT_DIR}/{args.api_route}.json"
    if pathlib.Path(outFile).exists():
        print(f"Existing json found {outFile}, please move or remove it before proceeding")
        exit(1)
    
    if config['CLIENT_ID'] and config['ACCESS_TOKEN']:
        logging.info("Using CLIENT_ID and existing ACCESS_TOKEN")
    elif config['CLIENT_ID'] and config['CLIENT_SECRET'] and not config['ACCESS_TOKEN']:
        logging.info("Fetching new access token...")
        response = requests.post(
            url="https://id.twitch.tv/oauth2/token",
            params={
                "client_id": config['CLIENT_ID'],
                "client_secret": config['CLIENT_SECRET'],
                "grant_type": "client_credentials"
            },
            timeout=30
        )
        config['ACCESS_TOKEN'] = response.json()['access_token']
    else:
        logging.info("Missing CLIENT_ID and CLIENT_SECRET or ACCESS_TOKEN")
        exit(1)
    
    # Re-check access token in case fetch failed
    if config['CLIENT_ID'] and config['ACCESS_TOKEN']:
        items = []
        offset = 0
        logging.info(f"Fetching batches of {API_PAGE_SIZE} on endpoint {args.api_route}")
        with tqdm() as pbar:
            while True:
                response = requests.post(
                    url=f"https://api.igdb.com/v4/%7Bargs.api_route%7D",
                    headers={
                        "Client-ID": config['CLIENT_ID'],
                        "Authorization": f"Bearer {config['ACCESS_TOKEN']}"
                    },
                    data=f"fields *; limit {API_PAGE_SIZE}; offset {offset};",
                    timeout=30
                )
                newItems = response.json()
                fetchCount = len(newItems)
                pbar.update(fetchCount)
                if fetchCount != API_PAGE_SIZE:
                    logging.info(f"WARN: Requested {API_PAGE_SIZE}, got {fetchCount}")
                offset += API_PAGE_SIZE
                items.extend(newItems)
                if fetchCount < API_PAGE_SIZE:
                    logging.info("Received partial page, ending")
                    break
                time.sleep(1)
    
        logging.info(f"Total fetched: {len(items)}")
        with open(outFile, "w", encoding="utf-8") as file:
            logging.info("Writing to json...")
            json.dump(items, file, ensure_ascii=False, indent=2)
    
        # Print some stats
        logging.info(f"\nChecking json output: {args.api_route}.json")
    
        entries = []
        with open(outFile, "r", encoding="utf-8") as file:
            entries = json.load(file)
    
        logging.info(f"{len(entries)} entries in json")
    
        entryDict = {}
        for entry in entries:
            entryDict.update({entry['id']: entry})
    
        logging.info(f"{len(entryDict)} unique IDs in json")
    else:
        logging.error("Client ID or Access Token not available")
        exit(1)
    
    

  • I also would want to pick the quality/size of the file depending on the show (good shows deserve better quality).

    I do this too and that was a major hesitation in switching to use arrstack. What I do is each library (movies, TV) has an organized folder (Archive) and a folder for arrstack (Active). I have both added to arrstack and Plex/jellyfin but I only let it download automatically to the arr folder. Every week or two I check what people have requested and downloaded into the arr folder and either move it to the archive since I’m happy with the quality / release group, or I use arr’s ui to pick a different release with a single click.

    It’s nice because I get the best of both worlds, hands free downloading for 10-15 people, new episodes daily, but I also get to screen and control what goes into my archive and upgrade important shows before I lose track of it.


  • What defaults are you talking about? If you meant to reply to my other comment, I’m talking about hardware transcoding codec support settings on the server, it has nothing to do with what codec is chosen for a client - that decision is made separately. Once the codec the client needs is chosen, the hardware transcoding setting only changes whether they codec is decoded using CPU or GPU/quicksync by the server - it has no effect on codec selection. The only reason you would disable hardware transcoding for a codec that your server is capable of hardware transcoding is if your hardware is faulty or produces undesirable output for that codec when using hardware transcoding - most people don’t do this, it’s a fairly uncommon edge case. And disabling it won’t stop clients from accessing that codec, it just means that your server will CPU transcode it if requested instead of using hardware acceleration - so again it has nothing to do with client support or TVs because all it does is switch your server between hardware and software encoding / decoding. The only sane default for that setting is to hardware accelerate codecs that your PC is capable of hardware accelerating if hardware acceleration is enabled. There’s no reason not to automatically detect hardware capabilities like Plex does, instead of the current “default” where you enable hardware transcoding and then have to figure out what your hardware supports to be hardware accelerated.

    Like even if they copy pasted the quicksync codec support table from Wikipedia into the server hardware acceleration settings that would be miles better because then you wouldn’t have to look up that information separately. Or, hear me out, just show next to each option which ones your computer is capable of hardware decoding vs CPU decoding.


  • It’s not, and I didn’t say it was hard. Just that it’s a sharp corner that jellyfin should fix if they want to make it as one click as Plex is. It’s another part of the setup where you have to pay attention and get every check box right or it’ll not work as intended. I found it annoying to have to look it up and I’ve been in software for 15 years. I don’t doubt that any newb would find it frustrating. I remember seeing that it was planned to have hardware transcoding codec support auto detected but IDK if that has happened yet.

    It’s especially annoying because jellyfin doesn’t just copy the support matrix into their docs, and the one on Wikipedia is by processor generation codename, so you have to look up your processor and get the codename, then reference the Wikipedia table and go down each codec and not make a mistake. Even though it’s “not hard” I still go back to that section because I second guess that I checked everything right thinking that I’ve caused some issues with a mistake. It’s additional cognitive load that isn’t worth defending if you want jellyfin to be good.


  • Yep, and it generally has fewer sharp corners. Like last time I checked, in order to set up quick sync, you have to manually check each codec you want to offload to hardware. And if you select one that isn’t supported by your hardware, you find out when you try to play that. So it means carefully cross-referencing with the Wikipedia page for your quick sync version. Plex just has an enable hardware transcoding check box and it figures it out for you.

    There’s also some features like smart playlists that I remember needing to set up plugins for whereas Plex supports it out of the box.

    Of course ther are other things where jellyfin comes out ahead, like surround to stereo down mixing - I could never get the center channel (dialog) to be at a good volume when down mixed to stereo on my TV, but it just works and produces the correct volume in jellyfin.

    But ultimately I think what causes all my users to prefer Plex is that the official app is polished and consistent across all platforms. The official jellyfin one looks like a programmer put it together with bootstrap components, and my favorite alternatives (like findroid) are in active development (I do donate on a reoccurring basis though in hopes that it reaches a level of polish matching Plex)





  • Purging into the chute doesn’t leave the nozzle with the same pressure as priming onto a surface because there’s no resistance. So even if you retract the same after both, you’ll get a different line start. Priming onto a surface is the best way to guarantee that the next line start is identical to one that comes after a print move and not differently due to coming from the poop chute.


  • BakedCatboy@lemmy.mltolinuxmemes@lemmy.world*Permanently Deleted*
    link
    fedilink
    English
    arrow-up
    94
    arrow-down
    1
    ·
    9 days ago

    As a web dev I hate the trend of websites relying on chromium-specific quirks, there are a handful of sites I need to use which refuse to work in any non-chromium browser, and customer support will always tell you to just use chrome as if you’re not a normal person for using Firefox. So yeah what’s wrong with chromium to me is that it’s the new internet explorer when it comes to web standards. Websites and large businesses can afford to just not care if they are following web standards as long as it works in chrome, and if you have a problem it’s your fault for not using chrome.


  • I’m sure coffee enthusiasts would accuse me of not liking the taste of coffee either lmao, I drink my espresso in a ratio of ~30% espresso 70% half and half. I do like the taste of coffee but especially so in combination with lots of cream and sugar, or ice cream. I’m very sensitive to caffeine though and even with decaf I can feel the remaining few percent of caffeine which still ruins my sleep if I have it after noon and it still makes me a tad bit jittery. Nowhere near as bad as full caf though.


  • I had similar effects from adderall, which is similar to coffee for me (jitters, feeling wired, sweating / clammy). I drink decaf a lot more to avoid that, and switching from Adderall to concerta (now I’m on 36mg concerta) which also helped eliminate jittery side effects. If it’s not caffeine withdrawal, maybe trying a different add medication is a good path. I would ask your doctor about adjusting dosage or trying a different option, since everyone’s a little different and what works for me seems to not be working for you 😅