[ / / / / / / / / / / / / ] [ dir / bbbb / chaos / firechan / liberty / loomis / o / s / strek ]

/hydrus/ - Hydrus Network

Bug reports, feature requests, and other discussion for the hydrus network.
Name
Email
Subject
Comment *
File
* = required field[▶ Show post options & limits]
Confused? See the FAQ.
Embed
(replaces files and can be used instead)
Options
Password (For file and post deletion.)

Allowed file types:jpg, jpeg, gif, png, webm, mp4, swf, pdf
Max filesize is 12 MB.
Max image dimensions are 10000 x 10000.
You may upload 5 per post.


New user? Start here ---> http://hydrusnetwork.github.io/hydrus/

Current to-do list has: 1069 items

Current big job: writing login and domain engines


File: 201ac678d919659⋯.png (2.4 MB, 1890x986, 945:493, hydrus-ss.PNG)

e4ff0d No.6668

Hello guys, I wrote this server based on the Spring Framework that creates an interface for the hydrus db through a REST API.

I wrote a front-end for it too, but it's simple and it assumes that the back-end is on the same server as the front-end.

Obviously, the server can't run together with hydrus because of concurrent access to the databases.

Here's the github repo https://github.com/pr0ves/hydrus-ss/

For now the features are:

>Search with tags, it returns an array of hashes

>Tag retrieval given the hash

>Serve a file and its thumbnail given the hash

Anyone that wants to help is welcome, i need help especially with the front-end since i'm bad at that; anyway the one i created just need some style and it would be good enough.

13c234 No.6675

how did you create a REST API for Hydrus, is it XML or JSON?


e4ff0d No.6676

>>6675

JSON, i just took data from the db and used the spring framework to create the api,

for example the function getByTags() is mapped to "/api/getByTags/" so that when u go to "serverurl.com/api/getByTags/&tags=tags" it return a json with an array of 10 (by default) hashes

the hash will then be used to get the image or the thumbnail through "/api/media/" and "/api/thumb/"


486625 No.6682

>>6676

How did you do it?

Because I would like to use Python or JS to make a similar API.


e4ff0d No.6683

>>6682

I wrote it in Kotlin, which is a language that runs on the Java Virtual Machine, basically it's java with more features.

The api was possible only with the Spring framework, i dont know which framework u can use in python but there surely will be some that let u do the same thing i did, just search for a framework.

I just know Django but i dont know if it's the same thing as Spring.


7b7e88 No.6684

>>6683

How do you create an API along side Hydrus' source code (which originally does not have one)?


e4ff0d No.6685

>>6684

I didn't use any code from hydrus source, i just used the databases from the db folder. This is also why u can't run this and hydrus together since they both ask a connection to the databases.

Best thing to do, would be for hydrus to implement directly an api; i think they're working on it.


002630 No.6688

File: 996863f7a34a26a⋯.png (28.79 KB, 1602x918, 89:51, screen.1504588849.png)

>>6668

I'm testing this out and running into problems I suppose.

It seems like it's working fine, but searching a tag from localhost:8080 doesn't seem to trigger anything in the console or front-end.


002630 No.6689

>>6688

Never, I get this error when searching.


2017-09-05 01:32:44.176 INFO 2872 --- [nio-8080-exec-4] pr0.ves.hydrus.ss.HydrusDB : Updating table cache
.cache_search_1
2017-09-05 01:32:44.176 ERROR 2872 --- [nio-8080-exec-4] o.a.c.c.C.[.[.[/].[dispatcherServlet] : Servlet.service() fo
r servlet [dispatcherServlet] in context with path [] threw exception [Request processing failed; nested exception is or
g.sqlite.SQLiteException: [SQLITE_ERROR] SQL error or missing database (no such table: mappings.current_mappings_9)] wit
h root cause

org.sqlite.SQLiteException: [SQLITE_ERROR] SQL error or missing database (no such table: mappings.current_mappings_9)
at org.sqlite.core.DB.newSQLException(DB.java:909) ~[sqlite-jdbc-3.20.0.jar:na]
at org.sqlite.core.DB.newSQLException(DB.java:921) ~[sqlite-jdbc-3.20.0.jar:na]
at org.sqlite.core.DB.throwex(DB.java:886) ~[sqlite-jdbc-3.20.0.jar:na]
at org.sqlite.core.NativeDB.prepare_utf8(Native Method) ~[sqlite-jdbc-3.20.0.jar:na]
at org.sqlite.core.NativeDB.prepare(NativeDB.java:127) ~[sqlite-jdbc-3.20.0.jar:na]
at org.sqlite.core.DB.prepare(DB.java:227) ~[sqlite-jdbc-3.20.0.jar:na]
at org.sqlite.core.CorePreparedStatement.<init>(CorePreparedStatement.java:41) ~[sqlite-jdbc-3.20.0.jar:na]
at org.sqlite.jdbc3.JDBC3PreparedStatement.<init>(JDBC3PreparedStatement.java:30) ~[sqlite-jdbc-3.20.0.jar:na]
at org.sqlite.jdbc4.JDBC4PreparedStatement.<init>(JDBC4PreparedStatement.java:19) ~[sqlite-jdbc-3.20.0.jar:na]
at ...

>SQL error or missing database

I don't know why, considering my path in settings.json is correct. "K:\\Hydrus Network\\db\\"


e4ff0d No.6690

>>6689

the path is fine, it doesn't find the table. i think it's because hydrus names the mappings table dynamically, i used the name that was in my db. I'll have to look into that.

>>6688

if there's no error in the console it means that the api works but it just returns an empty array. Try to go to localhost:8080/api/getByTags/?tags=first_tag+second_tag

Remember to use "_" instead of spaces if there's a space in a tag like "one tag" u'll have to write "one_tag"


e4ff0d No.6691

>>6690

>>6689

found the problem, hydrus names the mappings table based on the service that creates the maps.

I used current_mappings_9 because the service with id=9 is the one that gets the tag from a remote repository, as seen here https://hydrusnetwork.github.io/hydrus/help/getting_started_tags.html.

Now the problem is for each service that gets the tags hydrus creates a table.


e4ff0d No.6692

I've just pushed an update, please pull this version and try it, please. Run

gradlew test

first to test the setup. Report any errors.

Thanks for the help.


e4ff0d No.6693

too many please lol


002630 No.6701

>>6692

Thanks for looking into it.

It works now, however I don't think I'm getting the right tag search results back.

What determines how many tags I'm supposed to get back, for example?

Anyway I'm not expecting it to be perfectly working anything but its a neat thing to play around with


e4ff0d No.6705

>>6701

I don't think i understand what you mean.

To test your query, go to:

localhost:8080/api/getByTags/?tags=first_tags+second_tag+-tag_to_exclude

By default this returns the last 10 hashes with those tags.


002630 No.6706

File: 7377e2fce7a45d6⋯.png (109.64 KB, 501x244, 501:244, scr.png)

File: de004ec7904ca59⋯.png (83.79 KB, 628x782, 314:391, sc2.png)

>>6705

This is what I mean.


{"hashes":["31D648A755F388C441D4DFD6975A534FD94E1DAB9BA476FC479A6CA79E069740","891C625C0CA86915094E3F201EDCE154FBF649246D19ED3B6FE827B7BD1D0F88"],"tags":[],"type":"","count":10}

Searching "amy_rose" only returns 2 files for some reason, even though I know I have 8k+ files of that tag.

I decided to search one of the hashes to see if it possibly had an amy_rose tag, and it doesn't, so I'm not sure why that popped up.


e4ff0d No.6709

>>6706

could u pull the new version and try again?

i don't think it will work though.

Other than this i don't know how to recreate your problem on my pc, so i can't resolve the problem.


e4ff0d No.6710

>>6706

I think i resolved the problem now, could u pull the new version?

It was because i counted only the subtags, which worked fine for normal tags but not with charachter, series, etc… tags




[Return][Go to top][Catalog][Nerve Center][Post a Reply]
Delete Post [ ]
[]
[ / / / / / / / / / / / / ] [ dir / bbbb / chaos / firechan / liberty / loomis / o / s / strek ]