javlibrary 0.2.11 → 0.2.12

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: 9eccb00912d355abe97bbfc69fda2c5455acca48
4
- data.tar.gz: c1955ec501ab0cdfa098871c766a06acdbf480d0
3
+ metadata.gz: 5723255f77cb9d65e915321b64e063c022df08d4
4
+ data.tar.gz: 83f8061363421299df8f6f4311e11b3b252a91c7
5
5
  SHA512:
6
- metadata.gz: 36d0bb16e9aec71b743f9fdeb605f679f638ce152b2060fc9b566b078a1083ca81b12d339a653d94d9defefaf150ab4cef3bc8a5f1df47151411d5c7bf83989d
7
- data.tar.gz: c38c3768171a33fb7c803e354f050ccb61d6d702d253c66560e07052fd3364fe8abface55f9e19821abe824ea49406726dad5ad8a0b1beacc8ecf4d6eb8ec30a
6
+ metadata.gz: 0ca9c744206fa58ecdd25fe61598bc75c60b9197c7249c701a18c4ad26647df3de006c5fad3a3a096e54fb88a22822189ab0238f269667cfc077d75efdcf20aa
7
+ data.tar.gz: 48fb079df16f3bf5f40922057c4a4cdad4cab2ed7ccc12c97c77f7943e00013e7bff5034c1e5f377e9dc14e7b6fe0ec958f99a44c27d4dbc4ba9023f58a848ab
Binary file
Binary file
Binary file
Binary file
@@ -65,10 +65,12 @@ class Javlibrary
65
65
  #result["cast"] = details[-1]; result["genres"] = video_genres; result["img_url"] = video_jacket_img
66
66
  end
67
67
 
68
- def video_info_insert(client, index, identifer, actor_hash, genres_hash)
68
+ def video_info_insert(index, identifer, actor_hash, genres_hash)
69
+ client = client()
70
+
69
71
  result = downloader(identifer)
70
- return nil if result == nil
71
72
 
73
+ return nil if result == nil
72
74
  title, id, date, director, maker, label, cast_tmp, genres_tmp, img_url = result.split('$')
73
75
  cast = cast_tmp.split.reject(&:empty?)
74
76
  genres = genres_tmp.split.reject(&:empty?)
@@ -76,24 +78,34 @@ class Javlibrary
76
78
  client.query("INSERT INTO video (video_id,video_name,license,url,director,label,date,maker)
77
79
  VALUES (#{index},'#{title}','#{id}','#{img_url}','#{director}','#{label}','#{date}','#{maker}')")
78
80
  rescue
79
- return
81
+ client.query("UPDATE label SET video_download=1 WHERE video_num=#{index}")
82
+ return nil
80
83
  end
81
84
  cast.each do |a|
82
85
  a_tmp = actor_hash[a]
83
86
  next if a_tmp == nil
84
- client.query("INSERT INTO v2a (v2a_fk_video,v2a_fk_actor) VALUES(#{index}, #{a_tmp.to_i})")
87
+ begin
88
+ client.query("INSERT INTO v2a (v2a_fk_video,v2a_fk_actor) VALUES(#{index}, #{a_tmp.to_i})")
89
+ rescue
90
+ next
91
+ end
85
92
  end
86
93
 
87
94
  genres.each do |g|
88
95
  g_tmp = genres_hash[g]
89
96
  next if g_tmp == nil
90
- client.query("INSERT INTO v2c (v2c_fk_video,v2c_fk_category) VALUES(#{index}, #{g_tmp.to_i})")
97
+ begin
98
+ client.query("INSERT INTO v2c (v2c_fk_video,v2c_fk_category) VALUES(#{index}, #{g_tmp.to_i})")
99
+ rescue
100
+ next
101
+ end
91
102
  end
92
103
 
93
104
  client.query("UPDATE label SET video_download=1 WHERE video_num=#{index}")
105
+ client.close
94
106
  end
95
107
 
96
- def download_all_videos
108
+ def download_all_videos_thread
97
109
  client = client()
98
110
  result = client.query("SELECT video_num, video_label FROM label WHERE video_download=0")
99
111
  client.close
@@ -112,22 +124,37 @@ class Javlibrary
112
124
  video_array.each do |group|
113
125
  # Create a download thread
114
126
  thread_temp = Thread.new {
115
- client = client()
116
127
  group.each do |item|
117
128
  begin
118
- video_info_insert(client, item['video_num'], item['video_label'],
129
+ video_info_insert(item['video_num'], item['video_label'],
119
130
  actor_hash, genre_hash)
120
131
  rescue
121
132
  next
122
133
  end
123
134
  end
124
- client.close
125
135
  }
126
136
  thread_pool << thread_temp
127
137
  end
138
+
128
139
  thread_pool.map(&:join)
129
140
  end
130
141
 
142
+ def download_all_videos
143
+ client = client()
144
+ result = client.query("SELECT * FROM label WHERE video_download=0")
145
+ actor_hash = actor_hash()
146
+ genre_hash = genre_hash()
147
+ result.each do |item|
148
+ begin
149
+ video_info_insert(client, item['video_num'], item['video_label'],
150
+ actor_hash, genre_hash)
151
+ rescue
152
+ next
153
+ end
154
+ end
155
+ client.close
156
+ end
157
+
131
158
  def actor_hash
132
159
  client = client()
133
160
  actor_hash = Hash.new
@@ -1,3 +1,3 @@
1
1
  class Javlibrary
2
- VERSION = "0.2.11"
2
+ VERSION = "0.2.12"
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: javlibrary
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.11
4
+ version: 0.2.12
5
5
  platform: ruby
6
6
  authors:
7
7
  - Yuanhao Sun
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2017-06-02 00:00:00.000000000 Z
11
+ date: 2017-06-05 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -125,6 +125,10 @@ files:
125
125
  - Rakefile
126
126
  - bin/console
127
127
  - bin/setup
128
+ - javlibrary-0.2.10.gem
129
+ - javlibrary-0.2.11.gem
130
+ - javlibrary-0.2.8.gem
131
+ - javlibrary-0.2.9.gem
128
132
  - javlibrary.gemspec
129
133
  - lib/javlibrary.rb
130
134
  - lib/javlibrary/version.rb