Skip to content

Geremia/LibgenBulkUpload

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

14 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

LibgenBulkUpload

bulk upload files to https://library.bz/main/upload/

Usage

./upload.bash file_to_upload title language_code main_or_fiction

Specifying additional metadata

Example

isbn=9783868386066 authors='Feser, Edward' ./upload.bash Immortal_Souls.pdf 'Immortal Souls: A Treatise on Human Nature' eng main

Batch with GNU parallel

This GNU parallel command uploads (one-at-a-time) all the PDFs in the current directory, assigns their Libgen metadata author to the PDF filename (sans suffix), and sets the language to English:

parallel -j1 ./upload.bash {} {.} eng main ::: *.pdf

Metadata

The following metadata can be optionally passed as an environment variable to the script:

  • asin, authors, bookmarks, city, cleaned, colored, cover, ddc, description, doi, dpi, dpi_select, edition, file_commentary, file_source, file_source_issue, gb_id, isbn, issn, language, language_options, lbc, lcc, metadata_query, metadata_source, ol_id, page_orientation, pages, paginated, periodical, publisher, scan, series, sfearchable, tags, title, toc, topic, udc, volume, year

Calibre

If you export a CSV catalog from Calibre, you can use it with calibre.py to feed in the metadata for bulk book uploads, automatically.

Your Calibre catalog CSV file can have the following headings (in any order), including the custom ones (which begin with '#'):

  • #amazon, #doi, #google, #issn, #lcn, #pubyear, authors, comments, isbn, languages, publisher, series, series_index, tags, title

The specified "files to upload" directory is expected to contain symlinks to the files in your Calibre library.

To setup the symlinks, execute a command like this in your upload directory:

for i in `cat ../formats.txt`;
do
    find ~/Calibre\ Library/ -type f -iname "*.$i" -print0 | \
        xargs -0 -I{} sh -c 'filename=`basename "{}"`;
            random_part=$(mktemp -u XXXXXX);
            suffix=".${filename##*.}";
            newname="${filename%.*}-${random_part}${suffix}";
            ln -sv "{}" "$newname";'
done 

calibre.py is a similar script to the old upload.py Selenium script.