sjunkieex 0.1.2 → 0.1.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
data/Gemfile CHANGED
@@ -3,6 +3,9 @@ source 'https://rubygems.org'
3
3
  gem "turn"
4
4
  gem "ansi"
5
5
  gem "rake"
6
+ gem "guard"
7
+ gem 'rb-inotify', '~> 0.9'
8
+ gem 'guard-minitest'
6
9
 
7
10
  # Specify your gem's dependencies in sjunkieex.gemspec
8
11
  gemspec
data/Guardfile ADDED
@@ -0,0 +1,9 @@
1
+ # A sample Guardfile
2
+ # More info at https://github.com/guard/guard#readme
3
+
4
+ guard 'minitest' do
5
+ # with Minitest::Unit
6
+ watch(%r|^test/(.*)\/?test_(.*)\.rb|)
7
+ watch(%r|^lib/(.*)([^/]+)\.rb|) { |m| "test/#{m[1]}test_#{m[2]}.rb" }
8
+ watch(%r|^test/test_helper\.rb|) { "test" }
9
+ end
@@ -22,7 +22,7 @@ module Sjunkieex
22
22
  #
23
23
  # Returns a Hash of links for sites that should be visited
24
24
  def look_for_new_episodes()
25
- links = Hash.new
25
+ link_freq = {}
26
26
 
27
27
  doc = Nokogiri::XML(get_page_data(@options[:url]))
28
28
  doc.css("div#content > div.post > div.post-content a").each do |link|
@@ -33,16 +33,18 @@ module Sjunkieex
33
33
 
34
34
  series_name = Sindex::SeriesIndex.extract_seriesname(content)
35
35
  language = get_language_from_link_data(content)
36
+ href = link[:href]
36
37
 
37
38
  next if @index.episode_existing?(series_name, content, language)
38
39
 
39
- href = link[:href]
40
- next if links.include?(href)
40
+ # count the occurrences for each link and select the most common one
41
+ link_freq[series_name] ||= {}
42
+ link_freq[series_name][href] ||= 0
41
43
 
42
- links[href] = series_name
44
+ link_freq[series_name][href] += 1
43
45
  end
44
46
 
45
- return links
47
+ Hash[ link_freq.collect { |series,v| [ v.key(v.values.max), series ] } ]
46
48
  end
47
49
 
48
50
  # Public: parses a series page and extracts links
@@ -1,3 +1,3 @@
1
1
  module Sjunkieex
2
- VERSION = "0.1.2"
2
+ VERSION = "0.1.3"
3
3
  end
@@ -63,6 +63,12 @@
63
63
  <episode name="S02E11 - Just Like The Pilgrims Intended.mkv"/>
64
64
  </episodes>
65
65
  </series>
66
+ <series name="The Good Wife">
67
+ <alias to="Good Wife"/>
68
+ <episodes lang="en">
69
+ <episode name="S03E22 - something.avi" all_before="true"/>
70
+ </episodes>
71
+ </series>
66
72
  <series name="The Big Bang Theory">
67
73
  <episodes lang="en">
68
74
  <episode name="S06E04 - Penny und die Physiker.avi" all_before="true"/>