series_timer 0.1.3 → 0.1.5

Sign up to get free protection for your applications and to get access to all the features.
data/cache/House.cache ADDED
@@ -0,0 +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"]]
@@ -20,7 +20,7 @@ module SeriesTimer
20
20
  end
21
21
 
22
22
  def get_cache_file(serie)
23
- File.join(File.dirname(__FILE__), "../../cache/") + serie + ".cache"
23
+ "#{File.join(File.dirname(__FILE__), '../../cache/')}#{serie}.cache"
24
24
  end
25
25
 
26
26
  def web(serie)
@@ -42,7 +42,9 @@ module SeriesTimer
42
42
  episodes_parsed.each do |episode|
43
43
  season += 1 if !episodes.empty? &&
44
44
  episodes.last.number > episode[0].to_i
45
- episodes << Episode.new(serie, season.to_i, *episode) unless episode[1].empty?
45
+ unless episode[1].empty?
46
+ episodes << Episode.new(serie, season.to_i, *episode)
47
+ end
46
48
  end
47
49
  episodes
48
50
  end
@@ -5,8 +5,9 @@ module SeriesTimer
5
5
  @date ||= Date.parse date_raw
6
6
  end
7
7
 
8
- def countdown
9
- "#{(date - Date.today).to_i} days"
8
+ def diffdays
9
+ days = (date - Date.today).to_i
10
+ "#{days.abs} days#{days < 0 ? ' ago':''}"
10
11
  end
11
12
 
12
13
  def number
@@ -18,7 +19,7 @@ module SeriesTimer
18
19
  end
19
20
 
20
21
  def to_s
21
- "[#{serie}] S%02de%02d\t #{title}\t #{date}" % [ season, number ]
22
+ "[#{serie}] S%02de%02d\t #{title}\t #{date} (#{diffdays})" % [ season, number ]
22
23
  end
23
24
 
24
25
  end
@@ -1,4 +1,3 @@
1
1
  module SeriesTimer
2
-
3
2
  InvalidSerieException = Class.new(StandardError)
4
3
  end
@@ -7,17 +7,18 @@ module SeriesTimer
7
7
  def countdown(serie)
8
8
  episode = get_next_episode(serie)
9
9
  return if episode.nil?
10
- "#{episode.to_s} (#{episode.countdown})"
10
+ episode.to_s
11
11
  end
12
12
 
13
13
  def last_episode(serie)
14
14
  episodes = Crawler.get_episodes(serie)
15
- episodes.reject! { |episode| episode.date >= Date.today }
16
- episodes.last
15
+ episodes.reject! { |episode| episode.date >= Date.today }
16
+ return if episodes.nil?
17
+ episodes.last.to_s
17
18
  end
18
19
 
19
20
  def all(serie)
20
- Crawler.get_episodes(serie)
21
+ episodes = Crawler.get_episodes(serie).map(&:to_s)
21
22
  end
22
23
 
23
24
  private
@@ -1,3 +1,3 @@
1
1
  module SeriesTimer
2
- VERSION = "0.1.3"
2
+ VERSION = "0.1.5"
3
3
  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.3
4
+ version: 0.1.5
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-02-13 00:00:00.000000000 Z
12
+ date: 2012-03-06 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,11 +26,10 @@ 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
30
29
  - cache/empty
31
- - cache/Californication.cache
30
+ - cache/House.cache
32
31
  - README.md
33
- homepage: http://github.com/series_timer
32
+ homepage: http://github.com/abacha/series_timer
34
33
  licenses: []
35
34
  post_install_message:
36
35
  rdoc_options: []
@@ -1 +0,0 @@
1
- [["1", "Pilot", "2007-08-13"], ["2", "Hell", "2007-08-20"], ["3", "The Whore of Babylon", "2007-08-27"], ["4", "Fear and Loathing at the Fundraiser", "2007-09-03"], ["5", "LOL", "2007-09-10"], ["6", "Absinthe Makes the Heart Grow Fonder", "2007-09-17"], ["7", "Girls", "2007-09-24"], ["8", "California Son", "2007-10-01"], ["9", "Filthy Lucre", "2007-10-08"], ["10", "The Devil", "2007-10-15"], ["11", "Turn the Page", "2007-10-22"], ["12", "The Last Waltz", "2007-10-29"], ["1", "Slip of the Tongue", "2008-09-28"], ["2", "The Great Ashby", "2008-10-05"], ["3", "No Way to Treat a Lady", "2008-10-12"], ["4", "The Raw ", "2008-10-19"], ["5", "Vaginatown", "2008-10-26"], ["6", "Coke Dick ", "2008-11-02"], ["7", "In a Lonely Place", "2008-11-09"], ["8", "Going Down and Out in Beverly Hills", "2008-11-16"], ["9", "La Ronde", "2008-11-23"], ["10", "In Utero", "2008-11-30"], ["11", "Blues from Laurel Canyon", "2008-12-07"], ["12", "La Petite Mort", "2008-12-14"], ["1", "Wish You Were Here", "2009-09-27"], ["2", "The Land of Rape and Honey", "2009-10-04"], ["3", "Verities ", "2009-10-11"], ["4", "Zoso", "2009-10-18"], ["5", "Slow Happy Boys", "2009-10-25"], ["6", "Glass Houses", "2009-11-01"], ["7", "So Here", "2009-11-08"], ["8", "The Apartment", "2009-11-15"], ["9", "Mr", "2009-11-22"], ["10", "Dogtown", "2009-11-29"], ["11", "Comings ", "2009-12-06"], ["12", "Mia Culpa", "2009-12-13"], ["1", "Exile on Main St", "2011-01-09"], ["2", "Suicide Solution", "2011-01-16"], ["3", "Home Sweet Home", "2011-01-23"], ["4", "Monkey Business", "2011-01-30"], ["5", "Freeze", "2011-02-06"], ["6", "Lawyers", "2011-02-13"], ["7", "The Recused", "2011-02-20"], ["8", "Lights", "2011-02-27"], ["9", "Another Perfect Day", "2011-03-06"], ["10", "The Trial", "2011-03-13"], ["11", "The Last Supper", "2011-03-20"], ["12", "", "2011-03-27"], ["1", "JFK to LAX", "2012-01-08"], ["2", "The Way of the Fist", "2012-01-15"], ["3", "Boys ", "2012-01-22"], ["4", "Waiting for the Miracle", "2012-01-29"], ["5", "The Ride", "2012-02-05"], ["6", "Love Song", "2012-02-12"], ["7", "Here I Go Again", "2012-02-19"], ["8", "Raw", "2012-03-04"], ["9", "At the Movies", "2012-03-11"], ["10", "Perverts ", "2012-03-18"], ["11", "The Party", "2012-03-25"], ["12", "Hell Ain", "2012-04-01"]]
@@ -1 +0,0 @@
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", "2008-09-30"]]