Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

FEAT: Scraper : New features & improvements #1110

Merged
merged 11 commits into from
Sep 3, 2023
Merged

Conversation

schmurtzm
Copy link
Member

  • Implementation of "Media Type" selection in the configuration (it applies to every scrapers)
  • Implementation of "region" selection in the configuration (it applies to Screenscraper and Launchbox)
    (big work to determine the used regions on each scraper, put all these in a database and create fallback for each : for example search order fr -> eu -> world ...)
  • Launchbox scraper totally rewrited (region and media types management, updated internal database and include previous update)
  • Improved the search by CRC for screenscraper (use xcrc, skip when the file is too big)
  • Improved the input of text thanks to readline (source) binary (it allows to move the cursor without displaying special characters)
  • Added a new option in screenscraper settings to easily check credentials and have account statistics.
  • Added an automatic config repair tool, it serves several purposes :
    _ during update : will add missing keys with default value
    _ missing config file : will create it with default value.
    _ corrupted config file : will re-create it with default value.
  • Many fixes and optimizations

by: schmurtzm
with the collaboration of t0b10-t3nm4

tobio-tenma and others added 11 commits August 4, 2023 00:48
- The script now make 5 retries when api reaches "maximum threads"
- Implement CRC search in screenscraper (as fallback when the rom name doesn't give results)
Adding readline binary to get text from Terminal application.
It allows to move the cursor in Terminal app without displaying special characters.

Usage: readline [-h] [-m "prompt"]
  -h                Show this help message
  -m "prompt"       Specify a custom prompt message

This will create /tmp/readline.txt with the entered value by the user.

#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include "linenoise.h"

void printHelp() {
    printf("Usage: readline [-h] [-m \"prompt\"]\n");
    printf("  -h                Show this help message\n");
    printf("  -m \"prompt\"       Specify a custom prompt message\n");
    printf("\nThis will create /tmp/readline.txt with the entered value by the user.");
    printf("\nBy Schmurtz (Onion Team)\n\n");
}

int main(int argc, char *argv[]) {
    char *prompt = "Enter text: "; // Default prompt message

    for (int i = 1; i < argc; i++) {
        if (strcmp(argv[i], "-h") == 0) {
            printHelp();
            return 0;
        } else if (strcmp(argv[i], "-m") == 0 && i + 1 < argc) {
            prompt = argv[i + 1]; // Use the custom prompt message
        }
    }

    char *line = linenoise(prompt);
    if (line != NULL) {
        // Print the entered text with a newline
        printf("%s\n", line);

        // Generate the shell script content
        FILE *scriptFile = fopen("/tmp/readline.txt", "w");
        if (scriptFile != NULL) {
            fprintf(scriptFile, "%s", line);
            fclose(scriptFile);
        }

        linenoiseFree(line);
    }

    return 0;
}
Using readline binary instead of read -p it allows to move the cursor without writing strange characters.
- Implemented Media Type selection in the configuration (it applies to every scrapers)
- Implemented region selection in the configuration (it applies to SS and LB)
       (enormous work to know the used regions on each scraper, put all these in a database and create fallback for each : for example search order fr -> eu -> world ...)
- Improved the search by CRC for screenscraper (use xcrc, skip when the file is too big) 
        it has required some discussion with screenscraper because their documentation is wrong on this feature.
- Improved the input of text thanks to readline binary created myself (it allows to move the cursor without displaying special characters)
- Added a new option in screenscraper settings to easily check credentials and have account state.
                   It serves several purposes :
                        _ during update : will add missing keys with default value
                        _ missing config file : will create it with default value.
                        _ corrupted config file : will re-create it with default value.
- Many fixes and optimizations



Co-authored-by: t0b10-t3nm4 <[email protected]>
Co-authored-by: Schmurtz <[email protected]>
@XK9274
Copy link
Member

XK9274 commented Aug 20, 2023

So far done 3D box art in UK region for a large folder
Screenscraper mix US region for a large folder
Background/foreground scaping
All sources
Name/CRC matching working great

Multiple sizes of rom collections (some over 800)
Single roms with different configurations

All seems good

Edit:

One output:

Total scanned roms   : 339
--------------------------
Successfully scraped : 182
Alread present       : 150
Failed or not found  : 7
--------------------------

@XK9274 XK9274 self-requested a review August 20, 2023 20:24
Copy link
Member

@XK9274 XK9274 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Have tested very much as a user, but it works great

@poc-sm poc-sm mentioned this pull request Aug 26, 2023
3 tasks
@Aemiii91 Aemiii91 added this pull request to the merge queue Sep 3, 2023
Merged via the queue into main with commit 2e26690 Sep 3, 2023
@Aemiii91 Aemiii91 deleted the Scraper-improvements branch September 3, 2023 05:49
@Aemiii91 Aemiii91 added the enhancement New or improved feature label Oct 3, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New or improved feature
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants