code string | repo_name string | path string | language string | license string | size int64 |
|---|---|---|---|---|---|
#include "unp.h"
void server(int in,int out)
{
size_t n;
char buf[MAXLINE+1];
int fd;
if((n=read(in,buf,MAXLINE)) ==0){
err_sys("read error");
}
buf[n] = '\0';
printf("server receive:%s %d\n",buf,MAXLINE);
if((fd=open(buf,O_RDONLY)) < 0){
snprintf(buf+n,sizeof(buf)-n,":cant open ... | zy-code-unp | trunk/test/pipe/server.c | C | bsd | 548 |
#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
#include <errno.h>
#include <sys/stat.h>
#include <fcntl.h>
#include <limits.h>
#define MAXLINE 1024
#define FILE_MODE (S_IRUSR|S_IWUSR|S_IRGRP|S_IWGRP|S_IROTH|S_IWOTH)
int main(int argc ,char * argv[]){
int out;
char buff[MAXLINE] = {'\0'};
if(... | zy-code-unp | trunk/test/pipe/stdout2fifo.c | C | bsd | 1,010 |
#include <stdio.h>
#include <stdlib.h>
#include <errno.h>
#include <string.h>
#include <fcntl.h>
#include <unistd.h>
#include <stdarg.h>
#include <sys/stat.h>
#include <time.h>
#include <sys/types.h>
#include <signal.h>
#define READ_TIMEOUT 10 //sec
#define MAXLINE 512 * 1024
#define FILE_MODE (S_IRUSR|S_IWUSR|S_IR... | zy-code-unp | trunk/test/pipe/fifo2stdout.c | C | bsd | 3,284 |
#include "unp.h"
volatile sig_atomic_t mqflag;
static void sig_usr1(int signo);
mqd_t mqd;
void *buff;
struct mq_attr attr;
struct sigevent sigev;
int main(int argc,char *argv[])
{
//int rc = -1;
sigset_t zeromask,newmask,oldmask;
sigemptyset(&zeromask);
sigemptyset(&newmask);
sigemptyset(&oldmask);... | zy-code-unp | trunk/test/mq_notifysig2.c | C | bsd | 1,305 |
VPATH=.:../lib
CC=gcc
CXX=g++
INCLUDES=-I../include/
CFLAGS=-Wall -g -o2 $(INCLUDES)
LDFLAGS=
DEPLIBS=-lrt
TARGET = prodcons1
TARGET_g:=$(foreach t,$(TARGET),$(t)_g)
SOURCES=$(foreach t,$(TARGET),$(t).c)
COMMON_OBJS=my_error.o mem_pool.o inet.o event.o thread_pool.o block_queue.o
OBJS = $(foreach t,$(TARGET),$(t)... | zy-code-unp | trunk/test/pxsem/Makefile | Makefile | bsd | 800 |
#include "unp.h"
#include <semaphore.h>
#define NBUFF 10
#define SEM_MUTEX "mutex"
#define SEM_NEMPTY "nempty"
#define SEM_NSTORED "nstored"
int nitems;
struct {
int buff[NBUFF];
sem_t *mutex,*nempty,*nstored;
} shared;
void *produce(void*),*consume(void*);
int main(int argc,char* argv[])
{
pthread_t ti... | zy-code-unp | trunk/test/pxsem/prodcons1.c | C | bsd | 1,412 |
prodcons1.o prodcons1.d : prodcons1.c ../include/unp.h ../include/my_error.h \
../include/mem_pool.h ../include/inet.h ../include/event.h \
../include/thread_pool.h
| zy-code-unp | trunk/test/pxsem/prodcons1.d | Makefile | bsd | 169 |
#include <mqueue.h>
#include <stdarg.h>
#include <unistd.h>
#include <signal.h>
#include <sys/stat.h>
#include "my_error.h"
#include "mem_pool.h"
#include "inet.h"
#define MSG_W 0200
#define MSG_R 0400
#define FILE_MODE (S_IRUSR|S_IWUSR|S_IRGRP|S_IWGRP|S_IROTH|S_IWOTH)
#define MSG_MODE (S_IRUSR|S_IWUSR|S_IRGRP|... | zy-code-unp | trunk/test/include/unp.h | C | bsd | 346 |
#include <string.h>
#include <stdio.h>
#include <stdlib.h>
#ifndef KU6_MEM_POOL_H
#define KU6_MEM_POOL_H 1
typedef struct pool_data_t {
char *end;
char *last;
struct pool_t *next;
size_t failed;
} pool_data_t;
typedef struct pool_large_t {
void *... | zy-code-unp | trunk/test/include/mem_pool.h | C | bsd | 1,788 |
#include <stdio.h>
#include <fcntl.h>
#include <unistd.h>
#include <string.h>
#include <stdlib.h>
#include "thread_pool.h"
int filesize(char *filename);
int readfile(char *filename,char **buff);
int readfile_by_pool(char *filename,char **buf,pool_t *pool);
int writetofile(char *filename,char *buff,int len);
| zy-code-unp | trunk/test/include/fileutil.h | C | bsd | 313 |
#include <sys/epoll.h>
#include <stdlib.h>
#include <netinet/in.h>
#include <sys/socket.h>
#include <unistd.h>
#include "my_error.h"
#include "thread_pool.h"
extern void setnonblocking(int fd);
//extern int close(int fd);
//extern int read(int fd,char *buff,int len);
int epoll_init(int size);
int epoll_add(int ... | zy-code-unp | trunk/test/include/event.h | C | bsd | 557 |
#include <stdarg.h>
#include <syslog.h>
#include <stdlib.h>
#include <errno.h>
#include <stdio.h>
#include <string.h>
#define MAXLINE 1024
void err_ret(const char *, ...);
void err_sys(const char *, ...);
void err_dump(const char *, ...);
void err_msg(const char *, ...);
void err_quit(const char *, ...);
| zy-code-unp | trunk/test/include/my_error.h | C | bsd | 314 |
#ifndef KU6_BLOCK_QUEUE_H
#define KU6_BLOCK_QUEUE_H 1
#include <pthread.h>
#include <stddef.h>
typedef void (*free_func)(void *);
typedef struct queue_t {
struct queue_t *prev;
struct queue_t *next;
} queue_t;
typedef struct block_queue_t {
queue_t queue;
int size;
int max_size;
unsigned s... | zy-code-unp | trunk/test/include/block_queue.h | C | bsd | 2,653 |
#include <netinet/in.h>
#include <string.h>
#include <fcntl.h>
#include "event.h"
#include "my_error.h"
int open_socket(long host,int port);
void setnonblocking(int fd);
| zy-code-unp | trunk/test/include/inet.h | C | bsd | 175 |
#ifndef KU6_THREAD_POOL_H
#define KU6_THREAD_POOL_H 1
#include <stdint.h>
#include <inttypes.h>
#include <pthread.h>
#include "mem_pool.h"
#ifdef __cplusplus
extern "C" {
#endif
struct pool_t;
int thread_key_create(void (*destructor)(void*));
int thread_setspecific(void *opaque);
void thread_init_pools(int threads,... | zy-code-unp | trunk/test/include/thread_pool.h | C | bsd | 693 |
#include "unp.h"
int main(int argc , char *argv[])
{
int c , flags;
mqd_t mqd;
struct mq_attr attr;
flags = O_RDWR | O_CREAT;
while((c=getopt(argc,argv,"em:z:")) !=-1){
switch(c){
case 'e':
flags = flags | O_EXCL;
break;
case 'm':
attr.mq_maxmsg = atol(optarg... | zy-code-unp | trunk/test/mq_create.c | C | bsd | 1,034 |
#include "unp.h"
static void sig_usr1(int signo);
mqd_t mqd;
void *buff;
struct mq_attr attr;
struct sigevent sigev;
int main(int argc,char *argv[])
{
//int rc = -1;
mqd = mq_open(argv[1],O_RDONLY | O_NONBLOCK);
if(mqd == -1)
err_sys("mq_open error");
if(mq_getattr(mqd,&attr) == -1)
err_sys("... | zy-code-unp | trunk/test/mq_notifysig.c | C | bsd | 972 |
prodcons.o prodcons.d : prodcons.c ../include/unp.h ../include/my_error.h \
../include/mem_pool.h ../include/inet.h ../include/event.h \
../include/thread_pool.h
| zy-code-unp | trunk/test/pthread/prodcons.d | Makefile | bsd | 166 |
#include "unp.h"
#include <pthread.h>
#define MAXNITEMS 150000
#define min(a,b) \
(a<b?a:b)
int nitems;
struct {
pthread_mutex_t mutex;
int buf[MAXNITEMS];
int nput;
int nval;
} shared ={
PTHREAD_MUTEX_INITIALIZER
};
struct {
pthread_mutex_t mutex;
pthread_cond_t... | zy-code-unp | trunk/test/pthread/prodcons2.c | C | bsd | 2,532 |
VPATH=.:../lib
CC=gcc
CXX=g++
INCLUDES=-I../include/
CFLAGS=-Wall -g -o2 $(INCLUDES)
LDFLAGS=
DEPLIBS=-lrt
TARGET = prodcons prodcons2
TARGET_g:=$(foreach t,$(TARGET),$(t)_g)
SOURCES=$(foreach t,$(TARGET),$(t).c)
COMMON_OBJS=my_error.o mem_pool.o inet.o event.o thread_pool.o block_queue.o
OBJS = $(foreach t,$(TAR... | zy-code-unp | trunk/test/pthread/Makefile | Makefile | bsd | 809 |
prodcons2.o prodcons2.d : prodcons2.c ../include/unp.h ../include/my_error.h \
../include/mem_pool.h ../include/inet.h ../include/event.h \
../include/thread_pool.h
| zy-code-unp | trunk/test/pthread/prodcons2.d | Makefile | bsd | 169 |
#include "unp.h"
#include <pthread.h>
#define MAXNITEMS 150000
#define min(a,b) \
(a<b?a:b)
int nitems;
struct {
pthread_mutex_t mutex;
int buf[MAXNITEMS];
int nput;
int nval;
} shared ={
PTHREAD_MUTEX_INITIALIZER
};
void *produce(void *), *consume(void *);
int main... | zy-code-unp | trunk/test/pthread/prodcons.c | C | bsd | 1,904 |
#include "unp.h"
static void sig_usr1(int signo);
mqd_t mqd;
void *buff;
struct mq_attr attr;
struct sigevent sigev;
int fd[2] = {0};
int main(int argc,char *argv[])
{
fd_set rset,eset;
sigset_t sigset;
sigemptyset(&sigset);
sigaddset(&sigset,SIGUSR1);
mqd = mq_open(argv[1],O_RDONLY | O_NONBLOCK);
... | zy-code-unp | trunk/test/mq_notifysig_pipe.c | C | bsd | 1,799 |
#include "unp.h"
static void sig_usr1(int signo);
mqd_t mqd;
void *buff;
struct mq_attr attr;
struct sigevent sigev;
int main(int argc,char *argv[])
{
int signo;
sigset_t newmask;
sigemptyset(&newmask);
sigaddset(&newmask,SIGUSR1);
sigprocmask(SIG_BLOCK,&newmask,NULL);
mqd = mq_open(argv[1],O_RD... | zy-code-unp | trunk/test/mq_notifysig3.c | C | bsd | 1,438 |
#include <stdio.h>
char * inc(char *buff)
{
buff++;
printf("%s\n",buff);
return buff;
}
int main(int argc,char *argv[])
{
char *buff = "abcd";
char *p = inc(buff);
printf("%s:%s\n",buff,p);
printf("%d\n",sizeof(long));
}
| zy-code-unp | trunk/test/common/t.c | C | bsd | 249 |
#include <string.h>
#include <unistd.h>
#include <stdlib.h>
#include <stdio.h>
#include <errno.h>
//static const char *BOX_TYPE_UUID = "uuid";
//static const char *BOX_TYPE_ABST = "abst";
//static const char *BOX_TYPE_ASRT = "asrt";
//static const ... | zy-code-unp | trunk/test/common/parseAbst.c | C | bsd | 18,061 |
#include <stdio.h>
union little_big_end
{
short x16;
long y32;
};
int main(void)
{
union little_big_end lbe;
printf("the size of lbe=%d\n",sizeof(lbe));
lbe.y32 = 0x12345678;
if(lbe.x16 == 0x1234 )
{
printf("the memory format is big end!\n");
}
else if(lbe.x16 == 0x5678 )
{
printf("the memory format ... | zy-code-unp | trunk/test/common/big_little_end.c | C | bsd | 370 |
#include <string.h>
#include <stdlib.h>
#include <stdio.h>
#define ngx_string(str) { sizeof(str) - 1, (u_char *) str }
#define ngx_null_string { 0, NULL }
#define ngx_str_set(str, text) \
(str)->len = sizeof(text) - 1-1; (str)->data = (u_char *) text
#define ng... | zy-code-unp | trunk/test/common/clean.c | C | bsd | 3,474 |
#include <stdlib.h>
#include "fileutil.h"
#include "my_error.h"
#include <json/json_tokener.h>
#include <json/json.h>
int main(int argc ,char *argv[])
{
char *buff;
int ret = readfile(argv[1],&buff);
printf("ret:%d buff:%s\n",ret,buff);
free(buff);
pool_t *pool = create_pool(1024);
ret = readfile_b... | zy-code-unp | trunk/test/common/testfile.c | C | bsd | 751 |
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
#include <uuid/uuid.h>
/**
* [root@localhost test]# echo "obase=2 ; ibase=16 ; B560BA196D3C63CACF550D0F0FE7E137" | bc
10110101011000001011101000011001011011010011110001100011110010101100\
111101010101000011010000111100001111111001111110000100110111
2556d... | zy-code-unp | trunk/test/common/shorturl.c | C | bsd | 2,238 |
#include <unistd.h>
#include <stdio.h>
int main(int argc , char * argv[]){
int result = -1;
while((result=getopt(argc,argv,":ab:")) !=-1){
switch(result){
case 'a':
printf("set a\n");
break;
case 'b':
printf("set b:%s\n",optarg);
... | zy-code-unp | trunk/test/common/getopt.c | C | bsd | 653 |
#include "mem_pool.h"
pool_t * create_pool(size_t size){
unsigned int space_len = size + sizeof(pool_t);
pool_t *pool = malloc(space_len);
if(!pool)
return NULL;
pool->d.end = (char*)pool + space_len;
pool->d.last = (char*)pool + sizeof(pool_t);
pool->d.next = NULL;
pool->d.fai... | zy-code-unp | trunk/test/lib/mem_pool.c | C | bsd | 7,679 |
#include <stdio.h>
#include "block_queue.h"
queue_t * queue_middle(queue_t *queue){
queue_t *middle, *next;
middle = queue_head(queue);
if (middle == queue_last(queue)) {
return middle;
}
next = queue_head(queue);
for ( ;; ) {
middle = queue_next(middle);
next = queu... | zy-code-unp | trunk/test/lib/block_queue.c | C | bsd | 4,630 |
#include <stdio.h>
#include <stdlib.h>
#include <pthread.h>
#include "mem_pool.h"
static pthread_key_t key;
//mem pool for per thread
static pool_t **pools;
static int pool_num;
// MUST be called firstly
int thread_key_create(void (*destructor)(void*))
{
return pthread_key_create(&key,destructor);
}
int thr... | zy-code-unp | trunk/test/lib/thread_pool.c | C | bsd | 1,918 |
#include "event.h"
int epoll_init(int size)
{
int ep = epoll_create(size);
if(ep == -1)
err_dump("epoll_init error");
return ep;
}
int epoll_add(int ep,int fd,int event,int flags)
{
int op , ret = -1;
struct epoll_event ee;
ee.events = event | flags;
ee.data.fd = fd;
op = EPOLL_CT... | zy-code-unp | trunk/test/lib/event.c | C | bsd | 2,916 |
#include "fileutil.h"
int filesize(char *filename)
{
int fd = open(filename,O_RDONLY);
if(fd < 0){
err_ret("cant open %s:",filename);
return fd;
}
int len = lseek(fd,0,SEEK_END);
lseek(fd,0,SEEK_CUR);
close(fd);
return len;
}
int readfile(char *filename,char **buff)
{
int fd = op... | zy-code-unp | trunk/test/lib/fileutil.c | C | bsd | 1,171 |
#include "inet.h"
#include "event.h"
int main(int argc , char * argv[])
{
int sockfd;
sockfd = open_socket(INADDR_ANY,1982);
if(sockfd == -1)
err_quit("opensock error");
printf("SOCKED:%d\n",sockfd);
int ep = epoll_init(1024);
printf("ep:%d\n",ep);
int ret = epoll_add(so... | zy-code-unp | trunk/test/lib/test.c | C | bsd | 387 |
#include "inet.h"
int open_socket(long host , int port)
{
int sockfd = -1;
struct sockaddr_in serv_addr;
if((sockfd=socket(AF_INET,SOCK_STREAM,0)) < 0)
err_dump("server: cant open stream socket");
//setnonblocking(sockfd);
//epoll_add(sockfd,EPOLLIN,EPOLLET);
bzero((char*)&serv_addr,size... | zy-code-unp | trunk/test/lib/inet.c | C | bsd | 923 |
#include "my_error.h"
int daemon_flags;
static void err_doit(int ,int ,const char *,va_list);
void err_ret(const char *fmt, ...)
{
va_list ap;
va_start(ap,fmt);
err_doit(1,LOG_INFO,fmt,ap);
va_end(ap);
return;
}
void err_sys(const char *fmt, ...)
{
va_list ap;
va_start(ap,fmt);
... | zy-code-unp | trunk/test/lib/my_error.c | C | bsd | 1,336 |
#include <stdarg.h>
#include <unistd.h>
#include <arpa/inet.h>
#include "inet.h"
#include "event.h"
#include "thread_pool.h"
#include "block_queue.h"
#define MAX_DISPATHER_THREADS 8
typedef struct entity_t {
queue_t queue;
int fd;
} entity_t;
typedef struct thread_data {
pthread_t pid;
int ep;
int... | zy-code-unp | trunk/test/msg.c | C | bsd | 6,629 |
#include <string.h>
#include <stdio.h>
#include <stdlib.h>
#include "mem_pool.h"
pool_t * create_pool(size_t size){
unsigned int space_len = size + sizeof(pool_t);
pool_t *pool = malloc(space_len);
if(!pool)
return NULL;
pool->d.end = (char*)pool + space_len;
pool->d.last = (char*)pool ... | zy-code-unp | trunk/ku6/ku6downloader/mem_pool.c | C | bsd | 8,804 |
#include <stdio.h>
#include "block_queue.h"
queue_t * queue_middle(queue_t *queue){
queue_t *middle, *next;
middle = queue_head(queue);
if (middle == queue_last(queue)) {
return middle;
}
next = queue_head(queue);
for ( ;; ) {
middle = queue_next(middle);
next = queu... | zy-code-unp | trunk/ku6/ku6downloader/block_queue.c | C | bsd | 4,628 |
#include <stdio.h>
#include <stdlib.h>
#include <uuid/uuid.h>
int main(int argc, char* argv[])
{
uuid_t uuid,uuid2,uuid3;
//uuid_generate_time(uuid);
uuid_generate(uuid);
//uuid_generate_random(uuid);
char uuid_str[17] = {'\0'};
uuid_unparse(uuid,uuid_str);
printf("uuid_str %s\n",uuid_str);
int rc =... | zy-code-unp | trunk/ku6/ku6downloader/test_uuid.c | C | bsd | 600 |
//
// JSDownloader.cpp : Defines the entry point for the console application.
//
#if defined(_MSC_VER)
// Specifies that the minimum required platform is Windows XP.
#ifndef _WIN32_WINNT
#define _WIN32_WINNT 0x0501
#endif
#define _CRT_SECURE_NO_WARNINGS
#endif
#include <stdio.h>
#include <malloc.h>
#include <string.... | zy-code-unp | trunk/ku6/ku6downloader/JSDownloader.cpp | C++ | bsd | 18,995 |
#!/bin/bash
FILE=$1
exec_do()
{
echo "" > /data/work/workspace/suitang/log/${vid}
if [ -e /data/work/workspace/suitang/qq/${name}.mp4 ] ; then
echo "${name} has download"
return
fi
echo "/home/zy/zy-code-unp/ku6/ku6downloader/ku6downloader_g -i /home/zy/zy-code-unp/ku6/ku6downloader/js/ -r url=http://v... | zy-code-unp | trunk/ku6/ku6downloader/.svn/text-base/suitang.sh.svn-base | Shell | bsd | 793 |
#include <string.h>
#include <stdlib.h>
#include <stdio.h>
#include "block_queue.h"
#include "hash.h"
//typedef void * (hash_iter_fun_t)(hash_elt_t*);
void free_elt(void *p){
if(!p) return;
queue_t *q = (queue_t*)p;
hash_elt_t *elt = queue_data(q,hash_elt_t,queue);
//printf("free_elt from hash :%p\n",&*elt);
... | zy-code-unp | trunk/ku6/ku6downloader/hash.c | C | bsd | 3,257 |
#include <stddef.h>
#include "mem_pool.h"
#include "array.h"
//typedef unsigned char u_char;
static inline int
array_init(array_t *array, pool_t *pool, size_t n, size_t size)
{
/*
* set "array->nelts" before "array->elts", otherwise MSVC thinks
* that "array->nelts" may be used without having been i... | zy-code-unp | trunk/ku6/ku6downloader/array.c | C | bsd | 3,187 |
#include <stdio.h>
int main(int argc ,char *argv[]){
printf("%d %d\n",sizeof(long),sizeof(int));
return 0;
}
| zy-code-unp | trunk/ku6/ku6downloader/t.c | C | bsd | 117 |
/**
*
* Created by kouzhenfnag, 1/9/2011 23:19:40
*
*/
function validateVideoUrl(ori_url)
{
var strArray = new Array();
strArray = ori_url.split('/');
var vid = strArray[strArray.length-1];
if (vid == null) {
// Not Found
return 'NotFoundVideo';
}
var dst_url = 'http://v.ku6.com/fetc... | zy-code-unp | trunk/ku6/ku6downloader/js/ku6.js | JavaScript | bsd | 1,701 |
/**
*
* Created by Pan,hongxue, 9/7/2011 4:58:16 PM
*
*/
function validateVideoUrl(ori_url)
{
var html = download_page(ori_url);
var matches = html.match(/"?vid"? ?(,|:) ?'?(\d+)'?/);
if (matches == null) {
// Not Found
return 'NotFoundVideo';
}
var dst_url = 'http://v.iask.com/v_play.php?vid=' + matc... | zy-code-unp | trunk/ku6/ku6downloader/js/sina.js | JavaScript | bsd | 1,700 |
/**
* by zgb
* @param ori_url
*/
/* http://www.letv.com/ptv/pplay/48402/14.html */
function validateVideoUrl(ori_url){
var html = download_page(ori_url);
var matches = html.match(/vid:(\d+),/);
if(!matches){
//not found
return 'NotFoundVideo';
}
var xml_url = 'http://www.letv.com/v_xml/'+ma... | zy-code-unp | trunk/ku6/ku6downloader/js/letv.js | JavaScript | bsd | 2,463 |
/**
*
* Created by Song,YeWen, 9/15/2011 5:18:42 PM
*
*/
function validateVideoUrl(ori_url)
{
//We use a fake constant duration for xtube.com, because it is adult video,
//TODO: FIXME
var fcduration = '100';
const URL_POST_XML = 'http://www.xtube.com/find_video.php';
const URL_POST_XML_PARAMS = 'u... | zy-code-unp | trunk/ku6/ku6downloader/js/xtube.js | JavaScript | bsd | 2,573 |
/**
*
* Created by Pan,hongxue, 9/16/2011 4:53:15 PM
* Modified by Song,YeWen, 10/10/2011 4:02:06 PM
*
*/
function validateVideoUrl(ori_url)
{
var dst_url;
var matches;
var html;
/* we firstly use the specified vid in url */
var vid_str = copyBetween(ori_url, 'vid=', '&');
... | zy-code-unp | trunk/ku6/ku6downloader/js/qq.js | JavaScript | bsd | 3,450 |
/**
*
* Created by Song,YeWen, 1/16/2012 4:30:14 PM
*
*/
function validateVideoUrl(ori_url)
{
//We use a fake constant duration for mtime.com, because it is Movie trailer, not long duration video
//TODO: FIXME
var fcduration = '100';
var html = download_page(ori_url);
matches = html.match(/vid\s*=\... | zy-code-unp | trunk/ku6/ku6downloader/js/smgbb.js | JavaScript | bsd | 2,912 |
/**
*
* Created by Pan,hongxue, 8/30/2011 5:19:40 PM
*
*/
function RandomProxy(randomSeed)
{
this._randomSeed = randomSeed;
this.cg_hun = function () {
var _loc_4 = 0;
this._cgStr = "";
var _loc_1 = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ/\\:._-1234567890";
var _loc_2 = _loc_... | zy-code-unp | trunk/ku6/ku6downloader/js/youku.js | JavaScript | bsd | 3,760 |
/**
*
* Created by Song,YeWen, 9/15/2011 11:50:27 AM
*
*/
function validateVideoUrl(ori_url)
{
const URL_GET_XML = 'http://www.zappinternet.com/get_playlist.php?idvideo=%1';
var vidId = copyBetween(ori_url, 'video/', '/');
if (!vidId) {
// vid not found
return 'NotFoundVideo';
}
var html... | zy-code-unp | trunk/ku6/ku6downloader/js/zappinternet.js | JavaScript | bsd | 2,209 |
/**
*
* Created by Pan,hongxue, 9/8/2011 7:14:40 PM
*
*/
function validateVideoUrl(ori_url)
{
var html = download_page(ori_url,'GBK');
var matches = html.match(/iid( = |:)(\d+)/);
if (matches == null) {
// vid not found
return 'NotFoundVideo';
}
var dst_url = 'http://v2.tudou.com/v?it=' + matches... | zy-code-unp | trunk/ku6/ku6downloader/js/tudou.js | JavaScript | bsd | 1,348 |
/**
*
* Created by Song,YeWen, 10/10/2011 11:27:17 AM
*
*/
function validateVideoUrl(ori_url)
{
//We use a fake constant duration for m1905.com, because it is Trailer, not long duration video
//TODO: FIXME
var fcduration = '100';
var html = download_page(ori_url);
var matches = html.match(/videoid... | zy-code-unp | trunk/ku6/ku6downloader/js/m1905.js | JavaScript | bsd | 1,448 |
/**
*
* Created by Song,Yewen, 9/9/2011 2:56:38 PM
*
*/
function validateVideoUrl(ori_url)
{
const URL_GET_XML = "%1/player_config.xml";
var html = download_page(ori_url);
var xml_url = strFormat(URL_GET_XML, ori_url)
if(!xml_url){
// Not Found
return 'NotFoundVideo';
}
var xml_str = download_page... | zy-code-unp | trunk/ku6/ku6downloader/js/cinemavip.js | JavaScript | bsd | 1,734 |
/**
*
* Created by Pan,hongxue, 9/19/2011 6:46:17 PM
*
*/
/* http://yule.iqiyi.com/20111227/df9cfdc80292e04d.html */
function validateVideoUrl(ori_url)
{
var html = download_page(ori_url);
var matches = html.match(/videoId : "(.*?)"/);
if (!matches) {
// Not Found
return 'NotFoundVideo';
... | zy-code-unp | trunk/ku6/ku6downloader/js/qiyi.js | JavaScript | bsd | 2,165 |
/**
*
* Created by Song,YeWen, 9/15/2011 1:29:12 PM
*
*/
function validateVideoUrl(ori_url)
{
//We use a fake constant duration for m1905.com, because it is Trailer, not long duration video
//TODO: FIXME, parse: "Runtime: <strong>6m 28s</strong><br />"
var fcduration = '100';
var html = download_... | zy-code-unp | trunk/ku6/ku6downloader/js/tubeislam.js | JavaScript | bsd | 960 |
/**
*
* Created by Song, YeWen, 1/19/2012 4:35:20 PM
*
*/
var XBK_FLV = "xbk_flv";
var CCTV = "cctv";
var XBK_MP4 = "xbk_mp4";
var XIYOU = "xiyou";
function get3ByteNumberString(param1)
{
if (param1 < 10)
{
return "00" + param1;
}// end if
if (param1 < 100)
{
return "0" + ... | zy-code-unp | trunk/ku6/ku6downloader/js/cntv.js | JavaScript | bsd | 5,363 |
/**
*
* Created by Pan,hongxue, 9/16/2011 11:29:02 AM
* Enhanced by Song, YeWen, 11/2/2011 11:14:23 AM
*
*/
function validateVideoUrl(ori_url)
{
var html = download_page(ori_url,'GBK');
var matches = html.match(/[_]?vid\s*=\s*"(\d+)"/);
if (!matches) {
// Not Found
matches = html.match(/[_]?v... | zy-code-unp | trunk/ku6/ku6downloader/js/sohu.js | JavaScript | bsd | 2,223 |
/**
*
* Created by Song,YeWen, 10/9/2011 11:47:42 AM
*
*/
function validateVideoUrl(ori_url)
{
//We use a fake constant duration for joy.cn, because it is short News/Entertainment, not long duration video
//TODO: FIXME
var fcduration = '100';
var html = download_page(ori_url);
var matches = html.m... | zy-code-unp | trunk/ku6/ku6downloader/js/joy.js | JavaScript | bsd | 1,656 |
/**
*
* Created by Song, YeWen, 1/18/2012 5:31:45 PM
*
*/
function validateVideoUrl(ori_url)
{
//FIXME:
var fcduration = 100;
var html = download_page(ori_url);
var media_string = copyBetween(html, "mms://", "\r\n");
if (media_string.length < 1)
return 'NotFoundVideo';
media_string = "mms://" + m... | zy-code-unp | trunk/ku6/ku6downloader/js/xinhuanet.js | JavaScript | bsd | 1,029 |
/**
*
* Created by Pan,hongxue, 9/19/2011 6:46:17 PM
* Copied from qiyi.com on 12/28/2011 6:15:37 PM
*
*/
/* http://yule.iqiyi.com/20111227/df9cfdc80292e04d.html */
function validateVideoUrl(ori_url)
{
var html = download_page(ori_url);
var matches = html.match(/videoId : "(.*?)"/);
if (!matches)... | zy-code-unp | trunk/ku6/ku6downloader/js/iqiyi.js | JavaScript | bsd | 2,215 |
/**
*
* Created by Song,YeWen, 9/18/2011 9:15:05 PM
*
*/
function validateVideoUrl(ori_url)
{
//We use a fake constant duration for video.ca, because it is short UGC, not long duration video
//TODO: FIXME
var fcduration = '100';
const URL_GET_FLV = 'http://www.video.ca/media/video/%1.flv';
var html... | zy-code-unp | trunk/ku6/ku6downloader/js/videoca.js | JavaScript | bsd | 1,346 |
/**
*
* Created by Song,YeWen, 1/17/2012 8:50:58 PM
*
*/
var base64DecodeChars = new Array( - 1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, -1, 62, -1, -1, -1, 63, 52, 53, 54, 55, 56, 57, 58, 59... | zy-code-unp | trunk/ku6/ku6downloader/js/hihour.js | JavaScript | bsd | 2,515 |
/**
*
* Created by Song, YeWen, 10/10/2011 6:20:17 PM
*
*/
function validateVideoUrl(ori_url)
{
//We use a fake constant duration for mtime.com, because it is Movie trailer, not long duration video
//TODO: FIXME
var fcduration = '100';
var html = download_page(ori_url);
var matches = html.match(/... | zy-code-unp | trunk/ku6/ku6downloader/js/mtime.js | JavaScript | bsd | 1,548 |
/**
*
* Created by Song,Yewen, 9/9/2011 2:02:03 PM
*
*/
function validateVideoUrl(ori_url)
{
//We use a fake constant duration for gametrailers.com, because it is Game trailer, not long duration video
//TODO: FIXME
var fcduration = '100';
var html = download_page(ori_url);
var result_url = copyBet... | zy-code-unp | trunk/ku6/ku6downloader/js/gametrailers.js | JavaScript | bsd | 1,390 |
/**
*
* Created by Song,YeWen, 10/10/2011 6:02:13 PM
*
*/
function validateVideoUrl(ori_url)
{
//We use a fake constant duration for v1.com, because it is News, not long duration video
//TODO: FIXME
var fcduration = '100';
var html = download_page(ori_url);
var matches = html.match(/{id:"(\d+... | zy-code-unp | trunk/ku6/ku6downloader/js/v1.js | JavaScript | bsd | 2,306 |
/**
*
* Created by Pan,hongxue, 9/14/2011 4:02:21 PM
*
*/
function validateVideoUrl(ori_url)
{
//We use a fake constant duration for yinyuetai.com, because it is MTV, not long duration video
//TODO: FIXME
var fcduration = '100';
var html = download_page(ori_url);
var matches = html.match(/var vi... | zy-code-unp | trunk/ku6/ku6downloader/js/yinyuetai.js | JavaScript | bsd | 2,054 |
/**
*
* Created by Song,YeWen, 10/9/2011 11:47:42 AM
*
*/
function replaceSlash(_arg1) {
while (_arg1.indexOf("\\") != -1) {
_arg1 = _arg1.replace("\\", "/");
};
return (_arg1);
}
function newUrlCdn(_arg1) {
var _local2 = replaceSlash(_arg1);
var _local3 = Math.floor((parseInt(_local2.charAt((_local2.lastIn... | zy-code-unp | trunk/ku6/ku6downloader/js/ifeng.js | JavaScript | bsd | 2,997 |
VPATH=.
CC=gcc
CXX=g++
#CFLAGS=-Wall -g -O2 -D_DEBUG -Iinclude/
CFLAGS=-Wall -g -O2 -Iinclude/
LDFLAGS=-L./lib
DEPLIBS= -lv8 -lcurl -lrtmp -lssh2 -lssl -lcrypto -lidn -lldap -lrt -lz -ldl -lpthread -luuid
TARGET=ku6downloader
all:$(TARGET)
OBJS=JSDownloader_New.o block_queue.o hash.o thread_pool.o mem_pool.o
$(T... | zy-code-unp | trunk/ku6/ku6downloader/Makefile | Makefile | bsd | 797 |
#include <stdio.h>
#include <stdlib.h>
#include <pthread.h>
#include "mem_pool.h"
static pthread_key_t key;
//mem pool for per thread
static pool_t **pools;
static int pool_num;
// MUST be called firstly
int thread_key_create(void (*destructor)(void*))
{
return pthread_key_create(&key,destructor);
}
int thr... | zy-code-unp | trunk/ku6/ku6downloader/thread_pool.c | C | bsd | 1,918 |
#!/bin/bash
FILE=$1
exec_do()
{
echo "" > /data/work/workspace/suitang/log/${vid}
if [ -e /data/work/workspace/suitang/qq/${name}.mp4 ] ; then
echo "${name} has download"
return
fi
echo "/home/zy/zy-code-unp/ku6/ku6downloader/ku6downloader_g -i /home/zy/zy-code-unp/ku6/ku6downloader/js/ -r url=http://v... | zy-code-unp | trunk/ku6/ku6downloader/suitang.sh | Shell | bsd | 793 |
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
#include "mem_pool.h"
int main(int argc , char * argv[]){
pool_t *pool = create_pool(500);
printf("pool max:%ld size:%ld\n",pool->max,(pool->d.end - pool->d.last));
char * m = pool_calloc(pool,30);
strcpy(m,"abcdef");
//memset(m,0,30);
p... | zy-code-unp | trunk/ku6/ku6downloader/include/testmem.c | C | bsd | 726 |
#ifndef __STDC_HEADERS_H
#define __STDC_HEADERS_H
/***************************************************************************
* _ _ ____ _
* Project ___| | | | _ \| |
* / __| | | | |_) | |
* | (__| |_| ... | zy-code-unp | trunk/ku6/ku6downloader/include/curl/stdcheaders.h | C | bsd | 1,330 |
#ifndef __CURL_CURL_H
#define __CURL_CURL_H
/***************************************************************************
* _ _ ____ _
* Project ___| | | | _ \| |
* / __| | | | |_) | |
* | (__| |_| | _ <... | zy-code-unp | trunk/ku6/ku6downloader/include/curl/curl.h | C | bsd | 81,593 |
#ifndef __CURL_EASY_H
#define __CURL_EASY_H
/***************************************************************************
* _ _ ____ _
* Project ___| | | | _ \| |
* / __| | | | |_) | |
* | (__| |_| | _ <... | zy-code-unp | trunk/ku6/ku6downloader/include/curl/easy.h | C | bsd | 3,472 |
#ifndef __CURL_MULTI_H
#define __CURL_MULTI_H
/***************************************************************************
* _ _ ____ _
* Project ___| | | | _ \| |
* / __| | | | |_) | |
* | (__| |_| | _... | zy-code-unp | trunk/ku6/ku6downloader/include/curl/multi.h | C | bsd | 12,981 |
#ifndef __CURL_CURLRULES_H
#define __CURL_CURLRULES_H
/***************************************************************************
* _ _ ____ _
* Project ___| | | | _ \| |
* / __| | | | |_) | |
* | (__| ... | zy-code-unp | trunk/ku6/ku6downloader/include/curl/curlrules.h | C | bsd | 8,901 |
/* include/curl/curlbuild.h. Generated from curlbuild.h.in by configure. */
#ifndef __CURL_CURLBUILD_H
#define __CURL_CURLBUILD_H
/***************************************************************************
* _ _ ____ _
* Project ___| | | | _ \| |
* ... | zy-code-unp | trunk/ku6/ku6downloader/include/curl/curlbuild.h | C | bsd | 7,063 |
#ifndef __CURL_TYPECHECK_GCC_H
#define __CURL_TYPECHECK_GCC_H
/***************************************************************************
* _ _ ____ _
* Project ___| | | | _ \| |
* / __| | | | |_) | |
* ... | zy-code-unp | trunk/ku6/ku6downloader/include/curl/typecheck-gcc.h | C | bsd | 36,048 |
#ifndef __CURL_CURLVER_H
#define __CURL_CURLVER_H
/***************************************************************************
* _ _ ____ _
* Project ___| | | | _ \| |
* / __| | | | |_) | |
* | (__| |_| ... | zy-code-unp | trunk/ku6/ku6downloader/include/curl/curlver.h | C | bsd | 2,741 |
#ifndef __CURL_MPRINTF_H
#define __CURL_MPRINTF_H
/***************************************************************************
* _ _ ____ _
* Project ___| | | | _ \| |
* / __| | | | |_) | |
* | (__| |_| ... | zy-code-unp | trunk/ku6/ku6downloader/include/curl/mprintf.h | C | bsd | 2,790 |
#ifndef KU6_MEM_POOL_H
#define KU6_MEM_POOL_H 1
typedef struct pool_data_t {
char *end;
char *last;
struct pool_t *next;
size_t failed;
} pool_data_t;
typedef struct pool_large_t {
void *alloc;
struct pool_large_t *next;
} pool_large_t;
typede... | zy-code-unp | trunk/ku6/ku6downloader/include/mem_pool.h | C | bsd | 1,758 |
#ifndef RAPIDXML_UTILS_HPP_INCLUDED
#define RAPIDXML_UTILS_HPP_INCLUDED
// Copyright (C) 2006, 2009 Marcin Kalicinski
// Version 1.13
// Revision $DateTime: 2009/05/13 01:46:17 $
//! \file rapidxml_utils.hpp This file contains high-level rapidxml utilities that can be useful
//! in certain simple scenarios. The... | zy-code-unp | trunk/ku6/ku6downloader/include/rapidxml-1.13/rapidxml_utils.hpp | C++ | bsd | 3,539 |
#ifndef RAPIDXML_HPP_INCLUDED
#define RAPIDXML_HPP_INCLUDED
// Copyright (C) 2006, 2009 Marcin Kalicinski
// Version 1.13
// Revision $DateTime: 2009/05/13 01:46:17 $
//! \file rapidxml.hpp This file contains rapidxml parser and DOM implementation
// If standard library is disabled, user must provide implemen... | zy-code-unp | trunk/ku6/ku6downloader/include/rapidxml-1.13/rapidxml.hpp | C++ | bsd | 120,937 |
<html><head><style type="text/css">
body
{
font-family: sans-serif;
font-size: 90%;
margin: 8pt 8pt 8pt 8pt;
text-align: justify;
background-color: White;
}
h1 { font-weight: bold; text-align: left; }
h2 { font: 140% ... | zy-code-unp | trunk/ku6/ku6downloader/include/rapidxml-1.13/manual.html | HTML | bsd | 113,099 |
#ifndef RAPIDXML_ITERATORS_HPP_INCLUDED
#define RAPIDXML_ITERATORS_HPP_INCLUDED
// Copyright (C) 2006, 2009 Marcin Kalicinski
// Version 1.13
// Revision $DateTime: 2009/05/13 01:46:17 $
//! \file rapidxml_iterators.hpp This file contains rapidxml iterators
#include "rapidxml.hpp"
namespace rapidxml
{
... | zy-code-unp | trunk/ku6/ku6downloader/include/rapidxml-1.13/rapidxml_iterators.hpp | C++ | bsd | 4,092 |
#ifndef RAPIDXML_PRINT_HPP_INCLUDED
#define RAPIDXML_PRINT_HPP_INCLUDED
// Copyright (C) 2006, 2009 Marcin Kalicinski
// Version 1.13
// Revision $DateTime: 2009/05/13 01:46:17 $
//! \file rapidxml_print.hpp This file contains rapidxml printer implementation
#include "rapidxml.hpp"
// Only include streams ... | zy-code-unp | trunk/ku6/ku6downloader/include/rapidxml-1.13/rapidxml_print.hpp | C++ | bsd | 16,092 |
#include "rapidxml.hpp"
#include <iostream>
using namespace rapidxml;
using namespace std;
int main(int argc , char ** argv){
char txt[] = {"<html><head></head><body><form action=\"\"><input name=\"\" type=\"text\" /><input type=\"submit\"/></form></body></html>"};
/*memset(txt,0,1024);
memcpy(txt... | zy-code-unp | trunk/ku6/ku6downloader/include/rapidxml-1.13/t.cpp | C++ | bsd | 1,332 |
#include <string.h>
#include <stdio.h>
#include <stdlib.h>
#include "block_queue.h"
#include "hash.h"
int main(int argc ,char * argv[]){
char * name = "sohu.com";
unsigned int hashcode = (unsigned int)hash(name,strlen(name));
printf("hashcode:%d\n",hashcode);
hash_t *hash = hash_init(10);
... | zy-code-unp | trunk/ku6/ku6downloader/include/testhash.c | C | bsd | 1,243 |
// Copyright 2010 the V8 project authors. All rights reserved.
// Redistribution and use in source and binary forms, with or without
// modification, are permitted provided that the following conditions are
// met:
//
// * Redistributions of source code must retain the above copyright
// notice, this list of ... | zy-code-unp | trunk/ku6/ku6downloader/include/v8/v8-testing.h | C++ | bsd | 3,384 |
// Copyright 2010 the V8 project authors. All rights reserved.
// Redistribution and use in source and binary forms, with or without
// modification, are permitted provided that the following conditions are
// met:
//
// * Redistributions of source code must retain the above copyright
// notice, this list of ... | zy-code-unp | trunk/ku6/ku6downloader/include/v8/v8stdint.h | C | bsd | 2,120 |
// Copyright 2010 the V8 project authors. All rights reserved.
// Redistribution and use in source and binary forms, with or without
// modification, are permitted provided that the following conditions are
// met:
//
// * Redistributions of source code must retain the above copyright
// notice, this list of ... | zy-code-unp | trunk/ku6/ku6downloader/include/v8/v8-profiler.h | C++ | bsd | 16,150 |
// Copyright 2008 the V8 project authors. All rights reserved.
// Redistribution and use in source and binary forms, with or without
// modification, are permitted provided that the following conditions are
// met:
//
// * Redistributions of source code must retain the above copyright
// notice, this list of ... | zy-code-unp | trunk/ku6/ku6downloader/include/v8/v8-debug.h | C++ | bsd | 14,677 |
// Copyright 2011 the V8 project authors. All rights reserved.
// Redistribution and use in source and binary forms, with or without
// modification, are permitted provided that the following conditions are
// met:
//
// * Redistributions of source code must retain the above copyright
// notice, this list of ... | zy-code-unp | trunk/ku6/ku6downloader/include/v8/v8-preparser.h | C++ | bsd | 4,623 |
// Copyright 2011 the V8 project authors. All rights reserved.
// Redistribution and use in source and binary forms, with or without
// modification, are permitted provided that the following conditions are
// met:
//
// * Redistributions of source code must retain the above copyright
// notice, this list of ... | zy-code-unp | trunk/ku6/ku6downloader/include/v8/v8.h | C++ | bsd | 133,712 |