Skip to content
This repository was archived by the owner on Aug 31, 2021. It is now read-only.
This repository was archived by the owner on Aug 31, 2021. It is now read-only.

repush: uppercase extension PDF does not work #21

Open

Description

@karenerobinson

I said this elsewhere, but thank you for this script.

I have it working to send pdf files from my mac to my tablet, and I'm very happy about that.
I can't send epub files, per #14 (which is fine with me)

Also, I can only send files that are .pdf, not .PDF.
if I send a .PDF file, a blank pdf is created in the root directory on reMarkable with the lower-case filename, and the script seems caught in an infinite loop.

Likely this should be caught by the error-catching code that I removed on my machine since my grep does not have -P

#  elif [ -z $is_directory ] && ! echo "$1" | grep -qP "\.pdf$" && ! echo "$1" | grep -qP "\.epub$" ; then
#    echo "repush: File extension invalid or missing: $1"
#    return 0

The first thing I tried was naively rewriting the above to only check for "pdf" (since I disabled the epub issue to get up and running on a mac with no -P option in grep)

    # added by krobinso
  elif [ -z $is_directory ] && ! echo "$1" | grep -q ".pdf" && ! echo "$1"; then
    echo "repush: File extension invalid or missing: $1"
    return 0
    # end addition
#  elif [ -z $is_directory ] && ! echo "$1" | grep -qP "\.pdf$" && ! echo "$1" | grep -qP "\.epub$" ; then
#    echo "repush: File extension invalid or missing: $1"
#    return 0
#******

The result of this is somewhat interesting: when I send a file like filename.PDF,

  • the script echos the filename
  • a blank file filename.pdf (all lower case) is created on the reMarkable
  • the reMarkable wifi disconnects. It needs restarting, and then I have to go enable the webui again.

Activity

  1. vdrummer commented on Jan 6, 2020

    @vdrummer
    Contributor

    Perl regexes are not needed here, so I just removed the -P and added case insensitivity. I could only test it on 1.7, though.

  2. karenerobinson commented on Jan 14, 2020

    @karenerobinson
    Author

    Thanks, this renders my edits unnecessary, I can push .pdf files now.
    my reMarkable says it's on on 2.0.2.0.
    bash is 3.2.57(1)-release

    for what it's worth I still can't push .PDF files: I try to push schematiccap.PDF and I get a blank file on the remarkable called schematiccap.pdf (it appears, it has a cloud-download icon, then it gets a checkmark - so I assume it finishes). But the repush.sh script never finishes, I eventually ctrl-C to exit it.

    KER-MBP-6:Downloads$ echo "${BASH_VERSION}"
    3.2.57(1)-release
    KER-MBP-6:host$ ls sch*
    schematic.pdf		schematiccap.PDF
    
    
    KER-MBP-6:host$ bash repush.sh schematiccap.PDF 
    ^C
    KER-MBP-6:host$ bash repush.sh schematic.pdf 
    schematic.pdf                                                                                     100%   31KB   3.8MB/s   00:00    
    Exit request sent.
    repush: Successfully transferred 1 out of 1 files
    

    IMG_10201

  3. vdrummer commented on Jan 14, 2020

    @vdrummer
    Contributor

    I just tried again with 1.7. The name on my device has an uppercase suffix (-> ".PDF"). Maybe 2.0 changes suffixes to lower case. If that's the case, the script wouldn't be able to leave the loop in line 362.

    I don't have 2.0, so all I can do is guess, unfortunately. You could try changing the suffix of the name that is used internally to lowercase. That way, even if the web interface changes the case of the file name, repush won't get stuck.
    Just replace line 341 (the definition of placeholder_basename) with
    placeholder_basename="$(basename "$1" | sed 's/PDF$/pdf/')"

    If that actually solves the problem, I will write a more general version and submit yet another PR.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions