Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 9 additions & 6 deletions README.org
Original file line number Diff line number Diff line change
Expand Up @@ -13,12 +13,15 @@
- aria2 (recommended not required)

** Install
: cd ~/src
: git clone https://github.com/scottjad/cons.git
: ln -s ~/src/cons/cons ~/bin/cons # or add to PATH
: cp ~/src/cons/config.default ~/.cons_config.rb
: $EDITOR ~/.cons_config.rb # setup your apps
: mkdir ~/Desktop/cons # unless your library already exists
: $ cd ~/src
: $ git clone https://github.com/scottjad/cons.git
: $ cd cons
: $ gem build cons.gemspec
: $ su
: # gem install cons-<version>
: # exit
: $ cons config
: $ $EDITOR ~/.cons_config.rb # set up your apps

** Usage
| Task | Command |
Expand Down
62 changes: 61 additions & 1 deletion cons → bin/cons
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,65 @@

# see README.org for instructions

if (ARGV[0] == 'config')
if File.exists? configfile = File.join(Dir.home, '.cons_config.rb')
puts %Q{Your configuration file already exists: #{configfile}}
else
puts %Q{Creating configuration file: #{configfile}}
File.new(configfile, 'w')
File.open(configfile, 'w') do |f|
[
%q{LIBRARY_DIR = (ENV["CONS_LIBRARY_DIR"] or realpath "~/Desktop/cons/"},
%q{DOWNLOADER = "wget -c -P"},
%q{# DOWNLOADER = "aria2c -c -d"},
%q{YDL = "~/src/youtube-dl/youtube-dl -t -c --no-part"},
%q{PLAYBACK_SPEED = (ENV["CONS_PLAYBACK_SPEED"] or "1.0")},
%q{PDF_APP="xdg-open"},
%q{VIDEO_APP="mplayer -speed #{PLAYBACK_SPEED}"},
%q{AUDIO_APP="mplayer -speed #{PLAYBACK_SPEED}"},
%q{OTHER_APP="xdg-open"},
%q{# OTHER_APP="gnome-open"},
%q{UI_APP="dmenu -l 30 -b -i -nf '#888888' -nb '#222222' -sf '#ffffff' -sb 'MediumPurple3'"}
].each do |line|
f.puts line
end
end

if File.exists? configfile = File.join(Dir.home, '.cons_config.rb')
puts %Q{Success! Configuration file created: #{configfile}}
else
puts %Q{Error! Configuration file not created.}
end
end

desktopdir = File.join(Dir.home, 'Desktop')
if Dir.exists? desktopdir
puts %Q{Your desktop directory already exists: #{desktopdir}}
else
puts %Q{Creating desktop directory: #{desktopdir}}
Dir.mkdir desktopdir

if Dir.exists? desktopdir
puts %Q{Success! Desktop directory created: #{desktopdir}}
else
puts %Q{Error! Desktop directory not created.}
end
end

if Dir.exists? librarydir = File.join(desktopdir, 'cons')
puts %Q{Your library directory already exists: #{librarydir}}
else
puts %Q{Creating library directory: #{librarydir}}
Dir.mkdir librarydir

if Dir.exists? librarydir
puts %Q{Success! Library directory created: #{librarydir}}
else
puts %Q{Error! Library directory not created.}
end
end
else

# replaces ~ with full path
def realpath s
s.gsub /^~/, ENV["HOME"]
Expand All @@ -17,7 +76,7 @@ RETRY_FILE_PROCESSING = RETRY_FILE + "_PROCESSING"
LAST_FILE = realpath "~/.cons_last"
LIST_CACHE = realpath "~/.cons_list"
URLS_FILE = realpath "~/.cons_urls"
CONSUME_VERSION = "0.3.1"
CONSUME_VERSION = "0.3.2"

# load config
require realpath "~/.cons_config"
Expand Down Expand Up @@ -517,3 +576,4 @@ end

main

end
11 changes: 0 additions & 11 deletions config.default

This file was deleted.

30 changes: 30 additions & 0 deletions cons.gemspec
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
Gem::Specification.new do |s|
s.name = 'cons'
s.version = 0.3.2
s.authors = ['Scott Jaderholm', 'Chad Perrin']
s.date = '2014-01-25'
s.description = <<-EOF
Cons is a command line media library primarily for consuming temporary
media. Like iTunes but for video, pdfs, and audio. It's not intended for
managing a permanent music/video library. Files can also be removed/added
through normal file management tools.
EOF
s.summary = 'cons - makes consuming media fast and easy'
s.email = 'scott@jaderholm.com'
s.files = [
'LICENSE',
'README.org',
'bin/cons'
]
s.homepage = 'https://github.com/scottjad/cons'
s.has_rdoc = false
s.license = 'MIT/X11 License'
s.bindir = 'bin'
s.executables = ['cons']

s.post_install_message = <<-EOF

Run `cons config` to configure cons before use.

EOF
end