Skip to content

Commit

Permalink
Merge branch 'master' of github.com:seekshreyas/obidroid
Browse files Browse the repository at this point in the history
* 'master' of github.com:seekshreyas/obidroid:
  Updated Connection file
  Added new mongodb folder and rearranged db folder
  updated changes to wiki

Conflicts:
	.gitignore
  • Loading branch information
seekshreyas committed Feb 23, 2014
2 parents eced6d2 + aebff7b commit 39f97a0
Show file tree
Hide file tree
Showing 10 changed files with 15,124 additions and 3 deletions.
21 changes: 21 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -39,5 +39,26 @@ nosetests.xml
.RData
.Rhistory


## Vagrant file
.vagrant

## OSX files
# Compiled Python files
*.pyc

# Folder view configuration files
.DS_Store
Desktop.ini

# Thumbnail cache files
._*
Thumbs.db

# Files that might appear on external disks
.Spotlight-V100
.Trashes

# Ignore the Extras file
.extra

Binary file removed db/models/.DS_Store
Binary file not shown.
7 changes: 7 additions & 0 deletions db/mongodb/Connection.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
MONGODB Goods

Login:
mongo troup.mongohq.com:10005/app18812501 -u username -p password

Load a JSON File:
mongoimport --host troup.mongohq.com:10005 --jsonArray --db app18812501 --collection apps_old -u username -p password < json file
15,055 changes: 15,055 additions & 0 deletions db/mongodb/data/alldata.json

Large diffs are not rendered by default.

File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
44 changes: 41 additions & 3 deletions db/putAppsReviews.py → db/rdbs/putAppsReviews.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,8 @@
from models.review import Review
from models.app import App

engine = create_engine('postgresql://postgres:[email protected]:28432/obidroid')
#engine = create_engine('postgresql://postgres:[email protected]:28432/obidroid')
engine = create_engine('postgresql://uzwispzaxfcipd:aSkx0cJOSmD2N4tZ2rk4hmJ8EU@ec2-54-204-20-28.compute-1.amazonaws.com:5432/obidroid')
Base = declarative_base()
Session = sessionmaker(bind=engine)
session = Session()
Expand Down Expand Up @@ -104,6 +105,43 @@ def parse_all():
session.commit()
session.close()

def _processInput(path):
""" Process the input directory
Process only djvu files that have not been transformed from directory path parameter.
"""

# check if passed path is to a directory or to a file
if os.path.isfile(path):
# extract absolute path from user submitted path value
abs_path = os.path.dirname(os.path.abspath(path))
filename = os.path.basename(path)
processFile(abs_path, filename)
elif os.path.isdir(path):
# extract absolute path from user submitted path value
abs_path = os.path.abspath(path)
# loop through and open/transform djvu files
for filename in os.listdir(abs_path):
processFile(abs_path, filename)
else:
print "An invalid directory or file was passed as input"

def _getInput():
""" Command Line Input Parsing
Parse the user input
"""

parser = OptionParser()
parser.add_option('-i', '--input', dest='filepath', default='.')
(option, args) = parser.parse_args()

if not option.filepath:
return parser.error('Input file or directory path not given, use --input="path.to.db.input"')

return {'src': option.filepath}

def main():
userInput - _getInput()
processInput

if __name__ == '__main__':
#main
parse_all()
main

0 comments on commit 39f97a0

Please sign in to comment.