summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--Makefile5
-rw-r--r--README.md37
-rw-r--r--db-setup.sql12
3 files changed, 34 insertions, 20 deletions
diff --git a/Makefile b/Makefile
index 846d202..c8b28bd 100644
--- a/Makefile
+++ b/Makefile
@@ -9,12 +9,13 @@ INSTALL_PROGRAM=install
INSTALL_DATA=install -m 644
CFLAGS=-Wall -Wextra -O3 -ggdb
+LIBS=-lsqlite3
BIN=myal
all: $(BIN)
myal: $(SRCDIR)/main.c
- $(CC) $(CFLAGS) $(SRCDIR)/main.c -o myal
+ $(CC) $(CFLAGS) $(LIBS) $(SRCDIR)/main.c -o myal
install:
$(INSTALL_PROGRAM) myal $(PREFIX)$(BINDIR)/myal
@@ -22,5 +23,5 @@ install:
clean:
$(RM) myal
-distclean: clean
+uninstall:
$(RM) /usr/local/bin/myal
diff --git a/README.md b/README.md
index 3cc04ad..65914da 100644
--- a/README.md
+++ b/README.md
@@ -1,33 +1,34 @@
# myal - My Anime Library
-My Anime Library is a cli-tool written in C to manage an anime watchlist.
+My Anime Library is a cli-tool written in C to manage an anime and manga list.
I used to track which anime I have watched and what episode I'm on by writing in
a text file, which got annoying after a while.
-This is why I created a simple program to quickly search and change a
-csv file.
+This is why I created this tool to keep anime and manga organized in a sqlite3
+database.
Is it a complete overkill to write this in C? Yes
-Could this have been a simple bash script? Definitely
-
But why not? I wanted some practice with C, so if you see any glaring errors or
-unsafe code feel free to point it out and roast me.
-
-This cli-tool works with csv files in the format
-
-name,episode,status
+unsafe code feel free to point it out and roast me.
-For example:
+You need a database with tables `anime` and `manga`. Attached in this repo
+is a setup script for the database. Simply execute
+```
+sqlite3 <db-setup.sql
+```
-Samurai Champloo,14,watching
-Bakemonogatari,0,done
-Steins; Gate,1,watching
+This will create the following tables:
+anime(ID integer pk, NAME text, EPISODE text, STATUS text)
+manga(ID integer pk, NAME text, CHAPTER text, STATUS text)
-and so on. If I'm done watching a series, the episode is set to '0'.
+Chapters and episodes are stored as text, because sometimes the chapter isn't
+just a number but rather in the form "Volume 6 Chapter 4", shortened to "V6CH4".
+When I'm done with an anime or manga, I set the episode or chapter to 0 and set
+the status to "done".
-You need to set the filepath to your csv in the main.c, but everything else
+You need to set the filepath to your db-file in the main.c, but everything else
should work out of the box.
The Makefile uses clang, because that's what I prefer, but you can change it
to gcc in the second line. Or you could simply do
```
-gcc -o myal main.c
-``` \ No newline at end of file
+gcc -o myal main.c -lsqlite3
+```
diff --git a/db-setup.sql b/db-setup.sql
new file mode 100644
index 0000000..1d69989
--- /dev/null
+++ b/db-setup.sql
@@ -0,0 +1,12 @@
+CREATE TABLE anime(
+ ID INTEGER PRIMARY NOT NULL AUTOINCREMENT,
+ NAME TEXT NOT NULL,
+ EPISODE TEXT NOT NULL,
+ STATUS TEXT NOT NULL);
+
+CREATE TABLE manga(
+ ID INTEGER PRIMARY NOT NULL AUTOINCREMENT,
+ NAME TEXT NOT NULL,
+ CHAPTER TEXT NOT NULL,
+ STATUS TEXT NOT NULL);
+