-
- taglib_error = PyErr_NewException("flac_archive.taglib.error", 0, 0);
- if (taglib_error == 0) {
- return;
+ const char *mp3_path = argv[0];
+
+ char *image_bytes;
+ size_t image_len;
+ if (argc == 2) {
+ const char *image_path = argv[1];
+ int fd = open(image_path, O_RDONLY);
+ if (fd == -1) {
+ fprintf(stderr, "open(%s): %s\n", image_path, strerror(errno));
+ return 3;
+ }
+ struct stat st;
+ if (fstat(fd, &st) != 0) {
+ fprintf(stderr, "stat(%s): %s\n", image_path, strerror(errno));
+ return 3;
+ }
+ image_len = st.st_size;
+ image_bytes = (char *)malloc(image_len);
+ if (read(fd, image_bytes, image_len) != image_len) {
+ fprintf(stderr, "read(%s): %s\n", image_path, strerror(errno));
+ return 3;
+ }
+ } else {
+ fputs("not yet reading image from stdin\n", stderr);
+ return 3;