All Projects → agilecreativity → Ebook_renamer

agilecreativity / Ebook_renamer

Licence: mit
Rename multiple ebooks (pdf, epub, mobi) based on embedded meta-data.

Programming Languages

ruby
36898 projects - #4 most used programming language

Projects that are alternatives of or similar to Ebook renamer

Brotab
Control your browser's tabs from the command line
Stars: ✭ 137 (+448%)
Mutual labels:  automation, command-line
Qvplugin Command
在 Qv2ray 状态改变时运行指定的程序!
Stars: ✭ 41 (+64%)
Mutual labels:  automation, command-line
Elodie
An EXIF-based photo assistant, organizer, manager and workflow automation tool.
Stars: ✭ 840 (+3260%)
Mutual labels:  automation, command-line
Homebridge Garagedoor Command
Homebridge plugin to control a garage door using command line functions
Stars: ✭ 18 (-28%)
Mutual labels:  automation, command-line
Diffios
Cisco IOS diff tool
Stars: ✭ 23 (-8%)
Mutual labels:  automation
Webdriverio Jest
Example of a WebdriverIO test written with the Jest framework
Stars: ✭ 19 (-24%)
Mutual labels:  automation
Farmanager
File and Archive Manager
Stars: ✭ 898 (+3492%)
Mutual labels:  command-line
Mockup
Perspective app screens and isometric mock-up tool. Automated high quality, high resolution, marketing art designer for mockups. Written in minimalist Bash using ImageMagick and Love! [Application, Art]
Stars: ✭ 18 (-28%)
Mutual labels:  command-line
Awesome Hammerspoon
awesome configuration for Hammerspoon.
Stars: ✭ 928 (+3612%)
Mutual labels:  automation
Home Assistant Config
Home Assistant config files, rewritten to use the latest features, 100+ documented automations, automatically generated ToC 🏠 🤖
Stars: ✭ 926 (+3604%)
Mutual labels:  automation
Pybotlib
Python Robotic Process Automation Library
Stars: ✭ 23 (-8%)
Mutual labels:  automation
Clifx
Declarative framework for building command line interfaces
Stars: ✭ 900 (+3500%)
Mutual labels:  command-line
Virtesk
An Open Source VDI management solution to allow running virtual desktops in a RHEV/Ovirt environment seamlessly
Stars: ✭ 23 (-8%)
Mutual labels:  automation
Aruba
Test command-line applications with Cucumber-Ruby, RSpec or Minitest. The most up to date documentation can be found on Cucumber.Pro (https://app.cucumber.pro/projects/aruba)
Stars: ✭ 900 (+3500%)
Mutual labels:  command-line
Vkb
Bot for vk.com competitions
Stars: ✭ 24 (-4%)
Mutual labels:  automation
Physics Command
Physics platform is a tool for hardware systems (e.g: raspberryPi 3B ). It retrieves data passing through the network and sends it to a control panel. It works the same way as a botnet by receiving remote commands. (you can imagine that as a black box)
Stars: ✭ 23 (-8%)
Mutual labels:  command-line
Go Git Cmd Wrapper
A simple wrapper around git command in Go.
Stars: ✭ 22 (-12%)
Mutual labels:  command-line
Mprislyrics
Small command-line utility that displays lyrics in sync with the currently playing song in a MPRIS2 capable player.
Stars: ✭ 24 (-4%)
Mutual labels:  command-line
Supreme
A command line visual file manager for linux
Stars: ✭ 22 (-12%)
Mutual labels:  automation
Automation Report
Automation report是一款可以解决很多行业领域中设涉及到报告生成的需求,本项目最开始的初衷是为公司内部简化人工流程的一个环节,主要实现目的是将实验室检测得出的下机数据结果与对应的报告模版批量结合生成报告(.pdf)。
Stars: ✭ 22 (-12%)
Mutual labels:  automation

ebook_renamer

Gem Version Dependency Status Code Climate

Bulk rename of ebook files (epub,mobi,pdf) using embedded meta-data (title, author(s)). This version depends on the opensource software called Calibre that comes with Calibre CLI which is very easy to install on OSX or Linux system.

Release based on Semantic Versioning version.

How the file is renamed

The file will be renamed using the following format <title>.by.<author(s)>.<extension>

Also the final file name will be sanitized e.g. any multiple occurence of special characters will be replace by given separator char (default to dot) .

For example if the ebook contain the title Start with Why: How Grate Leader Inspire Everyone to Take Action and the author is Simon Sinek then the default output will be Start.with.Why.How.Great.Leader.Inspire.Everyone.to.Take.Action.by.Simon.Sinek.pdf Note that the : and one space before the word How is replaced by one dot string.

If the --sep-string _ is used then the above output will be Start_with_Why_How_Great_Leader_Inspire_Everyone_to_Take_Action_by_Simon_Sinek.pdf.

What you will need

Alternatively if you are using Ubuntu try:

sudo apt-get install calibre calibre-bin

# check your installation
which ebook-meta #=> /usr/bin/ebook-meta

In particular the gem is looking for the ebook-meta binary in a path. If this is not installed the error will be raised.

Tips for OSX installation

If you install using the binary above you will need to create a symlink to the ebook-meta binary like the following:

# Assume that /usr/local/bin is in your $PATH varaiable
cd /usr/local/bin
sudo ln -fs /Applications/calibre.app/Contents/MacOS/ebook-meta /usr/local/bin/ebook-meta
source ~/.zshrc # or source ~/.bashrc
which ebook-meta

Installation and Usage:

gem install ebook_renamer

# Show the list of options
ebook_renamer

Usage/Synopsis

Usage:
  ebook_renamer

Options:
  -b, [--base-dir=BASE_DIR]              # Base directory
                                         # Default: . (current directory)
  -r, [--recursive], [--no-recursive]    # Search for files recursively
                                         # Default: --recursive
  -s, [--sep-string=SEP_STRING]          # Separator string between each word in output filename
                                         # Default: '_' (underscore)
  -d, [--downcase], [--no-downcase]      # Convert each word in the output filename to lowercase
                                         # Default: --no-downcase
  -t, [--capitalize], [--no-capitalize]  # Capitalize each word in the output filename
                                         # Default: --no-capitalize
  -c, [--commit], [--no-commit]          # Make your changes permanent
                                         # Default: --no-commit
  -v, [--version], [--no-version]        # Display version information

Rename multiple ebook files (pdf,epub,mobi) from a given directory

Quick Usage

The shortest command that you can run to rename files is

# This will rename any ebook files under the directory `~/Dropbox/ebooks`
# and any sub-directory for (*.epub, *.pdf, *.mobi) using the default settings
cd ~/Dropbox/ebooks
ebook_renamer --commit

To see what the result would be like without making any changes (dry-run)

cd ~/Dropbox/ebooks/
ebook_renamer --base-dir .

Should see the result like

-----------------------------------------------------------
 FYI: no changes as this is a dry-run, please use --commit
-----------------------------------------------------------
1 of 4 old name : ./demo1.pdf
1 of 4 new name : ./Fearless.Refactoring.by.Andrzej.Krzywda.pdf
2 of 4 old name : ./demo2.epub
2 of 4 new name : ./EPUB.3.0.Specification.by.EPUB.3.Working.Group.epub
3 of 4 old name : ./subdir/demo3.pdf
3 of 4 new name : ./subdir/Reliably.Deploying.Rails.Applications.by.Ben.Dixon.pdf
4 of 4 old name : ./subdir/demo4.epub
4 of 4 new name : ./subdir/EPUB.3.0.Specification.by.EPUB.3.Working.Group.epub

with --sep-string option

cd ~/Dropbox/ebooks/
ebook_renamer --base-dir . --sep-string _

should result in something like

-----------------------------------------------------------
 FYI: no changes as this is a dry-run, please use --commit
-----------------------------------------------------------
1 of 4 old name : ./demo1.pdf
1 of 4 new name : ./Fearless_Refactoring_by_Andrzej_Krzywda.pdf
2 of 4 old name : ./demo2.epub
2 of 4 new name : ./EPUB_3_0_Specification_by_EPUB_3_Working_Group.epub
3 of 4 old name : ./subdir/demo3.pdf
3 of 4 new name : ./subdir/Reliably_Deploying_Rails_Applications_by_Ben_Dixon.pdf
4 of 4 old name : ./subdir/demo4.epub
4 of 4 new name : ./subdir/EPUB_3_0_Specification_by_EPUB_3_Working_Group.epub

Detail Usage

Run the following command from the directory that contain the file(s) that you want to rename.

# Cd to the directory containing the file(s) you like to rename
cd ~/Dropbox/ebooks/

# Or specify the directory as an option from any where if you set appropriate
# version of ruby (e.g. rbenv local 2.1.1 or rvm use 2.1.1)
ebook_renamer --base-dir ~/Dropbox/ebooks/samples

# Run the command without making any changes to the files (dry-run) in the current directory
ebook_renamer --base-dir . --recursive

# Once you are happy with the result then
ebook_renamer --base-dir . --recursive --commit

# Or using the short version
ebook_renamer -b . -r -c

Misc Options

In addition to the above usage, you can also use the two new flags --downcase or --capitalize

# Lowercase each word in the result filename
ebook_renamer --base-dir . --sep-string '_' --recursive --downcase --commit

will produce the result filename like start_with_why_how_great_leader_inspire_everyone_to_take_action_by_simon_sinek.pdf.

# Capitalize each word in the result filename
ebook_renamer --base-dir . --sep-string '_' --recursive --capitalize --commit

will produce the result filename like Start_With_Why_How_Great_Leader_Inspire_Everyone_To_Take_Action_by_Simon_Sinek.pdf.

Alternative

  • Check out my other gem called ebooks_renamer which provides similar functionality but implemented in pure ruby.
  • ebooks_renamer does not rely on the external software like Calibre CLI to be install before use!

Contributing

  1. Fork it
  2. Create your feature branch (git checkout -b my-new-feature)
  3. Commit your changes (git commit -am 'Add some feature')
  4. Make sure that you add the tests and ensure that all tests are passed
  5. Push to the branch (git push origin my-new-feature)
  6. Create new Pull Request
Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].