series_timer 0.1.5 → 0.2.0

Sign up to get free protection for your applications and to get access to all the features.
data/README.md CHANGED
@@ -7,23 +7,25 @@ https://rubygems.org/gems/series_timer
7
7
 
8
8
  ## Usage
9
9
 
10
- ````./bin/seriestimr -[lac] <series names>````
10
+ ````./bin/seriestimr -[lanf] <series names>````
11
11
 
12
12
  - -l = last episode on air
13
13
 
14
14
  - -a = list all episodes
15
15
 
16
- - -c = countdown to the next episode
16
+ - -n = next episode
17
+
18
+ - -f = force a cache update
17
19
 
18
20
  ex:
19
- ````./bin/seriestimr -c House "The Big Bang Theory" "Dexter"````
21
+ ````./bin/seriestimr -nf House "The Big Bang Theory" "Dexter"````
20
22
 
21
23
 
22
24
 
23
- ## Countdown
25
+ ## Next episode
24
26
 
25
27
  ````
26
- ./bin/series_timer -c "The Mentalist" Californication
28
+ ./bin/series_timer -n "The Mentalist" Californication
27
29
  [The Mentalist] S05e13 Red is the New Black 2012-02-02 (4 days)
28
30
  [Californication] S05e04 Waiting for the Miracle 2012-01-29 (0 days)
29
31
  ````
@@ -33,7 +35,7 @@ ex:
33
35
 
34
36
  ````
35
37
  ./bin/series_timer -l House Dexter
36
- [House] S09e09 Better Half 2012-01-23
38
+ [House] S08e09 Better Half 2012-01-23
37
39
  [Dexter] S06e12 This Is the Way the World Ends 2011-12-18
38
40
  ````
39
41
 
@@ -51,7 +53,6 @@ ex:
51
53
  [Game of Thrones] S01e08 The Pointy End 2011-06-05
52
54
  [Game of Thrones] S01e09 Baelor 2011-06-12
53
55
  [Game of Thrones] S01e10 Fire and Blood 2011-06-19
54
- [Game of Thrones] S10e09 Blackwater 2012-05-27
55
56
  ````
56
57
 
57
58
 
@@ -71,4 +72,4 @@ The above copyright notice and this permission notice shall be included in all c
71
72
 
72
73
  THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
73
74
 
74
- ---
75
+ ---
data/bin/series_timer CHANGED
@@ -2,7 +2,7 @@
2
2
 
3
3
  require_relative '../lib/series_timer'
4
4
 
5
- usage = "usage: series_timer [-lac] [series1 series2 ...]"
5
+ usage = "usage: series_timer [-lan] [series1 series2 ...]"
6
6
  begin
7
7
  SeriesTimer::Application.new(ARGV).run
8
8
  rescue OptionParser::InvalidOption => err
data/cache/House.cache CHANGED
@@ -1 +1 @@
1
- [["1", "Pilot", "2004-11-16"], ["2", "Paternity", "2004-11-23"], ["3", "Occam", "2004-11-30"], ["4", "Maternity", "2004-12-07"], ["5", "Damned If You Do", "2004-12-14"], ["6", "The Socratic Method", "2004-12-21"], ["7", "Fidelity", "2004-12-28"], ["8", "Poison", "2005-01-25"], ["9", "DNR", "2005-02-01"], ["10", "Histories", "2005-02-08"], ["11", "Detox", "2005-02-15"], ["12", "Sports Medicine", "2005-02-22"], ["13", "Cursed", "2005-03-01"], ["14", "Control", "2005-03-15"], ["15", "Mob Rules", "2005-03-22"], ["16", "Heavy", "2005-03-29"], ["17", "Role Model", "2005-04-12"], ["18", "Babies ", "2005-04-19"], ["19", "Kids", "2005-05-03"], ["20", "Love Hurts", "2005-05-10"], ["21", "Three Stories", "2005-05-17"], ["22", "Honeymoon", "2005-05-24"], ["1", "Acceptance", "2005-09-13"], ["2", "Autopsy", "2005-09-20"], ["3", "Humpty Dumpty", "2005-09-27"], ["4", "TB or Not TB", "2005-11-01"], ["5", "Daddy", "2005-11-08"], ["6", "Spin", "2005-11-15"], ["7", "Hunting", "2005-11-22"], ["8", "The Mistake", "2005-11-29"], ["9", "Deception", "2005-12-13"], ["10", "Failure to Communicate", "2006-01-10"], ["11", "Need to Know", "2006-02-07"], ["12", "Distractions", "2006-02-14"], ["13", "Skin Deep", "2006-02-20"], ["14", "Sex Kills", "2006-03-07"], ["15", "Clueless", "2006-03-28"], ["16", "Safe", "2006-04-04"], ["17", "All In", "2006-04-11"], ["18", "Sleeping Dogs Lie", "2006-04-18"], ["19", "House vs", "2006-04-25"], ["20", "Euphoria ", "2006-05-02"], ["21", "Euphoria ", "2006-05-03"], ["22", "Forever", "2006-05-09"], ["23", "Who", "2006-05-16"], ["24", "No Reason", "2006-05-23"], ["1", "Meaning", "2006-09-05"], ["2", "Cane and Able", "2006-09-12"], ["3", "Informed Consent", "2006-09-19"], ["4", "Lines in the Sand", "2006-09-26"], ["5", "Fools for Love", "2006-10-31"], ["6", "Que Ser", "2006-11-07"], ["7", "Son of Coma Guy", "2006-11-14"], ["8", "Whac", "2006-11-21"], ["9", "Finding Judas", "2006-11-28"], ["10", "Merry Little Christmas", "2006-12-12"], ["11", "Words and Deeds", "2007-01-09"], ["12", "One Day", "2007-01-30"], ["13", "Needle in a Haystack", "2007-02-06"], ["14", "Insensitive", "2007-02-13"], ["15", "Half", "2007-03-06"], ["16", "Top Secret", "2007-03-27"], ["17", "Fetal Position", "2007-04-03"], ["18", "Airborne", "2007-04-10"], ["19", "Act Your Age", "2007-04-17"], ["20", "House Training", "2007-04-24"], ["21", "Family", "2007-05-01"], ["22", "Resignation", "2007-05-08"], ["23", "The Jerk", "2007-05-15"], ["24", "Human Error", "2007-05-29"], ["1", "Alone", "2007-09-25"], ["2", "The Right Stuff", "2007-10-02"], ["3", "97 Seconds", "2007-10-09"], ["4", "Guardian Angels", "2007-10-23"], ["5", "Mirror Mirror", "2007-10-30"], ["6", "Whatever It Takes", "2007-11-06"], ["7", "Ugly", "2007-11-13"], ["8", "You Don", "2007-11-20"], ["9", "Games", "2007-11-27"], ["10", "It", "2008-01-29"], ["11", "Frozen", "2008-02-03"], ["12", "Don", "2008-02-05"], ["13", "No More Mr", "2008-04-28"], ["14", "Living the Dream", "2008-05-05"], ["15", "House", "2008-05-12"], ["16", "Wilson", "2008-05-19"], ["1", "Dying Changes Everything", "2008-09-16"], ["2", "Not Cancer", "2008-09-23"], ["3", "Adverse Events", "2008-09-30"], ["4", "Birthmarks", "2008-10-14"], ["5", "Lucky Thirteen", "2008-10-21"], ["6", "Joy", "2008-10-28"], ["7", "The Itch", "2008-11-11"], ["8", "Emancipation", "2008-11-18"], ["9", "Last Resort", "2008-11-25"], ["10", "Let Them Eat Cake", "2008-12-02"], ["11", "Joy to the World", "2008-12-09"], ["12", "Painless", "2009-01-19"], ["13", "Big Baby", "2009-01-26"], ["14", "The Greater Good", "2009-02-02"], ["15", "Unfaithful", "2009-02-16"], ["16", "The Softer Side", "2009-02-23"], ["17", "The Social Contract", "2009-03-09"], ["18", "Here Kitty", "2009-03-16"], ["19", "Locked In", "2009-03-30"], ["20", "Simple Explanation", "2009-04-06"], ["21", "Saviors", "2009-04-13"], ["22", "House Divided", "2009-04-27"], ["23", "Under My Skin", "2009-05-04"], ["24", "Both Sides Now", "2009-05-11"], ["1", "Broken ", "2009-09-21"], ["2", "Broken ", "2009-09-21"], ["3", "Epic Fail", "2009-09-28"], ["4", "The Tyrant", "2009-10-05"], ["5", "Instant Karma", "2009-10-12"], ["6", "Brave Heart", "2009-10-19"], ["7", "Known Unknowns", "2009-11-09"], ["8", "Teamwork", "2009-11-16"], ["9", "Ignorance Is Bliss", "2009-11-23"], ["10", "Wilson", "2009-11-30"], ["11", "The Down Low", "2010-01-11"], ["12", "Remorse", "2010-01-25"], ["13", "Moving the Chains", "2010-02-01"], ["14", "5 to 9", "2010-02-08"], ["15", "Private Lives", "2010-03-08"], ["16", "Black Hole", "2010-03-15"], ["17", "Lockdown", "2010-04-12"], ["18", "Knight Fall", "2010-04-19"], ["19", "Open and Shut", "2010-04-26"], ["20", "The Choice", "2010-05-03"], ["21", "Baggage", "2010-05-10"], ["22", "Help Me", "2010-05-17"], ["1", "Now What", "2010-09-20"], ["2", "Selfish", "2010-09-27"], ["3", "Unwritten", "2010-10-04"], ["4", "Massage Therapy", "2010-10-11"], ["5", "Unplanned Parenthood", "2010-10-18"], ["6", "Office Politics", "2010-11-08"], ["7", "A Pox on Our House", "2010-11-15"], ["8", "Small Sacrifices", "2010-11-22"], ["9", "Larger Than Life", "2011-01-17"], ["10", "Carrot or Stick", "2011-01-24"], ["11", "Family Practice", "2011-02-07"], ["12", "You Must Remember This", "2011-02-14"], ["13", "Two Stories", "2011-02-21"], ["14", "Recession Proof", "2011-02-28"], ["15", "Bombshells", "2011-03-07"], ["16", "Out of the Chute", "2011-03-14"], ["17", "Fall from Grace", "2011-03-21"], ["18", "The Dig", "2011-04-11"], ["19", "Last Temptation", "2011-04-18"], ["20", "Changes", "2011-05-02"], ["21", "The Fix", "2011-05-09"], ["22", "After Hours", "2011-05-16"], ["23", "Moving On", "2011-05-23"], ["1", "Twenty Vicodin", "2011-10-03"], ["2", "Transplant", "2011-10-10"], ["3", "Charity Case", "2011-10-17"], ["4", "Risky Business", "2011-10-31"], ["5", "The Confession", "2011-11-07"], ["6", "Parents", "2011-11-14"], ["7", "Dead ", "2011-11-21"], ["8", "Perils of Paranoia", "2011-11-28"], ["9", "Better Half", "2012-01-23"], ["10", "Runaways", "2012-01-30"], ["11", "Nobody", "2012-02-06"], ["12", "Chase", "2012-02-13"], ["13", "Man of the House", "2012-02-20"], ["14", "Love Is Blind", "2012-02-27"], ["15", "Blowing the Whistle", "2012-04-02"], ["16", "Gut Check", "2012-04-09"], ["17", "We Need the Eggs", "2012-04-16"], ["18", "Body and Soul", "2012-04-23"], ["19", "", "2012-04-30"], ["20", "", "2012-05-07"], ["21", "", "2012-05-14"], ["22", "", "2012-05-21"]]
1
+ [["1", "Pilot", "2004-11-16"], ["2", "Paternity", "2004-11-23"], ["3", "Occam", "2004-11-30"], ["4", "Maternity", "2004-12-07"], ["5", "Damned If You Do", "2004-12-14"], ["6", "The Socratic Method", "2004-12-21"], ["7", "Fidelity", "2004-12-28"], ["8", "Poison", "2005-01-25"], ["9", "DNR", "2005-02-01"], ["10", "Histories", "2005-02-08"], ["11", "Detox", "2005-02-15"], ["12", "Sports Medicine", "2005-02-22"], ["13", "Cursed", "2005-03-01"], ["14", "Control", "2005-03-15"], ["15", "Mob Rules", "2005-03-22"], ["16", "Heavy", "2005-03-29"], ["17", "Role Model", "2005-04-12"], ["18", "Babies ", "2005-04-19"], ["19", "Kids", "2005-05-03"], ["20", "Love Hurts", "2005-05-10"], ["21", "Three Stories", "2005-05-17"], ["22", "Honeymoon", "2005-05-24"], ["1", "Acceptance", "2005-09-13"], ["2", "Autopsy", "2005-09-20"], ["3", "Humpty Dumpty", "2005-09-27"], ["4", "TB or Not TB", "2005-11-01"], ["5", "Daddy", "2005-11-08"], ["6", "Spin", "2005-11-15"], ["7", "Hunting", "2005-11-22"], ["8", "The Mistake", "2005-11-29"], ["9", "Deception", "2005-12-13"], ["10", "Failure to Communicate", "2006-01-10"], ["11", "Need to Know", "2006-02-07"], ["12", "Distractions", "2006-02-14"], ["13", "Skin Deep", "2006-02-20"], ["14", "Sex Kills", "2006-03-07"], ["15", "Clueless", "2006-03-28"], ["16", "Safe", "2006-04-04"], ["17", "All In", "2006-04-11"], ["18", "Sleeping Dogs Lie", "2006-04-18"], ["19", "House vs", "2006-04-25"], ["20", "Euphoria ", "2006-05-02"], ["21", "Euphoria ", "2006-05-03"], ["22", "Forever", "2006-05-09"], ["23", "Who", "2006-05-16"], ["24", "No Reason", "2006-05-23"], ["1", "Meaning", "2006-09-05"], ["2", "Cane and Able", "2006-09-12"], ["3", "Informed Consent", "2006-09-19"], ["4", "Lines in the Sand", "2006-09-26"], ["5", "Fools for Love", "2006-10-31"], ["6", "Que Ser", "2006-11-07"], ["7", "Son of Coma Guy", "2006-11-14"], ["8", "Whac", "2006-11-21"], ["9", "Finding Judas", "2006-11-28"], ["10", "Merry Little Christmas", "2006-12-12"], ["11", "Words and Deeds", "2007-01-09"], ["12", "One Day", "2007-01-30"], ["13", "Needle in a Haystack", "2007-02-06"], ["14", "Insensitive", "2007-02-13"], ["15", "Half", "2007-03-06"], ["16", "Top Secret", "2007-03-27"], ["17", "Fetal Position", "2007-04-03"], ["18", "Airborne", "2007-04-10"], ["19", "Act Your Age", "2007-04-17"], ["20", "House Training", "2007-04-24"], ["21", "Family", "2007-05-01"], ["22", "Resignation", "2007-05-08"], ["23", "The Jerk", "2007-05-15"], ["24", "Human Error", "2007-05-29"], ["1", "Alone", "2007-09-25"], ["2", "The Right Stuff", "2007-10-02"], ["3", "97 Seconds", "2007-10-09"], ["4", "Guardian Angels", "2007-10-23"], ["5", "Mirror Mirror", "2007-10-30"], ["6", "Whatever It Takes", "2007-11-06"], ["7", "Ugly", "2007-11-13"], ["8", "You Don", "2007-11-20"], ["9", "Games", "2007-11-27"], ["10", "It", "2008-01-29"], ["11", "Frozen", "2008-02-03"], ["12", "Don", "2008-02-05"], ["13", "No More Mr", "2008-04-28"], ["14", "Living the Dream", "2008-05-05"], ["15", "House", "2008-05-12"], ["16", "Wilson", "2008-05-19"], ["1", "Dying Changes Everything", "2008-09-16"], ["2", "Not Cancer", "2008-09-23"], ["3", "Adverse Events", "2008-09-30"], ["4", "Birthmarks", "2008-10-14"], ["5", "Lucky Thirteen", "2008-10-21"], ["6", "Joy", "2008-10-28"], ["7", "The Itch", "2008-11-11"], ["8", "Emancipation", "2008-11-18"], ["9", "Last Resort", "2008-11-25"], ["10", "Let Them Eat Cake", "2008-12-02"], ["11", "Joy to the World", "2008-12-09"], ["12", "Painless", "2009-01-19"], ["13", "Big Baby", "2009-01-26"], ["14", "The Greater Good", "2009-02-02"], ["15", "Unfaithful", "2009-02-16"], ["16", "The Softer Side", "2009-02-23"], ["17", "The Social Contract", "2009-03-09"], ["18", "Here Kitty", "2009-03-16"], ["19", "Locked In", "2009-03-30"], ["20", "Simple Explanation", "2009-04-06"], ["21", "Saviors", "2009-04-13"], ["22", "House Divided", "2009-04-27"], ["23", "Under My Skin", "2009-05-04"], ["24", "Both Sides Now", "2009-05-11"], ["1", "Broken ", "2009-09-21"], ["2", "Broken ", "2009-09-21"], ["3", "Epic Fail", "2009-09-28"], ["4", "The Tyrant", "2009-10-05"], ["5", "Instant Karma", "2009-10-12"], ["6", "Brave Heart", "2009-10-19"], ["7", "Known Unknowns", "2009-11-09"], ["8", "Teamwork", "2009-11-16"], ["9", "Ignorance Is Bliss", "2009-11-23"], ["10", "Wilson", "2009-11-30"], ["11", "The Down Low", "2010-01-11"], ["12", "Remorse", "2010-01-25"], ["13", "Moving the Chains", "2010-02-01"], ["14", "5 to 9", "2010-02-08"], ["15", "Private Lives", "2010-03-08"], ["16", "Black Hole", "2010-03-15"], ["17", "Lockdown", "2010-04-12"], ["18", "Knight Fall", "2010-04-19"], ["19", "Open and Shut", "2010-04-26"], ["20", "The Choice", "2010-05-03"], ["21", "Baggage", "2010-05-10"], ["22", "Help Me", "2010-05-17"], ["1", "Now What", "2010-09-20"], ["2", "Selfish", "2010-09-27"], ["3", "Unwritten", "2010-10-04"], ["4", "Massage Therapy", "2010-10-11"], ["5", "Unplanned Parenthood", "2010-10-18"], ["6", "Office Politics", "2010-11-08"], ["7", "A Pox on Our House", "2010-11-15"], ["8", "Small Sacrifices", "2010-11-22"], ["9", "Larger Than Life", "2011-01-17"], ["10", "Carrot or Stick", "2011-01-24"], ["11", "Family Practice", "2011-02-07"], ["12", "You Must Remember This", "2011-02-14"], ["13", "Two Stories", "2011-02-21"], ["14", "Recession Proof", "2011-02-28"], ["15", "Bombshells", "2011-03-07"], ["16", "Out of the Chute", "2011-03-14"], ["17", "Fall from Grace", "2011-03-21"], ["18", "The Dig", "2011-04-11"], ["19", "Last Temptation", "2011-04-18"], ["20", "Changes", "2011-05-02"], ["21", "The Fix", "2011-05-09"], ["22", "After Hours", "2011-05-16"], ["23", "Moving On", "2011-05-23"], ["1", "Twenty Vicodin", "2011-10-03"], ["2", "Transplant", "2011-10-10"], ["3", "Charity Case", "2011-10-17"], ["4", "Risky Business", "2011-10-31"], ["5", "The Confession", "2011-11-07"], ["6", "Parents", "2011-11-14"], ["7", "Dead ", "2011-11-21"], ["8", "Perils of Paranoia", "2011-11-28"], ["9", "Better Half", "2012-01-23"], ["10", "Runaways", "2012-01-30"], ["11", "Nobody", "2012-02-06"], ["12", "Chase", "2012-02-13"], ["13", "Man of the House", "2012-02-20"], ["14", "Love Is Blind", "2012-02-27"], ["15", "", "2012-04-02"], ["16", "", "2012-04-09"], ["17", "", "2012-04-16"], ["18", "", "2012-04-23"], ["19", "", "2012-04-30"], ["20", "", "2012-05-07"], ["21", "", "2012-05-14"], ["22", "", "2012-05-21"]]
@@ -0,0 +1 @@
1
+ [["1", "Pilot", "2009-09-22"], ["2", "Stripped", "2009-09-29"], ["3", "Home", "2009-10-06"], ["4", "Fixed", "2009-10-13"], ["5", "Crash", "2009-10-20"], ["6", "Conjugal", "2009-11-03"], ["7", "Unorthodox", "2009-11-10"], ["8", "Unprepared", "2009-11-17"], ["9", "Threesome", "2009-11-24"], ["10", "Lifeguard", "2009-12-15"], ["11", "Infamy", "2010-01-05"], ["12", "Painkiller", "2010-01-12"], ["13", "Bad", "2010-02-02"], ["14", "Hi", "2010-02-09"], ["15", "Bang", "2010-03-02"], ["16", "Fleas", "2010-03-09"], ["17", "Heart", "2010-03-16"], ["18", "Doubt", "2010-04-06"], ["19", "Boom", "2010-04-27"], ["20", "Mock", "2010-05-04"], ["21", "Unplugged", "2010-05-11"], ["22", "Hybristophilia", "2010-05-18"], ["23", "Running", "2010-05-25"], ["1", "Taking Control", "2010-09-28"], ["2", "Double Jeopardy", "2010-10-05"], ["3", "Breaking Fast", "2010-10-12"], ["4", "Cleaning House", "2010-10-19"], ["5", "VIP Treatment", "2010-10-26"], ["6", "Poisoned Pill", "2010-11-09"], ["7", "Bad Girls", "2010-11-16"], ["8", "On Tap", "2010-11-23"], ["9", "Nine Hours", "2010-12-14"], ["10", "Breaking Up", "2011-01-11"], ["11", "Two Courts", "2011-01-18"], ["12", "Silly Season", "2011-02-01"], ["13", "Real Deal", "2011-02-08"], ["14", "Net Worth", "2011-02-15"], ["15", "Silver Bullet", "2011-02-22"], ["16", "Great Firewall", "2011-03-01"], ["17", "Ham Sandwich", "2011-03-22"], ["18", "Killer Song", "2011-03-29"], ["19", "Wrongful Termination", "2011-04-05"], ["20", "Foreign Affairs", "2011-04-12"], ["21", "In Sickness", "2011-05-03"], ["22", "Getting Off", "2011-05-10"], ["23", "Closing Arguments", "2011-05-17"], ["1", "A New Day", "2011-09-25"], ["2", "The Death Zone", "2011-10-02"], ["3", "Get a Room", "2011-10-09"], ["4", "Feeding the Rat", "2011-10-16"], ["5", "Marthas and Caitlins", "2011-10-23"], ["6", "Affairs of State", "2011-10-30"], ["7", "Executive Order 13224", "2011-11-06"], ["8", "Death Row Tip", "2011-11-13"], ["9", "Whiskey Tango Foxtrot", "2011-11-20"], ["10", "Parenting Made Easy", "2011-12-04"], ["11", "What Went Wrong", "2011-12-11"], ["12", "Alienation of Affection", "2012-01-08"], ["13", "Bitcoin for Dummies", "2012-01-15"], ["14", "Another Ham Sandwich", "2012-01-29"], ["15", "Live From Damascus", "2012-02-19"], ["16", "After the Fall", "2012-03-04"], ["17", "Long Way Home", "2012-03-11"], ["18", "Gloves Come Off", "2012-03-18"], ["19", "Blue Ribbon Panel", "2012-03-25"], ["20", "Pants on Fire", "2012-04-15"], ["21", "The Penalty Box", "2012-04-22"], ["22", "The Dream Team", "2012-04-29"]]
@@ -0,0 +1 @@
1
+ [["1", "Pilot", "2008-09-23"], ["2", "Red Hair and Silver Tape", "2008-09-30"], ["3", "Red Tide", "2008-10-14"], ["4", "Ladies in Red", "2008-10-21"], ["5", "Redwood", "2008-10-28"], ["6", "Red Handed", "2008-11-11"], ["7", "Seeing Red", "2008-11-18"], ["8", "The Thin Red Line", "2008-11-25"], ["9", "Flame Red", "2008-12-02"], ["10", "Red Brick and Ivy", "2008-12-16"], ["11", "Red John", "2009-01-06"], ["12", "Red Rum", "2009-01-13"], ["13", "Paint it Red", "2009-01-18"], ["14", "Crimson Casanova", "2009-02-10"], ["15", "Scarlett Fever", "2009-02-17"], ["16", "Bloodshot", "2009-03-17"], ["17", "Carnelian", "2009-03-24"], ["18", "Russet Potatoes", "2009-03-31"], ["19", "A Dozen Red Roses", "2009-04-07"], ["20", "Red Sauce", "2009-04-28"], ["21", "Miss Red", "2009-05-05"], ["22", "Blood Brothers", "2009-05-12"], ["23", "Red John", "2009-05-19"], ["1", "Redemption", "2009-09-24"], ["2", "The Scarlet Letter", "2009-10-01"], ["3", "Red Badge", "2009-10-08"], ["4", "Red Menace", "2009-10-15"], ["5", "Red Scare", "2009-10-29"], ["6", "Black Gold and Red Blood", "2009-11-05"], ["7", "Red Bulls", "2009-11-12"], ["8", "His Red Right Hand", "2009-11-19"], ["9", "A Price Above Rubies", "2009-12-10"], ["10", "Throwing Fire", "2009-12-17"], ["11", "Rose", "2010-01-14"], ["12", "Bleeding Heart", "2010-01-21"], ["13", "Redline", "2010-02-04"], ["14", "Blood In", "2010-02-11"], ["15", "Red Herring", "2010-03-04"], ["16", "Code Red", "2010-03-11"], ["17", "The Red Box", "2010-04-01"], ["18", "Aingavite Baa", "2010-04-08"], ["19", "Blood Money", "2010-04-22"], ["20", "Red All Over", "2010-04-29"], ["21", "18", "2010-05-06"], ["22", "Red Letter", "2010-05-13"], ["23", "Red Sky in the Morning", "2010-05-20"], ["1", "Red Sky at Night", "2010-09-23"], ["2", "Cackle", "2010-09-30"], ["3", "The Blood on His Hands", "2010-10-07"], ["4", "Red Carpet Treatment", "2010-10-14"], ["5", "The Red Ponies", "2010-10-21"], ["6", "Pink Chanel Suit", "2010-10-28"], ["7", "Red Hot", "2010-11-04"], ["8", "Ball of Fire", "2010-11-11"], ["9", "Red Moon", "2010-11-18"], ["10", "Jolly Red Elf", "2010-12-09"], ["11", "Bloodsport", "2011-01-06"], ["12", "Bloodhounds", "2011-01-20"], ["13", "Red Alert", "2011-02-03"], ["14", "Blood for Blood", "2011-02-10"], ["15", "Red Gold", "2011-02-17"], ["16", "Red Queen", "2011-02-24"], ["17", "Bloodstream", "2011-03-10"], ["18", "The Red Mile", "2011-03-31"], ["19", "Every Rose Has Its Thorn", "2011-04-07"], ["20", "Redacted", "2011-04-28"], ["21", "Like a Redheaded Stepchild", "2011-05-05"], ["22", "Rhapsody in Red", "2011-05-12"], ["23", "Strawberries and Cream ", "2011-05-19"], ["24", "Strawberries and Cream ", "2011-05-19"], ["1", "Scarlet Ribbons", "2011-09-22"], ["2", "Little Red Book", "2011-09-29"], ["3", "Pretty Red Balloon", "2011-10-06"], ["4", "Ring Around the Rosie", "2011-10-13"], ["5", "Blood and Sand", "2011-10-20"], ["6", "Where in the World is Carmine O", "2011-10-27"], ["7", "Blinking Red Light", "2011-11-03"], ["8", "Pink Tops", "2011-11-17"], ["9", "The Redshirt", "2011-12-08"], ["10", "Fugue in Red", "2011-12-15"], ["11", "Always Bet on Red", "2012-01-12"], ["12", "My Bloody Valentine", "2012-01-19"], ["13", "Red is the New Black", "2012-02-02"], ["14", "At First Blush", "2012-02-09"], ["15", "War of the Roses", "2012-02-16"], ["16", "His Thoughts Were Red Thoughts", "2012-02-23"], ["17", "Cheap Burgundy", "2012-03-08"], ["18", "Ruddy Cheeks", "2012-03-08"], ["19", "Pink Champagne on Ice", "2012-03-29"], ["20", "Something", "2012-04-05"], ["21", "Ruby Slippers", "2012-04-26"], ["22", "So Long", "2012-05-03"], ["23", "Red Rover", "2012-05-10"], ["24", "The Crimson Hat", "2012-05-17"]]
@@ -0,0 +1 @@
1
+ [["1", "Days Gone Bye", "2010-10-31"], ["2", "Guts", "2010-11-07"], ["3", "Tell It to the Frogs", "2010-11-14"], ["4", "Vatos", "2010-11-21"], ["5", "Wildfire", "2010-11-28"], ["6", "TS", "2010-12-05"], ["1", "What Lies Ahead", "2011-10-16"], ["2", "Bloodletting", "2011-10-23"], ["3", "Save the Last One", "2011-10-30"], ["4", "Cherokee Rose", "2011-11-06"], ["5", "Chupacabra", "2011-11-13"], ["6", "Secrets", "2011-11-20"], ["7", "Pretty Much Dead Already", "2011-11-27"], ["8", "Nebraska", "2012-02-12"], ["9", "Triggerfinger", "2012-02-19"], ["10", "18 Miles Out", "2012-02-26"], ["11", "Judge", "2012-03-04"], ["12", "Better Angels", "2012-03-11"], ["13", "Beside the Dying Fire", "2012-03-18"]]
@@ -1,5 +1,4 @@
1
1
  require_relative 'episode'
2
- require 'pry'
3
2
 
4
3
  module SeriesTimer
5
4
  module Crawler
@@ -7,9 +6,14 @@ module SeriesTimer
7
6
 
8
7
  REGEX_EPISODES =
9
8
  Regexp.new(/<td>(\d+)<\/td>[^<]+<td class="summary" [^>]+>(?:"<b>)?(?:<a [^>]+>)?([\w\s]*)(?:<\/a>)?(?:<\/b>")?.*?<span[^>]+>([0-9-]+)<\/span>/m)
9
+ CACHE_DIR = File.join(File.dirname(__FILE__), '../../cache/')
10
10
 
11
- def get_episodes(serie)
12
- File.exists?(get_cache_file(serie)) ? cache(serie) : web(serie)
11
+ def get_episodes(serie, options)
12
+ if options == :force
13
+ web(serie)
14
+ else
15
+ File.exists?(get_cache_file(serie)) ? cache(serie) : web(serie)
16
+ end
13
17
  end
14
18
 
15
19
  private
@@ -20,12 +24,13 @@ module SeriesTimer
20
24
  end
21
25
 
22
26
  def get_cache_file(serie)
23
- "#{File.join(File.dirname(__FILE__), '../../cache/')}#{serie}.cache"
27
+ "#{CACHE_DIR}#{serie}.cache"
24
28
  end
25
29
 
26
30
  def web(serie)
27
31
  renamed_serie = serie.gsub(" ", "_")
28
- uri = URI("http://en.wikipedia.org/wiki/List_of_#{renamed_serie}_episodes")
32
+ uri =
33
+ URI("http://en.wikipedia.org/wiki/List_of_#{renamed_serie}_episodes")
29
34
  response = Net::HTTP.get_response(uri)
30
35
  raise InvalidSerieException if response.code == "404"
31
36
 
@@ -19,7 +19,7 @@ module SeriesTimer
19
19
  end
20
20
 
21
21
  def to_s
22
- "[#{serie}] S%02de%02d\t #{title}\t #{date} (#{diffdays})" % [ season, number ]
22
+ "[#{serie}] S%02dE%02d\t #{title}\t #{date} (#{diffdays})" % [ season, number ]
23
23
  end
24
24
 
25
25
  end
@@ -4,26 +4,26 @@ module SeriesTimer
4
4
  module SeriesManager
5
5
  class << self
6
6
 
7
- def countdown(serie)
8
- episode = get_next_episode(serie)
7
+ def next_episode(serie, options)
8
+ episode = get_next_episode(serie, options)
9
9
  return if episode.nil?
10
10
  episode.to_s
11
11
  end
12
12
 
13
- def last_episode(serie)
14
- episodes = Crawler.get_episodes(serie)
13
+ def last_episode(serie, options)
14
+ episodes = Crawler.get_episodes(serie, options)
15
15
  episodes.reject! { |episode| episode.date >= Date.today }
16
16
  return if episodes.nil?
17
17
  episodes.last.to_s
18
18
  end
19
19
 
20
- def all(serie)
21
- episodes = Crawler.get_episodes(serie).map(&:to_s)
20
+ def all_episodes(serie, options)
21
+ Crawler.get_episodes(serie, options).map(&:to_s)
22
22
  end
23
23
 
24
24
  private
25
- def get_next_episode(serie)
26
- episodes = Crawler.get_episodes(serie)
25
+ def get_next_episode(serie, options)
26
+ episodes = Crawler.get_episodes(serie, options)
27
27
  next_episode = episodes.find { |episode| episode.date >= Date.today }
28
28
  end
29
29
 
@@ -1,3 +1,3 @@
1
1
  module SeriesTimer
2
- VERSION = "0.1.5"
2
+ VERSION = "0.2.0"
3
3
  end
data/lib/series_timer.rb CHANGED
@@ -16,7 +16,8 @@ module SeriesTimer
16
16
  def parse_options(argv)
17
17
  params = {}
18
18
  parser = OptionParser.new
19
- parser.on("-c") { params[:episodes] = :countdown }
19
+ parser.on("-f") { params[:options] = :force }
20
+ parser.on("-n") { params[:episodes] = :next }
20
21
  parser.on("-l") { params[:episodes] = :last }
21
22
  parser.on("-a") { params[:episodes] = :all }
22
23
  series = parser.parse(argv)
@@ -28,11 +29,11 @@ module SeriesTimer
28
29
  @series.each do |serie|
29
30
  case @params[:episodes]
30
31
  when :last
31
- puts SeriesManager.last_episode(serie)
32
+ puts SeriesManager.last_episode(serie, @params[:options])
32
33
  when :all
33
- puts SeriesManager.all(serie)
34
+ puts SeriesManager.all_episodes(serie, @params[:options])
34
35
  else
35
- puts SeriesManager.countdown(serie)
36
+ puts SeriesManager.next_episode(serie, @params[:options])
36
37
  end
37
38
  end
38
39
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: series_timer
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.5
4
+ version: 0.2.0
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,7 +9,7 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2012-03-06 00:00:00.000000000 Z
12
+ date: 2012-04-16 00:00:00.000000000 Z
13
13
  dependencies: []
14
14
  description: scrapes the list of episodes of any series from wikipedia
15
15
  email:
@@ -26,8 +26,11 @@ files:
26
26
  - lib/series_timer/series_manager.rb
27
27
  - lib/series_timer/episode.rb
28
28
  - lib/series_timer.rb
29
+ - cache/The Mentalist.cache
29
30
  - cache/empty
31
+ - cache/The Walking Dead.cache
30
32
  - cache/House.cache
33
+ - cache/The Good Wife.cache
31
34
  - README.md
32
35
  homepage: http://github.com/abacha/series_timer
33
36
  licenses: []