mirror of
https://github.com/moparisthebest/rcrdit
synced 2024-12-21 14:58:56 -05:00
Now works on postgresql and mysql/mariadb
This commit is contained in:
parent
bcbca03ffb
commit
111b7e255b
25
database.postgre.sql
Normal file
25
database.postgre.sql
Normal file
@ -0,0 +1,25 @@
|
||||
|
||||
-- you can migrate from mysql to postgresql by doing this:
|
||||
-- podman run --rm -it -v /run/postgresql:/run/postgresql ghcr.io/dimitri/pgloader:latest pgloader mysql://rcrdit:rcrdit@10.16.19.1:3306/rcrdit postgresql://rcrdit:rcrdit@unix:/run/postgresql:5432/rcrdit
|
||||
|
||||
|
||||
CREATE TABLE "profile" (
|
||||
"profile_id" SERIAL PRIMARY KEY,
|
||||
"name" character varying(64) NOT NULL,
|
||||
"folder" character varying(64) NOT NULL,
|
||||
"run_at_recording_start" character varying(64),
|
||||
"run_at_recording_finish" character varying(64)
|
||||
);
|
||||
|
||||
CREATE TABLE "autorecs" (
|
||||
"autorec_id" SERIAL PRIMARY KEY,
|
||||
"profile_id" int NOT NULL,
|
||||
"priority" int DEFAULT '5' NOT NULL,
|
||||
"title" character varying(256),
|
||||
"channel_name" character varying(64),
|
||||
"days_of_week" character varying(64),
|
||||
"between_time_start" time without time zone,
|
||||
"between_time_end" time without time zone,
|
||||
"time_min" timestamptz,
|
||||
"time_max" timestamptz
|
||||
);
|
14
pom.xml
14
pom.xml
@ -95,6 +95,20 @@
|
||||
<version>6.0.5</version>
|
||||
<scope>runtime</scope>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.postgresql</groupId>
|
||||
<artifactId>postgresql</artifactId>
|
||||
<version>42.6.0</version>
|
||||
<scope>runtime</scope>
|
||||
</dependency>
|
||||
<!-- needed for postgres unix socket -->
|
||||
<dependency>
|
||||
<groupId>com.kohlschutter.junixsocket</groupId>
|
||||
<artifactId>junixsocket-core</artifactId>
|
||||
<version>2.5.1</version>
|
||||
<type>pom</type>
|
||||
<scope>runtime</scope>
|
||||
</dependency>
|
||||
|
||||
<!-- logging -->
|
||||
<dependency>
|
||||
|
@ -18,7 +18,10 @@
|
||||
|
||||
<!-- rename this to rcrdit.cfg.xml and pass it's path in as an argument -->
|
||||
<rcrdit>
|
||||
<!-- jdbc database path, sqlite/postgresql/oracle/anything jdbc should work too if proper libraries are available -->
|
||||
<!-- jdbc database path, sqlite/postgresql/oracle/anything jdbc should work too if proper libraries are available
|
||||
postgres connecting to unix socket looks like:
|
||||
<databaseUrl>jdbc:postgresql://localhost/rcrdit?user=rcrdit&password=rcrdit&serverTimezone=America/New_York&socketFactory=org.newsclub.net.unix.AFUNIXSocketFactory$FactoryArg&socketFactoryArg=/run/postgresql/.s.PGSQL.5432</databaseUrl>
|
||||
-->
|
||||
<databaseUrl>jdbc:mysql://localhost:3306/rcrdit?user=rcrdit&password=rcrdit&serverTimezone=America/New_York</databaseUrl>
|
||||
<!-- server uri (context path and port) for web application -->
|
||||
<serverUri>http://localhost:8080/rcrdit/</serverUri>
|
||||
|
@ -13,6 +13,7 @@ Configure your TV tuner(s) by editing rcrdit.cfg.example.xml, compile the projec
|
||||
project with `java -jar target/rcrdit.jar`
|
||||
|
||||
rcrdit.ics is generated on every schedule import which when imported to a calendar program like thunderbird can easily
|
||||
show which shows will be recorded when and which will be skipped depeding on priority.
|
||||
show which shows will be recorded when and which will be skipped depending on priority.
|
||||
|
||||
A web interface is coming soon.
|
||||
A web interface is included which shows the schedule and allows you to schedule recordings. Profiles are still set up
|
||||
manually in the database.
|
||||
|
@ -581,12 +581,12 @@ public class RcrdIt extends ResourceConfig implements AutoCloseable {
|
||||
|
||||
try (Connection conn = DriverManager.getConnection(databaseUrl);
|
||||
QueryMapper qm = new QueryMapper(conn)) {
|
||||
String sql = "INSERT INTO autorecs (autorec_id, profile_id, priority, title, channel_name, days_of_week, between_time_start, between_time_end, time_min, time_max) "
|
||||
+ "VALUES (NULL, ?, ?, ?, ?, NULL, ?,?, from_unixtime(?), from_unixtime(?))";
|
||||
Long startDate = null;
|
||||
Long endDate = null;
|
||||
if(recordingRequest.getStartDateEpochSeconds() != null)startDate = recordingRequest.getStartDateEpochSeconds();
|
||||
if(recordingRequest.getEndDateEpochSeconds() != null)endDate = recordingRequest.getEndDateEpochSeconds();
|
||||
String sql = "INSERT INTO autorecs (profile_id, priority, title, channel_name, days_of_week, between_time_start, between_time_end, time_min, time_max) "
|
||||
+ "VALUES (?, ?, ?, ?, NULL, ?, ?, ?, ?)";
|
||||
java.sql.Timestamp startDate = null;
|
||||
java.sql.Timestamp endDate = null;
|
||||
if(recordingRequest.getStartDateEpochSeconds() != null)startDate = new Timestamp(recordingRequest.getStartDateEpochSeconds() * 1000);
|
||||
if(recordingRequest.getEndDateEpochSeconds() != null)endDate = new Timestamp(recordingRequest.getEndDateEpochSeconds() * 1000);
|
||||
String startTime = null;
|
||||
String endTime = null;
|
||||
if(recordingRequest.getStartTime() != null)startTime = recordingRequest.getStartTime().trim();
|
||||
|
2
src/main/resources/META-INF/services/java.sql.Driver
Normal file
2
src/main/resources/META-INF/services/java.sql.Driver
Normal file
@ -0,0 +1,2 @@
|
||||
org.postgresql.Driver
|
||||
com.mysql.cj.jdbc.Driver
|
Loading…
Reference in New Issue
Block a user