Refactor SampleEntity to BinaryEntity and update related files and queries
This commit is contained in:
@@ -1,6 +1,6 @@
|
|||||||
package nl.astraeus.vst.base.db
|
package nl.astraeus.vst.base.db
|
||||||
|
|
||||||
object SampleDao {
|
object BinaryDao {
|
||||||
val queryProvider = SampleEntityQueryProvider
|
val queryProvider = SampleEntityQueryProvider
|
||||||
|
|
||||||
fun getSample(waveHash: String): ByteArray {
|
fun getSample(waveHash: String): ByteArray {
|
||||||
@@ -2,8 +2,8 @@ package nl.astraeus.vst.base.db
|
|||||||
|
|
||||||
import java.sql.ResultSet
|
import java.sql.ResultSet
|
||||||
|
|
||||||
val SAMPLE_CREATE_QUERY = """
|
val BINARY_CREATE_QUERY = """
|
||||||
CREATE TABLE SAMPLES (
|
CREATE TABLE BINARIESYSAMPLES (
|
||||||
SHA1HASH TEXT,
|
SHA1HASH TEXT,
|
||||||
FILENAME TEXT,
|
FILENAME TEXT,
|
||||||
LENGTH NUMBER,
|
LENGTH NUMBER,
|
||||||
@@ -77,12 +77,17 @@ class WebsocketHandler(
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// todo: add LOAD_BINARY command which expects a hash,
|
||||||
|
// find the file in the data/files/ directory and send it as binary
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun onFullBinaryMessage(channel: WebSocketChannel?, message: BufferedBinaryMessage?) {
|
override fun onFullBinaryMessage(channel: WebSocketChannel?, message: BufferedBinaryMessage?) {
|
||||||
// do nothing yet
|
// todo: create hash from binary, save file in data/files/ directory,
|
||||||
|
// sub directories are 5 characters of the hash per directory
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user