{"action":"created","issue":{"url":"https://api.github.com/repos/clinton-hall/GetScripts/issues/3","labels_url":"https://api.github.com/repos/clinton-hall/GetScripts/issues/3/labels{/name}","comments_url":"https://api.github.com/repos/clinton-hall/GetScripts/issues/3/comments","events_url":"https://api.github.com/repos/clinton-hall/GetScripts/issues/3/events","html_url":"https://github.com/clinton-hall/GetScripts/issues/3","id":57314297,"number":3,"title":"SafeRename.py: quoted spaces in mv command","user":{"login":"sanderjo","id":1273502,"avatar_url":"https://avatars.githubusercontent.com/u/1273502?v=3","gravatar_id":"","url":"https://api.github.com/users/sanderjo","html_url":"https://github.com/sanderjo","followers_url":"https://api.github.com/users/sanderjo/followers","following_url":"https://api.github.com/users/sanderjo/following{/other_user}","gists_url":"https://api.github.com/users/sanderjo/gists{/gist_id}","starred_url":"https://api.github.com/users/sanderjo/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/sanderjo/subscriptions","organizations_url":"https://api.github.com/users/sanderjo/orgs","repos_url":"https://api.github.com/users/sanderjo/repos","events_url":"https://api.github.com/users/sanderjo/events{/privacy}","received_events_url":"https://api.github.com/users/sanderjo/received_events","type":"User","site_admin":false},"labels":[],"state":"closed","locked":false,"assignee":null,"milestone":null,"comments":4,"created_at":"2015-02-11T13:17:33Z","updated_at":"2015-05-24T11:55:41Z","closed_at":"2015-05-24T11:55:41Z","body":"IMHO it seems lines like\r\n```\r\nmv    02.01.2015.9 \"[blabla] - 2010-12-07 - bla & bla - bla & bla 2/061.jpg\"\r\n```\r\nare not handled correctly by\r\n```\r\ncmd = filter(None, re.split('(?:mv|Move)\\s+(\\S+)\\s+(\\S+)',line))\r\n```\r\nas double quotes are ignored. I used shlex to solve that.\r\n\r\nProof-of-concept script:\r\n\r\n```\r\nimport re\r\nimport shlex\r\n\r\nline = 'mv    02.01.2015.36 \"[ZEMANI] - 2010-12-07 - bla & bla - bla & bla 2/032.jpg\"'\r\nprint line\r\n\r\n\r\ncmd = filter(None, re.split('(?:mv|Move)\\s+(\\S+)\\s+(\\S+)',line))\r\nprint cmd\r\n\r\nif re.search('^(mv|Move)', line, re.IGNORECASE):\r\n    cmd = shlex.split(line)[1:]\r\n    print cmd\r\n```\r\nResult:\r\n```\r\n$ python kul-splitter.py \r\nmv    02.01.2015.36 \"[ZEMANI] - 2010-12-07 - bla & bla - bla & bla 2/032.jpg\"\r\n['02.01.2015.36', '\"[ZEMANI]', ' - 2010-12-07 - bla & bla - bla & bla 2/032.jpg\"']\r\n['02.01.2015.36', '[ZEMANI] - 2010-12-07 - bla & bla - bla & bla 2/032.jpg']\r\n\r\n```\r\n\r\nCode change in SafeRename.py\r\n```\r\n            # cmd = filter(None, re.split('(?:mv|Move)\\s+(\\S+)\\s+(\\S+)',line))\r\n            if re.search('^(mv|Move)', line, re.IGNORECASE):\r\n                cmd = shlex.split(line)[1:]\r\n                print cmd\r\n            else:\r\n                continue\r\n\r\n```\r\nI'll NOT send a github pull request; I'm not using your code in NZBget, so I find it a bit dangerous to change it without testing it in NZBget itselft.\r\n\r\n\r\n"},"comment":{"url":"https://api.github.com/repos/clinton-hall/GetScripts/issues/comments/105006596","html_url":"https://github.com/clinton-hall/GetScripts/issues/3#issuecomment-105006596","issue_url":"https://api.github.com/repos/clinton-hall/GetScripts/issues/3","id":105006596,"user":{"login":"clinton-hall","id":1888006,"avatar_url":"https://avatars.githubusercontent.com/u/1888006?v=3","gravatar_id":"","url":"https://api.github.com/users/clinton-hall","html_url":"https://github.com/clinton-hall","followers_url":"https://api.github.com/users/clinton-hall/followers","following_url":"https://api.github.com/users/clinton-hall/following{/other_user}","gists_url":"https://api.github.com/users/clinton-hall/gists{/gist_id}","starred_url":"https://api.github.com/users/clinton-hall/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/clinton-hall/subscriptions","organizations_url":"https://api.github.com/users/clinton-hall/orgs","repos_url":"https://api.github.com/users/clinton-hall/repos","events_url":"https://api.github.com/users/clinton-hall/events{/privacy}","received_events_url":"https://api.github.com/users/clinton-hall/received_events","type":"User","site_admin":false},"created_at":"2015-05-24T11:55:41Z","updated_at":"2015-05-24T11:55:41Z","body":"I believe this has all been implemented. Closing."}}