summaryrefslogtreecommitdiff
path: root/src/torrent.c
diff options
context:
space:
mode:
authorGravatar Alan Fitton <ajf@eth0.org.uk>2011-09-30 08:28:32 +0000
committerGravatar Alan Fitton <ajf@eth0.org.uk>2011-09-30 08:28:32 +0000
commita61f54aadce62bb71e076f3902a3ca0c59fadb20 (patch)
treefe298593d337a37c87e95e19a35cb3ccf616f812 /src/torrent.c
parente686fec66c00a77ed532013223ca0683c8ebf3d6 (diff)
some improvements to remote exec. can now use profile options like %{hostname}
Diffstat (limited to 'src/torrent.c')
-rw-r--r--src/torrent.c21
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;
+}