blitzcrank 0.1.0 → 0.1.1

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.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: b9bb6bb9dd42703db58aa7893c6f1b0f81c71e0b
4
- data.tar.gz: e733df2418cd8d24de025aa735d3742eb2cb6bf7
3
+ metadata.gz: b8fd04be5f9f957818a9d67d0b092123f8273600
4
+ data.tar.gz: eaef4cae484010e2a3f17b0cdee60d24a35d0a83
5
5
  SHA512:
6
- metadata.gz: 67875a44997615db71b5ea5abf3e1c2aa111d32c01428c7754b77837f6a784a7018d655c29e8bc3259766f1da1b56985e7f14cefb2115cd7a1697f85cd8234c3
7
- data.tar.gz: 471121d590e20df4f447ec5fb231502d6b44125b924abcfee26ae049725daa1672be3e981e484c1a624625fda40f835265775d7eabbf1d2f50433384ed340dc5
6
+ metadata.gz: 1962d42effbc0298c48235dc381e1c87a33446eeaab2021172244af3ee50c9dd34fa4a2550ea7ca8e88cd2bfb21dda410d75bc2f6dca3b5c03a2d409b3eec420
7
+ data.tar.gz: ef2a7a00ce83ab74b4ea20686ea42f49f3cb393a8a0f6ea02ddd77d7cc1d201a2c00df8155fdfa78c9afa29968550efb32c5ff7e52244515d35a80abe5bf5da4
data/lib/blitzcrank.rb CHANGED
@@ -12,11 +12,14 @@ module Blitzcrank
12
12
  :season_identifier => "Season ",
13
13
  :remote_host => "localhost" ,
14
14
  :remote_user => %x[whoami],
15
- :remote_base_dir => "~/"
15
+ :remote_base_dir => "~/",
16
+ :dry_run => false
16
17
  }
17
18
 
18
19
  @valid_config_keys = @config.keys
19
20
 
21
+ @tv_show_regex = /(.*)\.s?(\d{1,2})[ex](\d{2})/i # Supports s01e01, 1x03
22
+
20
23
  # Configure through hash
21
24
  def self.configure(opts = {})
22
25
  opts.each {|k,v| @config[k.to_sym] = v if @valid_config_keys.include? k.to_sym}
@@ -43,7 +46,11 @@ module Blitzcrank
43
46
  end
44
47
 
45
48
  def self.transfer_file(remote_path, local_dir)
46
- system("rsync -avz #{ '--bwlimit=' + @config[:bwlimit] unless @config[:bwlimit].nil? } --progress --rsh='ssh' \"#{@config[:remote_user]}@#{@config[:remote_host]}:#{@config[:remote_base_dir]}#{remote_path.gsub(' ', '\\ ')}\" \"#{local_dir}\"")
49
+ if @config[:dry_run]
50
+ puts "Copying #{remote_path} to #{local_dir}"
51
+ else
52
+ system("rsync -avz #{ '--bwlimit=' + @config[:bwlimit] unless @config[:bwlimit].nil? } --progress --rsh='ssh' \"#{@config[:remote_user]}@#{@config[:remote_host]}:#{@config[:remote_base_dir]}#{remote_path.gsub(' ', '\\ ')}\" \"#{local_dir}\"")
53
+ end
47
54
  end
48
55
 
49
56
  # get a listing of all remote files that would be considered "videos"
@@ -114,14 +121,14 @@ module Blitzcrank
114
121
 
115
122
  # pulls the season number froma file
116
123
  def self.season(file_name)
117
- /s?(\d{2})e?\d{2}/i.match(file_name)
118
- $1.gsub(/\A0+/, '')
124
+ @tv_show_regex.match(file_name)
125
+ $2.gsub(/\A0+/, '')
119
126
  end
120
127
 
121
128
  def self.nice_tv_name(file_name)
122
- unless /(.*).s?(\d{2})e?(\d{2})/i.match(file_name).nil?
123
- oldShowName = $1
124
- wordsInShowName = oldShowName.gsub('.', ' ').downcase.split(" ")
129
+ unless @tv_show_regex.match(file_name).nil?
130
+ showName = $1
131
+ wordsInShowName = showName.gsub(/[\._]/, ' ').downcase.split(" ") # strip . and _
125
132
  wordsInShowName.each do |word|
126
133
  if wordsInShowName.index(word) == 0 || /^(in|a|the|and|on)$/i.match(word).nil?
127
134
  word.capitalize!
@@ -1,3 +1,3 @@
1
1
  module Blitzcrank
2
- VERSION = "0.1.0"
2
+ VERSION = "0.1.1"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: blitzcrank
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.0
4
+ version: 0.1.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - pyro2927