{"action":"created","issue":{"url":"https://api.github.com/repos/The-Compiler/qutebrowser/issues/1199","labels_url":"https://api.github.com/repos/The-Compiler/qutebrowser/issues/1199/labels{/name}","comments_url":"https://api.github.com/repos/The-Compiler/qutebrowser/issues/1199/comments","events_url":"https://api.github.com/repos/The-Compiler/qutebrowser/issues/1199/events","html_url":"https://github.com/The-Compiler/qutebrowser/issues/1199","id":124253089,"number":1199,"title":"userscripts: play_in_mpv wrong url because $QUOTE_URL is overwriten by javascript","user":{"login":"rumpelsepp","id":1961699,"avatar_url":"https://avatars.githubusercontent.com/u/1961699?v=3","gravatar_id":"","url":"https://api.github.com/users/rumpelsepp","html_url":"https://github.com/rumpelsepp","followers_url":"https://api.github.com/users/rumpelsepp/followers","following_url":"https://api.github.com/users/rumpelsepp/following{/other_user}","gists_url":"https://api.github.com/users/rumpelsepp/gists{/gist_id}","starred_url":"https://api.github.com/users/rumpelsepp/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/rumpelsepp/subscriptions","organizations_url":"https://api.github.com/users/rumpelsepp/orgs","repos_url":"https://api.github.com/users/rumpelsepp/repos","events_url":"https://api.github.com/users/rumpelsepp/events{/privacy}","received_events_url":"https://api.github.com/users/rumpelsepp/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":5,"created_at":"2015-12-29T18:54:36Z","updated_at":"2015-12-30T14:49:47Z","closed_at":null,"body":"The issue is about this script: https://github.com/The-Compiler/qutebrowser/blob/master/misc/userscripts/view_in_mpv\r\n\r\n`$QUTE_URL` is overwritten after the javascript is executed and the userscript fails with exit code 2. The fix is very simple and I am to lazy to do the github fork/pull request stuff for this trivial thing; here is a patch which fixes that problem.\r\n\r\n```patch\r\nFrom f441691b50fde0e0ca4669353f09c6e0de51bbc3 Mon Sep 17 00:00:00 2001\r\nFrom: Stefan Tatschner <rumpelsepp@sevenbyte.org>\r\nDate: Tue, 29 Dec 2015 19:50:35 +0100\r\nSubject: [PATCH] misc/userscripts: Do not overwrite $QUTE_URL\r\n\r\nThis patch fixes a problem in a provided userscript. The variable\r\n$QUTE_URL is overwritten *after* executing the javascript code, thus\r\nspawning mpv fails. This patch stores the video url in advance in\r\n$VIDEO_URL to avoid failing painfully.\r\n---\r\n misc/userscripts/view_in_mpv | 7 +++++--\r\n 1 file changed, 5 insertions(+), 2 deletions(-)\r\n\r\ndiff --git a/misc/userscripts/view_in_mpv b/misc/userscripts/view_in_mpv\r\nindex 51aee47..b063b79 100755\r\n--- a/misc/userscripts/view_in_mpv\r\n+++ b/misc/userscripts/view_in_mpv\r\n@@ -49,6 +49,9 @@ MPV_COMMAND=${MPV_COMMAND:-mpv}\r\n # Warning: spaces in single flags are not supported\r\n MPV_FLAGS=${MPV_FLAGS:- --force-window --no-terminal --keep-open=yes --ytdl }\r\n video_command=( \"$MPV_COMMAND\"  $MPV_FLAGS )\r\n+# When the javascript below is executed,$QUTE_URL is overwritten.\r\n+# Let's store the value in a separate variable.\r\n+VIDEO_URL=$QUTE_URL\r\n\r\n js() {\r\n cat <<EOF\r\n@@ -137,5 +140,5 @@ printjs() {\r\n }\r\n echo \"jseval -q $(printjs)\" >> \"$QUTE_FIFO\"\r\n\r\n-msg info \"Opening $QUTE_URL with mpv\"\r\n-\"${video_command[@]}\" \"$QUTE_URL\"\r\n+msg info \"Opening $VIDEO_URL with mpv\"\r\n+\"${video_command[@]}\" \"$VIDEO_URL\"\r\n--\r\n2.6.4\r\n```"},"comment":{"url":"https://api.github.com/repos/The-Compiler/qutebrowser/issues/comments/168013992","html_url":"https://github.com/The-Compiler/qutebrowser/issues/1199#issuecomment-168013992","issue_url":"https://api.github.com/repos/The-Compiler/qutebrowser/issues/1199","id":168013992,"user":{"login":"rumpelsepp","id":1961699,"avatar_url":"https://avatars.githubusercontent.com/u/1961699?v=3","gravatar_id":"","url":"https://api.github.com/users/rumpelsepp","html_url":"https://github.com/rumpelsepp","followers_url":"https://api.github.com/users/rumpelsepp/followers","following_url":"https://api.github.com/users/rumpelsepp/following{/other_user}","gists_url":"https://api.github.com/users/rumpelsepp/gists{/gist_id}","starred_url":"https://api.github.com/users/rumpelsepp/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/rumpelsepp/subscriptions","organizations_url":"https://api.github.com/users/rumpelsepp/orgs","repos_url":"https://api.github.com/users/rumpelsepp/repos","events_url":"https://api.github.com/users/rumpelsepp/events{/privacy}","received_events_url":"https://api.github.com/users/rumpelsepp/received_events","type":"User","site_admin":false},"created_at":"2015-12-30T14:49:47Z","updated_at":"2015-12-30T14:49:47Z","body":"@t-wissmann: Thanks for your explanation! I will have a look at yout link these days, but maybe in 2016 because everybody goes crazy these days and I have not that much time. :-) "}}