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 +3 -0
- data/Guardfile +9 -0
- data/lib/sjunkieex/interface.rb +7 -5
- data/lib/sjunkieex/version.rb +1 -1
- data/test/seriesindex_example.xml +6 -0
- data/test/site_dumps/homepage_with_wrong_links.html +9337 -0
- data/test/test_interface.rb +7 -9
- metadata +5 -2
data/Gemfile
CHANGED
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
|
data/lib/sjunkieex/interface.rb
CHANGED
@@ -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
|
-
|
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
|
-
|
40
|
-
|
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
|
-
|
44
|
+
link_freq[series_name][href] += 1
|
43
45
|
end
|
44
46
|
|
45
|
-
|
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
|
data/lib/sjunkieex/version.rb
CHANGED
@@ -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"/>
|