diff --git a/common.h b/common.h index 286e08e..519e04a 100755 --- a/common.h +++ b/common.h @@ -31,6 +31,7 @@ #define FLAG_HTTPS 131072 #define FLAG_POST 262144 #define FLAG_PLAYER_AUTO 524288 +#define FLAG_NOOUT 1048576 extern int Type, Flags; diff --git a/libUseful-2.8/config.log b/libUseful-2.8/config.log index 8300990..cfc2dd1 100644 --- a/libUseful-2.8/config.log +++ b/libUseful-2.8/config.log @@ -284,8 +284,8 @@ configure:3706: $? = 0 configure:3715: result: yes configure:3731: checking for OpenSSL_add_all_algorithms configure:3731: gcc -o conftest -g -O2 conftest.c -lcrypto -lssl -lc >&5 -/tmp/ccgcl9xZ.o: In function `main': -/home/metacosm89/Movgrab-3.0.4/libUseful-2.8/conftest.c:59: undefined reference to `OpenSSL_add_all_algorithms' +/tmp/ccS3DHI2.o: In function `main': +/home/metacosm89/coding-2017/Movgrab/libUseful-2.8/conftest.c:59: undefined reference to `OpenSSL_add_all_algorithms' collect2: error: ld returned 1 exit status configure:3731: $? = 1 configure: failed program was: @@ -366,8 +366,8 @@ configure:3731: $? = 0 configure:3731: result: yes configure:3731: checking for EVP_rc5_32_12_16_cbc configure:3731: gcc -o conftest -g -O2 conftest.c -lcrypto -lssl -lc >&5 -/tmp/ccup7tvX.o: In function `main': -/home/metacosm89/Movgrab-3.0.4/libUseful-2.8/conftest.c:62: undefined reference to `EVP_rc5_32_12_16_cbc' +/tmp/ccSb6JoV.o: In function `main': +/home/metacosm89/coding-2017/Movgrab/libUseful-2.8/conftest.c:62: undefined reference to `EVP_rc5_32_12_16_cbc' collect2: error: ld returned 1 exit status configure:3731: $? = 1 configure: failed program was: diff --git a/libUseful-2.8/config.status b/libUseful-2.8/config.status index 4d9b36e..9a693ac 100755 --- a/libUseful-2.8/config.status +++ b/libUseful-2.8/config.status @@ -427,7 +427,7 @@ Copyright (C) 2012 Free Software Foundation, Inc. This config.status script is free software; the Free Software Foundation gives unlimited permission to copy, distribute and modify it." -ac_pwd='/home/metacosm89/Movgrab-3.0.4/libUseful-2.8' +ac_pwd='/home/metacosm89/coding-2017/Movgrab/libUseful-2.8' srcdir='.' test -n "$AWK" || AWK=awk # The default lists apply if the user does not specify any file. diff --git a/outputfiles.c b/outputfiles.c index 39533a4..2a1756d 100755 --- a/outputfiles.c +++ b/outputfiles.c @@ -184,11 +184,14 @@ ListNode *Curr; int val=0, Resume=FALSE; STREAM *S=NULL; +if (Flags & FLAG_NOOUT) return; if ((Flags & FLAG_RESUME) && (ListSize(OutputFiles)==1)) Resume=TRUE; Curr=ListGetNext(OutputFiles); while (Curr) { + if (! Curr->Item) + { if (! StrValid(Curr->Tag)) { Tempstr=GetSaveFilePath(Tempstr, Title, URL); @@ -203,6 +206,7 @@ while (Curr) Curr->Item=S; } else Curr->Item=OpenSaveFile(Curr->Tag, FileSize, Resume); + } Curr=ListGetNext(Curr); } @@ -261,17 +265,18 @@ Curr=ListGetNext(Curr); DestroyString(Tempstr); } +void AddOutputStream(const char *Path, STREAM *S) +{ +if (! OutputFiles) OutputFiles=ListCreate(); +ListAddNamedItem(OutputFiles,Path,S); +} void AddOutputFile(const char *Path, int SingleOutput) { //if 'SingleOutput' is set then overwrite any existing outputs, this should be the //only one if (SingleOutput) ListClear(OutputFiles,NULL); - -if (! OutputFiles) OutputFiles=ListCreate(); -ListAddNamedItem(OutputFiles,Path,NULL); - - +AddOutputStream(Path, NULL); } diff --git a/outputfiles.h b/outputfiles.h index 663f481..ef01edb 100755 --- a/outputfiles.h +++ b/outputfiles.h @@ -4,11 +4,13 @@ #include "common.h" + char *OutputFilesGetFilePath(); void OpenOutputFiles(const char *Title, const char *URL, double *FileSize); void WriteOutputFiles(const char *Data, int Len); void CloseOutputFiles(char *Extn); void AddOutputFile(const char *Path, int SingleOutput); +void AddOutputStream(const char *Path, STREAM *S); char *GuessExtn(const char *ContentType, const char *Format, const char *ID); diff --git a/players.c b/players.c index 3637eee..b73ceeb 100644 --- a/players.c +++ b/players.c @@ -47,12 +47,19 @@ else Player=CopyStr(Player, Config); void LaunchPlayer() { char *Tempstr=NULL; +STREAM *S; if (PlayerPid > 0) return; if (! StrValid(Player)) return; -Tempstr=MCopyStr(Tempstr,Player," ",OutputFilesGetFilePath(),NULL); -PlayerPid=Spawn(Tempstr,""); +//Tempstr=MCopyStr(Tempstr,Player," ",OutputFilesGetFilePath(),NULL); + +S=STREAMSpawnCommand(Player,""); +if (S) +{ + AddOutputStream(Player, S); + PlayerPid=atoi(STREAMGetValue(S, "PeerPID")); +} DestroyString(Tempstr); } diff --git a/settings.c b/settings.c index d63dfb9..be3302b 100644 --- a/settings.c +++ b/settings.c @@ -172,8 +172,13 @@ for (i=1; i < argc; i++) else if (strcmp(argv[i],"-o")==0) { i++; - AddOutputFile(argv[i], TRUE); - if (strcmp(argv[i],"-")==0) Flags |= FLAG_STDOUT; + if (strcmp(argv[i],"none")==0) Flags |= FLAG_NOOUT; + else if (strcmp(argv[i],"-")==0) + { + Flags |= FLAG_STDOUT; + AddOutputFile(argv[i], TRUE); + } + else AddOutputFile(argv[i], TRUE); } else if (strcmp(argv[i],"+o")==0) {