shithub: nvi

ref: d81d2b35559fea6684cee44a5d4f494fc585e38d
dir: /nvi.h/

View raw version
typedef struct Info Info;
typedef struct Format Format;

struct Format {
	char *url;
	char *type;
	char *quality; /* nil for audio, "360p"/etc for video */
	vlong sz;
	int included; /* Iaudio|Ivideo */
	int id;
};

struct Info {
	char *author;
	char *title;
	char *description;
	Tm published;
	uvlong duration;
	Format *fmt;
	int nfmt;
};

enum {
	Cdownload,
	Cinfo,

	Iaudio = 1<<0,
	Ivideo = 1<<1,
};

extern int cmd;
extern int debug;

Info *peertube(char *url);
Info *youtube(char *vid);

int pipeexec(int *fd, char *file, char **argv);
void procwait(void);
char *readall(int f);
int hget(char *url, int out);
char *estrdup(char *s);
int alldigit(char *s);
JSON *jfield(JSON *j, int type, ...);
char *jstrdup(JSON *j, char *name);
vlong jint(JSON *j, char *name);
char *strrpbrk(char *s, char *c);

#pragma varargck type "Z" vlong
int Zfmt(Fmt *f);

#pragma varargck type "P" uvlong
int Pfmt(Fmt *f);