Package: library2notion
library2notionA tool to create a library on Notion with all your books (digital or not) in order to make it easier to find them, add comments, priorities, filter by type or category and keep track of read ones.Main features:Detects all digital books from a given path and all the subfolders.Adds, updates or deletes entries on Notion DB to match the status of the local folder.Possibility to create a simple .paper file to add non-digital to be tracked as well.Extracts metadata from .pdf and .epub files.InstallationUsing portable binaryDownload the latest binary release.WithHomebrew(Recommended for macOS)$brewinstallhelguera/tap/library2notionWithPIPX(Recommended for Linux & Windows)$pipxinstalllibrary2notionWith PIP$pipinstall--userlibrary2notionPython 3.7 or later required.From sourceThis project usespoetryfor dependency management and packaging. You will have to install it first. Seepoetry official documentationfor instructions.$gitclonehttps://github.com/helguera/library2notion.git
$cdlibrary2notion/
$poetryinstall
$poetryrunlibrary2notionUsage$ library2notion --help
usage: library2notion [-h] -p PATH [-l LOGFILEPATH] [-e EXTENSIONS [EXTENSIONS ...]] [-t NOTIONTOKEN] [-u NOTIONDBURL] [-f] [-o OUTPUTFOLDER]

library2notion created by Javier Helguera (github.com/helguera) © 2023 MIT License

general options:
  -p, --Path PATH                    Path where to start looking for books. It will also check all subfolders
  -t, --NotionToken NOTIONTOKEN      Notion token
  -d, --NotionDbId  NOTIONDBURL      Notion database id
  -f, --Formats     FORMATS          List of formats to be taken into account. At this moment .PDF, .EPUB and .PAPER are supported.
  -only_new,                         Only check new books
  -only_updated                      Only check changes in existing books (does not include removals)
  -only_deleted                      Only check deleted books
  -h, --help                         Show this help message and exitInput-p, --PathThe path where to look for files (and subfolders). It is higly recommended to use relative paths. This is really important since it will also be used to generate the tags of each book. (Take a look at "Metadata" section for further info).For example, if your library looks like:/home/your_user/Documents/books/Programming/Python
/home/your_user/Documents/books/Programming/C
/home/your_user/Documents/books/History/Spanish HistoryThey ideal way to proceed is, first, move tobooksfolder, since it is the common one for all books.cd /home/your_user/Documents/booksAnd from here, execute l2n with a relative path:library2notion -p "./"They way a book is uniquely identified is by using its path. This is important because the book./books/Programming/Python/PythonCookbookwill be treated as a different one from./Programming/Python/PythonCookbook.-t, --NotionTokenIt is the secret token from Notion when an itegration is created. Visitthe official docsfor further info. Don't forget togive your integration page permissions.-d, --NotionDbIdThe id of the Notion database where all info will be uploaded. This database has to exist in advance and the columns it needs to have are fixed andcan't be changed. These are:Column NameTypeFile NameTitleTitleTextPrioritySelectStatusSelectFormatMulti-selectTagsMulti-selectCommentsTextAuthorTextPublisherTextISBNTextTo get the database ID value, open the database as a full page in Notion. Use the Share menu to Copy link. Now paste the link in your text editor so you can take a closer look. The URL uses the following format:https://www.notion.so/{workspace_name}/{database_id}?v={view_id}-f, --FormatsThese are the formats that will be taken into account. At this moment,.epub, .pdf and .paperare supported and used by default.library2notion -f EPUB PAPER  -> only look for .epub and .paper files
library2notion -f PDF         -> only look for .pdf files-only_newChecks only new books that have been added to the path since the last execution. Skips updated and deleted ones.-only_updatedChecks only books that have been updated since the last execution. Skips new and deleted ones.-only_deletedChecks only books that have been deleted since the last execution. Skips new and updated ones.MetadataThe tool will extract the following data to upload to Notion:File Name: is the full path to the file. It is used as primary key of the table in Notion, so it can't be duplicated.Title: title of the book.Tags: the categories of the book. They are generated automatically from the path. For example, if the path is./Tech Books/Programming/Python/mybook.pdf, the tags will beTech Books,Programming,Python.Author: the author or authors of the book.Publisher: the publisher of the book.Formats: the available formats of the book. A book available in multiple formats will only appear once in the database.ISBN: the ISBN.Non-digital books (.paper)With update 0.2.0, the tool supports non-digital books. You just have to create a.paperfile in a folder per non-digital book that you want to add with the following content:{"Title":"","Author":"","Publisher":"","ISBN":""}Log FilesA log file will be created after each execution in folder./library2notion-logs. It will include info about created, updated and deleted books.ExamplesFirst exampleSecond exampleThird exampleGetting helpIf you found a bug or have a feature request, pleaseopen a new issue.If you have a question about the program or have difficulty using it, you are welcome tothe discussions page. You can also mail me directly atjavier@javierhelguera.com, I'm always happy to help.