Skip to content

Commit

Permalink
Better handling of pages without newlines
Browse files Browse the repository at this point in the history
  • Loading branch information
ColumPaget committed Jun 23, 2017
1 parent 48bd9fd commit a46b041
Showing 1 changed file with 8 additions and 5 deletions.
13 changes: 8 additions & 5 deletions servicetypes.c
Original file line number Diff line number Diff line change
Expand Up @@ -701,8 +701,9 @@ DestroyString(Res);
int ExtractItemInfo(STREAM *S, int Type, const char *URL, const char *Title, int Flags)
{
char *Tempstr=NULL, *Token=NULL, *VarName=NULL, *Server=NULL;
char *Document=NULL;
ListNode *Vars=NULL;
const char *ptr;
const char *ptr, *remaining;
char *ptr2;
int MediaCount=0, i, Port;
int RetVal=FALSE, State=0;
Expand All @@ -718,10 +719,13 @@ Tempstr=FormatStr(Tempstr,"%d",Port);
SetVar(Vars,"Port",Tempstr);

if (Flags & (FLAG_DEBUG2 | FLAG_DEBUG3)) fprintf(stderr,"\n------- DOWNLOADING DOCUMENT ------\n");
Tempstr=STREAMReadLine(Tempstr, S);

while (Tempstr)
Document=STREAMReadDocument(Document, S);
remaining=Document;

while (remaining)
{
remaining=GetToken(remaining,"\n",&Tempstr,0);
StripTrailingWhitespace(Tempstr);
StripLeadingWhitespace(Tempstr);

Expand Down Expand Up @@ -766,7 +770,7 @@ else if (strncmp(Tempstr,"#EXT-X-STREAM-INF:",18)==0)

M3UStreamVarName(Tempstr+18, &VarName);

Tempstr=STREAMReadLine(Tempstr,S);
remaining=GetToken(remaining,"\n",&Tempstr,0);
StripTrailingWhitespace(Tempstr);
if (strncasecmp(Tempstr,"http:",5)==0) SetVar(Vars, VarName, Tempstr);
else if (strncasecmp(Tempstr,"https:",6)==0) SetVar(Vars, VarName, Tempstr);
Expand Down Expand Up @@ -1525,7 +1529,6 @@ case TYPE_DISCOVERY:
break;
}

Tempstr=STREAMReadLine(Tempstr,S);
}

if (Flags & (FLAG_DEBUG2 | FLAG_DEBUG3)) fprintf(stderr,"\n------- END DOCUMENT ------\n\n");
Expand Down

0 comments on commit a46b041

Please sign in to comment.