diff options
author | Alan Fitton <ajf@eth0.org.uk> | 2011-09-30 08:28:32 +0000 |
---|---|---|
committer | Alan Fitton <ajf@eth0.org.uk> | 2011-09-30 08:28:32 +0000 |
commit | a61f54aadce62bb71e076f3902a3ca0c59fadb20 (patch) | |
tree | fe298593d337a37c87e95e19a35cb3ccf616f812 /src/torrent.c | |
parent | e686fec66c00a77ed532013223ca0683c8ebf3d6 (diff) |
some improvements to remote exec. can now use profile options like %{hostname}
Diffstat (limited to 'src/torrent.c')
-rw-r--r-- | src/torrent.c | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/src/torrent.c b/src/torrent.c index 426a2ce..046693a 100644 --- a/src/torrent.c +++ b/src/torrent.c @@ -439,3 +439,24 @@ const gchar *tracker_stats_get_host(JsonObject *t) { return json_object_get_string_member(t, FIELD_HOST); } + +gchar *torrent_get_full_path(JsonObject * obj) { + gchar *containing_path, *name, *delim; + const gchar *location; + JsonArray *files = torrent_get_files(obj); + JsonObject *firstFile; + + location = json_object_get_string_member(obj, FIELD_DOWNLOAD_DIR); + firstFile = json_array_get_object_element(files, 0); + name = g_strdup(json_object_get_string_member(firstFile, TFILE_NAME)); + + if ( (delim = g_strstr_len(name,-1,"/")) ) { + *delim = '\0'; + containing_path = g_strdup_printf("%s/%s",location,name); + } else { + containing_path = g_strdup(location); + } + + g_free(name); + return containing_path; +} |