aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--makefile6
-rw-r--r--musicopy.c16
-rw-r--r--readme.md38
3 files changed, 56 insertions, 4 deletions
diff --git a/makefile b/makefile
index 37f7b82..83107d1 100644
--- a/makefile
+++ b/makefile
@@ -1,15 +1,15 @@
CC = gcc
LD = gcc
RM = rm -f
-CFLAGS =
+CFLAGS = -lcwalk
SOURCES := $(wildcard *.c)
OBJECTS := $(patsubst %.c,%.o, $(SOURCES))
all: musicopy
-voerbak: $(OBJECTS)
- $(CC) $(OBJECTS) -o musicopy
+musicopy: $(OBJECTS)
+ $(CC) -static $(OBJECTS) $(CFLAGS) -o musicopy
clean:
$(RM) musicopy
diff --git a/musicopy.c b/musicopy.c
index 29fda6e..2e63ae7 100644
--- a/musicopy.c
+++ b/musicopy.c
@@ -1,6 +1,20 @@
#include <stdio.h>
+#include <string.h>
+#include <stdlib.h>
+#include <ini.h>
+#include <cwalk.h>
int main() {
- printf("Hello World!\n");
+ char* home = getenv("HOME");
+ if(!home) {
+ printf("$HOME could not be read! exiting...\n");
+ exit(1);
+ }
+ char* config_file_loc = ".config/musicopy/rc.ini";
+ size_t config_path_size = (strlen(home) + strlen(config_file_loc) + 4) * sizeof(char);
+ char* config_path = malloc(config_path_size);
+ cwk_path_join(home, config_file_loc, config_path, config_path_size);
+
+ printf("%s\n", config_path);
return 0;
}
diff --git a/readme.md b/readme.md
new file mode 100644
index 0000000..dc019d0
--- /dev/null
+++ b/readme.md
@@ -0,0 +1,38 @@
+# musicopy
+
+a simple utility that copies music and playlists from a folder to another folder
+
+## 'amazing' features:
+
+- glob include/exclude patterns
+- doesn't copy existing files
+- multiple different configuration sections for different media players or libraries
+- stores a copy of your playlist to merge differences created on another media player
+
+## dependencies
+
+- [inih](https://github.com/benhoyt/inih)
+- [cwalk](https://github.com/likle/cwalk)
+
+## config file
+
+the config file is in ini format. here's the options:
+
+```rc
+[default]
+music_dir = ~/music
+playlist_dir = ~/playlists
+
+exclude = junk/**
+ i don't like this music/**
+
+# include = folders to include/**
+
+# don't copy existing files
+# lazy = only check file size
+# full = compare sha1 hash
+# none = blindly overwrite files
+existing = lazy
+
+```
+