Class: Subfinder::Dryrun

Inherits:
Object
  • Object
show all
Defined in:
lib/subfinder/dryrun.rb

Overview

Would create a folder, create fake files and run Subfinder

Class Method Summary collapse

Class Method Details

.create_mock_files_in(folder) ⇒ Object



43
44
45
46
47
48
49
# File 'lib/subfinder/dryrun.rb', line 43

def create_mock_files_in(folder)
  mock_list_file.each do |file_name|
    File.open(folder + '/' + file_name, 'w') do |f|
      f.write('this is sample file')
    end
  end
end

.enableObject



7
8
9
10
11
12
13
# File 'lib/subfinder/dryrun.rb', line 7

def enable
  Logger.info 'Runnign in Dryrun mode.'
  dryrun_dir = Dir.pwd + '/dryrun_test_directory'
  Dir.mkdir(dryrun_dir)
  Config.working_dir = dryrun_dir
  create_mock_files_in dryrun_dir
end

.mock_list_fileObject



15
16
17
18
19
20
21
22
23
24
25
26
# File 'lib/subfinder/dryrun.rb', line 15

def mock_list_file
  # files with different subtitle file names
  files = video_subtitle_pairs

  # Files with space in their names
  files += ['The Mechanism S01E06 - The Silkworm pt1 x264 RB58.mp4',
            'The Mechanism S01E06.pilot.720p BluRay BRRip 480p'\
            ' BoB-edited version.srt']

  # Dingle file without subtutles
  files + %w[The.Mechanism.S02E03.1080p.HDTV.x264.mp4]
end

.video_subtitle_pairsObject



28
29
30
31
32
33
34
35
36
37
38
39
40
41
# File 'lib/subfinder/dryrun.rb', line 28

def video_subtitle_pairs
  %w(
    Mechanism.The.S01E01.1080p.5.1Ch.BluRay.ReEnc-DeeJayAhmed.mkv
    The.Mechanism.S01E02.HDTV.x264-SVA[eztv].mkv
    The.Mechanism.S01E03.1080p.HDTV.x264.mp4
    The.Mechanism.S01E04.720p.WEB-DL.DibaMoviez.mkv
    Agatha.Christies.Poirot.S13E02.1080p.BluRay.x264.mkv
    The.Mechanism.S01E01.WEB-DL.srt
    The.Mechanism.S01E02.HDTV.x264-SVA.srt
    The.Mechanism.S01E03.720p.HDTV.x264-IMMERSE.srt
    The.Mechanism.S01E04.HDTV.x264.KILLERS.HI.srx.srt
    The.Mechanism.S01E05.720p.WEB.H264-MEMENTO.srt
  )
end