Merge branch 'master' of github.com:samuelclay/NewsBlur into backbone

* 'master' of github.com:samuelclay/NewsBlur:
  expand on OS X install notes
  easier interface for multiple items (stories, feeds) in Python API
This commit is contained in:
Samuel Clay 2012-06-07 13:57:19 -07:00
commit 452f330148
2 changed files with 42 additions and 21 deletions

View file

@ -87,6 +87,7 @@ Not the easiest to get installed. If you are running Mac OS X, you have a few op
* Use the [Superpack by Chris Fonnesbeck](http://fonnesbeck.github.com/ScipySuperpack/)
* Use MacPorts: `sudo port install py26-numpy py26-scipy`
* Install from source (grueling): [http://www.scipy.org/Download](http://www.scipy.org/Download)
* Use a combination of pip, easy_install, and [homebrew](http://mxcl.github.com/homebrew/): `pip install numpy && brew install gfortran && easy_install scipy`
### Configure paths
@ -109,6 +110,7 @@ these after the installation below.
fab -R local setup_mongoengine
fab -R local setup_forked_mongoengine
fab -R local setup_repo_local_settings
fab -R local compress_assets
If any of the packages fail to install (`lxml`, for instance), look through `fabfile.py`
and check if there is a function that can be used to circumvent broken easy_install
@ -117,7 +119,16 @@ these after the installation below.
fab -R local setup_libxml_code
2. Configure MySQL/PostgreSQL by adding in a `newsblur` user and a `newsblur` database.
2. Configure MySQL/PostgreSQL by adding in a `newsblur` user and a `newsblur` database. Here's an example for MySQL:
mysql_install_db --verbose --user=`whoami` --basedir="$(brew --prefix mysql)" --datadir=/path/to/var/mysql --tmpdir=/tmp
mysql.server start
mysql -u root
> CREATE USER 'newsblur'@'localhost' IDENTIFIED BY '';
> GRANT ALL PRIVILEGES ON *.* TO 'newsblur'@'localhost' WITH GRANT OPTION;
> CREATE DATABASE newsblur;
> exit
Then load up the database with empty NewsBlur tables and bootstrap the database:
./manage.py syncdb --all
@ -127,7 +138,11 @@ these after the installation below.
If you don't create a user during `syncdb`, the `bootstrap.json` file will create a
newsblur user with no password.
3. Run the development server. At this point, all dependencies should be installed and no
3. Start mongodb (if not already running):
mongod run
4. Run the development server. At this point, all dependencies should be installed and no
additional configuration is needed. If you find that something is not working at this
point, please email the resulting output to Samuel Clay at
[samuel@ofbrooklyn.com](samuel@ofbrooklyn.com).

View file

@ -1,5 +1,6 @@
# Original API work by Dananjaya Ramanayake <dananjaya86@gmail.com>
# Retooled by Samuel Clay, August 2011
# Modified by Luke Hagan, 2011-11-05
import urllib, urllib2
import cookielib
@ -95,9 +96,10 @@ class API:
Used when combined with /reader/feeds and include_favicons=false, so the feeds request contains far less data.
Useful for mobile devices, but requires a second request.
'''
return {
'feeds': feeds
}
data = []
for feed in feeds:
data.append( ("feeds", feed) )
return data
@request()
def page(self, feed_id):
@ -166,32 +168,34 @@ class API:
'page': page,
}
@request('rewader/river_stories')
@request('reader/river_stories')
def river_stories(self, feeds, page=1, read_stories_count=0):
'''
Retrieve stories from a collection of feeds. This is known as the River of News.
Stories are ordered in reverse chronological order.
`read_stories_count` is the number of stories that have been read in this
continuation, so NewsBlur can efficiently skip those stories when retrieving
new stories.
new stories. Takes an array of feed ids.
'''
return {
'feeds': feeds,
'page': page,
'read_stories_count': read_stories_count,
}
data = [ ('page', page), ('read_stories_count', read_stories_count) ]
for feed in feeds:
data.append( ("feeds", feed) )
return data
@request('reader/mark_story_as_read')
def mark_story_as_read(self, feed_id, story_id):
def mark_story_as_read(self, feed_id, story_ids):
'''
Mark stories as read.
Multiple story ids can be sent at once.
Each story must be from the same feed.
Takes an array of story ids.
'''
return {
'feed_id': feed_id,
'story_id': story_id,
}
data = [ ('feed_id', feed_id) ]
for story_id in story_ids:
data.append( ("story_id", story_id) )
return data
@request('reader/mark_story_as_starred')
def mark_story_as_starred(self, feed_id, story_id):
@ -277,13 +281,15 @@ class API:
}
@request('reader/mark_feed_as_read')
def mark_feed_as_read(self, feed_id):
def mark_feed_as_read(self, feed_ids):
'''
Mark a list of feeds as read.
Takes an array of feeds.
'''
return {
'feed_id': feed_id,
}
data = []
for feed in feed_ids:
data.append( ("feed_id", feed) )
return data
@request('reader/save_feed_order')
def save_feed_order(self, folders):