{"action":"created","comment":{"url":"https://api.github.com/repos/lbryio/lbry/pulls/comments/122773438","pull_request_review_id":44917399,"id":122773438,"diff_hunk":"@@ -1,21 +1,13 @@\n import json\n import logging.handlers\n-import sys\n import os\n \n-from appdirs import user_data_dir\n from twisted.internet.task import LoopingCall\n from twisted.internet import reactor\n+from lbrynet import conf\n \n \n-if sys.platform != \"darwin\":\n-    log_dir = os.path.join(os.path.expanduser(\"~\"), \".lbrynet\")\n-else:\n-    log_dir = user_data_dir(\"LBRY\")\n-\n-if not os.path.isdir(log_dir):\n-    os.mkdir(log_dir)\n-\n+log_dir = conf.settings['data_dir']","path":"lbrynet/lbrynet_daemon/daemon_scripts/Autofetcher.py","position":20,"original_position":20,"commit_id":"ddde036e3a073fc49d4e9b4b5838f8c18d7f532b","original_commit_id":"ddde036e3a073fc49d4e9b4b5838f8c18d7f532b","user":{"login":"lyoshenka","id":362784,"avatar_url":"https://avatars3.githubusercontent.com/u/362784?v=3","gravatar_id":"","url":"https://api.github.com/users/lyoshenka","html_url":"https://github.com/lyoshenka","followers_url":"https://api.github.com/users/lyoshenka/followers","following_url":"https://api.github.com/users/lyoshenka/following{/other_user}","gists_url":"https://api.github.com/users/lyoshenka/gists{/gist_id}","starred_url":"https://api.github.com/users/lyoshenka/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/lyoshenka/subscriptions","organizations_url":"https://api.github.com/users/lyoshenka/orgs","repos_url":"https://api.github.com/users/lyoshenka/repos","events_url":"https://api.github.com/users/lyoshenka/events{/privacy}","received_events_url":"https://api.github.com/users/lyoshenka/received_events","type":"User","site_admin":false},"body":"you have to call `conf.initialize_settings()` before using conf settings","created_at":"2017-06-19T17:36:18Z","updated_at":"2017-06-19T17:37:03Z","html_url":"https://github.com/lbryio/lbry/pull/705#discussion_r122773438","pull_request_url":"https://api.github.com/repos/lbryio/lbry/pulls/705","_links":{"self":{"href":"https://api.github.com/repos/lbryio/lbry/pulls/comments/122773438"},"html":{"href":"https://github.com/lbryio/lbry/pull/705#discussion_r122773438"},"pull_request":{"href":"https://api.github.com/repos/lbryio/lbry/pulls/705"}}},"pull_request":{"url":"https://api.github.com/repos/lbryio/lbry/pulls/705","id":126174877,"html_url":"https://github.com/lbryio/lbry/pull/705","diff_url":"https://github.com/lbryio/lbry/pull/705.diff","patch_url":"https://github.com/lbryio/lbry/pull/705.patch","issue_url":"https://api.github.com/repos/lbryio/lbry/issues/705","number":705,"state":"open","locked":false,"title":"WIP: Fix default directories (fixes #574)","user":{"login":"zestyr","id":9434921,"avatar_url":"https://avatars0.githubusercontent.com/u/9434921?v=3","gravatar_id":"","url":"https://api.github.com/users/zestyr","html_url":"https://github.com/zestyr","followers_url":"https://api.github.com/users/zestyr/followers","following_url":"https://api.github.com/users/zestyr/following{/other_user}","gists_url":"https://api.github.com/users/zestyr/gists{/gist_id}","starred_url":"https://api.github.com/users/zestyr/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/zestyr/subscriptions","organizations_url":"https://api.github.com/users/zestyr/orgs","repos_url":"https://api.github.com/users/zestyr/repos","events_url":"https://api.github.com/users/zestyr/events{/privacy}","received_events_url":"https://api.github.com/users/zestyr/received_events","type":"User","site_admin":false},"body":"When I installed lbry today I noticed it created a `Downloads` folder in my Linux home directory. As I've modified the default [xdg-user-dirs](https://freedesktop.org/wiki/Software/xdg-user-dirs/), I assumed lbry doesn't comply to the freedesktop standards. I checked the source code and found #574, so I wrote a fix.\r\n\r\nMost importantly, this pull request moves the lbry directories out of the home directory, and into where they should be on Linux. \r\n\r\nIn #574 a fix was suggested that included the use of GLib. It works, but it requires you to have that installed, and since `lbry` seemingly only supports python2, I couldn't get it to work. Instead I chose to write a couple lines more and not use a library.\r\n\r\nFor Linux, the new default locations are as follows (using the appdirs library):\r\n```\r\ndefault_data_dir = ~/.local/share/LBRY\r\ndefault_lbryum_dir = ~/.config/LBRY\r\n```\r\nTo determine the correct downloads folder, we first look for `XDG_DOWNLOAD_DIR` in the `user_dirs.dirs` file which most likely exists, as it's created by default on pretty much every Linux distribution as part of the XDG standard. If this fails, the environment variable is checked, and if that's empty we simply default to `~/Downloads`.\r\n\r\nI've also deleted some old seeming redundant code for creating some directories, they even had TODO comments about being duplicates. I did a tiny bit of linting, renamed the `default_downloads_directory` variable for consistency and readability, and a few other minor changes that should make some parts more readable.\r\n\r\nI've tested the changes on two Linux machines, a macOS VM and a Windows machine, everything seems to work just fine.\r\n\r\nI'm fully aware this is sort of a \"breaking\" change, since the folders wouldn't be moved automatically, leaving Linux users with a seemingly blank state after updating. I'd like to hear what you think about that, I'm open to any suggestions.\r\n\r\nLBRY is an amazing project and this is likely not the last pull request you'll see from me, keep up the good work!","created_at":"2017-06-18T02:46:14Z","updated_at":"2017-06-19T17:37:03Z","closed_at":null,"merged_at":null,"merge_commit_sha":"2d8d010609e6d62aac9c61640a1f226c37f96eb8","assignee":null,"assignees":[],"requested_reviewers":[],"milestone":null,"commits_url":"https://api.github.com/repos/lbryio/lbry/pulls/705/commits","review_comments_url":"https://api.github.com/repos/lbryio/lbry/pulls/705/comments","review_comment_url":"https://api.github.com/repos/lbryio/lbry/pulls/comments{/number}","comments_url":"https://api.github.com/repos/lbryio/lbry/issues/705/comments","statuses_url":"https://api.github.com/repos/lbryio/lbry/statuses/ddde036e3a073fc49d4e9b4b5838f8c18d7f532b","head":{"label":"zestyr:master","ref":"master","sha":"ddde036e3a073fc49d4e9b4b5838f8c18d7f532b","user":{"login":"zestyr","id":9434921,"avatar_url":"https://avatars0.githubusercontent.com/u/9434921?v=3","gravatar_id":"","url":"https://api.github.com/users/zestyr","html_url":"https://github.com/zestyr","followers_url":"https://api.github.com/users/zestyr/followers","following_url":"https://api.github.com/users/zestyr/following{/other_user}","gists_url":"https://api.github.com/users/zestyr/gists{/gist_id}","starred_url":"https://api.github.com/users/zestyr/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/zestyr/subscriptions","organizations_url":"https://api.github.com/users/zestyr/orgs","repos_url":"https://api.github.com/users/zestyr/repos","events_url":"https://api.github.com/users/zestyr/events{/privacy}","received_events_url":"https://api.github.com/users/zestyr/received_events","type":"User","site_admin":false},"repo":{"id":94652853,"name":"lbry","full_name":"zestyr/lbry","owner":{"login":"zestyr","id":9434921,"avatar_url":"https://avatars0.githubusercontent.com/u/9434921?v=3","gravatar_id":"","url":"https://api.github.com/users/zestyr","html_url":"https://github.com/zestyr","followers_url":"https://api.github.com/users/zestyr/followers","following_url":"https://api.github.com/users/zestyr/following{/other_user}","gists_url":"https://api.github.com/users/zestyr/gists{/gist_id}","starred_url":"https://api.github.com/users/zestyr/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/zestyr/subscriptions","organizations_url":"https://api.github.com/users/zestyr/orgs","repos_url":"https://api.github.com/users/zestyr/repos","events_url":"https://api.github.com/users/zestyr/events{/privacy}","received_events_url":"https://api.github.com/users/zestyr/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/zestyr/lbry","description":"A fully decentralized network for distributing data","fork":true,"url":"https://api.github.com/repos/zestyr/lbry","forks_url":"https://api.github.com/repos/zestyr/lbry/forks","keys_url":"https://api.github.com/repos/zestyr/lbry/keys{/key_id}","collaborators_url":"https://api.github.com/repos/zestyr/lbry/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/zestyr/lbry/teams","hooks_url":"https://api.github.com/repos/zestyr/lbry/hooks","issue_events_url":"https://api.github.com/repos/zestyr/lbry/issues/events{/number}","events_url":"https://api.github.com/repos/zestyr/lbry/events","assignees_url":"https://api.github.com/repos/zestyr/lbry/assignees{/user}","branches_url":"https://api.github.com/repos/zestyr/lbry/branches{/branch}","tags_url":"https://api.github.com/repos/zestyr/lbry/tags","blobs_url":"https://api.github.com/repos/zestyr/lbry/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/zestyr/lbry/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/zestyr/lbry/git/refs{/sha}","trees_url":"https://api.github.com/repos/zestyr/lbry/git/trees{/sha}","statuses_url":"https://api.github.com/repos/zestyr/lbry/statuses/{sha}","languages_url":"https://api.github.com/repos/zestyr/lbry/languages","stargazers_url":"https://api.github.com/repos/zestyr/lbry/stargazers","contributors_url":"https://api.github.com/repos/zestyr/lbry/contributors","subscribers_url":"https://api.github.com/repos/zestyr/lbry/subscribers","subscription_url":"https://api.github.com/repos/zestyr/lbry/subscription","commits_url":"https://api.github.com/repos/zestyr/lbry/commits{/sha}","git_commits_url":"https://api.github.com/repos/zestyr/lbry/git/commits{/sha}","comments_url":"https://api.github.com/repos/zestyr/lbry/comments{/number}","issue_comment_url":"https://api.github.com/repos/zestyr/lbry/issues/comments{/number}","contents_url":"https://api.github.com/repos/zestyr/lbry/contents/{+path}","compare_url":"https://api.github.com/repos/zestyr/lbry/compare/{base}...{head}","merges_url":"https://api.github.com/repos/zestyr/lbry/merges","archive_url":"https://api.github.com/repos/zestyr/lbry/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/zestyr/lbry/downloads","issues_url":"https://api.github.com/repos/zestyr/lbry/issues{/number}","pulls_url":"https://api.github.com/repos/zestyr/lbry/pulls{/number}","milestones_url":"https://api.github.com/repos/zestyr/lbry/milestones{/number}","notifications_url":"https://api.github.com/repos/zestyr/lbry/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/zestyr/lbry/labels{/name}","releases_url":"https://api.github.com/repos/zestyr/lbry/releases{/id}","deployments_url":"https://api.github.com/repos/zestyr/lbry/deployments","created_at":"2017-06-17T22:39:14Z","updated_at":"2017-06-17T22:39:17Z","pushed_at":"2017-06-19T17:24:47Z","git_url":"git://github.com/zestyr/lbry.git","ssh_url":"git@github.com:zestyr/lbry.git","clone_url":"https://github.com/zestyr/lbry.git","svn_url":"https://github.com/zestyr/lbry","homepage":"https://lbry.io","size":5474,"stargazers_count":0,"watchers_count":0,"language":"Python","has_issues":false,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":0,"mirror_url":null,"open_issues_count":0,"forks":0,"open_issues":0,"watchers":0,"default_branch":"master"}},"base":{"label":"lbryio:master","ref":"master","sha":"2dab24ea14e3eacd4c79103761cc38dc48588dd5","user":{"login":"lbryio","id":13889222,"avatar_url":"https://avatars0.githubusercontent.com/u/13889222?v=3","gravatar_id":"","url":"https://api.github.com/users/lbryio","html_url":"https://github.com/lbryio","followers_url":"https://api.github.com/users/lbryio/followers","following_url":"https://api.github.com/users/lbryio/following{/other_user}","gists_url":"https://api.github.com/users/lbryio/gists{/gist_id}","starred_url":"https://api.github.com/users/lbryio/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/lbryio/subscriptions","organizations_url":"https://api.github.com/users/lbryio/orgs","repos_url":"https://api.github.com/users/lbryio/repos","events_url":"https://api.github.com/users/lbryio/events{/privacy}","received_events_url":"https://api.github.com/users/lbryio/received_events","type":"Organization","site_admin":false},"repo":{"id":41103286,"name":"lbry","full_name":"lbryio/lbry","owner":{"login":"lbryio","id":13889222,"avatar_url":"https://avatars0.githubusercontent.com/u/13889222?v=3","gravatar_id":"","url":"https://api.github.com/users/lbryio","html_url":"https://github.com/lbryio","followers_url":"https://api.github.com/users/lbryio/followers","following_url":"https://api.github.com/users/lbryio/following{/other_user}","gists_url":"https://api.github.com/users/lbryio/gists{/gist_id}","starred_url":"https://api.github.com/users/lbryio/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/lbryio/subscriptions","organizations_url":"https://api.github.com/users/lbryio/orgs","repos_url":"https://api.github.com/users/lbryio/repos","events_url":"https://api.github.com/users/lbryio/events{/privacy}","received_events_url":"https://api.github.com/users/lbryio/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/lbryio/lbry","description":"A fully decentralized network for distributing data","fork":false,"url":"https://api.github.com/repos/lbryio/lbry","forks_url":"https://api.github.com/repos/lbryio/lbry/forks","keys_url":"https://api.github.com/repos/lbryio/lbry/keys{/key_id}","collaborators_url":"https://api.github.com/repos/lbryio/lbry/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/lbryio/lbry/teams","hooks_url":"https://api.github.com/repos/lbryio/lbry/hooks","issue_events_url":"https://api.github.com/repos/lbryio/lbry/issues/events{/number}","events_url":"https://api.github.com/repos/lbryio/lbry/events","assignees_url":"https://api.github.com/repos/lbryio/lbry/assignees{/user}","branches_url":"https://api.github.com/repos/lbryio/lbry/branches{/branch}","tags_url":"https://api.github.com/repos/lbryio/lbry/tags","blobs_url":"https://api.github.com/repos/lbryio/lbry/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/lbryio/lbry/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/lbryio/lbry/git/refs{/sha}","trees_url":"https://api.github.com/repos/lbryio/lbry/git/trees{/sha}","statuses_url":"https://api.github.com/repos/lbryio/lbry/statuses/{sha}","languages_url":"https://api.github.com/repos/lbryio/lbry/languages","stargazers_url":"https://api.github.com/repos/lbryio/lbry/stargazers","contributors_url":"https://api.github.com/repos/lbryio/lbry/contributors","subscribers_url":"https://api.github.com/repos/lbryio/lbry/subscribers","subscription_url":"https://api.github.com/repos/lbryio/lbry/subscription","commits_url":"https://api.github.com/repos/lbryio/lbry/commits{/sha}","git_commits_url":"https://api.github.com/repos/lbryio/lbry/git/commits{/sha}","comments_url":"https://api.github.com/repos/lbryio/lbry/comments{/number}","issue_comment_url":"https://api.github.com/repos/lbryio/lbry/issues/comments{/number}","contents_url":"https://api.github.com/repos/lbryio/lbry/contents/{+path}","compare_url":"https://api.github.com/repos/lbryio/lbry/compare/{base}...{head}","merges_url":"https://api.github.com/repos/lbryio/lbry/merges","archive_url":"https://api.github.com/repos/lbryio/lbry/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/lbryio/lbry/downloads","issues_url":"https://api.github.com/repos/lbryio/lbry/issues{/number}","pulls_url":"https://api.github.com/repos/lbryio/lbry/pulls{/number}","milestones_url":"https://api.github.com/repos/lbryio/lbry/milestones{/number}","notifications_url":"https://api.github.com/repos/lbryio/lbry/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/lbryio/lbry/labels{/name}","releases_url":"https://api.github.com/repos/lbryio/lbry/releases{/id}","deployments_url":"https://api.github.com/repos/lbryio/lbry/deployments","created_at":"2015-08-20T15:24:10Z","updated_at":"2017-06-19T08:41:02Z","pushed_at":"2017-06-19T17:24:49Z","git_url":"git://github.com/lbryio/lbry.git","ssh_url":"git@github.com:lbryio/lbry.git","clone_url":"https://github.com/lbryio/lbry.git","svn_url":"https://github.com/lbryio/lbry","homepage":"https://lbry.io","size":5441,"stargazers_count":3226,"watchers_count":3226,"language":"Python","has_issues":true,"has_projects":true,"has_downloads":true,"has_wiki":true,"has_pages":true,"forks_count":111,"mirror_url":null,"open_issues_count":64,"forks":111,"open_issues":64,"watchers":3226,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/lbryio/lbry/pulls/705"},"html":{"href":"https://github.com/lbryio/lbry/pull/705"},"issue":{"href":"https://api.github.com/repos/lbryio/lbry/issues/705"},"comments":{"href":"https://api.github.com/repos/lbryio/lbry/issues/705/comments"},"review_comments":{"href":"https://api.github.com/repos/lbryio/lbry/pulls/705/comments"},"review_comment":{"href":"https://api.github.com/repos/lbryio/lbry/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/lbryio/lbry/pulls/705/commits"},"statuses":{"href":"https://api.github.com/repos/lbryio/lbry/statuses/ddde036e3a073fc49d4e9b4b5838f8c18d7f532b"}}}}
{"actor":{"display_login":"lyoshenka"}}