{"action":"created","comment":{"url":"https://api.github.com/repos/metabrainz/picard-plugins/pulls/comments/55505561","id":55505561,"diff_hunk":"@@ -0,0 +1,71 @@\n+\"\"\"\n+Get genre, performed date and (soon) vocalists and instrumentalists from tango.info\n+Uses web scraping since opendata is disabled for now\n+\"\"\"\n+\n+PLUGIN_NAME = 'ix5 tango.info'\n+PLUGIN_AUTHOR = 'ix5'\n+PLUGIN_DESCRIPTION = 'change <em>genre</em> and <em>year</em> fields'\n+PLUGIN_VERSION = '0.1'\n+PLUGIN_API_VERSIONS = [\"0.9.0\", \"0.12\", \"1.0.0\"]\n+\n+from picard import log\n+from picard.metadata import register_track_metadata_processor\n+import re,os\n+\n+from bs4 import BeautifulSoup\n+import urllib2\n+\n+scraped_data = {}\n+\n+def scrape_page(barcode):\n+    url = (\"https://tango.info/0\" + str(barcode))\n+    page = urllib2.urlopen(url).read()\n+    soup = BeautifulSoup(page, \"lxml\")\n+    table = soup.findAll(\"table\")[3]\n+    x = (len(table.findAll('tr')) -1)\n+\n+\n+    for row in table.findAll('tr')[1:]:\n+        col = row.findAll('td')\n+        genre = col[3].getText().capitalize()\n+        perf_date = col[6].getText()\n+        # checks\n+        info = col[-1].find('a').get('href').split('/')[1] # get TINT\n+        #track_tint = \"0\" + str(int(metadata[\"barcode\"])) + \"-\" + str(mydiscnumber) + \"-\" + metadata[\"tracknumber\"]\n+        scraped_data[info] = {\"genre\": genre, \"year\": perf_date}\n+        #: Data expected to be in this format:\n+        # [\"Side\", \"Tracknr\", \"Title\", \"Genre\", \"Instrumentalists\", \"Vocalists\", \"Perf Date\", \"Duration\", \"Info\"]\n+\n+_discnumber_re = re.compile(r\"\\s+\\(disc (\\d+)(?::\\s+([^)]+))?\\)\")\n+\n+def get_discnumber(metadata):\n+    retval = 1\n+    if (is_integer(metadata[\"discnumber\"])):","path":"plugins/picard-tangoinfo/tangoinfo.py","position":44,"original_position":44,"commit_id":"3dadf88c680cfa70d4767f50a5d255eff6dea60f","original_commit_id":"3dadf88c680cfa70d4767f50a5d255eff6dea60f","user":{"login":"zas","id":151042,"avatar_url":"https://avatars.githubusercontent.com/u/151042?v=3","gravatar_id":"","url":"https://api.github.com/users/zas","html_url":"https://github.com/zas","followers_url":"https://api.github.com/users/zas/followers","following_url":"https://api.github.com/users/zas/following{/other_user}","gists_url":"https://api.github.com/users/zas/gists{/gist_id}","starred_url":"https://api.github.com/users/zas/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/zas/subscriptions","organizations_url":"https://api.github.com/users/zas/orgs","repos_url":"https://api.github.com/users/zas/repos","events_url":"https://api.github.com/users/zas/events{/privacy}","received_events_url":"https://api.github.com/users/zas/received_events","type":"User","site_admin":false},"body":"Useless outer parenthesis","created_at":"2016-03-09T11:30:28Z","updated_at":"2016-03-09T11:30:28Z","html_url":"https://github.com/metabrainz/picard-plugins/pull/49#discussion_r55505561","pull_request_url":"https://api.github.com/repos/metabrainz/picard-plugins/pulls/49","_links":{"self":{"href":"https://api.github.com/repos/metabrainz/picard-plugins/pulls/comments/55505561"},"html":{"href":"https://github.com/metabrainz/picard-plugins/pull/49#discussion_r55505561"},"pull_request":{"href":"https://api.github.com/repos/metabrainz/picard-plugins/pulls/49"}}},"pull_request":{"url":"https://api.github.com/repos/metabrainz/picard-plugins/pulls/49","id":62037964,"html_url":"https://github.com/metabrainz/picard-plugins/pull/49","diff_url":"https://github.com/metabrainz/picard-plugins/pull/49.diff","patch_url":"https://github.com/metabrainz/picard-plugins/pull/49.patch","issue_url":"https://api.github.com/repos/metabrainz/picard-plugins/issues/49","number":49,"state":"open","locked":false,"title":"Added picard-tangoinfo plugin","user":{"login":"ix5","id":10212877,"avatar_url":"https://avatars.githubusercontent.com/u/10212877?v=3","gravatar_id":"","url":"https://api.github.com/users/ix5","html_url":"https://github.com/ix5","followers_url":"https://api.github.com/users/ix5/followers","following_url":"https://api.github.com/users/ix5/following{/other_user}","gists_url":"https://api.github.com/users/ix5/gists{/gist_id}","starred_url":"https://api.github.com/users/ix5/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ix5/subscriptions","organizations_url":"https://api.github.com/users/ix5/orgs","repos_url":"https://api.github.com/users/ix5/repos","events_url":"https://api.github.com/users/ix5/events{/privacy}","received_events_url":"https://api.github.com/users/ix5/received_events","type":"User","site_admin":false},"body":"Hey Picard devs,\r\n\r\nwe tango folks really like MusicBrainz. But sometimes, it does not have enough information on the really old recordings. And in tango music, there is usually little doubt about the genre. And most importantly, we do not really care about the release date of a compilation of old songs, we *have* to know the original release date(30s, 40s, 50s are all very different eras to us).\r\nSo that is why tagging tango music involves \"cleaning up\" with Picard, and then tagging genre, release date and the singers manually by cross-referencing tango.info or other sites.\r\n\r\nI have written this plugin to ease that process in Picard. It ain't pretty, as it scrapes the website and only works of MusicBrainz provides a barcode, but I believe it will help many tango DJs organize their collections better and save a lot of time.\r\n\r\nLet me know if there is a problem with approving plugins that utilize scraping(tango.info has shut down their opendata initiative, sadly) or if the code could be improved. There seems to be very little information on the plugin API; this is my best shot.\r\nI can confirm the plugin works on Ubuntu 15.10 with Picard version 1.3.2 from the repositories.","created_at":"2016-03-08T08:15:21Z","updated_at":"2016-03-09T11:30:28Z","closed_at":null,"merged_at":null,"merge_commit_sha":"a3072c82639fc8e698576929e73e3c3715a0a5ed","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/metabrainz/picard-plugins/pulls/49/commits","review_comments_url":"https://api.github.com/repos/metabrainz/picard-plugins/pulls/49/comments","review_comment_url":"https://api.github.com/repos/metabrainz/picard-plugins/pulls/comments{/number}","comments_url":"https://api.github.com/repos/metabrainz/picard-plugins/issues/49/comments","statuses_url":"https://api.github.com/repos/metabrainz/picard-plugins/statuses/3dadf88c680cfa70d4767f50a5d255eff6dea60f","head":{"label":"ix5:master","ref":"master","sha":"3dadf88c680cfa70d4767f50a5d255eff6dea60f","user":{"login":"ix5","id":10212877,"avatar_url":"https://avatars.githubusercontent.com/u/10212877?v=3","gravatar_id":"","url":"https://api.github.com/users/ix5","html_url":"https://github.com/ix5","followers_url":"https://api.github.com/users/ix5/followers","following_url":"https://api.github.com/users/ix5/following{/other_user}","gists_url":"https://api.github.com/users/ix5/gists{/gist_id}","starred_url":"https://api.github.com/users/ix5/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ix5/subscriptions","organizations_url":"https://api.github.com/users/ix5/orgs","repos_url":"https://api.github.com/users/ix5/repos","events_url":"https://api.github.com/users/ix5/events{/privacy}","received_events_url":"https://api.github.com/users/ix5/received_events","type":"User","site_admin":false},"repo":{"id":53393872,"name":"picard-plugins","full_name":"ix5/picard-plugins","owner":{"login":"ix5","id":10212877,"avatar_url":"https://avatars.githubusercontent.com/u/10212877?v=3","gravatar_id":"","url":"https://api.github.com/users/ix5","html_url":"https://github.com/ix5","followers_url":"https://api.github.com/users/ix5/followers","following_url":"https://api.github.com/users/ix5/following{/other_user}","gists_url":"https://api.github.com/users/ix5/gists{/gist_id}","starred_url":"https://api.github.com/users/ix5/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/ix5/subscriptions","organizations_url":"https://api.github.com/users/ix5/orgs","repos_url":"https://api.github.com/users/ix5/repos","events_url":"https://api.github.com/users/ix5/events{/privacy}","received_events_url":"https://api.github.com/users/ix5/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/ix5/picard-plugins","description":"","fork":true,"url":"https://api.github.com/repos/ix5/picard-plugins","forks_url":"https://api.github.com/repos/ix5/picard-plugins/forks","keys_url":"https://api.github.com/repos/ix5/picard-plugins/keys{/key_id}","collaborators_url":"https://api.github.com/repos/ix5/picard-plugins/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/ix5/picard-plugins/teams","hooks_url":"https://api.github.com/repos/ix5/picard-plugins/hooks","issue_events_url":"https://api.github.com/repos/ix5/picard-plugins/issues/events{/number}","events_url":"https://api.github.com/repos/ix5/picard-plugins/events","assignees_url":"https://api.github.com/repos/ix5/picard-plugins/assignees{/user}","branches_url":"https://api.github.com/repos/ix5/picard-plugins/branches{/branch}","tags_url":"https://api.github.com/repos/ix5/picard-plugins/tags","blobs_url":"https://api.github.com/repos/ix5/picard-plugins/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/ix5/picard-plugins/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/ix5/picard-plugins/git/refs{/sha}","trees_url":"https://api.github.com/repos/ix5/picard-plugins/git/trees{/sha}","statuses_url":"https://api.github.com/repos/ix5/picard-plugins/statuses/{sha}","languages_url":"https://api.github.com/repos/ix5/picard-plugins/languages","stargazers_url":"https://api.github.com/repos/ix5/picard-plugins/stargazers","contributors_url":"https://api.github.com/repos/ix5/picard-plugins/contributors","subscribers_url":"https://api.github.com/repos/ix5/picard-plugins/subscribers","subscription_url":"https://api.github.com/repos/ix5/picard-plugins/subscription","commits_url":"https://api.github.com/repos/ix5/picard-plugins/commits{/sha}","git_commits_url":"https://api.github.com/repos/ix5/picard-plugins/git/commits{/sha}","comments_url":"https://api.github.com/repos/ix5/picard-plugins/comments{/number}","issue_comment_url":"https://api.github.com/repos/ix5/picard-plugins/issues/comments{/number}","contents_url":"https://api.github.com/repos/ix5/picard-plugins/contents/{+path}","compare_url":"https://api.github.com/repos/ix5/picard-plugins/compare/{base}...{head}","merges_url":"https://api.github.com/repos/ix5/picard-plugins/merges","archive_url":"https://api.github.com/repos/ix5/picard-plugins/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/ix5/picard-plugins/downloads","issues_url":"https://api.github.com/repos/ix5/picard-plugins/issues{/number}","pulls_url":"https://api.github.com/repos/ix5/picard-plugins/pulls{/number}","milestones_url":"https://api.github.com/repos/ix5/picard-plugins/milestones{/number}","notifications_url":"https://api.github.com/repos/ix5/picard-plugins/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/ix5/picard-plugins/labels{/name}","releases_url":"https://api.github.com/repos/ix5/picard-plugins/releases{/id}","deployments_url":"https://api.github.com/repos/ix5/picard-plugins/deployments","created_at":"2016-03-08T08:02:11Z","updated_at":"2016-03-08T08:02:12Z","pushed_at":"2016-03-08T08:06:10Z","git_url":"git://github.com/ix5/picard-plugins.git","ssh_url":"git@github.com:ix5/picard-plugins.git","clone_url":"https://github.com/ix5/picard-plugins.git","svn_url":"https://github.com/ix5/picard-plugins","homepage":null,"size":253,"stargazers_count":0,"watchers_count":0,"language":"Python","has_issues":false,"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":"metabrainz:master","ref":"master","sha":"10f74716b3eea355d322be2f1368eee5a07ffa8e","user":{"login":"metabrainz","id":293421,"avatar_url":"https://avatars.githubusercontent.com/u/293421?v=3","gravatar_id":"","url":"https://api.github.com/users/metabrainz","html_url":"https://github.com/metabrainz","followers_url":"https://api.github.com/users/metabrainz/followers","following_url":"https://api.github.com/users/metabrainz/following{/other_user}","gists_url":"https://api.github.com/users/metabrainz/gists{/gist_id}","starred_url":"https://api.github.com/users/metabrainz/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/metabrainz/subscriptions","organizations_url":"https://api.github.com/users/metabrainz/orgs","repos_url":"https://api.github.com/users/metabrainz/repos","events_url":"https://api.github.com/users/metabrainz/events{/privacy}","received_events_url":"https://api.github.com/users/metabrainz/received_events","type":"Organization","site_admin":false},"repo":{"id":21579007,"name":"picard-plugins","full_name":"metabrainz/picard-plugins","owner":{"login":"metabrainz","id":293421,"avatar_url":"https://avatars.githubusercontent.com/u/293421?v=3","gravatar_id":"","url":"https://api.github.com/users/metabrainz","html_url":"https://github.com/metabrainz","followers_url":"https://api.github.com/users/metabrainz/followers","following_url":"https://api.github.com/users/metabrainz/following{/other_user}","gists_url":"https://api.github.com/users/metabrainz/gists{/gist_id}","starred_url":"https://api.github.com/users/metabrainz/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/metabrainz/subscriptions","organizations_url":"https://api.github.com/users/metabrainz/orgs","repos_url":"https://api.github.com/users/metabrainz/repos","events_url":"https://api.github.com/users/metabrainz/events{/privacy}","received_events_url":"https://api.github.com/users/metabrainz/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/metabrainz/picard-plugins","description":"","fork":false,"url":"https://api.github.com/repos/metabrainz/picard-plugins","forks_url":"https://api.github.com/repos/metabrainz/picard-plugins/forks","keys_url":"https://api.github.com/repos/metabrainz/picard-plugins/keys{/key_id}","collaborators_url":"https://api.github.com/repos/metabrainz/picard-plugins/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/metabrainz/picard-plugins/teams","hooks_url":"https://api.github.com/repos/metabrainz/picard-plugins/hooks","issue_events_url":"https://api.github.com/repos/metabrainz/picard-plugins/issues/events{/number}","events_url":"https://api.github.com/repos/metabrainz/picard-plugins/events","assignees_url":"https://api.github.com/repos/metabrainz/picard-plugins/assignees{/user}","branches_url":"https://api.github.com/repos/metabrainz/picard-plugins/branches{/branch}","tags_url":"https://api.github.com/repos/metabrainz/picard-plugins/tags","blobs_url":"https://api.github.com/repos/metabrainz/picard-plugins/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/metabrainz/picard-plugins/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/metabrainz/picard-plugins/git/refs{/sha}","trees_url":"https://api.github.com/repos/metabrainz/picard-plugins/git/trees{/sha}","statuses_url":"https://api.github.com/repos/metabrainz/picard-plugins/statuses/{sha}","languages_url":"https://api.github.com/repos/metabrainz/picard-plugins/languages","stargazers_url":"https://api.github.com/repos/metabrainz/picard-plugins/stargazers","contributors_url":"https://api.github.com/repos/metabrainz/picard-plugins/contributors","subscribers_url":"https://api.github.com/repos/metabrainz/picard-plugins/subscribers","subscription_url":"https://api.github.com/repos/metabrainz/picard-plugins/subscription","commits_url":"https://api.github.com/repos/metabrainz/picard-plugins/commits{/sha}","git_commits_url":"https://api.github.com/repos/metabrainz/picard-plugins/git/commits{/sha}","comments_url":"https://api.github.com/repos/metabrainz/picard-plugins/comments{/number}","issue_comment_url":"https://api.github.com/repos/metabrainz/picard-plugins/issues/comments{/number}","contents_url":"https://api.github.com/repos/metabrainz/picard-plugins/contents/{+path}","compare_url":"https://api.github.com/repos/metabrainz/picard-plugins/compare/{base}...{head}","merges_url":"https://api.github.com/repos/metabrainz/picard-plugins/merges","archive_url":"https://api.github.com/repos/metabrainz/picard-plugins/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/metabrainz/picard-plugins/downloads","issues_url":"https://api.github.com/repos/metabrainz/picard-plugins/issues{/number}","pulls_url":"https://api.github.com/repos/metabrainz/picard-plugins/pulls{/number}","milestones_url":"https://api.github.com/repos/metabrainz/picard-plugins/milestones{/number}","notifications_url":"https://api.github.com/repos/metabrainz/picard-plugins/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/metabrainz/picard-plugins/labels{/name}","releases_url":"https://api.github.com/repos/metabrainz/picard-plugins/releases{/id}","deployments_url":"https://api.github.com/repos/metabrainz/picard-plugins/deployments","created_at":"2014-07-07T17:02:53Z","updated_at":"2016-03-01T20:33:02Z","pushed_at":"2016-03-08T08:15:23Z","git_url":"git://github.com/metabrainz/picard-plugins.git","ssh_url":"git@github.com:metabrainz/picard-plugins.git","clone_url":"https://github.com/metabrainz/picard-plugins.git","svn_url":"https://github.com/metabrainz/picard-plugins","homepage":null,"size":289,"stargazers_count":29,"watchers_count":29,"language":"Python","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":false,"forks_count":33,"mirror_url":null,"open_issues_count":13,"forks":33,"open_issues":13,"watchers":29,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/metabrainz/picard-plugins/pulls/49"},"html":{"href":"https://github.com/metabrainz/picard-plugins/pull/49"},"issue":{"href":"https://api.github.com/repos/metabrainz/picard-plugins/issues/49"},"comments":{"href":"https://api.github.com/repos/metabrainz/picard-plugins/issues/49/comments"},"review_comments":{"href":"https://api.github.com/repos/metabrainz/picard-plugins/pulls/49/comments"},"review_comment":{"href":"https://api.github.com/repos/metabrainz/picard-plugins/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/metabrainz/picard-plugins/pulls/49/commits"},"statuses":{"href":"https://api.github.com/repos/metabrainz/picard-plugins/statuses/3dadf88c680cfa70d4767f50a5d255eff6dea60f"}}}}