Skip to content

Commit a0c1cdf

Browse files
v1.7.0 Merge
v1.7.0 Merge
2 parents 32ec88a + 21ad430 commit a0c1cdf

21 files changed

+763
-168
lines changed

.gitignore

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,10 +5,11 @@
55
.Trashes
66
ehthumbs.db
77
Thumbs.db
8-
__pycache__
98
GeoLite2-City.mmdb
109
GeoLite2-City.tar.gz
1110
data/varken.ini
1211
.idea/
1312
varken-venv/
13+
venv/
1414
logs/
15+
__pycache__

CHANGELOG.md

Lines changed: 19 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,24 @@
11
# Change Log
22

3-
## [v1.6.8](https://github.com/Boerderij/Varken/tree/v1.6.8) (2019-04-18)
4-
[Full Changelog](https://github.com/Boerderij/Varken/compare/1.6.7...v1.6.8)
3+
## [v1.7.0](https://github.com/Boerderij/Varken/tree/v1.7.0) (2019-05-05)
4+
[Full Changelog](https://github.com/Boerderij/Varken/compare/1.6.8...v1.7.0)
5+
6+
**Implemented enhancements:**
7+
8+
- \[ENHANCEMENT\] Add album and track totals to artist library from Tautulli [\#127](https://github.com/Boerderij/Varken/issues/127)
9+
- \[Feature Request\] No way to show music album / track count [\#125](https://github.com/Boerderij/Varken/issues/125)
10+
11+
**Fixed bugs:**
12+
13+
- \[BUG\] Invalid retention policy name causing retention policy creation failure [\#129](https://github.com/Boerderij/Varken/issues/129)
14+
- \[BUG\] Unifi errors on unnamed devices [\#126](https://github.com/Boerderij/Varken/issues/126)
15+
16+
**Merged pull requests:**
17+
18+
- v1.7.0 Merge [\#131](https://github.com/Boerderij/Varken/pull/131) ([DirtyCajunRice](https://github.com/DirtyCajunRice))
19+
20+
## [1.6.8](https://github.com/Boerderij/Varken/tree/1.6.8) (2019-04-19)
21+
[Full Changelog](https://github.com/Boerderij/Varken/compare/1.6.7...1.6.8)
522

623
**Implemented enhancements:**
724

Dockerfile

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ FROM amd64/python:3.7.2-alpine
22

33
LABEL maintainers="dirtycajunrice,samwiseg0"
44

5-
ENV DEBUG="False"
5+
ENV DEBUG="True"
66

77
WORKDIR /app
88

@@ -12,6 +12,8 @@ COPY /varken /app/varken
1212

1313
COPY /data /app/data
1414

15+
COPY /utilities /app/data/utilities
16+
1517
RUN apk add --no-cache tzdata && \
1618
python3 -m pip install -r /app/requirements.txt
1719

Dockerfile.arm

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ FROM arm32v6/python:3.7.2-alpine
22

33
LABEL maintainers="dirtycajunrice,samwiseg0"
44

5-
ENV DEBUG="False"
5+
ENV DEBUG="True"
66

77
WORKDIR /app
88

Dockerfile.arm64

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ FROM arm64v8/python:3.7.2-alpine
22

33
LABEL maintainers="dirtycajunrice,samwiseg0"
44

5-
ENV DEBUG="False"
5+
ENV DEBUG="True"
66

77
WORKDIR /app
88

README.md

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
<p align="center">
2-
<img width="800" src="https://bin.cajun.pro/images/varken_full_banner.png">
2+
<img width="800" src="https://bin.cajun.pro/images/varken_full_banner.png" alt="Logo Banner">
33
</p>
44

55
[![Build Status](https://jenkins.cajun.pro/buildStatus/icon?job=Varken/master)](https://jenkins.cajun.pro/job/Varken/job/master/)
@@ -11,19 +11,19 @@
1111

1212
Dutch for PIG. PIG is an Acronym for Plex/InfluxDB/Grafana
1313

14-
Varken is a standalone command-line utility to aggregate data
15-
from the Plex ecosystem into InfluxDB. Examples use Grafana for a
16-
frontend
14+
Varken is a standalone application to aggregate data from the Plex
15+
ecosystem into InfluxDB using Grafana for a frontend
1716

1817
Requirements:
1918
* [Python 3.6.7+](https://www.python.org/downloads/release/python-367/)
2019
* [Python3-pip](https://pip.pypa.io/en/stable/installing/)
2120
* [InfluxDB](https://www.influxdata.com/)
21+
* [Grafana](https://grafana.com/)
2222

2323
<p align="center">
2424
Example Dashboard
2525

26-
<img width="800" src="https://i.imgur.com/3hNZTkC.png">
26+
<img width="800" src="https://i.imgur.com/3hNZTkC.png" alt="dashboard">
2727
</p>
2828

2929
Supported Modules:
@@ -33,6 +33,7 @@ Supported Modules:
3333
* [Tautulli](https://tautulli.com/) - A Python based monitoring and tracking tool for Plex Media Server.
3434
* [Ombi](https://ombi.io/) - Want a Movie or TV Show on Plex or Emby? Use Ombi!
3535
* [Unifi](https://unifi-sdn.ubnt.com/) - The Global Leader in Managed Wi-Fi Systems
36+
* [Lidarr](https://lidarr.audio/) - Looks and smells like Sonarr but made for music.
3637

3738
Key features:
3839
* Multiple server support for all modules
@@ -41,21 +42,20 @@ Key features:
4142

4243

4344
## Installation Guides
44-
Varken Installation guides can be found in the [wiki](https://github.com/Boerderij/Varken/wiki/Installation).
45+
Varken Installation guides can be found in the [wiki](https://wiki.cajun.pro/books/varken/chapter/installation).
4546

4647
## Support
47-
Please read [Asking for Support](https://github.com/Boerderij/Varken/wiki/Asking-for-Support) before seeking support.
48+
Please read [Asking for Support](https://wiki.cajun.pro/books/varken/chapter/asking-for-support) before seeking support.
4849

4950
[Click here for quick access to discord support](http://cyborg.decreator.dev/channels/518970285773422592/530424560504537105/). No app or account needed!
5051

5152
### InfluxDB
52-
[InfluxDB Installation Documentation](https://docs.influxdata.com/influxdb/v1.7/introduction/installation/)
53+
[InfluxDB Installation Documentation](https://wiki.cajun.pro/books/varken/page/influxdb-d1f)
5354

5455
Influxdb is required but not packaged as part of Varken. Varken will create
5556
its database on its own. If you choose to give varken user permissions that
5657
do not include database creation, please ensure you create an influx database
5758
named `varken`
5859

5960
### Grafana
60-
[Grafana Installation Documentation](http://docs.grafana.org/installation/)
61-
Official dashboard installation instructions can be found in the [wiki](https://github.com/Boerderij/Varken/wiki/Installation#grafana)
61+
[Grafana Installation/Dashboard Documentation](https://wiki.cajun.pro/books/varken/page/grafana)

Varken.py

Lines changed: 41 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@
1717
from varken import VERSION, BRANCH
1818
from varken.sonarr import SonarrAPI
1919
from varken.radarr import RadarrAPI
20+
from varken.lidarr import LidarrAPI
2021
from varken.iniparser import INIParser
2122
from varken.dbmanager import DBManager
2223
from varken.helpers import GeoIPHandler
@@ -28,13 +29,9 @@
2829
PLATFORM_LINUX_DISTRO = ' '.join(x for x in linux_distribution() if x)
2930

3031

31-
def thread():
32-
while schedule.jobs:
33-
job = QUEUE.get()
34-
a = job()
35-
if a is not None:
36-
schedule.clear(a)
37-
QUEUE.task_done()
32+
def thread(job, **kwargs):
33+
worker = Thread(target=job, kwargs=dict(**kwargs))
34+
worker.start()
3835

3936

4037
if __name__ == "__main__":
@@ -43,7 +40,8 @@ def thread():
4340
formatter_class=RawTextHelpFormatter)
4441

4542
parser.add_argument("-d", "--data-folder", help='Define an alternate data folder location')
46-
parser.add_argument("-D", "--debug", action='store_true', help='Use to enable DEBUG logging')
43+
parser.add_argument("-D", "--debug", action='store_true', help='Use to enable DEBUG logging. (Depreciated)')
44+
parser.add_argument("-ND", "--no_debug", action='store_true', help='Use to disable DEBUG logging')
4745

4846
opts = parser.parse_args()
4947

@@ -72,10 +70,15 @@ def thread():
7270
enable_opts = ['True', 'true', 'yes']
7371
debug_opts = ['debug', 'Debug', 'DEBUG']
7472

75-
if not opts.debug:
73+
opts.debug = True
74+
75+
if getenv('DEBUG') is not None:
7676
opts.debug = True if any([getenv(string, False) for true in enable_opts
7777
for string in debug_opts if getenv(string, False) == true]) else False
7878

79+
elif opts.no_debug:
80+
opts.debug = False
81+
7982
# Initiate the logger
8083
vl = VarkenLogger(data_folder=DATA_FOLDER, debug=opts.debug)
8184
vl.logger.info('Starting Varken...')
@@ -98,72 +101,84 @@ def thread():
98101
SONARR = SonarrAPI(server, DBMANAGER)
99102
if server.queue:
100103
at_time = schedule.every(server.queue_run_seconds).seconds
101-
at_time.do(QUEUE.put, SONARR.get_queue).tag("sonarr-{}-get_queue".format(server.id))
104+
at_time.do(thread, SONARR.get_queue).tag("sonarr-{}-get_queue".format(server.id))
102105
if server.missing_days > 0:
103106
at_time = schedule.every(server.missing_days_run_seconds).seconds
104-
at_time.do(QUEUE.put, SONARR.get_missing).tag("sonarr-{}-get_missing".format(server.id))
107+
at_time.do(thread, SONARR.get_calendar, query="Missing").tag("sonarr-{}-get_missing".format(server.id))
105108
if server.future_days > 0:
106109
at_time = schedule.every(server.future_days_run_seconds).seconds
107-
at_time.do(QUEUE.put, SONARR.get_future).tag("sonarr-{}-get_future".format(server.id))
110+
at_time.do(thread, SONARR.get_calendar, query="Future").tag("sonarr-{}-get_future".format(server.id))
108111

109112
if CONFIG.tautulli_enabled:
110113
GEOIPHANDLER = GeoIPHandler(DATA_FOLDER)
111-
schedule.every(12).to(24).hours.do(QUEUE.put, GEOIPHANDLER.update)
114+
schedule.every(12).to(24).hours.do(thread, GEOIPHANDLER.update)
112115
for server in CONFIG.tautulli_servers:
113116
TAUTULLI = TautulliAPI(server, DBMANAGER, GEOIPHANDLER)
114117
if server.get_activity:
115118
at_time = schedule.every(server.get_activity_run_seconds).seconds
116-
at_time.do(QUEUE.put, TAUTULLI.get_activity).tag("tautulli-{}-get_activity".format(server.id))
119+
at_time.do(thread, TAUTULLI.get_activity).tag("tautulli-{}-get_activity".format(server.id))
117120
if server.get_stats:
118121
at_time = schedule.every(server.get_stats_run_seconds).seconds
119-
at_time.do(QUEUE.put, TAUTULLI.get_stats).tag("tautulli-{}-get_stats".format(server.id))
122+
at_time.do(thread, TAUTULLI.get_stats).tag("tautulli-{}-get_stats".format(server.id))
120123

121124
if CONFIG.radarr_enabled:
122125
for server in CONFIG.radarr_servers:
123126
RADARR = RadarrAPI(server, DBMANAGER)
124127
if server.get_missing:
125128
at_time = schedule.every(server.get_missing_run_seconds).seconds
126-
at_time.do(QUEUE.put, RADARR.get_missing).tag("radarr-{}-get_missing".format(server.id))
129+
at_time.do(thread, RADARR.get_missing).tag("radarr-{}-get_missing".format(server.id))
127130
if server.queue:
128131
at_time = schedule.every(server.queue_run_seconds).seconds
129-
at_time.do(QUEUE.put, RADARR.get_queue).tag("radarr-{}-get_queue".format(server.id))
132+
at_time.do(thread, RADARR.get_queue).tag("radarr-{}-get_queue".format(server.id))
133+
134+
if CONFIG.lidarr_enabled:
135+
for server in CONFIG.lidarr_servers:
136+
LIDARR = LidarrAPI(server, DBMANAGER)
137+
if server.queue:
138+
at_time = schedule.every(server.queue_run_seconds).seconds
139+
at_time.do(thread, LIDARR.get_queue).tag("lidarr-{}-get_queue".format(server.id))
140+
if server.missing_days > 0:
141+
at_time = schedule.every(server.missing_days_run_seconds).seconds
142+
at_time.do(thread, LIDARR.get_calendar, query="Missing").tag(
143+
"lidarr-{}-get_missing".format(server.id))
144+
if server.future_days > 0:
145+
at_time = schedule.every(server.future_days_run_seconds).seconds
146+
at_time.do(thread, LIDARR.get_calendar, query="Future").tag("lidarr-{}-get_future".format(
147+
server.id))
130148

131149
if CONFIG.ombi_enabled:
132150
for server in CONFIG.ombi_servers:
133151
OMBI = OmbiAPI(server, DBMANAGER)
134152
if server.request_type_counts:
135153
at_time = schedule.every(server.request_type_run_seconds).seconds
136-
at_time.do(QUEUE.put, OMBI.get_request_counts).tag("ombi-{}-get_request_counts".format(server.id))
154+
at_time.do(thread, OMBI.get_request_counts).tag("ombi-{}-get_request_counts".format(server.id))
137155
if server.request_total_counts:
138156
at_time = schedule.every(server.request_total_run_seconds).seconds
139-
at_time.do(QUEUE.put, OMBI.get_all_requests).tag("ombi-{}-get_all_requests".format(server.id))
157+
at_time.do(thread, OMBI.get_all_requests).tag("ombi-{}-get_all_requests".format(server.id))
140158
if server.issue_status_counts:
141159
at_time = schedule.every(server.issue_status_run_seconds).seconds
142-
at_time.do(QUEUE.put, OMBI.get_issue_counts).tag("ombi-{}-get_issue_counts".format(server.id))
160+
at_time.do(thread, OMBI.get_issue_counts).tag("ombi-{}-get_issue_counts".format(server.id))
143161

144162
if CONFIG.sickchill_enabled:
145163
for server in CONFIG.sickchill_servers:
146164
SICKCHILL = SickChillAPI(server, DBMANAGER)
147165
if server.get_missing:
148166
at_time = schedule.every(server.get_missing_run_seconds).seconds
149-
at_time.do(QUEUE.put, SICKCHILL.get_missing).tag("sickchill-{}-get_missing".format(server.id))
167+
at_time.do(thread, SICKCHILL.get_missing).tag("sickchill-{}-get_missing".format(server.id))
150168

151169
if CONFIG.unifi_enabled:
152170
for server in CONFIG.unifi_servers:
153171
UNIFI = UniFiAPI(server, DBMANAGER)
154172
at_time = schedule.every(server.get_usg_stats_run_seconds).seconds
155-
at_time.do(QUEUE.put, UNIFI.get_usg_stats).tag("unifi-{}-get_usg_stats".format(server.id))
173+
at_time.do(thread, UNIFI.get_usg_stats).tag("unifi-{}-get_usg_stats".format(server.id))
156174

157175
# Run all on startup
158176
SERVICES_ENABLED = [CONFIG.ombi_enabled, CONFIG.radarr_enabled, CONFIG.tautulli_enabled, CONFIG.unifi_enabled,
159-
CONFIG.sonarr_enabled, CONFIG.sickchill_enabled]
177+
CONFIG.sonarr_enabled, CONFIG.sickchill_enabled, CONFIG.lidarr_enabled]
160178
if not [enabled for enabled in SERVICES_ENABLED if enabled]:
161179
vl.logger.error("All services disabled. Exiting")
162180
exit(1)
163181

164-
WORKER = Thread(target=thread)
165-
WORKER.start()
166-
167182
schedule.run_all()
168183

169184
while schedule.jobs:

data/varken.example.ini

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
[global]
22
sonarr_server_ids = 1,2
33
radarr_server_ids = 1,2
4+
lidarr_server_ids = false
45
tautulli_server_ids = 1
56
ombi_server_ids = 1
67
sickchill_server_ids = false
@@ -69,6 +70,18 @@ queue_run_seconds = 300
6970
get_missing = true
7071
get_missing_run_seconds = 300
7172

73+
[lidarr-1]
74+
url = lidarr1.domain.tld:8686
75+
apikey = xxxxxxxxxxxxxxxx
76+
ssl = false
77+
verify_ssl = false
78+
missing_days = 30
79+
missing_days_run_seconds = 300
80+
future_days = 30
81+
future_days_run_seconds = 300
82+
queue = true
83+
queue_run_seconds = 300
84+
7285
[ombi-1]
7386
url = ombi.domain.tld
7487
apikey = xxxxxxxxxxxxxxxx

docker-compose.yml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ networks:
55
services:
66
influxdb:
77
hostname: influxdb
8+
container_name: influxdb
89
image: influxdb
910
networks:
1011
- internal
@@ -13,6 +14,7 @@ services:
1314
restart: unless-stopped
1415
varken:
1516
hostname: varken
17+
container_name: varken
1618
image: boerderij/varken
1719
networks:
1820
- internal
@@ -27,6 +29,7 @@ services:
2729
restart: unless-stopped
2830
grafana:
2931
hostname: grafana
32+
container_name: grafana
3033
image: grafana/grafana
3134
networks:
3235
- internal
@@ -41,4 +44,5 @@ services:
4144
- GF_INSTALL_PLUGINS=grafana-piechart-panel,grafana-worldmap-panel
4245
depends_on:
4346
- influxdb
47+
- varken
4448
restart: unless-stopped

requirements.txt

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,9 @@
22
# Potential requirements.
33
# pip3 install -r requirements.txt
44
#---------------------------------------------------------
5-
requests>=2.20.1
6-
geoip2>=2.9.0
7-
influxdb>=5.2.0
8-
schedule>=0.5.0
9-
distro>=1.3.0
10-
urllib3>=1.22
5+
requests==2.21
6+
geoip2==2.9.0
7+
influxdb==5.2.0
8+
schedule==0.6.0
9+
distro==1.4.0
10+
urllib3==1.24.2

0 commit comments

Comments
 (0)