rubyVDRconvert 0.0.2 → 0.0.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/bin/rubyVDRconvert CHANGED
@@ -2,3 +2,15 @@
2
2
 
3
3
  # TODO: Lower my own process priority to idle class
4
4
  # TODO: Write the daemon
5
+
6
+ require 'rubygems'
7
+
8
+ require 'lib/recordings.rb'
9
+
10
+ recordings = Recordings.new
11
+ recordings.load
12
+
13
+ while true
14
+ recordings.scan
15
+ sleep 300
16
+ end
data/lib/recording.rb CHANGED
@@ -30,18 +30,13 @@ class Recording
30
30
  def load_info()
31
31
  #begin
32
32
  info = File.read(@directory + '/info')
33
- info.force_encoding('BINARY')
34
- cd = CharDet.detect(info)
35
- encoding = cd['encoding']
36
33
  info.each_line { | line |
37
34
  case line[0..1]
38
35
  when 'T '
39
36
  @title = line[2..256].chomp
40
- @title.force_encoding(encoding)
41
37
  p "Found title: #{@title}"
42
38
  when 'S '
43
39
  @subtitle = line[2..256].chomp
44
- @subtitle.force_encoding(encoding)
45
40
  p "Found subtitle: #{@subtitle}"
46
41
  end
47
42
  }
data/lib/recordings.rb CHANGED
@@ -1,5 +1,4 @@
1
1
  require 'rubygems'
2
- require 'rchardet'
3
2
  require 'find'
4
3
 
5
4
  require 'recording'
@@ -9,15 +8,10 @@ class Recordings
9
8
  @recordings_db = Hash.new
10
9
  end
11
10
  def scan()
12
- basedir = '/var/vdr/video'
11
+ basedir = '/vdr'
13
12
  found_directories = Array.new
14
13
  Find.find(basedir) { | entry |
15
14
  entry.force_encoding('BINARY')
16
- # Guess encoding of filename
17
- cd = CharDet.detect(entry)
18
- encoding = cd['encoding']
19
- #p encoding
20
- entry.force_encoding(encoding)
21
15
  # Look for the index file created by VDR
22
16
  if File.basename(entry) == "index" then
23
17
  directory = File.dirname(entry)
@@ -34,13 +28,14 @@ class Recordings
34
28
  }
35
29
  end
36
30
  def dump()
37
- File.new('/var/vdr/video/rubyVDRconvert.recordings.marshal', 'wb:ascii-8bit') { | f |
31
+ File.new('/vdr/rubyVDRconvert.recordings.marshal', 'wb:ascii-8bit') { | f |
38
32
  f.write(Marshal.dump(@recordings_db))
39
33
  }
40
34
  end
41
35
  def load()
42
36
  begin
43
- @recordings_db = Marshal.load(File.read('/var/vdr/video/rubyVDRconvert.recordings.marshal'))
37
+ data = File.read('/vdr/rubyVDRconvert.recordings.marshal')
38
+ @recordings_db = Marshal.load(data)
44
39
  rescue
45
40
  @recordings_db = Hash.new
46
41
  end
@@ -53,7 +48,4 @@ class Recordings
53
48
  @recordings_db[directory] = Recording.new(directory)
54
49
  @recordings_db[directory].process!
55
50
  end
56
- def delete(recording)
57
- # TODO: Delete the recording
58
- end
59
51
  end
metadata CHANGED
@@ -5,8 +5,8 @@ version: !ruby/object:Gem::Version
5
5
  segments:
6
6
  - 0
7
7
  - 0
8
- - 2
9
- version: 0.0.2
8
+ - 3
9
+ version: 0.0.3
10
10
  platform: ruby
11
11
  authors:
12
12
  - Daniel Frank
@@ -28,7 +28,6 @@ extra_rdoc_files: []
28
28
 
29
29
  files:
30
30
  - lib/file_dir.rb
31
- - lib/processing_thread.rb
32
31
  - lib/recording.rb
33
32
  - lib/recording_ts.rb
34
33
  - lib/recording_vdr.rb
@@ -1,8 +0,0 @@
1
- class Processing_thread
2
- def start
3
- # TODO: Run the processing thread
4
- end
5
- def stop
6
- # TODO: Stop the processing thread
7
- end
8
- end