sjunkieex 0.0.1 → 0.0.2
Sign up to get free protection for your applications and to get access to all the features.
- data/bin/sjunkieex +6 -3
- data/lib/sjunkieex/interface.rb +0 -1
- data/lib/sjunkieex/series_index.rb +5 -1
- data/lib/sjunkieex/version.rb +1 -1
- data/test/test_interface.rb +6 -2
- data/test/test_series_index.rb +7 -2
- metadata +3 -2
data/bin/sjunkieex
CHANGED
@@ -17,7 +17,8 @@ FileUtils.mkdir(CONFIG_DIR) unless File.directory?(CONFIG_DIR)
|
|
17
17
|
###
|
18
18
|
# configuration
|
19
19
|
STANDARD_CONFIG = {
|
20
|
-
:
|
20
|
+
:hd_enabled => false,
|
21
|
+
:hd_exceptions => ["SERIES_NOT_EXISTING_PLACEHOLDER"],
|
21
22
|
:index_directory => File.join(CONFIG_DIR, ".index/"),
|
22
23
|
:index_suffix => "xml",
|
23
24
|
:hoster_id => "nl",
|
@@ -76,8 +77,10 @@ interface.look_for_new_episodes.each do |link,series|
|
|
76
77
|
links.each do |identifier, link_data|
|
77
78
|
puts link_data[:episodedata]
|
78
79
|
|
79
|
-
hd =
|
80
|
-
(hd =
|
80
|
+
hd = config[:hd_enabled]
|
81
|
+
(hd = false) if not config[:hd_exceptions].select do |elem|
|
82
|
+
elem.match(/#{series}/i)
|
83
|
+
end.empty?
|
81
84
|
|
82
85
|
###
|
83
86
|
# select links, depending on wanted resolution
|
data/lib/sjunkieex/interface.rb
CHANGED
@@ -35,6 +35,8 @@ module Sjunkieex
|
|
35
35
|
#
|
36
36
|
# Returns true if the episode is existing, false otherwise
|
37
37
|
def episode_existing?(series_name, episode_text)
|
38
|
+
series_name.downcase!
|
39
|
+
|
38
40
|
if @series_data[series_name]
|
39
41
|
|
40
42
|
if id = SeriesIndex.extract_episode_identifier(episode_text)
|
@@ -55,7 +57,7 @@ module Sjunkieex
|
|
55
57
|
def is_series_in_index?(episode_text)
|
56
58
|
|
57
59
|
if series_name = SeriesIndex.extract_seriesname(episode_text)
|
58
|
-
if @series_data[series_name]
|
60
|
+
if @series_data[series_name.downcase]
|
59
61
|
return true
|
60
62
|
end
|
61
63
|
end
|
@@ -112,6 +114,8 @@ module Sjunkieex
|
|
112
114
|
title = series_node[:name]
|
113
115
|
next unless title && title.match(/\w+/)
|
114
116
|
|
117
|
+
title.downcase!
|
118
|
+
|
115
119
|
series = Hash.new
|
116
120
|
series_node.css("file").each do |file_node|
|
117
121
|
|
data/lib/sjunkieex/version.rb
CHANGED
data/test/test_interface.rb
CHANGED
@@ -9,11 +9,13 @@ class TestInterface < Test::Unit::TestCase
|
|
9
9
|
@series_index = Sjunkieex::SeriesIndex.new(files: files)
|
10
10
|
end
|
11
11
|
|
12
|
+
|
12
13
|
def test_instantiating
|
13
14
|
interface = Sjunkieex::Interface.new(@series_index)
|
14
15
|
assert_instance_of Sjunkieex::Interface, interface
|
15
16
|
end
|
16
17
|
|
18
|
+
|
17
19
|
def test_option_passing
|
18
20
|
url = "http://example.org"
|
19
21
|
interface = Sjunkieex::Interface.new(@series_index, url: url)
|
@@ -23,6 +25,7 @@ class TestInterface < Test::Unit::TestCase
|
|
23
25
|
assert_equal interface.options[:url], "http://serienjunkies.org"
|
24
26
|
end
|
25
27
|
|
28
|
+
|
26
29
|
def test_parse_homepage
|
27
30
|
filename = File.dirname(__FILE__) + '/site_dumps/homepage.html'
|
28
31
|
interface = Sjunkieex::Interface.new(@series_index, url: filename)
|
@@ -32,12 +35,13 @@ class TestInterface < Test::Unit::TestCase
|
|
32
35
|
assert_equal false, links.empty?
|
33
36
|
|
34
37
|
assert_equal true, links.include?("http://serienjunkies.org/serie/chase-2010/")
|
35
|
-
assert_equal "
|
38
|
+
assert_equal "chase", links["http://serienjunkies.org/serie/chase-2010/"]
|
36
39
|
|
37
40
|
assert_equal true, links.include?("http://serienjunkies.org/serie/shameless-us/")
|
38
|
-
assert_equal "
|
41
|
+
assert_equal "shameless us", links["http://serienjunkies.org/serie/shameless-us/"]
|
39
42
|
end
|
40
43
|
|
44
|
+
|
41
45
|
def test_parse_series_page
|
42
46
|
interface = Sjunkieex::Interface.new(@series_index)
|
43
47
|
filename = File.dirname(__FILE__) + '/site_dumps/chase.html'
|
data/test/test_series_index.rb
CHANGED
@@ -15,10 +15,10 @@ class TestInterface < Test::Unit::TestCase
|
|
15
15
|
end
|
16
16
|
|
17
17
|
def test_parse_seriesindex
|
18
|
-
assert_equal 13, @series_index.series_data["
|
18
|
+
assert_equal 13, @series_index.series_data["chase"].length
|
19
19
|
|
20
20
|
assert_equal "S01E04 - Blutiger Wahnsinn.avi",
|
21
|
-
@series_index.series_data["
|
21
|
+
@series_index.series_data["chase"]["1_4"]
|
22
22
|
|
23
23
|
assert_equal false, @series_index.empty?
|
24
24
|
end
|
@@ -66,4 +66,9 @@ class TestInterface < Test::Unit::TestCase
|
|
66
66
|
"Private.Practice.S05E12.Aussichtsloser.Kampf.German.Dubbed.WS.WEB-DL.XviD-GDR")
|
67
67
|
end
|
68
68
|
|
69
|
+
def test_check_seriesname_in_index_case_insensitive
|
70
|
+
assert_equal true, @series_index.is_series_in_index?(
|
71
|
+
"Two.and.a.half.Men.S09E09.Ein.Opossum.auf.Chemo.German.Dubbed.WS.WEB-DL.XviD-GDR")
|
72
|
+
|
73
|
+
end
|
69
74
|
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: sjunkieex
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.2
|
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-
|
12
|
+
date: 2012-08-28 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: nokogiri
|
@@ -99,3 +99,4 @@ test_files:
|
|
99
99
|
- test/test_helper.rb
|
100
100
|
- test/test_interface.rb
|
101
101
|
- test/test_series_index.rb
|
102
|
+
has_rdoc:
|