aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--CHANGELOG.txt10
-rw-r--r--watch.c35
-rw-r--r--watch.exebin69632 -> 70144 bytes
-rw-r--r--watch.objbin4739 -> 5641 bytes
4 files changed, 30 insertions, 15 deletions
diff --git a/CHANGELOG.txt b/CHANGELOG.txt
index 92a1801..f5e1b84 100644
--- a/CHANGELOG.txt
+++ b/CHANGELOG.txt
@@ -1,6 +1,6 @@
-CHANGELOG ----------------------- 2.1 ---------------------- 2020-06-13
+CHANGELOG ----------------------- 2.2 ---------------------- 2020-06-13
-NEW: Video title support.
-NEW: Now handles Ctrl-Break signal by interrupting youtube-dl and
- launching MPC-HC immediately. Ctrl-C still interrupts youtube-dl
- without launching MPC-HC.
+NEW: You can now specify custom command line parameters for youtube-dl
+ with the /c flag.
+FIX: Now skips YouTube DASH manifest using --youtube-skip-dash-manifest
+ flag, as MPC-HC does not support it. \ No newline at end of file
diff --git a/watch.c b/watch.c
index b731062..09cc154 100644
--- a/watch.c
+++ b/watch.c
@@ -20,7 +20,7 @@
#define MAX_PATH 260
#define SR_ERR_NOASSOC (HINSTANCE)31
-#define USAGE "usage: %s URL\n", argv[0]
+#define USAGE "usage: %s [/c argument-string] URL\n", argv[0]
char out[MAX_PATH];
@@ -33,7 +33,7 @@ void sigbreak(int sig) {
int main(int argc, char *argv[]) {
bool new, title;
- char *cmd, temp[MAX_PATH];
+ char *cmd, *extra, temp[MAX_PATH], *url;
FILE *f, *p;
HINSTANCE r;
int c, i, linecount;
@@ -50,19 +50,34 @@ int main(int argc, char *argv[]) {
strcat(out, "watch.tmp.mpcpl");
if (argc == 1) goto open; /* open previous link */
- if (argc > 2) die(USAGE);
- if (strncmp(argv[1], "watch:", 6) == 0) /* support watch: urls */
- argv[1] += 6;
+ if (argv[1][0] == '/') {
+ if (argv[1][1] != 'c' || argc != 4) die(USAGE);
+ extra = argv[2];
+ url = argv[3];
+ } else {
+ if (argc != 2) die(USAGE);
+ extra = NULL;
+ url = argv[1];
+ }
+
+ if (strncmp(url, "watch:", 6) == 0) /* support watch: urls */
+ url += 6;
- for (i = 0; i < strlen(argv[1]); i++)
- if (argv[1][i] == '"') die("URL cannot contain quotes (\")\n");
+ for (i = 0; i < strlen(url); i++)
+ if (url[i] == '"') die("URL cannot contain quotes (\")\n");
/* start youtube-dl */
- cmd = malloc(sizeof("youtube-dl -eg \"\"") + strlen(argv[1]) * sizeof(char));
- if (cmd == NULL) err(1, "malloc");
- if (sprintf(cmd, "youtube-dl -eg \"%s\"", argv[1]) < 0) err(1, "sprintf");
+ if (extra != NULL) {
+ cmd = malloc(sizeof("youtube-dl -eg --youtube-skip-dash-manifest \"\"") + (strlen(url) + strlen(extra)) * sizeof(char));
+ if (cmd == NULL) err(1, "malloc");
+ if (sprintf(cmd, "youtube-dl -eg --youtube-skip-dash-manifest %s \"%s\"", extra, url) < 0) err(1, "sprintf");
+ } else {
+ cmd = malloc(sizeof("youtube-dl -eg --youtube-skip-dash-manifest \"\"") + strlen(url) * sizeof(char));
+ if (cmd == NULL) err(1, "malloc");
+ if (sprintf(cmd, "youtube-dl -eg --youtube-skip-dash-manifest \"%s\"", url) < 0) err(1, "sprintf");
+ }
p = _popen(cmd, "r");
if (p == NULL) err(1, "popen");
diff --git a/watch.exe b/watch.exe
index 0222d3d..7e2212f 100644
--- a/watch.exe
+++ b/watch.exe
Binary files differ
diff --git a/watch.obj b/watch.obj
index 3bea372..8320f55 100644
--- a/watch.obj
+++ b/watch.obj
Binary files differ