Skip to content

Commit

Permalink
Merge branch 'master' of https://github.com/2mol/pboy
Browse files Browse the repository at this point in the history
  • Loading branch information
2mol committed May 25, 2018
2 parents 5f52ba5 + 68c6c64 commit df60340
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 10 deletions.
11 changes: 6 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,13 @@

![import screen](https://raw.githubusercontent.com/2mol/pboy/master/doc/import.png)

Born out of my frustration that
PaperBoy is a small .pdf management utility.

* Scientific papers generally have the most useless file names. What was `PFP_JFP06.pdf` or `1803.05316.pdf` again?
* My download folder is dump of those documents, as well as `omg%20cutesnowleopard.png`, `DXOpsCwX0AA3JXi.jpeg`, `David\ Lynch Teaches\ Typing.zip`, and about a hundred other files like that.
* I have zero desire manually 1) crawl through that mess of a folder, 2) open the .pdfs to find out what's in them, 3) decide which ones I want to keep, 4) think of a filename, 5) rename it, and 6) move it to some precious library folder.
It is borne out of the frustration that most documents you download have pretty useless file names.

* My download folder is dump of those documents like `PFP_JFP06.pdf` or `1803.05316.pdf`, mixed in with `omg%20cutesnowleopard.png`, `DXOpsCwX0AA3JXi.jpeg`, `David\ Lynch Teaches\ Typing.zip`, and about a hundred other files like that.
* I have zero desire to manually 1) crawl through that mess of a folder, 2) open the .pdfs to find out what's in them, 3) decide which ones I want to keep, 4) think of a filename, 5) rename it, and 6) move it to some precious library folder.

Well, `paperboy` helps to rename those files without too much fuss. It will rename/move files to a specified specified folder, and it even gives some suggestions for the filename by looking at the file metadata and the content.

Paperboy aims to keep its file management dumb (no keeping files in a database or hidden library folder), so you can uninstall it at any time and your files will remain perfectly accessible.
Paperboy aims to keep its file management dumb (no keeping files in a database or hidden library folder), so you can uninstall it at any time and your files will remain perfectly accessible.
11 changes: 7 additions & 4 deletions app/UI.hs
Original file line number Diff line number Diff line change
Expand Up @@ -168,19 +168,22 @@ drawUI s =

handleEvent :: State -> BrickEvent Name Event -> EventM Name (Next State)
handleEvent s (VtyEvent e) =
let
focus = F.focusGetCurrent (s ^. focusRing)
in
case e of
V.EvKey (V.KChar 'c') [V.MCtrl] -> halt s

V.EvKey (V.KChar '\t') [] ->
continue $ s & focusRing %~ F.focusNext

V.EvKey V.KEsc [] ->
continue $ s & focusRing .~ initFocus & fileImport .~ fileImportInit
if elem focus (Just <$> [Inbox, Library])
then halt s
else
continue $ s & focusRing .~ initFocus & fileImport .~ fileImportInit

_ ->
let
focus = F.focusGetCurrent (s ^. focusRing)
in
case focus of
Just Library ->
handleLibraryEvent s e
Expand Down
2 changes: 1 addition & 1 deletion src/Lib.hs
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@ fileNameSuggestions config filePath = do
cleanFileName : maybeTitle : topContent
& Maybe.catMaybes

pure $ baseName :| take 4 (List.nub suggestions)
pure $ baseName :| take 5 (List.nub suggestions)

lengthCheck :: Text -> Bool
lengthCheck t = T.length t >= 3 && T.length t <= 64
Expand Down

0 comments on commit df60340

Please sign in to comment.