refactor: reorganize into subdirs (config/ util/ http/ notifs/ queue/ integrations/ static/)
This commit is contained in:
@@ -0,0 +1,56 @@
|
||||
#pragma once
|
||||
#include <time.h>
|
||||
#include <pthread.h>
|
||||
|
||||
typedef struct {
|
||||
int active;
|
||||
int cancelled;
|
||||
char id[64];
|
||||
char name[256];
|
||||
char status[64];
|
||||
char cover_url[512];
|
||||
char url[512];
|
||||
char dest_dir[512];
|
||||
char filename[256];
|
||||
int is_movie;
|
||||
long downloaded;
|
||||
long total;
|
||||
time_t speed_ts;
|
||||
long speed_bytes;
|
||||
float speed_bps;
|
||||
} Download;
|
||||
|
||||
typedef struct {
|
||||
char url[512];
|
||||
char dest_dir[512];
|
||||
char filename[256];
|
||||
char name[256];
|
||||
char id[64];
|
||||
char cover_url[512];
|
||||
} DlTask;
|
||||
|
||||
typedef struct QNode { DlTask *task; struct QNode *next; } QNode;
|
||||
|
||||
extern Download g_downloads[/* MAX_DL */];
|
||||
extern int g_dl_count;
|
||||
extern pthread_mutex_t g_dl_mutex;
|
||||
|
||||
extern QNode *g_q_head;
|
||||
extern QNode *g_q_tail;
|
||||
extern pthread_mutex_t g_q_mutex;
|
||||
extern pthread_cond_t g_q_cond;
|
||||
|
||||
/* Enqueue a download; skips if file exists or already queued/downloading */
|
||||
void queue_download(const char *stream_id, const char *filename,
|
||||
const char *dest_dir, const char *name,
|
||||
int is_movie, const char *cover_url);
|
||||
|
||||
/* Worker thread entry point */
|
||||
void *dl_worker(void *arg);
|
||||
|
||||
/* History persistence */
|
||||
void history_save(void);
|
||||
void history_load(void);
|
||||
|
||||
/* Delete orphaned .part files from both dl dirs */
|
||||
void clean_partials(void);
|
||||
Reference in New Issue
Block a user