dmikoss / pdfbook-renamer

Simple utility for automatic renaming pdf book files with isbn information from google books
MIT License
3 stars 0 forks source link

Does not work for me (in Git Bash) #1

Closed JVariance closed 1 year ago

JVariance commented 1 year ago

Hi, I created a data folder, put my PDF files into it, but they don't get renamed. There is a folder "data;C" created by the script with no content.

dmikoss commented 1 year ago

Hi! You need to place your PDF files in the data folder located next to the Dockerfile. The files will be renamed if: 1) an ISBN is found in the PDF file (so raster (scanned) PDF files won't work) 2) information from the Google Books API is found based on the ISBN. image

What does the program output?

JVariance commented 1 year ago
$ docker build -t pdfbook-renamer . && docker run -it --rm -v "$(pwd)/data:/data" pdfbook-renamer:latest /app/pdfbook-renamer
[+] Building 10.2s (18/18) FINISHED
 => [internal] load build definition from Dockerfile                                                                                                                                         0.0s 
 => => transferring dockerfile: 32B                                                                                                                                                          0.0s 
 => [internal] load .dockerignore                                                                                                                                                            0.0s 
 => => transferring context: 2B                                                                                                                                                              0.0s 
 => [internal] load metadata for docker.io/library/alpine:latest                                                                                                                             1.6s 
 => [internal] load metadata for docker.io/library/golang:1.20.6-alpine3.18                                                                                                                  1.5s 
 => [stage-1 1/6] FROM docker.io/library/alpine:latest@sha256:7144f7bab3d4c2648d7e59409f15ec52a18006a128c733fcff20d3a4a54ba44a                                                               0.0s 
 => [build-stage 1/6] FROM docker.io/library/golang:1.20.6-alpine3.18@sha256:7839c9f01b5502d7cb5198b2c032857023424470b3e31ae46a8261ffca72912a                                                0.0s 
 => [internal] load build context                                                                                                                                                            8.5s 
 => => transferring context: 1.21GB                                                                                                                                                          8.4s 
 => CACHED [stage-1 2/6] RUN apk add --no-cache python3 py3-pip                                                                                                                              0.0s 
 => CACHED [stage-1 3/6] RUN pip install pypdf                                                                                                                                               0.0s 
 => CACHED [build-stage 2/6] WORKDIR /app                                                                                                                                                    0.0s 
 => CACHED [build-stage 3/6] COPY go.mod go.sum ./                                                                                                                                           0.0s 
 => CACHED [build-stage 4/6] RUN go mod download                                                                                                                                             0.0s 
 => CACHED [build-stage 5/6] ADD . ./                                                                                                                                                        0.0s 
 => CACHED [build-stage 6/6] RUN CGO_ENABLED=0 GOOS=linux go build -o /app/pdfbook-renamer ./cmd/pdfbook-renamer.go                                                                          0.0s 
 => CACHED [stage-1 4/6] COPY --from=build-stage ./app/pdfbook-renamer /app/                                                                                                                 0.0s 
 => CACHED [stage-1 5/6] COPY ./pdf-to-text.py /app/                                                                                                                                         0.0s 
 => CACHED [stage-1 6/6] WORKDIR /data                                                                                                                                                       0.0s 
 => exporting to image                                                                                                                                                                       0.0s 
 => => exporting layers                                                                                                                                                                      0.0s 
 => => writing image sha256:770ebe9d7f91cc141cc09910e994592ad3d9343ae3dd360e0bb6ee6711c7183f                                                                                                 0.0s 
 => => naming to docker.io/library/pdfbook-renamer                                                                                                                                           0.0s 

Use 'docker scan' to run Snyk tests against images to find vulnerabilities and learn how to fix them
docker: Error response from daemon: failed to create shim task: OCI runtime create failed: runc create failed: unable to start container process: exec: "C:/Program Files/Git/app/pdfbook-renamer": stat C:/Program Files/Git/app/pdfbook-renamer: no such file or directory: unknown.
JVariance commented 1 year ago

The PDF files aren't rasterized ☝🏼

JVariance commented 1 year ago

I run the command via Git Bash in VSCode.

dmikoss commented 1 year ago

Pls try command in Powershell. Git Bash not tested.

JVariance commented 1 year ago

I switched to Git Bash because PowerShell doesn't support the &&, but I used

docker build -t pdfbook-renamer .
docker run -it --rm -v "$(pwd)/data:/data" pdfbook-renamer:latest /app/pdfbook-renamer

instead in PowerShell and it works! 👍🏼

JVariance commented 1 year ago

And many thanks for this utility 🙌🏼

JVariance commented 1 year ago

Maybe you could add the code above to the README for PowerShell/Windows Users.