$ git clone http://tcclient.ion.nu/tc_client.git
commit 447878fb8800843149204011bc998c74d801b029
Author: Alicia <...>
Date:   Sat Dec 3 21:25:06 2016 +0100

    tc_client-gtk: tweaks for windows compatibility.

diff --git a/ChangeLog b/ChangeLog
index 7c82a54..b024e62 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -16,6 +16,7 @@ tc_client-gtk: added a setting to control /disablesnapshots and /enablesnapshots
 tc_client-gtk: added support for integrated youtube videos.
 tc_client-gtk: compatibility with older versions of libavformat.
 tc_client-gtk: build fixes for windows.
+tc_client-gtk: tweaks for windows compatibility.
 dist/appimage.sh: fix audio in appimages by building ffmpeg with support for nellymoser and speex, and depending on the system's libao and libpulse instead of including it in the appimage.
 libcamera(escapi): handle failure to open camera more gracefully.
 irchack: pass along "<user> cammed up" notifications.
diff --git a/dist/w32.sh b/dist/w32.sh
index 405360a..6a97d7f 100755
--- a/dist/w32.sh
+++ b/dist/w32.sh
@@ -50,6 +50,8 @@ cd "$here"
 make || exit 1
 
 cp *.exe gtkgui.glade "tc_client-${version}-w32/bin"
+(cd "tc_client-${version}-w32/bin"
+wget -c 'http://youtube-dl.org/downloads/latest/youtube-dl.exe')
 mkdir -p "tc_client-${version}-w32/share/glib-2.0/schemas"
 cp /mingw32/share/glib-2.0/schemas/gschemas.compiled "tc_client-${version}-w32/share/glib-2.0/schemas"
 . /etc/profile
diff --git a/utilities/gtk/playmedia.c b/utilities/gtk/playmedia.c
index 03fdd1c..41593b3 100644
--- a/utilities/gtk/playmedia.c
+++ b/utilities/gtk/playmedia.c
@@ -100,11 +100,11 @@ void* playmedia(void* data)
   int fd=pmd->fd;
   playmedia_seek=pmd->seek;
   // Get the URL for the actual file
-  if(strchr(pmd->id, '\'')){free(pmd->id); free(pmd); return 0;}
-  char cmd[strlen("youtube-dl -f 'best[height<=480]' -g -- ''0")+strlen(pmd->id)];
-  strcpy(cmd, "youtube-dl -f 'best[height<=480]' -g -- '");
+  if(strchr(pmd->id, '"')){free(pmd->id); free(pmd); return 0;}
+  char cmd[strlen("youtube-dl -f \"best[height<=480]\" -g -- \"\"0")+strlen(pmd->id)];
+  strcpy(cmd, "youtube-dl -f \"best[height<=480]\" -g -- \"");
   strcat(cmd, pmd->id);
-  strcat(cmd, "'");
+  strcat(cmd, "\"");
   free(pmd->id);
   free(pmd);
   FILE* ytdl=popen(cmd, "r");