tmdb_trailer 0.2.6 → 0.2.7
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/VERSION +1 -1
- data/lib/tmdb_trailer.rb +6 -15
- data/spec/test.pstore +1 -1
- data/tmdb_trailer.gemspec +1 -1
- metadata +3 -3
data/VERSION
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
0.2.
|
|
1
|
+
0.2.7
|
data/lib/tmdb_trailer.rb
CHANGED
|
@@ -11,26 +11,17 @@ module TMDB
|
|
|
11
11
|
API_KEY = File.read(File.join(File.expand_path(File.dirname(__FILE__)), "secret.txt")).gsub("\n","")
|
|
12
12
|
NEXT_PAGE = 1
|
|
13
13
|
# country - country code i.e "us" for united states, "hk" for hongkong
|
|
14
|
-
#
|
|
15
|
-
|
|
16
|
-
def initialize(country,mode)
|
|
14
|
+
# db_name - database name to store mongo documents, will create one for you if it doesnt exists
|
|
15
|
+
def initialize(country,db_name)
|
|
17
16
|
@base_uri = "http://api.themoviedb.org/2.1/Movie.browse/en-US/json/"
|
|
18
17
|
@country = country
|
|
19
|
-
|
|
20
|
-
db_name = "grindbox"
|
|
21
|
-
pstore_name = "country_progress.pstore"
|
|
22
|
-
elsif mode == "test"
|
|
23
|
-
db_name = "test"
|
|
24
|
-
pstore_name = "test.pstore"
|
|
25
|
-
else
|
|
26
|
-
puts "Incorrect Mode: should be 'production' or 'test'"
|
|
27
|
-
end
|
|
18
|
+
|
|
28
19
|
#initialize the mongoDB connection
|
|
29
20
|
@db = Mongo::Connection.new.db(db_name)
|
|
30
|
-
@pstore = PStore.new(
|
|
21
|
+
@pstore = PStore.new("#{db_name}.pstore")
|
|
31
22
|
@coll = @db["movies"]
|
|
32
|
-
|
|
33
|
-
# create index to avoid duplicate documents
|
|
23
|
+
|
|
24
|
+
#if mongo collection does not exist, create index to avoid duplicate documents
|
|
34
25
|
if @coll.count == 0
|
|
35
26
|
@coll.create_index("name", :unique => true)
|
|
36
27
|
end
|
data/spec/test.pstore
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"czi"
|
|
1
|
+
{"nzi"czi"bri
|
data/tmdb_trailer.gemspec
CHANGED
metadata
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
|
2
2
|
name: tmdb_trailer
|
|
3
3
|
version: !ruby/object:Gem::Version
|
|
4
|
-
hash:
|
|
4
|
+
hash: 25
|
|
5
5
|
prerelease:
|
|
6
6
|
segments:
|
|
7
7
|
- 0
|
|
8
8
|
- 2
|
|
9
|
-
-
|
|
10
|
-
version: 0.2.
|
|
9
|
+
- 7
|
|
10
|
+
version: 0.2.7
|
|
11
11
|
platform: ruby
|
|
12
12
|
authors:
|
|
13
13
|
- redgetan
|