Commit graph

22 commits

Author SHA1 Message Date
King_DuckZ
f445c430d7 Fix meson warnings 2025-04-08 02:14:59 +01:00
King_DuckZ
42a4fbc686 Add support for command line parameters
Using tclap library, released under MIT. This adds the meson
wrap file along with the minimal custom meson.build for tclap,
all the meson code to get config files generated and the
integration of the tclap parser.
2025-04-08 02:05:06 +01:00
King_DuckZ
3f10b30efc Add unit test 2025-04-07 22:57:15 +01:00
King_DuckZ
86c6b1ca89 Add read_url_list() functions 2025-04-07 22:57:15 +01:00
King_DuckZ
5f5518bb88 Make cli build optional but on by default 2025-04-07 22:57:15 +01:00
King_DuckZ
5a78ef04de Split project into cli and shared object
Since it's a .so now I also added a C API that wraps TorrentRead
2025-04-07 22:57:15 +01:00
King_DuckZ
b43d5ecb6a Bump version to 0.2.0
Implementation can do quite a lot now compared to when
I started so now feels like a good time for a version bump.
2025-04-07 02:41:11 +01:00
King_DuckZ
d04b4d8274 Add a read_announce_list() to TorrentRead
announce-list is very annoyingly a list of lists. I don't
have any useful primitive to manage that case in TorrentRead,
so for now I've done a not-so-elegant implementation where I
step around the visitor, use my knowledge of the variant and
access the outer list directly through boost::get(). I'm not
necessarily convinced that this is bad since on the other hand
the solution consistent with the rest of the implementation
would involve searching for "/[[x]]/[[y]]" which has its own
overhead. I mean, variant contains a vector, I can access it
normally. Visitor is a convenience thing, I don't see why
parser's client code should be obliged to pretend the variant
cannot be accessed directly.
2025-04-07 02:39:35 +01:00
King_DuckZ
f7d90a789d Move hashes collection to TorrentRead
So yeah, while TorrentRead is not compulsory to use,
right now it'd be pretty inconvenient to not use it
as the hash grouping function is fidgety to get right.
I think group_torrent_hashes() eventually should be
moved elsewhere.
2025-04-07 01:30:04 +01:00
King_DuckZ
5aa42b5e43 Add some more read_ functions to TorrentRead 2025-04-07 01:27:59 +01:00
King_DuckZ
50f33300be Refactor higher level code into TorrentRead class
This also addresses the issue with paths of more than 1 item
so all torrents should now work and adds some error reporting
through exceptions
2025-04-07 01:01:52 +01:00
King_DuckZ
3e2cfb3b37 Allow searching for raw variants
This makes the visitor a little bit more complicated but
it allows client code to fetch raw variants. It is useful when
dealing with arrays and maps, so that client code can decide to
cache the intermediate array or map into a variable and then run
subsequent searches on that variant rather than from the start.
It should make looping a bit less expensive.
2025-04-06 00:57:44 +01:00
King_DuckZ
9fb7dd8537 Attach GPL3+ licence 2025-04-05 20:13:24 +01:00
King_DuckZ
903095c23f Add support for verifying hashes in torrents with multiple files
Directory names are not supported yet so this only works
if all the torrent files exist, are of the correct size and
are directly located in the working directory
2025-04-05 20:04:36 +01:00
King_DuckZ
ca049e5f6f Bug fix in parser when reading large integers 2025-04-05 20:03:24 +01:00
King_DuckZ
72d52860f6 Refactor visitors into separate files
This also includes some small improvements that I don't remember right now
2025-04-05 20:02:17 +01:00
King_DuckZ
365a888511 Hash verification works for torrents with a single file 2025-04-03 01:06:04 +01:00
King_DuckZ
6ef11e3256 Cleanup
Properly add libstriezel as a meson dependency
2025-04-02 23:52:45 +01:00
King_DuckZ
24450dc07d Clean up and simplify code 2025-04-02 23:39:32 +01:00
King_DuckZ
c1f8016f66 Add helper find function
Hash calculation is only correct if the relative path
found in the torrent file is accessible from pwd
2025-04-02 21:30:35 +01:00
King_DuckZ
fc0086b90f More generic implementation for searching nodes 2025-04-02 21:14:56 +01:00
King_DuckZ
3dcfcc7f0c Working proof of concept 2025-04-02 20:41:48 +01:00