Skip to content

Commit

Permalink
Fixed playlist/container files. Added 'now playing' output. Added sit…
Browse files Browse the repository at this point in the history
…es 'ign' & 'ebaumsworld'. Fixed site 'break.com'. Removed site 'redbalcony.com'
  • Loading branch information
ColumPaget committed Jan 25, 2017
1 parent 9e1ea63 commit 677c3bd
Show file tree
Hide file tree
Showing 24 changed files with 449 additions and 389 deletions.
8 changes: 7 additions & 1 deletion Makefile
100755 → 100644
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ prefix=/usr/local
bindir=$(prefix)${exec_prefix}/bin
DESTDIR=
FLAGS=$(CFLAGS) -DPACKAGE_NAME=\"\" -DPACKAGE_TARNAME=\"\" -DPACKAGE_VERSION=\"\" -DPACKAGE_STRING=\"\" -DPACKAGE_BUGREPORT=\"\" -DPACKAGE_URL=\"\" -DSTDC_HEADERS=1 -DHAVE_LIBZ=1 -D_LARGEFILE64_SOURCE=1 -D_FILE_OFFSET_BITS=64 -DHAVE_LIBSSL=1 -DHAVE_LIBCRYPTO=1
OBJ=containerfiles.o outputfiles.o common.o ehow.o youtube.o servicetypes.o extract_text.o download.o display.o
OBJ=containerfiles.o outputfiles.o common.o ehow.o ign.o youtube.o servicetypes.o extract_text.o download.o display.o selectformat.o

all: $(OBJ)
@cd libUseful-2.6; $(MAKE)
Expand All @@ -28,6 +28,9 @@ common.o: common.c common.h
ehow.o: ehow.c ehow.h
$(CC) $(FLAGS) -c ehow.c

ign.o: ign.c ign.h
$(CC) $(FLAGS) -c ign.c

youtube.o: youtube.c youtube.h
$(CC) $(FLAGS) -c youtube.c

Expand All @@ -40,6 +43,9 @@ download.o: download.c download.h
display.o: display.c display.h
$(CC) $(FLAGS) -c display.c

selectformat.o: selectformat.c selectformat.h
$(CC) $(FLAGS) -c selectformat.c

extract_text.o: extract_text.c extract_text.h
$(CC) $(FLAGS) -c extract_text.c

Expand Down
8 changes: 7 additions & 1 deletion Makefile.in
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ prefix=@prefix@
bindir=$(prefix)@bindir@
DESTDIR=
FLAGS=$(CFLAGS) @DEFS@
OBJ=containerfiles.o outputfiles.o common.o ehow.o youtube.o servicetypes.o extract_text.o download.o display.o
OBJ=containerfiles.o outputfiles.o common.o ehow.o ign.o youtube.o servicetypes.o extract_text.o download.o display.o selectformat.o

all: $(OBJ)
@cd libUseful-2.6; $(MAKE)
Expand All @@ -28,6 +28,9 @@ common.o: common.c common.h
ehow.o: ehow.c ehow.h
$(CC) $(FLAGS) -c ehow.c

ign.o: ign.c ign.h
$(CC) $(FLAGS) -c ign.c

youtube.o: youtube.c youtube.h
$(CC) $(FLAGS) -c youtube.c

Expand All @@ -40,6 +43,9 @@ download.o: download.c download.h
display.o: display.c display.h
$(CC) $(FLAGS) -c display.c

selectformat.o: selectformat.c selectformat.h
$(CC) $(FLAGS) -c selectformat.c

extract_text.o: extract_text.c extract_text.h
$(CC) $(FLAGS) -c extract_text.c

Expand Down
21 changes: 21 additions & 0 deletions common.c
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@

char *FileTypes[]={".flv",".mp3",".mp4",".mov",".wma",".m4a",".m4v",".wmv",".webm",".avi",".3gp",NULL};
char *ItemSelectionArg=NULL;
char *NowPlayingFile=NULL;
char *FormatPreference=NULL;

char *FileTypeFromURL(char *URL)
{
Expand Down Expand Up @@ -55,3 +57,22 @@ DestroyString(Tempstr);
return(RetStr);
}


void VarsAddDownloadItem(const char *ItemName, const char *URL, ListNode *Vars, int AddFlags)
{
const char *ptr;
char *Token=NULL;

//Do this without disturbing ptr, as we must return ptr
ptr=ItemName;
if (AddFlags & EXTRACT_GUESSTYPE)
{
Token=ItemCodeFromFileExtension(Token, ItemName, URL);
if (StrValid(Token)) ptr=Token;
}

SetVar(Vars,ptr,URL);
if (Flags & FLAG_DEBUG2) fprintf(stderr,"Extracted Item: [%s] [%s]\n",ptr,URL);

DestroyString(Token);
}
3 changes: 3 additions & 0 deletions common.h
Original file line number Diff line number Diff line change
Expand Up @@ -34,9 +34,12 @@
extern int Type, Flags;
extern char *FileTypes[];
extern char *ItemSelectionArg;
extern char *NowPlayingFile;
extern char *FormatPreference;

char *FileTypeFromURL(char *URL);
char *ItemCodeFromFileExtension(char *RetBuf, const char *Default, const char *URL);
void VarsAddDownloadItem(const char *ItemName, const char *URL, ListNode *Vars, int AddFlags);


#endif
28 changes: 9 additions & 19 deletions config.log
Original file line number Diff line number Diff line change
Expand Up @@ -10,11 +10,11 @@ generated by GNU Autoconf 2.69. Invocation command line was
## Platform. ##
## --------- ##

hostname = colums-hp
hostname = rack1
uname -m = x86_64
uname -r = 4.7.4-64
uname -r = 4.8.6-64
uname -s = Linux
uname -v = #1 SMP Fri Sep 16 22:00:54 UTC 2016
uname -v = #13 SMP Mon Nov 21 20:22:55 UTC 2016

/usr/bin/uname -p = unknown
/bin/uname -X = unknown
Expand All @@ -34,23 +34,13 @@ PATH: /usr/X11R7/bin
PATH: /bin
PATH: /usr/games/bin
PATH: .
PATH: /opt/Csound-6.05/bin
PATH: /opt/Qt4/bin
PATH: /opt/SDL/bin
PATH: /opt/SDL2/bin
PATH: /opt/chkrootkit-0.50/bin
PATH: /opt/ghostscript-9.19/bin
PATH: /opt/git-2.9.3/bin
PATH: /opt/jx9-1.0/bin
PATH: /opt/gdbm-1.12/bin
PATH: /opt/git-2.10.2/bin
PATH: /opt/httpd/bin
PATH: /opt/lua-5.3.3/bin
PATH: /opt/lxc-2.0.3/bin
PATH: /opt/mujs-b005928/bin
PATH: /opt/perl-5.20.1/bin
PATH: /opt/poppler-0.43.0/bin
PATH: /opt/qemu-2.5.0/bin
PATH: /opt/schily/bin
PATH: /opt/wine-1.9.18/bin
PATH: /opt/x86_64/bin
PATH: /opt/perl-5.24.0/bin


## ----------- ##
Expand Down Expand Up @@ -196,10 +186,10 @@ generated by GNU Autoconf 2.69. Invocation command line was
CONFIG_COMMANDS =
$ ./config.status

on colums-hp
on rack1

config.status:729: creating Makefile
configure:4604: === configuring in libUseful-2.6 (/mnt/Movgrab-2.0.0/libUseful-2.6)
configure:4604: === configuring in libUseful-2.6 (/home/metacosm89/Movgrab/libUseful-2.6)
configure:4667: running /bin/sh ./configure --disable-option-checking '--prefix=/usr/local' '--enable-ssl' --cache-file=/dev/null --srcdir=.

## ---------------- ##
Expand Down
2 changes: 1 addition & 1 deletion config.status
Original file line number Diff line number Diff line change
Expand Up @@ -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='/mnt/Movgrab-2.0.0'
ac_pwd='/home/metacosm89/Movgrab'
srcdir='.'
INSTALL='/bin/install -c'
test -n "$AWK" || AWK=awk
Expand Down
23 changes: 20 additions & 3 deletions display.c
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,19 @@ return(result);
}


void WriteNowPlayingFile(const char *Title)
{
STREAM *S;

S=STREAMOpenFile(NowPlayingFile, SF_WRONLY | SF_CREAT | SF_TRUNC);
if (S)
{
STREAMWriteLine(Title, S);
STREAMWriteLine("\n", S);
STREAMClose(S);
}
}


//Display progress of download
void DisplayProgress(const char *FullTitle, const char *Format, double bytes_read, double DocSize, int PrintName)
Expand All @@ -93,14 +106,18 @@ if (CheckForKeyboardInput()) PrintName=TRUE;

if ((DisplayTitleWidth > 0) && (StrLen(FullTitle) > DisplayTitleWidth))
{
Title=CopyStrLen(Title, FullTitle, DisplayTitleWidth);
Title=CatStr(Title,"...");
Title=CopyStrLen(Title, FullTitle, DisplayTitleWidth);
Title=CatStr(Title,"...");
}
else Title=CopyStr(Title, FullTitle);

if (! (Flags & FLAG_QUIET))
{
if (PrintName) fprintf(stderr,"\nGetting: %s Size: %s Format: %s\n",Title,GetHumanReadableDataQty(DocSize,0), Format);
if (PrintName)
{
fprintf(stderr,"\nGetting: %s Size: %s Format: %s\n",Title,GetHumanReadableDataQty(DocSize,0), Format);
if (StrLen(NowPlayingFile)) WriteNowPlayingFile(Title);
}
}

if ((Now != SpeedStart) && (Now != LastDisplay))
Expand Down
3 changes: 2 additions & 1 deletion download.c
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ if (BytesRange > 0)
SetVar(Info->CustomSendHeaders,"Range",Tempstr);
}

SetVar(Info->CustomSendHeaders,"Icy-MetaData","1");
//SetVar(Info->CustomSendHeaders,"Icy-MetaData","1");

Con=HTTPTransact(Info);
if ((! Con) && (! (Flags & FLAG_QUIET)))
Expand All @@ -43,6 +43,7 @@ if ((! Con) && (! (Flags & FLAG_QUIET)))
else fprintf(stderr,"ERROR: Connection failed to %s can't get file=%s \n",Info->Host, Info->Doc);
}


DestroyString(Tempstr);
DestroyString(Method);

Expand Down
27 changes: 17 additions & 10 deletions extract_text.c
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
#include "extract_text.h"



//This function Extracts Text from a line that's found between two specified
//chunks of text 'ItemStart' and 'ItemEnd'
char *GenericExtractFromLine(char *Line, const char *ItemName, const char *ItemStart, const char *ItemEnd, ListNode *Vars, int ExtractFlags)
Expand Down Expand Up @@ -55,20 +56,26 @@ int GTF=0;
}
}

//Do this without disturbing ptr, as we must return ptr
ptr2=ItemName;
if (ExtractFlags & EXTRACT_GUESSTYPE)
{
Token=ItemCodeFromFileExtension(Token, ItemName, Item);
if (StrValid(Token)) ptr2=Token;
}

SetVar(Vars,ptr2,Item);
if (Flags & FLAG_DEBUG2) fprintf(stderr,"Extracted Item: [%s] [%s]\n",ptr2,Item);
VarsAddDownloadItem(ItemName, Item, Vars, ExtractFlags);

DestroyString(Token);
DestroyString(Item);

return(ptr);
}


void GenericTitleExtract(const char *Line, ListNode *Vars)
{
if (strstr(Line,"<title>")) GenericExtractFromLine(Line, "Title:html","<title>","</title>", Vars,EXTRACT_DEQUOTE);

if (strstr(Line,"<meta name=\"title\" content=\""))
{
GenericExtractFromLine(Line, "Title:meta","<meta name=\"title\" content=\"","\"", Vars,EXTRACT_DEQUOTE);
}

if (strstr(Line,"<meta property=\"og:title\" content=\""))
{
GenericExtractFromLine(Line, "Title:meta","<meta property=\"og:title\" content=\"", "\"", Vars,EXTRACT_DEQUOTE);
}
}
1 change: 1 addition & 0 deletions extract_text.h
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
//This function Extracts Text from a line that's found between two specified
//chunks of text 'ItemStart' and 'ItemEnd'
char *GenericExtractFromLine(char *Line, const char *ItemName, const char *ItemStart, const char *ItemEnd, ListNode *Vars, int Flags);
void GenericTitleExtract(const char *Line, ListNode *Vars);

#endif

49 changes: 49 additions & 0 deletions ign.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
#include "ign.h"

const char *IGN_DecodeLine(const char *Data, ListNode *Vars)
{
const char *ptr;
char *Name=NULL, *Value=NULL, *URL=NULL;
int height=0, width=0;

ptr=GetNameValuePair(Data,",",":",&Name,&Value);
while (ptr)
{
StripQuotes(Name);
StripQuotes(Value);

if (strcmp("url",Name)==0) URL=CopyStr(URL,Value);
if (strcmp("width",Name)==0) width=atoi(Value);
if (strcmp("height",Name)==0) height=atoi(Value);
ptr=GetNameValuePair(ptr,",",":",&Name,&Value);
}

if (width && height && StrLen(URL))
{
Value=FormatStr(Value,"item:mp4:%dx%d",width,height);
SetVar(Vars,Value,URL);
}

DestroyString(Name);
DestroyString(Value);
DestroyString(URL);

return(ptr);
}

void IGN_DecodeFormats(const char *Data, ListNode *Vars)
{
const char *ptr;
char *Token=NULL;

ptr=strstr(Data,"{\"url\":");
while (ptr)
{
ptr++;
ptr=GetToken(ptr,"}",&Token,0);
IGN_DecodeLine(Token, Vars);
ptr=strstr(ptr,"{\"url\":");
}

DestroyString(Token);
}
9 changes: 9 additions & 0 deletions ign.h
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
#ifndef MOVGRAB_IGN
#define MOVGRAB_IGN

#include "common.h"


void IGN_DecodeFormats(const char *Data, ListNode *Vars);

#endif
Empty file modified libUseful-2.6/Makefile
100755 → 100644
Empty file.
Loading

0 comments on commit 677c3bd

Please sign in to comment.