Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/mange/organ
Small app that move files around according to recipes
https://github.com/mange/organ
Last synced: 18 days ago
JSON representation
Small app that move files around according to recipes
- Host: GitHub
- URL: https://github.com/mange/organ
- Owner: Mange
- License: other
- Created: 2014-02-04T20:05:14.000Z (almost 11 years ago)
- Default Branch: master
- Last Pushed: 2014-02-04T20:05:22.000Z (almost 11 years ago)
- Last Synced: 2023-04-10T08:21:29.352Z (over 1 year ago)
- Language: Ruby
- Size: 117 KB
- Stars: 1
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# organ #
`organ` is a small command that moves around files according to a recipe that you write yourself.
It was written mostly to test out different approaches to object oriented CLI programs, but I found it useful enough to use it in a cronjob on my machine. I release this codebase in the hopes that it might help someone else.
## Usage ##
Write your own recipe and save it as `~/.organrc`. Here's one example recipe:
```ruby
#!/bin/env organ
# vi: ft=ruby
require 'pathname'library_base = Pathname.new "/home/shared/Library"
directory "#{ENV['HOME']}/Downloads" do
directory "Series" do
series = [
"Black Mirror",
"Robot Chicken",
"The Good Wife",
]
library = library_base.join "Series"series.each do |name|
match_episode name do |file|
file.move_to library.join(name, "Season #{file.season}")
end
endmatch_episode "The Killing" do |file|
file.move_to "/home/shared/Videos/Series/The Killing (2011)/Season #{file.season}"
end
enddirectory "Music" do
# ...
end
end
```The DSL is centered around matching files inside directories and then acting upon them. In the example above, `organ` would move episodes in "~/Downloads/Series" into their respective library locations. The episode matcher extracts season and episode number from the filename, so you can rename the files as well if you so wish.
## Developing ##
Install all dependencies with `bundle`. You can run tests by calling `bundle exec rspec`.
# License #
This code is public domain. Do with it as you wish!