Created
March 30, 2013 22:22
-
-
Save AnimaWish/5278608 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# good UI | |
# sorting choices | |
# detect downloads, give shows update prompt | |
# use classes? | |
# {Show => [[Seasons, Episodes], Complete?, Notes]} | |
$series = Hash.new() | |
def addseries(title) | |
$series[title] = [[0,0], false, ''] | |
end | |
def updateseries(title, seasonEpisode, complete, notes) | |
end | |
def displayseries(title, season, episode, complete, notes) | |
printf "%-22s - %2s.%-2s[%1s] %30s \n", title, season, episode, complete, notes | |
end | |
def list(*args) | |
$series.sort_by {|title, seasonEpisode, complete, notes| title}.each do |x| | |
if x[0].length > 22 | |
title = x[0][0..18] + '...' | |
else | |
title = x[0] | |
end | |
if x[1][1] | |
complete = 'x' | |
end | |
displayseries(title, x[1][0][0].to_s, x[1][0][1].to_s, complete, x[1][2]) | |
#printf "%-22s - %2s.%-2s[%1s] %30s \n", title, x[1][0][0].to_s, x[1][0][1].to_s, complete, x[1][2] | |
end | |
end | |
def find(title) | |
found = $series.select{|key, value| key.downcase =~ /#{title}/} | |
found.each do |x| | |
p x | |
end | |
end | |
def help() | |
end | |
addseries('House of Cards') | |
addseries('Game of Thrones') | |
addseries('Regular Show') | |
addseries('Tengen Toppa Gurren Lagann') | |
loop do | |
input = gets.chomp | |
case input | |
when 'ls' | |
list() | |
when 'list' | |
list() | |
when 'u' | |
when /\/(.*)/ | |
find($1) | |
when '?' | |
help() | |
when 'quit' | |
break | |
end | |
end | |
puts $series |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment