add readme n shit
This commit is contained in:
parent
5e0e2288b9
commit
bfc595dc16
6 changed files with 51 additions and 13 deletions
6
.gitignore
vendored
6
.gitignore
vendored
|
|
@ -5,10 +5,7 @@ build/
|
|||
!**/src/test/**/build/
|
||||
|
||||
### IntelliJ IDEA ###
|
||||
.idea/modules.xml
|
||||
.idea/jarRepositories.xml
|
||||
.idea/compiler.xml
|
||||
.idea/libraries/
|
||||
.idea
|
||||
*.iws
|
||||
*.iml
|
||||
*.ipr
|
||||
|
|
@ -45,3 +42,4 @@ bin/
|
|||
.DS_Store
|
||||
|
||||
offers.md
|
||||
rooms-scanned.txt
|
||||
13
README.md
Normal file
13
README.md
Normal file
|
|
@ -0,0 +1,13 @@
|
|||
# Kamer Zoeken
|
||||
|
||||
## Running
|
||||
|
||||
If you want a command that just downloads, compiles and runs everything, run this: (Assumes you run Linux. It might work on Windows. no guarantees though.)
|
||||
|
||||
```sh
|
||||
git clone https://github.com/KoenDR06/KamerZoeken
|
||||
cd KamerZoeken
|
||||
|
||||
./gradlew build
|
||||
java -jar build/libs/KamerZoeken-1.0.0.jar
|
||||
```
|
||||
|
|
@ -1,17 +1,17 @@
|
|||
plugins {
|
||||
kotlin("jvm") version "2.1.20"
|
||||
kotlin("plugin.serialization") version "2.1.21"
|
||||
application
|
||||
}
|
||||
|
||||
group = "me.koendev"
|
||||
version = "1.0-SNAPSHOT"
|
||||
version = "1.0.0"
|
||||
|
||||
repositories {
|
||||
mavenCentral()
|
||||
}
|
||||
|
||||
dependencies {
|
||||
implementation(files("../Utils-latest.jar"))
|
||||
implementation("org.jetbrains.kotlinx:kotlinx-serialization-json:1.8.1")
|
||||
implementation("de.thelooter:toml4j:0.8.1")
|
||||
}
|
||||
|
|
@ -22,3 +22,23 @@ tasks.test {
|
|||
kotlin {
|
||||
jvmToolchain(21)
|
||||
}
|
||||
|
||||
application.mainClass = "me.koendev.MainKt"
|
||||
|
||||
tasks.withType<Jar> {
|
||||
// Otherwise you'll get a "No main manifest attribute" error
|
||||
manifest {
|
||||
attributes["Main-Class"] = "me.koendev.MainKt"
|
||||
}
|
||||
|
||||
// To avoid the duplicate handling strategy error
|
||||
duplicatesStrategy = DuplicatesStrategy.EXCLUDE
|
||||
|
||||
// To add all of the dependencies otherwise a "NoClassDefFoundError" error
|
||||
from(sourceSets.main.get().output)
|
||||
|
||||
dependsOn(configurations.runtimeClasspath)
|
||||
from({
|
||||
configurations.runtimeClasspath.get().filter { it.name.endsWith("jar") }.map { zipTree(it) }
|
||||
})
|
||||
}
|
||||
|
|
@ -9,8 +9,16 @@ data class ReactableOffer(
|
|||
)
|
||||
|
||||
fun main() {
|
||||
val inputFile = File("rooms-scanned.txt")
|
||||
|
||||
val roomsFound = if (inputFile.exists()) inputFile.readLines() else listOf()
|
||||
|
||||
val rooms = getRooms().filter { room ->
|
||||
room.unitType == config.general.unitType
|
||||
room.unitType == config.general.unitType && room.wocasId !in roomsFound
|
||||
}
|
||||
if (rooms.isEmpty()) {
|
||||
println("No suitable offers were found, quitting.")
|
||||
return
|
||||
}
|
||||
val offers = getOffers(rooms.map { it.wocasId }).offers.filter { offer ->
|
||||
offer.adres[0].plaats !in listOf(
|
||||
|
|
@ -62,12 +70,14 @@ fun main() {
|
|||
|
||||
str.append("| Roken | ${if (it.floor.floorInfo.smokingAllowed) "✅ Mag" else "❌ Mag niet"} |\n")
|
||||
str.append("| Huisdieren | ${if (it.floor.floorInfo.petsAllowed) "✅ Mogen" else "❌ Mogen niet"} |\n")
|
||||
str.append("| Reacties | ${it.floor.applicantCount} al gereageerd.")
|
||||
|
||||
str.append("\n")
|
||||
str.append("### Message: \n\n${it.floor.floorInfo.description}\n")
|
||||
str.append("### Message: \n\n${it.floor.floorInfo.description ?: "Deze pannekoeken hebben geen bericht achtergelaten"}\n")
|
||||
|
||||
str.append("\n\n")
|
||||
}
|
||||
out.writeText(str.toString())
|
||||
inputFile.writeText(roomsFound.joinToString("\n") + rooms.joinToString("\n") { it.wocasId })
|
||||
println("${coupled.size} offers found, wrote to $fileName")
|
||||
}
|
||||
|
|
|
|||
|
|
@ -7,7 +7,7 @@ import kotlinx.serialization.json.Json
|
|||
@Serializable
|
||||
data class FloorInfo(
|
||||
@SerialName("WocasId") val wocasId: String,
|
||||
@SerialName("Description") val description: String,
|
||||
@SerialName("Description") val description: String?,
|
||||
@SerialName("HospiteerDate") val hospiteerDate: String?,
|
||||
@SerialName("PreferenceSmokingAllowed") val smokingAllowed: Boolean,
|
||||
@SerialName("PreferencePetsAllowed") val petsAllowed: Boolean,
|
||||
|
|
|
|||
|
|
@ -3,9 +3,6 @@ package me.koendev
|
|||
import kotlinx.serialization.SerialName
|
||||
import kotlinx.serialization.Serializable
|
||||
import kotlinx.serialization.json.Json
|
||||
import me.koendev.utils.println
|
||||
import java.net.http.HttpClient
|
||||
import java.net.http.HttpResponse
|
||||
|
||||
@Serializable
|
||||
data class Offers(
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue