sindex 0.2.3 → 0.2.4

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: bbc43040a3a6eebb9f7d7e82d35f31692b8cd800
4
- data.tar.gz: 6fd7ee91bfcecbd424b8a847d21583762d3e759d
3
+ metadata.gz: c6080918a70331ea28e8896016f662886530f354
4
+ data.tar.gz: 48980a04a5b95b9d215faa3496eacfb9e1f7542c
5
5
  SHA512:
6
- metadata.gz: 2320984dfc8e448c07c75bdb59100de737899bfd979939dac4fc88f32d65601763e304beddb2c83721a44e74dfd48398d725d3a439a8abfcd84565719b9a4583
7
- data.tar.gz: 291d7c433a459d9ac88fdd59ac4b36c15a75e641169bc3c3201169480dba17074d534bb48710f8ad1faac7270cd800420a087ebe46bcf74504844d530c960c60
6
+ metadata.gz: afecd8d833ca83bdee4d21a3a16a5e150ec6b836c8c5752f6cfcf0198264d6405ffcfca734ba34ee41b0fd1ff2dba2e217d2872082b3f47b13aa75b7da3d148c
7
+ data.tar.gz: eb976345d9a3e6e0ef97139655b308a264cdbdf3acaadffca0a8f4a91f96ef09f0a5d8ec221280d92ec370f5f6c1377212084def31f04f3aef6e9e1166e45b46
@@ -18,8 +18,6 @@ module Sindex
18
18
  @series_data = {}
19
19
  @series_aliases = {}
20
20
 
21
- @dtd_path = File.expand_path(
22
- File.join(File.dirname(__FILE__), '../../res/seriesindex.dtd'))
23
21
 
24
22
  if @index_file and File.file? @index_file
25
23
  parse_file(@index_file)
@@ -243,8 +241,6 @@ module Sindex
243
241
  def build_up_xml_tree_from_index
244
242
 
245
243
  builder = Nokogiri::XML::Builder.new(:encoding => 'UTF-8') do |xml|
246
- xml.doc.create_internal_subset("seriesindex", nil, @dtd_path)
247
-
248
244
  xml.seriesindex {
249
245
  @series_data.sort.map do |seriesname, data|
250
246
  attrs = {:name => seriesname}
@@ -363,12 +359,12 @@ module Sindex
363
359
  #
364
360
  # returns Nokogiri XML Document
365
361
  def open_xml_file(file)
366
- fix_broken_dtd_path(file)
362
+ xml_content = add_dtd_reference(File.read(file).lines)
367
363
 
368
364
  options = Nokogiri::XML::ParseOptions::DEFAULT_XML |
369
365
  Nokogiri::XML::ParseOptions::DTDLOAD
370
366
 
371
- doc = Nokogiri::XML::Document.parse(File.read(file), nil, nil, options)
367
+ doc = Nokogiri::XML::Document.parse(xml_content, nil, nil, options)
372
368
  doc.external_subset || raise(XmlDTDError, "DTD could not be processed")
373
369
 
374
370
  errors = doc.external_subset.validate(doc)
@@ -383,14 +379,14 @@ module Sindex
383
379
  end
384
380
 
385
381
  # Internal: fixes the path that points to the dtd file in the seriesindex
386
- def fix_broken_dtd_path(file)
387
- new_doctype = '<!DOCTYPE seriesindex SYSTEM "' + @dtd_path +'">'
382
+ def add_dtd_reference(content)
383
+ dtd_path = File.expand_path(
384
+ File.join(File.dirname(__FILE__), '../../res/seriesindex.dtd'))
388
385
 
389
- lines = File.open(file).read
390
- lines.gsub!(/^.*DOCTYPE.*SYSTEM.*$/, new_doctype)
386
+ content.delete_if {|line| line.match(/^.*DOCTYPE/) }
387
+ content.insert(1, '<!DOCTYPE seriesindex SYSTEM "' + dtd_path +'">')
391
388
 
392
- File.open(file, 'w') {|f| f.write(lines) }
389
+ content.join("\n")
393
390
  end
394
-
395
391
  end
396
392
  end
@@ -1,3 +1,3 @@
1
1
  module Sindex
2
- VERSION = "0.2.3"
2
+ VERSION = "0.2.4"
3
3
  end
@@ -0,0 +1,82 @@
1
+ <?xml version="1.0" encoding="UTF-8"?>
2
+ <seriesindex>
3
+ <series name="Community">
4
+ <episodes>
5
+ <episode name="S01E01 - Zurück aufs College.avi"></episode>
6
+ <episode name="S01E02 - Grundkurs Spanisch.avi"></episode>
7
+ <episode name="S01E03 - Carpe Diem.avi"></episode>
8
+ <episode name="S01E04 - Bitte warten.avi"></episode>
9
+ <episode name="S01E05 - Prozess im Schwimmbad.avi"></episode>
10
+ <episode name="S01E06 - Toiletten Talk.avi"></episode>
11
+ <episode name="S01E07 - Mexanisches Halloween.avi"></episode>
12
+ <episode name="S01E08 - Picknick unter Sternen.avi"></episode>
13
+ <episode name="S01E09 - Der Mensch ist gut.avi"></episode>
14
+ <episode name="S01E10 - Green Day für Arme.avi"></episode>
15
+ <episode name="S01E11 - Das P Wort.avi"></episode>
16
+ <episode name="S01E12 - Die Weihnachtsschlacht.avi"></episode>
17
+ <episode name="S01E13 - Zweite Wahl.avi"></episode>
18
+ <episode name="S01E14 - Echte Männer tanzen nicht.avi"></episode>
19
+ <episode name="S01E15 - Jeder mit jedem.avi"></episode>
20
+ <episode name="S01E16 - Trunken am Telefon.avi"></episode>
21
+ <episode name="S01E17 - Billard ohne.mkv"></episode>
22
+ <episode name="S01E18 - Familientag.mkv"></episode>
23
+ <episode name="S01E19 - Die Parkplatzsegler.mkv"></episode>
24
+ <episode name="S01E20 - Die Spassbremse.mkv"></episode>
25
+ </episodes>
26
+ <alias to="Comm"></alias>
27
+ <alias to="unity"></alias>
28
+ </series>
29
+ <series name="Shameless US">
30
+ <episodes lang="de">
31
+ <episode name="S01E01 - Pilot.avi"></episode>
32
+ <episode name="S01E02 - Frank The Plank.avi"></episode>
33
+ <episode name="S01E03 - Der Scheck heiligt die Mittel.avi"></episode>
34
+ <episode name="S01E04 - Nur mal Spielen.avi"></episode>
35
+ <episode name="S01E05 - Drei Freunde.avi"></episode>
36
+ <episode name="S01E06 - Killer Carl.avi"></episode>
37
+ <episode name="S01E07 - Frank Gallagher Loving Husband Devoted Father.avi"></episode>
38
+ <episode name="S01E08 - Katerstimmung.avi"></episode>
39
+ </episodes>
40
+ <episodes lang="en">
41
+ <episode name="S01E01 - Pilot.avi"></episode>
42
+ <episode name="S01E02 - Frank The Plank.avi"></episode>
43
+ <episode name="S01E03 - Der Scheck heiligt die Mittel.avi"></episode>
44
+ <episode name="S01E04 - Nur mal Spielen.avi"></episode>
45
+ <episode name="S01E05 - Drei Freunde.avi"></episode>
46
+ <episode name="S01E06 - Killer Carl.avi"></episode>
47
+ <episode name="S01E07 - Frank Gallagher Loving Husband Devoted Father.avi"></episode>
48
+ <episode name="S01E08 - Katerstimmung.avi"></episode>
49
+ <episode name="S01E09 - But At Last Came A Knock.avi"></episode>
50
+ <episode name="S01E10 - Auf Oma ist verlass.avi"></episode>
51
+ <episode name="S01E11 - Daddys Girl.avi"></episode>
52
+ <episode name="S01E12 - Vater Frank voller Gnade.avi"></episode>
53
+ <episode name="S02E01 - Summertime.avi"></episode>
54
+ <episode name="S02E02 - Summer Loving.avi"></episode>
55
+ <episode name="S02E03 - Ill Light A Candle For You Every Day.avi"></episode>
56
+ <episode name="S02E04 - A Beautiful Mess.avi"></episode>
57
+ <episode name="S02E05 - Fathers Day.avi"></episode>
58
+ <episode name="S02E06 - Can I Have A Mother.avi"></episode>
59
+ <episode name="S02E07 - A Bottle of Jean Nate.avi"></episode>
60
+ <episode name="S02E08 - Parenthood.avi"></episode>
61
+ <episode name="S02E09 - Hurricane Monica.avi"></episode>
62
+ <episode name="S02E10 - A Great Cause.mkv"></episode>
63
+ <episode name="S02E11 - Just Like The Pilgrims Intended.mkv"></episode>
64
+ </episodes>
65
+ </series>
66
+ <series name="Prison Break">
67
+ <episodes>
68
+ <episode name="S01E01 - Zurück aufs College.avi"></episode>
69
+ <episode name="S01E02 - Grundkurs Spanisch.avi"></episode>
70
+ <episode name="S01E03 - Carpe Diem.avi"></episode>
71
+ <episode name="S01E04 - Bitte warten.avi"></episode>
72
+ </episodes>
73
+ </series>
74
+ <series name="The Big Bang Theory">
75
+ <episodes>
76
+ <episode name="S06E01 - do not change.avi" all_before="true"></episode>
77
+ <episode name="S06E02 - Grundkurs Spanisch.avi"></episode>
78
+ <episode name="S06E03 - Carpe Diem.avi"></episode>
79
+ <episode name="S06E04 - Bitte warten.avi"></episode>
80
+ </episodes>
81
+ </series>
82
+ </seriesindex>
@@ -7,15 +7,10 @@ require 'tempfile'
7
7
  class TestIndex < Test::Unit::TestCase
8
8
 
9
9
  STANDARD_SINDEX_PATH = File.dirname(__FILE__) + '/seriesindex_example.xml'
10
- STANDARD_SINDEX_CONTENT = File.open(STANDARD_SINDEX_PATH).read
10
+ NEW_FORMAT_SINDEX_PATH = File.dirname(__FILE__) + '/seriesindex_new_format.xml'
11
11
 
12
12
  def setup
13
-
14
- @tempfile = Tempfile.new('seriesindex')
15
- @tempfile.puts(STANDARD_SINDEX_CONTENT)
16
- @tempfile.flush
17
-
18
- @series_index = Sindex::SeriesIndex.new(index_file: @tempfile.path)
13
+ @series_index = Sindex::SeriesIndex.new(index_file: STANDARD_SINDEX_PATH)
19
14
  end
20
15
 
21
16
  def test_instantiating
@@ -26,11 +21,6 @@ class TestIndex < Test::Unit::TestCase
26
21
  assert_equal index.empty?, true
27
22
  end
28
23
 
29
- def test_that_the_path_of_DTD_file_has_been_updated
30
- content = File.open(@tempfile.path).read
31
- assert_equal content.match(/^.*DOCTYPE.*\"res\/seriesindex.xml\".*$/), nil
32
- end
33
-
34
24
  def test_parsing_a_valid_series_index
35
25
  assert_not_nil @series_index.series_data['Community']
36
26
 
@@ -44,6 +34,13 @@ class TestIndex < Test::Unit::TestCase
44
34
  assert_equal series.has_episodes_in_language?(:en), true
45
35
  end
46
36
 
37
+ def test_parsing_index_in_new_format
38
+ assert_nothing_raised do
39
+ index = Sindex::SeriesIndex.new(index_file: NEW_FORMAT_SINDEX_PATH)
40
+ assert_equal index.is_series_in_index?("shameless uS", true), true
41
+ end
42
+ end
43
+
47
44
  def test_that_series_aliases_take_place
48
45
  assert_equal @series_index.is_series_in_index?("Comm", true), true
49
46
  assert_equal @series_index.is_series_in_index?("unity", true), true
metadata CHANGED
@@ -1,69 +1,69 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: sindex
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.3
4
+ version: 0.2.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - Philipp Böhm
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2013-09-05 00:00:00.000000000 Z
11
+ date: 2014-04-13 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: nokogiri
15
15
  requirement: !ruby/object:Gem::Requirement
16
16
  requirements:
17
- - - '>='
17
+ - - ">="
18
18
  - !ruby/object:Gem::Version
19
19
  version: '1.5'
20
20
  type: :runtime
21
21
  prerelease: false
22
22
  version_requirements: !ruby/object:Gem::Requirement
23
23
  requirements:
24
- - - '>='
24
+ - - ">="
25
25
  - !ruby/object:Gem::Version
26
26
  version: '1.5'
27
27
  - !ruby/object:Gem::Dependency
28
28
  name: hashconfig
29
29
  requirement: !ruby/object:Gem::Requirement
30
30
  requirements:
31
- - - '>='
31
+ - - ">="
32
32
  - !ruby/object:Gem::Version
33
33
  version: 0.0.1
34
34
  type: :runtime
35
35
  prerelease: false
36
36
  version_requirements: !ruby/object:Gem::Requirement
37
37
  requirements:
38
- - - '>='
38
+ - - ">="
39
39
  - !ruby/object:Gem::Version
40
40
  version: 0.0.1
41
41
  - !ruby/object:Gem::Dependency
42
42
  name: serienrenamer
43
43
  requirement: !ruby/object:Gem::Requirement
44
44
  requirements:
45
- - - '>='
45
+ - - ">="
46
46
  - !ruby/object:Gem::Version
47
47
  version: 0.0.16
48
48
  type: :runtime
49
49
  prerelease: false
50
50
  version_requirements: !ruby/object:Gem::Requirement
51
51
  requirements:
52
- - - '>='
52
+ - - ">="
53
53
  - !ruby/object:Gem::Version
54
54
  version: 0.0.16
55
55
  - !ruby/object:Gem::Dependency
56
56
  name: highline
57
57
  requirement: !ruby/object:Gem::Requirement
58
58
  requirements:
59
- - - ~>
59
+ - - "~>"
60
60
  - !ruby/object:Gem::Version
61
61
  version: 1.6.13
62
62
  type: :runtime
63
63
  prerelease: false
64
64
  version_requirements: !ruby/object:Gem::Requirement
65
65
  requirements:
66
- - - ~>
66
+ - - "~>"
67
67
  - !ruby/object:Gem::Version
68
68
  version: 1.6.13
69
69
  description: Tool and library that manages the episodes you have seen in different
@@ -75,9 +75,9 @@ executables:
75
75
  extensions: []
76
76
  extra_rdoc_files: []
77
77
  files:
78
- - .autotest
79
- - .gitignore
80
- - .travis.yml
78
+ - ".autotest"
79
+ - ".gitignore"
80
+ - ".travis.yml"
81
81
  - Gemfile
82
82
  - LICENSE.txt
83
83
  - README.md
@@ -91,6 +91,7 @@ files:
91
91
  - res/seriesindex.dtd
92
92
  - sindex.gemspec
93
93
  - test/seriesindex_example.xml
94
+ - test/seriesindex_new_format.xml
94
95
  - test/test_helper.rb
95
96
  - test/test_series_index.rb
96
97
  - test/test_testdata.rb
@@ -103,22 +104,23 @@ require_paths:
103
104
  - lib
104
105
  required_ruby_version: !ruby/object:Gem::Requirement
105
106
  requirements:
106
- - - '>='
107
+ - - ">="
107
108
  - !ruby/object:Gem::Version
108
109
  version: '0'
109
110
  required_rubygems_version: !ruby/object:Gem::Requirement
110
111
  requirements:
111
- - - '>='
112
+ - - ">="
112
113
  - !ruby/object:Gem::Version
113
114
  version: '0'
114
115
  requirements: []
115
116
  rubyforge_project:
116
- rubygems_version: 2.0.3
117
+ rubygems_version: 2.2.0
117
118
  signing_key:
118
119
  specification_version: 4
119
120
  summary: Series-Index that manages your watched episodes
120
121
  test_files:
121
122
  - test/seriesindex_example.xml
123
+ - test/seriesindex_new_format.xml
122
124
  - test/test_helper.rb
123
125
  - test/test_series_index.rb
124
126
  - test/test_testdata.rb