aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDiederick de Vries <diederick@diederickdevries.net>2018-06-13 17:44:59 +0200
committerDiederick de Vries <diederick@diederickdevries.net>2018-06-13 17:44:59 +0200
commit6d8a6f687338d5ee70d627a32bdb8836925f068f (patch)
tree93b46b2cf020c18c8d3322f4de1283e4e9f57551
parent83e434fd102d7b2df2d37562581794c4eb4bd11f (diff)
downloadcareless-6d8a6f687338d5ee70d627a32bdb8836925f068f.tar.gz
careless-6d8a6f687338d5ee70d627a32bdb8836925f068f.tar.bz2
careless-6d8a6f687338d5ee70d627a32bdb8836925f068f.zip
Externalize properties
-rw-r--r--careless.groovy33
-rw-r--r--properties.conf9
2 files changed, 33 insertions, 9 deletions
diff --git a/careless.groovy b/careless.groovy
index 8708f24..ada40c6 100644
--- a/careless.groovy
+++ b/careless.groovy
@@ -32,17 +32,32 @@ import groovy.transform.Canonical
32@Slf4j 32@Slf4j
33class Careless { 33class Careless {
34 34
35 def trans = "philae" // The name of the host of Transmission 35 def trans = ""
36 def ttrss = "http://localhost/tt-rss/api/"; // The full URL to Tiny Tiny RSS, ending with /api/ 36 def ttrss = ""
37 def user = "" // Your Tiny Tiny RSS user name 37 def user = ""
38 def pass = "" // Your Tiny Tiny RSS password 38 def pass = ""
39 def feed = "" // The feed id (numeric) 39 def feed = ""
40 40
41 def tv = "" // The directory where the articles are stored 41 def tv = ""
42 def allowed = ['mkv', 'mp4', 'mpg', 'avi'] // The allowed file name extensions 42 def allowed = []
43 def nrs = "[Ss]?[0-9]{1,2}[EeXx][0-9]{1,2}"// The regex that determines the season and 43 def nrs = ""
44 44
45 def sid = null 45 def sid = null
46
47 public Careless(String configFile) {
48
49 def conf = new ConfigSlurper().parse(new File(configFile).toURL())
50
51 trans = conf.trans
52 ttrss = conf.ttrss
53 user = conf.user
54 pass = conf.pass
55 feed = conf.feed
56
57 tv = conf.tv
58 allowed = conf.allowed
59 nrs = conf.nrs
60 }
46 61
47 public String login () { 62 public String login () {
48 def message = """{ 63 def message = """{
@@ -168,7 +183,7 @@ public class Article {
168 } 183 }
169} 184}
170 185
171def process = new Careless() 186def process = new Careless(args[0])
172def sid = process.login() 187def sid = process.login()
173def entries = process.getArticles(sid) 188def entries = process.getArticles(sid)
174process.transmit(sid, entries); \ No newline at end of file 189process.transmit(sid, entries); \ No newline at end of file
diff --git a/properties.conf b/properties.conf
new file mode 100644
index 0000000..1ee1af0
--- /dev/null
+++ b/properties.conf
@@ -0,0 +1,9 @@
1trans = ""
2ttrss = "http://localhost/tt-rss/api/"
3user = ""
4pass = ""
5feed = ""
6
7tv = ""
8allowed = ['mkv', 'mp4', 'mpg', 'avi']
9nrs = "[Ss]?[0-9]{1,2}[EeXx][0-9]{1,2}"