Commit Graph

2437 Commits

Author SHA1 Message Date
Georges-Antoine Assi
8fb4769776 changes from code review 2025-08-13 14:03:45 -04:00
Georges-Antoine Assi
81a04e4ab4 Always hash the largest file in compressed multi file roms 2025-08-13 13:43:07 -04:00
Michael Manganiello
63f84b78d5 misc: Create startup script to run initial tasks before main application
For steps that need to run before the web application starts, such as
scheduling tasks, this new `startup.py` script is introduced.

This fixes a recently introduced issue where task scheduling was not
being triggered, because of it being included in the
`if __name__ == "__main__":` block, which is not executed when
the application is run by Gunicorn in production environments.

We do not include this logic as part of FastAPI's lifespan
implementation, as running multiple workers with Gunicorn would
cause this logic to be executed multiple times.
2025-08-12 23:14:26 -03:00
Georges-Antoine Assi
47e9138cbb lower the extension in config manager 2025-08-12 18:24:21 -04:00
Georges-Antoine Assi
774be0cbde [ROMM-2163] Fix excluding single roms without extensions 2025-08-12 18:18:29 -04:00
Michael Manganiello
1d2403d7cb fix: Correctly upload manual to resources path
Use the right filesystem handler for the manual to be uploaded to the
`resources` path instead of the `rom` path.
2025-08-12 16:17:20 -03:00
Michael Manganiello
f95e0edff4 feat: Add OpenTelemetry integration to file watcher
Run file watcher using `opentelemetry-instrument` to enable tracing for
the watcher service.
2025-08-12 11:25:40 -03:00
Michael Manganiello
edbff6b7e8 Merge pull request #2248 from rommapp/fix/performance-asset-screenshot
fix: Improve performance on asset screenshot retrieval
2025-08-10 16:05:35 -03:00
Georges-Antoine Assi
4728e5da67 [ROMM-2247] Return early if cover write fails 2025-08-10 14:51:06 -04:00
Michael Manganiello
00d7815889 fix: Improve performance on asset screenshot retrieval
When retrieving the related screenshot for a `Save` or `State`, we were
retrieving a very heavy representation of the associated `Rom` object,
only to iterate through its screenshots to find the one we needed.

This change modifies the `Save` and `State` models to directly query the
`Screenshot` model, which is much faster and more efficient. The
`DBScreenshotsHandler` has been updated to include a new `filter` method
that will simplify building queries using SQLAlchemy, something we can
extend to other handlers in the future.

Fixes #1925.
2025-08-10 15:33:13 -03:00
Michael Manganiello
889c71444b feat: Add support for database query string using DB_QUERY_JSON variable
This change adds a new environment variable `DB_QUERY_JSON` that allows
users to specify querystring values for additional database connection
parameters. This is useful for passing custom query parameters to the
database connection URL.

The `DB_QUERY_JSON` variable should contain a JSON string with key-value
pairs of strings, which is the required format for the SQLAlchemy URL
`query` parameter. If the variable is not set, no additional query
parameters will be added to the database connection URL.

Closes #2093.
2025-08-10 00:31:03 -03:00
Michael Manganiello
c0483832ac Merge pull request #2240 from rommapp/fix/retroachievements-case-insensitive-hash-match
fix: Make RetroAchievements hash matching case-insensitive
2025-08-09 16:13:41 -03:00
Georges-Antoine Assi
84ded3bc24 pick largest file from the list 2025-08-09 14:47:34 -04:00
Michael Manganiello
f13d2198db fix: Make RetroAchievements hash matching case-insensitive
Fixes #2182.
2025-08-09 12:48:28 -03:00
Georges-Antoine Assi
d005dba90b fix a bunch of shit 2025-08-09 11:16:12 -04:00
Georges-Antoine Assi
afaef09c84 cleanup 2025-08-08 17:08:16 -04:00
Georges-Antoine Assi
16c8c9f993 only init JW once 2025-08-08 17:03:28 -04:00
Georges-Antoine Assi
69079b2a90 Merge branch 'master' into find-best-match 2025-08-08 16:55:39 -04:00
Georges-Antoine Assi
659a3eb104 use jaro-winkler algo 2025-08-08 16:54:26 -04:00
Georges-Antoine Assi
b1609096de fix file_type typo 2025-08-08 15:00:18 -04:00
Michael Manganiello
ba21cbc1e1 misc: Separate tests folder from backend code
Create separate `tests/` folder for all tests. This will also simplify
not copying tests code into the Docker image.
2025-08-08 12:49:13 -03:00
Georges-Antoine Assi
de42333f2f Merge pull request #2232 from rommapp/native-7z-parse
Use native 7z to extract files and calculate hashes
2025-08-08 09:23:29 -04:00
Georges-Antoine Assi
c47be7240b changs from bot review 2025-08-07 18:15:49 -04:00
Georges-Antoine Assi
9e37d87610 fix complex game names 2025-08-07 18:02:04 -04:00
Georges-Antoine Assi
b247a5c5bb small tweaks 2025-08-07 17:39:57 -04:00
Georges-Antoine Assi
1a2944806b Use best-match algo for more providers 2025-08-07 16:57:29 -04:00
Georges-Antoine Assi
926fe26fd9 [exp] use cli 7z to cacl hash files 2025-08-07 13:12:32 -04:00
Michael Manganiello
76db0ab98c feat: Migrate watcher to use watchfiles library
The `watchfiles` library supports event batching, which allows us to
process multiple filesystem changes in a single run.

This change also avoids database calls in the watcher as much as
possible.
2025-08-07 13:28:49 -03:00
Georges-Antoine Assi
f3a74bc892 changes from review 2025-08-07 11:33:02 -04:00
Georges-Antoine Assi
a90bc75b92 Merge branch 'master' into romm-2142 2025-08-07 10:34:19 -04:00
Georges-Antoine Assi
00c9d740c7 Merge pull request #2227 from rommapp/worker-native-process
Migrate worker to native rq process
2025-08-07 10:04:21 -04:00
Georges-Antoine Assi
c4ea27b6fa pass in metadata providers enabled 2025-08-07 09:51:18 -04:00
Georges-Antoine Assi
c030d10c05 changes from bot review 2025-08-07 09:43:18 -04:00
Georges-Antoine Assi
836e7358c2 fix issues from code review 2025-08-07 09:34:43 -04:00
Michael Manganiello
097818d560 misc: Replace emoji dependency with constants
The `emoji` library has been removed, in favor of using constants for
the few emojis used in the codebase. This reduces memory usage, and
avoids calling `emojize` for Python to discover where to replace emojis
in pre-defined strings.
2025-08-07 09:50:14 -03:00
Georges-Antoine Assi
7e0cb2272d run watchdog as a native task 2025-08-06 23:25:47 -04:00
Georges-Antoine Assi
e156158a3e fixse from bot review 2025-08-06 22:16:46 -04:00
Georges-Antoine Assi
6b307afcd3 Run worker as a native process 2025-08-06 21:57:32 -04:00
Michael Manganiello
5dcc1bd31c feat: Migrate scheduler to native RQ process
This change replaces our custom `scheduler.py` script with the
`rqscheduler` command, allowing us to run the RQ scheduler as a
separate, low-memory process, by avoiding the need to maintain
the Python app in memory.

* Remove `scheduler.py` script.
* Move initialization of scheduled tasks to `worker.py`.
* Update `docker/init_scripts/init` to start the `rqscheduler`
  command instead of the custom script.
* Fix scheduled tasks' `func` paths to the new project structure.
* Temporarily use a fork of `rq-scheduler` to support
  username and SSL settings in the `rqscheduler` command.
2025-08-06 19:13:12 -03:00
Georges-Antoine Assi
90f10e8946 Fixed platform slugs that were missed 2025-08-06 17:28:10 -04:00
Michael Manganiello
637a0b74f7 misc: Add type hints to task classes
Small change including type hints for the Task base classes, and related
fixes to related tests.
2025-08-06 15:55:41 -03:00
Georges-Antoine Assi
53cf1bdc72 implement real lev distnce 2025-08-06 11:04:24 -04:00
Georges-Antoine Assi
eb6498da61 custom similarity implementation 2025-08-06 10:27:04 -04:00
Georges-Antoine Assi
1d797e286b custom implement mix 2025-08-06 10:21:54 -04:00
Georges-Antoine Assi
f4a65c3680 Merge pull request #2185 from rommapp/response-cleanup
Replace MessageResponse with specific responses
2025-08-06 09:16:05 -04:00
Georges-Antoine Assi
7d873dcf9e Merge pull request #2203 from rommapp/romm-1868
[ROMM-1868] Fix grouping by metadata rows
2025-08-06 09:13:16 -04:00
Michael Manganiello
2ba0283b65 Merge pull request #2214 from rommapp/misc/move-pytest-ini-to-backend-dir
misc: Move pytest.ini to backend directory
2025-08-05 15:00:28 -03:00
Michael Manganiello
d63895d410 misc: Move pytest.ini to backend directory
Moving the `pytest.ini` file simplifies the `pytest` run command, and
also correctly mounts the file in the development Docker container.
2025-08-05 14:02:47 -03:00
Michael Manganiello
3906cf3991 fix: Correctly evaluate enabled metadata sources in scheduled library scan
The existing code incorrectly maps boolean flags to metadata sources,
leading to colliding `True` keys in the dictionary. This caused only one
metadata source to be recognized during scheduled scans, even when
multiple sources were enabled.
2025-08-05 13:30:11 -03:00
Georges-Antoine Assi
cf28e4fdb4 reorder grouping 2025-08-04 20:59:26 -04:00