aboutsummaryrefslogtreecommitdiff
path: root/src/main.c
diff options
context:
space:
mode:
authordec05eba <dec05eba@protonmail.com>2020-07-15 09:28:51 +0200
committerdec05eba <dec05eba@protonmail.com>2020-07-15 09:28:51 +0200
commit73393bfab65515c68159a649c10856659b5ac016 (patch)
tree67cb37484cccc0cf9d3cbe88a58095c2040bd79e /src/main.c
parent35aca1f0582c43b5f6818c8fc00b924247e45881 (diff)
Use transmission rpc, fixes rss torrent name
Diffstat (limited to 'src/main.c')
-rw-r--r--src/main.c12
1 files changed, 9 insertions, 3 deletions
diff --git a/src/main.c b/src/main.c
index eabd755..bb8114a 100644
--- a/src/main.c
+++ b/src/main.c
@@ -264,7 +264,7 @@ static void automedia_pid_signal_handler(int signum) {
running = 0;
}
-static void sync_tracked_rss(char *rss_config_dir) {
+static void sync_tracked_rss(TransmissionSession *transmission_session, char *rss_config_dir) {
char rss_tracked_dir[PATH_MAX];
strcpy(rss_tracked_dir, rss_config_dir);
strcat(rss_tracked_dir, "/tracked");
@@ -323,7 +323,7 @@ static void sync_tracked_rss(char *rss_config_dir) {
tracked_rss.title = dir->d_name;
tracked_rss.link = link_file_content;
tracked_rss.json_data = json_value_as_object(json_data);
- if(sync_rss(&tracked_rss, rss_config_dir) != 0)
+ if(sync_rss(transmission_session, &tracked_rss, rss_config_dir) != 0)
fprintf(stderr, "Failed to sync %s\n", dir->d_name);
free(link_file_content);
@@ -343,10 +343,16 @@ static void sync_rss_html(char *rss_config_dir, char *html_config_dir, const cha
}
}
+ TransmissionSession transmission_session;
+ if(transmission_connect(&transmission_session) != 0) {
+ fprintf(stderr, "Failed to connect to the transmission daemon!\n");
+ exit(2);
+ }
+
running = 1;
/* running is set to 0 in SIGINT signal handler (ctrl+c) */
while(running) {
- sync_tracked_rss(rss_config_dir);
+ sync_tracked_rss(&transmission_session, rss_config_dir);
if(running)
sleep(sync_rate_sec);
}