{"action":"created","comment":{"url":"https://api.github.com/repos/ubclaunchpad/RocketCast/pulls/comments/78301869","id":78301869,"diff_hunk":"@@ -11,33 +11,52 @@ import Foundation\n import UIKit\n \n protocol DownloadBridgeProtocol {\n-    func downloadPodcastXML(url:PodcastWebURL, result:(url: PodcastStorageURL) -> ())\n-    func downloadImage(url: ImageWebURL, result:(url: ImageStorageURL) -> ())\n-    func downloadMp3(url: MP3WebURL, result:(url: MP3StorageURL) -> ())\n+  func downloadPodcastXML(url:PodcastWebURL, result:(url: PodcastStorageURL) -> ())\n+  func downloadImage(url: ImageWebURL, result:(url: ImageStorageURL) -> ())\n+  func downloadMp3(url: MP3WebURL, result:(url: MP3StorageURL) -> ())\n }\n extension ModelBridge: DownloadBridgeProtocol {\n+  \n+  func downloadPodcastXML(url:PodcastWebURL, result:(url: PodcastStorageURL) -> ()) {\n+    let podcastURL = NSURL(string: url)\n+    \n+    let task = NSURLSession.sharedSession().dataTaskWithURL(podcastURL!) {(data, response, error) in\n+      \n+      guard error == nil else {\n+        print(error)\n+        return\n+      }\n+      let XMLString = NSString(data: data!, encoding: NSUTF8StringEncoding)\n+      \n+      let filePathAppend = \"/Documents/\\(url.stringByRemovingAll(stringsToRemove)).xml\"\n+      \n+      let filePath = NSHomeDirectory() + filePathAppend\n \n-    func downloadPodcastXML(url:PodcastWebURL, result:(url: PodcastStorageURL) -> ()) {\n-        let nsURL = NSURL(string: url)\n-        let parser = NSXMLParser(contentsOfURL: nsURL!)\n-        print(parser)\n-        \n-        let xmlParser = XMLParser(url: nsURL!)\n-        \n-        //download it\n-        //pass the rss data to another object\n-        // get the authrfrom that object\n-        //get other info from that object (list of episodes, title of podcast)\n-        //put the title, episodes, and author into the POdcastModel\n-        \n+      do {\n+        _ = try XMLString!.writeToFile(filePath, atomically: true, encoding: NSUTF8StringEncoding)\n+        result(url: filePathAppend)\n+      } catch let error as NSError {\n+        print(error.description)\n+      }","path":"RocketCast/DownloadBridge.swift","position":46,"original_position":46,"commit_id":"539e806f228efc9910981a2238a24fac9a1d34e5","original_commit_id":"5c950b5f903f6b90c5ee370a1ab20968cd39962a","user":{"login":"miltonleung","id":14854351,"avatar_url":"https://avatars.githubusercontent.com/u/14854351?v=3","gravatar_id":"","url":"https://api.github.com/users/miltonleung","html_url":"https://github.com/miltonleung","followers_url":"https://api.github.com/users/miltonleung/followers","following_url":"https://api.github.com/users/miltonleung/following{/other_user}","gists_url":"https://api.github.com/users/miltonleung/gists{/gist_id}","starred_url":"https://api.github.com/users/miltonleung/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/miltonleung/subscriptions","organizations_url":"https://api.github.com/users/miltonleung/orgs","repos_url":"https://api.github.com/users/miltonleung/repos","events_url":"https://api.github.com/users/miltonleung/events{/privacy}","received_events_url":"https://api.github.com/users/miltonleung/received_events","type":"User","site_admin":false},"body":"done","created_at":"2016-09-11T20:27:28Z","updated_at":"2016-09-11T20:27:28Z","html_url":"https://github.com/ubclaunchpad/RocketCast/pull/19#discussion_r78301869","pull_request_url":"https://api.github.com/repos/ubclaunchpad/RocketCast/pulls/19","_links":{"self":{"href":"https://api.github.com/repos/ubclaunchpad/RocketCast/pulls/comments/78301869"},"html":{"href":"https://github.com/ubclaunchpad/RocketCast/pull/19#discussion_r78301869"},"pull_request":{"href":"https://api.github.com/repos/ubclaunchpad/RocketCast/pulls/19"}}},"pull_request":{"url":"https://api.github.com/repos/ubclaunchpad/RocketCast/pulls/19","id":84770116,"html_url":"https://github.com/ubclaunchpad/RocketCast/pull/19","diff_url":"https://github.com/ubclaunchpad/RocketCast/pull/19.diff","patch_url":"https://github.com/ubclaunchpad/RocketCast/pull/19.patch","issue_url":"https://api.github.com/repos/ubclaunchpad/RocketCast/issues/19","number":19,"state":"open","locked":false,"title":"RC-23 Download XML anand saved with url  as name","user":{"login":"miltonleung","id":14854351,"avatar_url":"https://avatars.githubusercontent.com/u/14854351?v=3","gravatar_id":"","url":"https://api.github.com/users/miltonleung","html_url":"https://github.com/miltonleung","followers_url":"https://api.github.com/users/miltonleung/followers","following_url":"https://api.github.com/users/miltonleung/following{/other_user}","gists_url":"https://api.github.com/users/miltonleung/gists{/gist_id}","starred_url":"https://api.github.com/users/miltonleung/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/miltonleung/subscriptions","organizations_url":"https://api.github.com/users/miltonleung/orgs","repos_url":"https://api.github.com/users/miltonleung/repos","events_url":"https://api.github.com/users/miltonleung/events{/privacy}","received_events_url":"https://api.github.com/users/miltonleung/received_events","type":"User","site_admin":false},"body":"","created_at":"2016-09-10T22:39:07Z","updated_at":"2016-09-11T20:27:28Z","closed_at":null,"merged_at":null,"merge_commit_sha":"b8bd81df4f1fbe54a64d3e8a35ae968827d53dbf","assignee":null,"assignees":[],"milestone":null,"commits_url":"https://api.github.com/repos/ubclaunchpad/RocketCast/pulls/19/commits","review_comments_url":"https://api.github.com/repos/ubclaunchpad/RocketCast/pulls/19/comments","review_comment_url":"https://api.github.com/repos/ubclaunchpad/RocketCast/pulls/comments{/number}","comments_url":"https://api.github.com/repos/ubclaunchpad/RocketCast/issues/19/comments","statuses_url":"https://api.github.com/repos/ubclaunchpad/RocketCast/statuses/539e806f228efc9910981a2238a24fac9a1d34e5","head":{"label":"ubclaunchpad:RC-23","ref":"RC-23","sha":"539e806f228efc9910981a2238a24fac9a1d34e5","user":{"login":"ubclaunchpad","id":12406312,"avatar_url":"https://avatars.githubusercontent.com/u/12406312?v=3","gravatar_id":"","url":"https://api.github.com/users/ubclaunchpad","html_url":"https://github.com/ubclaunchpad","followers_url":"https://api.github.com/users/ubclaunchpad/followers","following_url":"https://api.github.com/users/ubclaunchpad/following{/other_user}","gists_url":"https://api.github.com/users/ubclaunchpad/gists{/gist_id}","starred_url":"https://api.github.com/users/ubclaunchpad/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ubclaunchpad/subscriptions","organizations_url":"https://api.github.com/users/ubclaunchpad/orgs","repos_url":"https://api.github.com/users/ubclaunchpad/repos","events_url":"https://api.github.com/users/ubclaunchpad/events{/privacy}","received_events_url":"https://api.github.com/users/ubclaunchpad/received_events","type":"Organization","site_admin":false},"repo":{"id":66735196,"name":"RocketCast","full_name":"ubclaunchpad/RocketCast","owner":{"login":"ubclaunchpad","id":12406312,"avatar_url":"https://avatars.githubusercontent.com/u/12406312?v=3","gravatar_id":"","url":"https://api.github.com/users/ubclaunchpad","html_url":"https://github.com/ubclaunchpad","followers_url":"https://api.github.com/users/ubclaunchpad/followers","following_url":"https://api.github.com/users/ubclaunchpad/following{/other_user}","gists_url":"https://api.github.com/users/ubclaunchpad/gists{/gist_id}","starred_url":"https://api.github.com/users/ubclaunchpad/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ubclaunchpad/subscriptions","organizations_url":"https://api.github.com/users/ubclaunchpad/orgs","repos_url":"https://api.github.com/users/ubclaunchpad/repos","events_url":"https://api.github.com/users/ubclaunchpad/events{/privacy}","received_events_url":"https://api.github.com/users/ubclaunchpad/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/ubclaunchpad/RocketCast","description":null,"fork":false,"url":"https://api.github.com/repos/ubclaunchpad/RocketCast","forks_url":"https://api.github.com/repos/ubclaunchpad/RocketCast/forks","keys_url":"https://api.github.com/repos/ubclaunchpad/RocketCast/keys{/key_id}","collaborators_url":"https://api.github.com/repos/ubclaunchpad/RocketCast/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/ubclaunchpad/RocketCast/teams","hooks_url":"https://api.github.com/repos/ubclaunchpad/RocketCast/hooks","issue_events_url":"https://api.github.com/repos/ubclaunchpad/RocketCast/issues/events{/number}","events_url":"https://api.github.com/repos/ubclaunchpad/RocketCast/events","assignees_url":"https://api.github.com/repos/ubclaunchpad/RocketCast/assignees{/user}","branches_url":"https://api.github.com/repos/ubclaunchpad/RocketCast/branches{/branch}","tags_url":"https://api.github.com/repos/ubclaunchpad/RocketCast/tags","blobs_url":"https://api.github.com/repos/ubclaunchpad/RocketCast/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/ubclaunchpad/RocketCast/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/ubclaunchpad/RocketCast/git/refs{/sha}","trees_url":"https://api.github.com/repos/ubclaunchpad/RocketCast/git/trees{/sha}","statuses_url":"https://api.github.com/repos/ubclaunchpad/RocketCast/statuses/{sha}","languages_url":"https://api.github.com/repos/ubclaunchpad/RocketCast/languages","stargazers_url":"https://api.github.com/repos/ubclaunchpad/RocketCast/stargazers","contributors_url":"https://api.github.com/repos/ubclaunchpad/RocketCast/contributors","subscribers_url":"https://api.github.com/repos/ubclaunchpad/RocketCast/subscribers","subscription_url":"https://api.github.com/repos/ubclaunchpad/RocketCast/subscription","commits_url":"https://api.github.com/repos/ubclaunchpad/RocketCast/commits{/sha}","git_commits_url":"https://api.github.com/repos/ubclaunchpad/RocketCast/git/commits{/sha}","comments_url":"https://api.github.com/repos/ubclaunchpad/RocketCast/comments{/number}","issue_comment_url":"https://api.github.com/repos/ubclaunchpad/RocketCast/issues/comments{/number}","contents_url":"https://api.github.com/repos/ubclaunchpad/RocketCast/contents/{+path}","compare_url":"https://api.github.com/repos/ubclaunchpad/RocketCast/compare/{base}...{head}","merges_url":"https://api.github.com/repos/ubclaunchpad/RocketCast/merges","archive_url":"https://api.github.com/repos/ubclaunchpad/RocketCast/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/ubclaunchpad/RocketCast/downloads","issues_url":"https://api.github.com/repos/ubclaunchpad/RocketCast/issues{/number}","pulls_url":"https://api.github.com/repos/ubclaunchpad/RocketCast/pulls{/number}","milestones_url":"https://api.github.com/repos/ubclaunchpad/RocketCast/milestones{/number}","notifications_url":"https://api.github.com/repos/ubclaunchpad/RocketCast/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/ubclaunchpad/RocketCast/labels{/name}","releases_url":"https://api.github.com/repos/ubclaunchpad/RocketCast/releases{/id}","deployments_url":"https://api.github.com/repos/ubclaunchpad/RocketCast/deployments","created_at":"2016-08-27T20:57:03Z","updated_at":"2016-09-04T22:02:56Z","pushed_at":"2016-09-10T23:15:34Z","git_url":"git://github.com/ubclaunchpad/RocketCast.git","ssh_url":"git@github.com:ubclaunchpad/RocketCast.git","clone_url":"https://github.com/ubclaunchpad/RocketCast.git","svn_url":"https://github.com/ubclaunchpad/RocketCast","homepage":null,"size":69,"stargazers_count":0,"watchers_count":0,"language":"Swift","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":1,"forks":0,"open_issues":1,"watchers":0,"default_branch":"master"}},"base":{"label":"ubclaunchpad:dev","ref":"dev","sha":"3cab3deba9037a60b7b4e626a019979c4c88585a","user":{"login":"ubclaunchpad","id":12406312,"avatar_url":"https://avatars.githubusercontent.com/u/12406312?v=3","gravatar_id":"","url":"https://api.github.com/users/ubclaunchpad","html_url":"https://github.com/ubclaunchpad","followers_url":"https://api.github.com/users/ubclaunchpad/followers","following_url":"https://api.github.com/users/ubclaunchpad/following{/other_user}","gists_url":"https://api.github.com/users/ubclaunchpad/gists{/gist_id}","starred_url":"https://api.github.com/users/ubclaunchpad/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ubclaunchpad/subscriptions","organizations_url":"https://api.github.com/users/ubclaunchpad/orgs","repos_url":"https://api.github.com/users/ubclaunchpad/repos","events_url":"https://api.github.com/users/ubclaunchpad/events{/privacy}","received_events_url":"https://api.github.com/users/ubclaunchpad/received_events","type":"Organization","site_admin":false},"repo":{"id":66735196,"name":"RocketCast","full_name":"ubclaunchpad/RocketCast","owner":{"login":"ubclaunchpad","id":12406312,"avatar_url":"https://avatars.githubusercontent.com/u/12406312?v=3","gravatar_id":"","url":"https://api.github.com/users/ubclaunchpad","html_url":"https://github.com/ubclaunchpad","followers_url":"https://api.github.com/users/ubclaunchpad/followers","following_url":"https://api.github.com/users/ubclaunchpad/following{/other_user}","gists_url":"https://api.github.com/users/ubclaunchpad/gists{/gist_id}","starred_url":"https://api.github.com/users/ubclaunchpad/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ubclaunchpad/subscriptions","organizations_url":"https://api.github.com/users/ubclaunchpad/orgs","repos_url":"https://api.github.com/users/ubclaunchpad/repos","events_url":"https://api.github.com/users/ubclaunchpad/events{/privacy}","received_events_url":"https://api.github.com/users/ubclaunchpad/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/ubclaunchpad/RocketCast","description":null,"fork":false,"url":"https://api.github.com/repos/ubclaunchpad/RocketCast","forks_url":"https://api.github.com/repos/ubclaunchpad/RocketCast/forks","keys_url":"https://api.github.com/repos/ubclaunchpad/RocketCast/keys{/key_id}","collaborators_url":"https://api.github.com/repos/ubclaunchpad/RocketCast/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/ubclaunchpad/RocketCast/teams","hooks_url":"https://api.github.com/repos/ubclaunchpad/RocketCast/hooks","issue_events_url":"https://api.github.com/repos/ubclaunchpad/RocketCast/issues/events{/number}","events_url":"https://api.github.com/repos/ubclaunchpad/RocketCast/events","assignees_url":"https://api.github.com/repos/ubclaunchpad/RocketCast/assignees{/user}","branches_url":"https://api.github.com/repos/ubclaunchpad/RocketCast/branches{/branch}","tags_url":"https://api.github.com/repos/ubclaunchpad/RocketCast/tags","blobs_url":"https://api.github.com/repos/ubclaunchpad/RocketCast/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/ubclaunchpad/RocketCast/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/ubclaunchpad/RocketCast/git/refs{/sha}","trees_url":"https://api.github.com/repos/ubclaunchpad/RocketCast/git/trees{/sha}","statuses_url":"https://api.github.com/repos/ubclaunchpad/RocketCast/statuses/{sha}","languages_url":"https://api.github.com/repos/ubclaunchpad/RocketCast/languages","stargazers_url":"https://api.github.com/repos/ubclaunchpad/RocketCast/stargazers","contributors_url":"https://api.github.com/repos/ubclaunchpad/RocketCast/contributors","subscribers_url":"https://api.github.com/repos/ubclaunchpad/RocketCast/subscribers","subscription_url":"https://api.github.com/repos/ubclaunchpad/RocketCast/subscription","commits_url":"https://api.github.com/repos/ubclaunchpad/RocketCast/commits{/sha}","git_commits_url":"https://api.github.com/repos/ubclaunchpad/RocketCast/git/commits{/sha}","comments_url":"https://api.github.com/repos/ubclaunchpad/RocketCast/comments{/number}","issue_comment_url":"https://api.github.com/repos/ubclaunchpad/RocketCast/issues/comments{/number}","contents_url":"https://api.github.com/repos/ubclaunchpad/RocketCast/contents/{+path}","compare_url":"https://api.github.com/repos/ubclaunchpad/RocketCast/compare/{base}...{head}","merges_url":"https://api.github.com/repos/ubclaunchpad/RocketCast/merges","archive_url":"https://api.github.com/repos/ubclaunchpad/RocketCast/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/ubclaunchpad/RocketCast/downloads","issues_url":"https://api.github.com/repos/ubclaunchpad/RocketCast/issues{/number}","pulls_url":"https://api.github.com/repos/ubclaunchpad/RocketCast/pulls{/number}","milestones_url":"https://api.github.com/repos/ubclaunchpad/RocketCast/milestones{/number}","notifications_url":"https://api.github.com/repos/ubclaunchpad/RocketCast/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/ubclaunchpad/RocketCast/labels{/name}","releases_url":"https://api.github.com/repos/ubclaunchpad/RocketCast/releases{/id}","deployments_url":"https://api.github.com/repos/ubclaunchpad/RocketCast/deployments","created_at":"2016-08-27T20:57:03Z","updated_at":"2016-09-04T22:02:56Z","pushed_at":"2016-09-10T23:15:34Z","git_url":"git://github.com/ubclaunchpad/RocketCast.git","ssh_url":"git@github.com:ubclaunchpad/RocketCast.git","clone_url":"https://github.com/ubclaunchpad/RocketCast.git","svn_url":"https://github.com/ubclaunchpad/RocketCast","homepage":null,"size":69,"stargazers_count":0,"watchers_count":0,"language":"Swift","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":1,"forks":0,"open_issues":1,"watchers":0,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/ubclaunchpad/RocketCast/pulls/19"},"html":{"href":"https://github.com/ubclaunchpad/RocketCast/pull/19"},"issue":{"href":"https://api.github.com/repos/ubclaunchpad/RocketCast/issues/19"},"comments":{"href":"https://api.github.com/repos/ubclaunchpad/RocketCast/issues/19/comments"},"review_comments":{"href":"https://api.github.com/repos/ubclaunchpad/RocketCast/pulls/19/comments"},"review_comment":{"href":"https://api.github.com/repos/ubclaunchpad/RocketCast/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/ubclaunchpad/RocketCast/pulls/19/commits"},"statuses":{"href":"https://api.github.com/repos/ubclaunchpad/RocketCast/statuses/539e806f228efc9910981a2238a24fac9a1d34e5"}}}}
{"actor":{"display_login":"miltonleung"}}