xbmc-sql 0.0.2

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.
Files changed (54) hide show
  1. checksums.yaml +7 -0
  2. data/.gitignore +17 -0
  3. data/.rspec +1 -0
  4. data/.travis.yml +20 -0
  5. data/CHANGELOG.markdown +5 -0
  6. data/Gemfile +9 -0
  7. data/Guardfile +13 -0
  8. data/LICENSE +20 -0
  9. data/README.markdown +92 -0
  10. data/Rakefile +49 -0
  11. data/app/models/xbmc_sql/base.rb +45 -0
  12. data/app/models/xbmc_sql/file.rb +17 -0
  13. data/app/models/xbmc_sql/movie.rb +78 -0
  14. data/app/models/xbmc_sql/path.rb +33 -0
  15. data/app/models/xbmc_sql/set.rb +9 -0
  16. data/bin/rails +12 -0
  17. data/lib/tasks/xbmc_sql_tasks.rake +13 -0
  18. data/lib/xbmc_sql.rb +34 -0
  19. data/lib/xbmc_sql/engine.rb +13 -0
  20. data/lib/xbmc_sql/nfo_file.rb +76 -0
  21. data/lib/xbmc_sql/rating_updater.rb +36 -0
  22. data/lib/xbmc_sql/top_250_updater.rb +102 -0
  23. data/lib/xbmc_sql/version.rb +3 -0
  24. data/spec/factories/movie.rb +5 -0
  25. data/spec/factories/path.rb +5 -0
  26. data/spec/fixtures/movie.nfo +595 -0
  27. data/spec/fixtures/movie.nfo.bak +595 -0
  28. data/spec/fixtures/movie.tmp.nfo +595 -0
  29. data/spec/lib/xbmc_sql/nfo_file_spec.rb +62 -0
  30. data/spec/lib/xbmc_sql/rating_updater_spec.rb +48 -0
  31. data/spec/lib/xbmc_sql/top_250_updater_spec.rb +49 -0
  32. data/spec/lib/xbmc_sql_spec.rb +29 -0
  33. data/spec/models/xbmc_sql/base_spec.rb +7 -0
  34. data/spec/models/xbmc_sql/file_spec.rb +16 -0
  35. data/spec/models/xbmc_sql/movie_spec.rb +115 -0
  36. data/spec/models/xbmc_sql/path_spec.rb +49 -0
  37. data/spec/models/xbmc_sql/set_spec.rb +5 -0
  38. data/spec/spec_helper.rb +23 -0
  39. data/spec/test_app/Rakefile +6 -0
  40. data/spec/test_app/bin/bundle +3 -0
  41. data/spec/test_app/bin/rails +4 -0
  42. data/spec/test_app/bin/rake +4 -0
  43. data/spec/test_app/config.ru +4 -0
  44. data/spec/test_app/config/application.rb +16 -0
  45. data/spec/test_app/config/boot.rb +5 -0
  46. data/spec/test_app/config/database.yml +20 -0
  47. data/spec/test_app/config/environment.rb +5 -0
  48. data/spec/test_app/config/environments/development.rb +8 -0
  49. data/spec/test_app/config/environments/test.rb +7 -0
  50. data/spec/test_app/db/fresh_db.sqlite3 +0 -0
  51. data/spec/test_app/db/schema.rb +415 -0
  52. data/spec/test_app/log/.keep +0 -0
  53. data/xbmc_sql.gemspec +34 -0
  54. metadata +265 -0
@@ -0,0 +1,16 @@
1
+ require File.expand_path('../boot', __FILE__)
2
+
3
+ # Pick the frameworks you want:
4
+ require "active_record/railtie"
5
+
6
+ Bundler.require(*Rails.groups)
7
+ require "xbmc_sql"
8
+
9
+ module TestApp
10
+ class Application < Rails::Application
11
+ # config.time_zone = 'Central Time (US & Canada)'
12
+ # config.i18n.load_path += Dir[Rails.root.join('my', 'locales', '*.{rb,yml}').to_s]
13
+ # config.i18n.default_locale = :de
14
+ end
15
+ end
16
+
@@ -0,0 +1,5 @@
1
+ # Set up gems listed in the Gemfile.
2
+ ENV['BUNDLE_GEMFILE'] ||= File.expand_path('../../../../Gemfile', __FILE__)
3
+
4
+ require 'bundler/setup' if File.exist?(ENV['BUNDLE_GEMFILE'])
5
+ $LOAD_PATH.unshift File.expand_path('../../../../lib', __FILE__)
@@ -0,0 +1,20 @@
1
+ default: &default
2
+ adapter: sqlite3
3
+ pool: 5
4
+ timeout: 5000
5
+
6
+ test:
7
+ <<: *default
8
+ database: db/test.db
9
+
10
+ development:
11
+ <<: *default
12
+ database: db/development.db
13
+
14
+ xbmc_test:
15
+ <<: *default
16
+ database: db/test.db
17
+
18
+ xbmc_development:
19
+ <<: *default
20
+ database: db/development.db
@@ -0,0 +1,5 @@
1
+ # Load the Rails application.
2
+ require File.expand_path('../application', __FILE__)
3
+
4
+ # Initialize the Rails application.
5
+ Rails.application.initialize!
@@ -0,0 +1,8 @@
1
+ TestApp::Application.configure do
2
+ config.cache_classes = false
3
+ config.eager_load = false
4
+ config.active_support.deprecation = :log
5
+ config.active_record.migration_error = :page_load
6
+ config.assets.debug = true
7
+ config.assets.raise_runtime_errors = true
8
+ end
@@ -0,0 +1,7 @@
1
+ TestApp::Application.configure do
2
+ config.cache_classes = true
3
+ config.eager_load = false
4
+ config.static_cache_control = 'public, max-age=3600'
5
+ config.consider_all_requests_local = true
6
+ config.active_support.deprecation = :stderr
7
+ end
@@ -0,0 +1,415 @@
1
+ # encoding: UTF-8
2
+ # This file is auto-generated from the current state of the database. Instead
3
+ # of editing this file, please use the migrations feature of Active Record to
4
+ # incrementally modify your database, and then regenerate this schema definition.
5
+ #
6
+ # Note that this schema.rb definition is the authoritative source for your
7
+ # database schema. If you need to create the application database on another
8
+ # system, you should be using db:schema:load, not running all the migrations
9
+ # from scratch. The latter is a flawed and unsustainable approach (the more migrations
10
+ # you'll amass, the slower it'll run and the greater likelihood for issues).
11
+ #
12
+ # It's strongly recommended that you check this file into your version control system.
13
+
14
+ ActiveRecord::Schema.define(version: 0) do
15
+
16
+ create_table "actorlinkepisode", id: false, force: true do |t|
17
+ t.integer "idActor"
18
+ t.integer "idEpisode"
19
+ t.text "strRole"
20
+ t.integer "iOrder"
21
+ end
22
+
23
+ add_index "actorlinkepisode", ["idActor", "idEpisode"], name: "ix_actorlinkepisode_1", unique: true
24
+ add_index "actorlinkepisode", ["idEpisode", "idActor"], name: "ix_actorlinkepisode_2", unique: true
25
+
26
+ create_table "actorlinkmovie", id: false, force: true do |t|
27
+ t.integer "idActor"
28
+ t.integer "idMovie"
29
+ t.text "strRole"
30
+ t.integer "iOrder"
31
+ end
32
+
33
+ add_index "actorlinkmovie", ["idActor", "idMovie"], name: "ix_actorlinkmovie_1", unique: true
34
+ add_index "actorlinkmovie", ["idMovie", "idActor"], name: "ix_actorlinkmovie_2", unique: true
35
+
36
+ create_table "actorlinktvshow", id: false, force: true do |t|
37
+ t.integer "idActor"
38
+ t.integer "idShow"
39
+ t.text "strRole"
40
+ t.integer "iOrder"
41
+ end
42
+
43
+ add_index "actorlinktvshow", ["idActor", "idShow"], name: "ix_actorlinktvshow_1", unique: true
44
+ add_index "actorlinktvshow", ["idShow", "idActor"], name: "ix_actorlinktvshow_2", unique: true
45
+
46
+ create_table "actors", primary_key: "idActor", force: true do |t|
47
+ t.text "strActor"
48
+ t.text "strThumb"
49
+ end
50
+
51
+ create_table "art", primary_key: "art_id", force: true do |t|
52
+ t.integer "media_id"
53
+ t.text "media_type"
54
+ t.text "type"
55
+ t.text "url"
56
+ end
57
+
58
+ add_index "art", ["media_id", "media_type", "type"], name: "ix_art"
59
+
60
+ create_table "artistlinkmusicvideo", id: false, force: true do |t|
61
+ t.integer "idArtist"
62
+ t.integer "idMVideo"
63
+ end
64
+
65
+ add_index "artistlinkmusicvideo", ["idArtist", "idMVideo"], name: "ix_artistlinkmusicvideo_1", unique: true
66
+ add_index "artistlinkmusicvideo", ["idMVideo", "idArtist"], name: "ix_artistlinkmusicvideo_2", unique: true
67
+
68
+ create_table "bookmark", primary_key: "idBookmark", force: true do |t|
69
+ t.integer "idFile"
70
+ t.float "timeInSeconds"
71
+ t.float "totalTimeInSeconds"
72
+ t.text "thumbNailImage"
73
+ t.text "player"
74
+ t.text "playerState"
75
+ t.integer "type"
76
+ end
77
+
78
+ add_index "bookmark", ["idFile", "type"], name: "ix_bookmark"
79
+
80
+ create_table "country", primary_key: "idCountry", force: true do |t|
81
+ t.text "strCountry"
82
+ end
83
+
84
+ create_table "countrylinkmovie", id: false, force: true do |t|
85
+ t.integer "idCountry"
86
+ t.integer "idMovie"
87
+ end
88
+
89
+ add_index "countrylinkmovie", ["idCountry", "idMovie"], name: "ix_countrylinkmovie_1", unique: true
90
+ add_index "countrylinkmovie", ["idMovie", "idCountry"], name: "ix_countrylinkmovie_2", unique: true
91
+
92
+ create_table "directorlinkepisode", id: false, force: true do |t|
93
+ t.integer "idDirector"
94
+ t.integer "idEpisode"
95
+ end
96
+
97
+ add_index "directorlinkepisode", ["idDirector", "idEpisode"], name: "ix_directorlinkepisode_1", unique: true
98
+ add_index "directorlinkepisode", ["idEpisode", "idDirector"], name: "ix_directorlinkepisode_2", unique: true
99
+
100
+ create_table "directorlinkmovie", id: false, force: true do |t|
101
+ t.integer "idDirector"
102
+ t.integer "idMovie"
103
+ end
104
+
105
+ add_index "directorlinkmovie", ["idDirector", "idMovie"], name: "ix_directorlinkmovie_1", unique: true
106
+ add_index "directorlinkmovie", ["idMovie", "idDirector"], name: "ix_directorlinkmovie_2", unique: true
107
+
108
+ create_table "directorlinkmusicvideo", id: false, force: true do |t|
109
+ t.integer "idDirector"
110
+ t.integer "idMVideo"
111
+ end
112
+
113
+ add_index "directorlinkmusicvideo", ["idDirector", "idMVideo"], name: "ix_directorlinkmusicvideo_1", unique: true
114
+ add_index "directorlinkmusicvideo", ["idMVideo", "idDirector"], name: "ix_directorlinkmusicvideo_2", unique: true
115
+
116
+ create_table "directorlinktvshow", id: false, force: true do |t|
117
+ t.integer "idDirector"
118
+ t.integer "idShow"
119
+ end
120
+
121
+ add_index "directorlinktvshow", ["idDirector", "idShow"], name: "ix_directorlinktvshow_1", unique: true
122
+ add_index "directorlinktvshow", ["idShow", "idDirector"], name: "ix_directorlinktvshow_2", unique: true
123
+
124
+ create_table "episode", primary_key: "idEpisode", force: true do |t|
125
+ t.integer "idFile"
126
+ t.text "c00"
127
+ t.text "c01"
128
+ t.text "c02"
129
+ t.text "c03"
130
+ t.text "c04"
131
+ t.text "c05"
132
+ t.text "c06"
133
+ t.text "c07"
134
+ t.text "c08"
135
+ t.text "c09"
136
+ t.text "c10"
137
+ t.text "c11"
138
+ t.string "c12", limit: 24
139
+ t.string "c13", limit: 24
140
+ t.text "c14"
141
+ t.text "c15"
142
+ t.text "c16"
143
+ t.string "c17", limit: 24
144
+ t.text "c18"
145
+ t.text "c19"
146
+ t.text "c20"
147
+ t.text "c21"
148
+ t.text "c22"
149
+ t.text "c23"
150
+ t.integer "idShow"
151
+ end
152
+
153
+ add_index "episode", ["c12", "c13"], name: "ix_episode_season_episode"
154
+ add_index "episode", ["c17"], name: "ix_episode_bookmark"
155
+ add_index "episode", ["c19"], name: "ixEpisodeBasePath"
156
+ add_index "episode", ["idEpisode", "idFile"], name: "ix_episode_file_1", unique: true
157
+ add_index "episode", ["idEpisode", "idShow"], name: "ix_episode_show1"
158
+ add_index "episode", ["idFile", "idEpisode"], name: "id_episode_file_2", unique: true
159
+ add_index "episode", ["idShow", "idEpisode"], name: "ix_episode_show2"
160
+
161
+ create_table "files", primary_key: "idFile", force: true do |t|
162
+ t.integer "idPath"
163
+ t.text "strFilename"
164
+ t.integer "playCount"
165
+ t.text "lastPlayed"
166
+ t.text "dateAdded"
167
+ end
168
+
169
+ add_index "files", ["idPath", "strFilename"], name: "ix_files"
170
+
171
+ create_table "genre", primary_key: "idGenre", force: true do |t|
172
+ t.text "strGenre"
173
+ end
174
+
175
+ create_table "genrelinkmovie", id: false, force: true do |t|
176
+ t.integer "idGenre"
177
+ t.integer "idMovie"
178
+ end
179
+
180
+ add_index "genrelinkmovie", ["idGenre", "idMovie"], name: "ix_genrelinkmovie_1", unique: true
181
+ add_index "genrelinkmovie", ["idMovie", "idGenre"], name: "ix_genrelinkmovie_2", unique: true
182
+
183
+ create_table "genrelinkmusicvideo", id: false, force: true do |t|
184
+ t.integer "idGenre"
185
+ t.integer "idMVideo"
186
+ end
187
+
188
+ add_index "genrelinkmusicvideo", ["idGenre", "idMVideo"], name: "ix_genrelinkmusicvideo_1", unique: true
189
+ add_index "genrelinkmusicvideo", ["idMVideo", "idGenre"], name: "ix_genrelinkmusicvideo_2", unique: true
190
+
191
+ create_table "genrelinktvshow", id: false, force: true do |t|
192
+ t.integer "idGenre"
193
+ t.integer "idShow"
194
+ end
195
+
196
+ add_index "genrelinktvshow", ["idGenre", "idShow"], name: "ix_genrelinktvshow_1", unique: true
197
+ add_index "genrelinktvshow", ["idShow", "idGenre"], name: "ix_genrelinktvshow_2", unique: true
198
+
199
+ create_table "movie", primary_key: "idMovie", force: true do |t|
200
+ t.integer "idFile"
201
+ t.text "c00"
202
+ t.text "c01"
203
+ t.text "c02"
204
+ t.text "c03"
205
+ t.text "c04"
206
+ t.text "c05"
207
+ t.text "c06"
208
+ t.text "c07"
209
+ t.text "c08"
210
+ t.text "c09"
211
+ t.text "c10"
212
+ t.text "c11"
213
+ t.text "c12"
214
+ t.text "c13"
215
+ t.text "c14"
216
+ t.text "c15"
217
+ t.text "c16"
218
+ t.text "c17"
219
+ t.text "c18"
220
+ t.text "c19"
221
+ t.text "c20"
222
+ t.text "c21"
223
+ t.text "c22"
224
+ t.text "c23"
225
+ t.integer "idSet"
226
+ end
227
+
228
+ add_index "movie", ["c23"], name: "ixMovieBasePath"
229
+ add_index "movie", ["idFile", "idMovie"], name: "ix_movie_file_1", unique: true
230
+ add_index "movie", ["idMovie", "idFile"], name: "ix_movie_file_2", unique: true
231
+
232
+ create_table "movielinktvshow", id: false, force: true do |t|
233
+ t.integer "idMovie"
234
+ t.integer "IdShow"
235
+ end
236
+
237
+ add_index "movielinktvshow", ["IdShow", "idMovie"], name: "ix_movielinktvshow_1", unique: true
238
+ add_index "movielinktvshow", ["idMovie", "IdShow"], name: "ix_movielinktvshow_2", unique: true
239
+
240
+ create_table "musicvideo", primary_key: "idMVideo", force: true do |t|
241
+ t.integer "idFile"
242
+ t.text "c00"
243
+ t.text "c01"
244
+ t.text "c02"
245
+ t.text "c03"
246
+ t.text "c04"
247
+ t.text "c05"
248
+ t.text "c06"
249
+ t.text "c07"
250
+ t.text "c08"
251
+ t.text "c09"
252
+ t.text "c10"
253
+ t.text "c11"
254
+ t.text "c12"
255
+ t.text "c13"
256
+ t.text "c14"
257
+ t.text "c15"
258
+ t.text "c16"
259
+ t.text "c17"
260
+ t.text "c18"
261
+ t.text "c19"
262
+ t.text "c20"
263
+ t.text "c21"
264
+ t.text "c22"
265
+ t.text "c23"
266
+ end
267
+
268
+ add_index "musicvideo", ["c14"], name: "ixMusicVideoBasePath"
269
+ add_index "musicvideo", ["idFile", "idMVideo"], name: "ix_musicvideo_file_2", unique: true
270
+ add_index "musicvideo", ["idMVideo", "idFile"], name: "ix_musicvideo_file_1", unique: true
271
+
272
+ # Could not dump table "path" because of following NoMethodError
273
+ # undefined method `[]' for nil:NilClass
274
+
275
+ create_table "seasons", primary_key: "idSeason", force: true do |t|
276
+ t.integer "idShow"
277
+ t.integer "season"
278
+ end
279
+
280
+ add_index "seasons", ["idShow", "season"], name: "ix_seasons"
281
+
282
+ create_table "sets", primary_key: "idSet", force: true do |t|
283
+ t.text "strSet"
284
+ end
285
+
286
+ # Could not dump table "settings" because of following NoMethodError
287
+ # undefined method `[]' for nil:NilClass
288
+
289
+ create_table "stacktimes", id: false, force: true do |t|
290
+ t.integer "idFile"
291
+ t.text "times"
292
+ end
293
+
294
+ add_index "stacktimes", ["idFile"], name: "ix_stacktimes", unique: true
295
+
296
+ create_table "streamdetails", id: false, force: true do |t|
297
+ t.integer "idFile"
298
+ t.integer "iStreamType"
299
+ t.text "strVideoCodec"
300
+ t.float "fVideoAspect"
301
+ t.integer "iVideoWidth"
302
+ t.integer "iVideoHeight"
303
+ t.text "strAudioCodec"
304
+ t.integer "iAudioChannels"
305
+ t.text "strAudioLanguage"
306
+ t.text "strSubtitleLanguage"
307
+ t.integer "iVideoDuration"
308
+ t.text "strStereoMode"
309
+ end
310
+
311
+ add_index "streamdetails", ["idFile"], name: "ix_streamdetails"
312
+
313
+ create_table "studio", primary_key: "idStudio", force: true do |t|
314
+ t.text "strStudio"
315
+ end
316
+
317
+ create_table "studiolinkmovie", id: false, force: true do |t|
318
+ t.integer "idStudio"
319
+ t.integer "idMovie"
320
+ end
321
+
322
+ add_index "studiolinkmovie", ["idMovie", "idStudio"], name: "ix_studiolinkmovie_2", unique: true
323
+ add_index "studiolinkmovie", ["idStudio", "idMovie"], name: "ix_studiolinkmovie_1", unique: true
324
+
325
+ create_table "studiolinkmusicvideo", id: false, force: true do |t|
326
+ t.integer "idStudio"
327
+ t.integer "idMVideo"
328
+ end
329
+
330
+ add_index "studiolinkmusicvideo", ["idMVideo", "idStudio"], name: "ix_studiolinkmusicvideo_2", unique: true
331
+ add_index "studiolinkmusicvideo", ["idStudio", "idMVideo"], name: "ix_studiolinkmusicvideo_1", unique: true
332
+
333
+ create_table "studiolinktvshow", id: false, force: true do |t|
334
+ t.integer "idStudio"
335
+ t.integer "idShow"
336
+ end
337
+
338
+ add_index "studiolinktvshow", ["idShow", "idStudio"], name: "ix_studiolinktvshow_2", unique: true
339
+ add_index "studiolinktvshow", ["idStudio", "idShow"], name: "ix_studiolinktvshow_1", unique: true
340
+
341
+ create_table "tag", primary_key: "idTag", force: true do |t|
342
+ t.text "strTag"
343
+ end
344
+
345
+ add_index "tag", ["strTag"], name: "ix_tag_1", unique: true
346
+
347
+ create_table "taglinks", id: false, force: true do |t|
348
+ t.integer "idTag"
349
+ t.integer "idMedia"
350
+ t.text "media_type"
351
+ end
352
+
353
+ add_index "taglinks", ["idMedia", "media_type", "idTag"], name: "ix_taglinks_2", unique: true
354
+ add_index "taglinks", ["idTag", "media_type", "idMedia"], name: "ix_taglinks_1", unique: true
355
+ add_index "taglinks", ["media_type"], name: "ix_taglinks_3"
356
+
357
+ create_table "tvshow", primary_key: "idShow", force: true do |t|
358
+ t.text "c00"
359
+ t.text "c01"
360
+ t.text "c02"
361
+ t.text "c03"
362
+ t.text "c04"
363
+ t.text "c05"
364
+ t.text "c06"
365
+ t.text "c07"
366
+ t.text "c08"
367
+ t.text "c09"
368
+ t.text "c10"
369
+ t.text "c11"
370
+ t.text "c12"
371
+ t.text "c13"
372
+ t.text "c14"
373
+ t.text "c15"
374
+ t.text "c16"
375
+ t.text "c17"
376
+ t.text "c18"
377
+ t.text "c19"
378
+ t.text "c20"
379
+ t.text "c21"
380
+ t.text "c22"
381
+ t.text "c23"
382
+ end
383
+
384
+ add_index "tvshow", ["c17"], name: "ixTVShowBasePath"
385
+
386
+ create_table "tvshowlinkpath", id: false, force: true do |t|
387
+ t.integer "idShow"
388
+ t.integer "idPath"
389
+ end
390
+
391
+ add_index "tvshowlinkpath", ["idPath", "idShow"], name: "ix_tvshowlinkpath_2", unique: true
392
+ add_index "tvshowlinkpath", ["idShow", "idPath"], name: "ix_tvshowlinkpath_1", unique: true
393
+
394
+ create_table "version", id: false, force: true do |t|
395
+ t.integer "idVersion"
396
+ t.integer "iCompressCount"
397
+ end
398
+
399
+ create_table "writerlinkepisode", id: false, force: true do |t|
400
+ t.integer "idWriter"
401
+ t.integer "idEpisode"
402
+ end
403
+
404
+ add_index "writerlinkepisode", ["idEpisode", "idWriter"], name: "ix_writerlinkepisode_2", unique: true
405
+ add_index "writerlinkepisode", ["idWriter", "idEpisode"], name: "ix_writerlinkepisode_1", unique: true
406
+
407
+ create_table "writerlinkmovie", id: false, force: true do |t|
408
+ t.integer "idWriter"
409
+ t.integer "idMovie"
410
+ end
411
+
412
+ add_index "writerlinkmovie", ["idMovie", "idWriter"], name: "ix_writerlinkmovie_2", unique: true
413
+ add_index "writerlinkmovie", ["idWriter", "idMovie"], name: "ix_writerlinkmovie_1", unique: true
414
+
415
+ end