From 32deda57e0fdc353277cd927c355afccbcd03801 Mon Sep 17 00:00:00 2001 From: rmuxnet Date: Tue, 9 Jun 2026 00:56:27 +0200 Subject: [PATCH] refactor: reorganize into subdirs (config/ util/ http/ notifs/ queue/ integrations/ static/) --- Makefile | 51 +++++++++++++++++---------- config.c => config/config.c | 0 config.h => config/config.h | 0 handlers.c => http/handlers.c | 0 handlers.h => http/handlers.h | 0 http.c => http/http.c | 0 http.h => http/http.h | 0 server.c => http/server.c | 0 server.h => http/server.h | 0 discord.c => integrations/discord.c | 0 discord.h => integrations/discord.h | 0 jellyfin.c => integrations/jellyfin.c | 0 jellyfin.h => integrations/jellyfin.h | 0 notify.c => notifs/notify.c | 0 notify.h => notifs/notify.h | 0 iptv_api.c => queue/iptv_api.c | 0 iptv_api.h => queue/iptv_api.h | 0 queue.c => queue/queue.c | 0 queue.h => queue/queue.h | 0 buf.c => util/buf.c | 0 buf.h => util/buf.h | 0 json.c => util/json.c | 0 json.h => util/json.h | 0 23 files changed, 33 insertions(+), 18 deletions(-) rename config.c => config/config.c (100%) rename config.h => config/config.h (100%) rename handlers.c => http/handlers.c (100%) rename handlers.h => http/handlers.h (100%) rename http.c => http/http.c (100%) rename http.h => http/http.h (100%) rename server.c => http/server.c (100%) rename server.h => http/server.h (100%) rename discord.c => integrations/discord.c (100%) rename discord.h => integrations/discord.h (100%) rename jellyfin.c => integrations/jellyfin.c (100%) rename jellyfin.h => integrations/jellyfin.h (100%) rename notify.c => notifs/notify.c (100%) rename notify.h => notifs/notify.h (100%) rename iptv_api.c => queue/iptv_api.c (100%) rename iptv_api.h => queue/iptv_api.h (100%) rename queue.c => queue/queue.c (100%) rename queue.h => queue/queue.h (100%) rename buf.c => util/buf.c (100%) rename buf.h => util/buf.h (100%) rename json.c => util/json.c (100%) rename json.h => util/json.h (100%) diff --git a/Makefile b/Makefile index cf8bf8a..f6cd75d 100644 --- a/Makefile +++ b/Makefile @@ -1,16 +1,29 @@ CC = gcc -CFLAGS = -O2 -Wall -Wextra -I. -pthread +CFLAGS = -O2 -Wall -Wextra -pthread \ + -I. -Iconfig -Iutil -Ihttp -Inotifs -Iqueue -Iintegrations LDFLAGS = -pthread -lcurl TARGET = iptv-dl -SRCS = main.c config.c buf.c json.c http.c discord.c jellyfin.c \ - iptv_api.c queue.c notify.c handlers.c server.c -OBJS = $(SRCS:.c=.o) -# Install paths (override with: make install PREFIX=/usr/local) -PREFIX = /usr/local -BINDIR = $(PREFIX)/bin -SHAREDIR = $(PREFIX)/share/iptv-dl -SYSCONFDIR = /etc/iptv-downloader +SRCS = main.c \ + config/config.c \ + util/buf.c \ + util/json.c \ + http/http.c \ + http/server.c \ + http/handlers.c \ + notifs/notify.c \ + queue/iptv_api.c \ + queue/queue.c \ + integrations/discord.c \ + integrations/jellyfin.c + +OBJS = $(SRCS:.c=.o) + +# Install paths (override: make install PREFIX=/usr/local) +PREFIX = /usr/local +BINDIR = $(PREFIX)/bin +SHAREDIR = $(PREFIX)/share/iptv-dl +SYSCONFDIR = /etc/iptv-downloader all: $(TARGET) @@ -22,15 +35,17 @@ $(TARGET): $(OBJS) install: $(TARGET) install -d $(BINDIR) $(SHAREDIR) $(SYSCONFDIR) - install -m 755 $(TARGET) $(BINDIR)/iptv-dl - install -m 644 static/iptv.css $(SHAREDIR)/iptv.css - install -m 644 static/iptv.js $(SHAREDIR)/iptv.js - install -m 644 static/downloads.js $(SHAREDIR)/downloads.js - install -m 644 static/series_show.js $(SHAREDIR)/series_show.js - install -m 644 static/header.html $(SHAREDIR)/header.html - install -m 644 static/footer.html $(SHAREDIR)/footer.html - @echo "Installed. Create config at $(SYSCONFDIR)/config.json or ~/.iptv-downloader/config.json" - @echo "Run: $(BINDIR)/iptv-dl --dump-config (to see defaults)" + install -m 755 $(TARGET) $(BINDIR)/iptv-dl + install -m 644 static/iptv.css $(SHAREDIR)/iptv.css + install -m 644 static/iptv.js $(SHAREDIR)/iptv.js + install -m 644 static/downloads.js $(SHAREDIR)/downloads.js + install -m 644 static/series_show.js $(SHAREDIR)/series_show.js + install -m 644 static/header.html $(SHAREDIR)/header.html + install -m 644 static/footer.html $(SHAREDIR)/footer.html + @echo "" + @echo "Installed to $(BINDIR)/iptv-dl" + @echo "Create config at ~/.iptv-downloader/config.json or $(SYSCONFDIR)/config.json" + @echo "Run: iptv-dl --dump-config (to see active defaults)" clean: rm -f $(OBJS) $(TARGET) diff --git a/config.c b/config/config.c similarity index 100% rename from config.c rename to config/config.c diff --git a/config.h b/config/config.h similarity index 100% rename from config.h rename to config/config.h diff --git a/handlers.c b/http/handlers.c similarity index 100% rename from handlers.c rename to http/handlers.c diff --git a/handlers.h b/http/handlers.h similarity index 100% rename from handlers.h rename to http/handlers.h diff --git a/http.c b/http/http.c similarity index 100% rename from http.c rename to http/http.c diff --git a/http.h b/http/http.h similarity index 100% rename from http.h rename to http/http.h diff --git a/server.c b/http/server.c similarity index 100% rename from server.c rename to http/server.c diff --git a/server.h b/http/server.h similarity index 100% rename from server.h rename to http/server.h diff --git a/discord.c b/integrations/discord.c similarity index 100% rename from discord.c rename to integrations/discord.c diff --git a/discord.h b/integrations/discord.h similarity index 100% rename from discord.h rename to integrations/discord.h diff --git a/jellyfin.c b/integrations/jellyfin.c similarity index 100% rename from jellyfin.c rename to integrations/jellyfin.c diff --git a/jellyfin.h b/integrations/jellyfin.h similarity index 100% rename from jellyfin.h rename to integrations/jellyfin.h diff --git a/notify.c b/notifs/notify.c similarity index 100% rename from notify.c rename to notifs/notify.c diff --git a/notify.h b/notifs/notify.h similarity index 100% rename from notify.h rename to notifs/notify.h diff --git a/iptv_api.c b/queue/iptv_api.c similarity index 100% rename from iptv_api.c rename to queue/iptv_api.c diff --git a/iptv_api.h b/queue/iptv_api.h similarity index 100% rename from iptv_api.h rename to queue/iptv_api.h diff --git a/queue.c b/queue/queue.c similarity index 100% rename from queue.c rename to queue/queue.c diff --git a/queue.h b/queue/queue.h similarity index 100% rename from queue.h rename to queue/queue.h diff --git a/buf.c b/util/buf.c similarity index 100% rename from buf.c rename to util/buf.c diff --git a/buf.h b/util/buf.h similarity index 100% rename from buf.h rename to util/buf.h diff --git a/json.c b/util/json.c similarity index 100% rename from json.c rename to util/json.c diff --git a/json.h b/util/json.h similarity index 100% rename from json.h rename to util/json.h