diff options
author | dec05eba <dec05eba@protonmail.com> | 2020-07-15 09:28:51 +0200 |
---|---|---|
committer | dec05eba <dec05eba@protonmail.com> | 2020-07-15 09:28:51 +0200 |
commit | 73393bfab65515c68159a649c10856659b5ac016 (patch) | |
tree | 67cb37484cccc0cf9d3cbe88a58095c2040bd79e /src/main.c | |
parent | 35aca1f0582c43b5f6818c8fc00b924247e45881 (diff) |
Use transmission rpc, fixes rss torrent name
Diffstat (limited to 'src/main.c')
-rw-r--r-- | src/main.c | 12 |
1 files changed, 9 insertions, 3 deletions
@@ -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); } |