annotate backend/couchdb/scripts/findUnlinkedArticles.py @ 240:1b98925facf6

Bugfix: use the existing _retrieveEntriesForSelectedFeed method to retrieve all articles when deleting a feed
author Dirk Olmes <dirk@xanthippe.ping.de>
date Tue, 28 Apr 2015 02:23:44 +0200
parents 5bbb1e707e56
children
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
237
5bbb1e707e56 add maintainance script
Dirk Olmes <dirk@xanthippe.ping.de>
parents:
diff changeset
1 #!/usr/bin/env python
5bbb1e707e56 add maintainance script
Dirk Olmes <dirk@xanthippe.ping.de>
parents:
diff changeset
2
5bbb1e707e56 add maintainance script
Dirk Olmes <dirk@xanthippe.ping.de>
parents:
diff changeset
3 import couchdb
5bbb1e707e56 add maintainance script
Dirk Olmes <dirk@xanthippe.ping.de>
parents:
diff changeset
4
5bbb1e707e56 add maintainance script
Dirk Olmes <dirk@xanthippe.ping.de>
parents:
diff changeset
5 server = couchdb.Server('http://xanthippe:5984')
5bbb1e707e56 add maintainance script
Dirk Olmes <dirk@xanthippe.ping.de>
parents:
diff changeset
6 database = server['feedworm']
5bbb1e707e56 add maintainance script
Dirk Olmes <dirk@xanthippe.ping.de>
parents:
diff changeset
7
5bbb1e707e56 add maintainance script
Dirk Olmes <dirk@xanthippe.ping.de>
parents:
diff changeset
8 #result = database.view('feedworm/feeds_with_unread_entries', group=True)
5bbb1e707e56 add maintainance script
Dirk Olmes <dirk@xanthippe.ping.de>
parents:
diff changeset
9 #for entry in result:
5bbb1e707e56 add maintainance script
Dirk Olmes <dirk@xanthippe.ping.de>
parents:
diff changeset
10 ## print(entry.key)
5bbb1e707e56 add maintainance script
Dirk Olmes <dirk@xanthippe.ping.de>
parents:
diff changeset
11 # try:
5bbb1e707e56 add maintainance script
Dirk Olmes <dirk@xanthippe.ping.de>
parents:
diff changeset
12 # document = database[entry.key]
5bbb1e707e56 add maintainance script
Dirk Olmes <dirk@xanthippe.ping.de>
parents:
diff changeset
13 # except:
5bbb1e707e56 add maintainance script
Dirk Olmes <dirk@xanthippe.ping.de>
parents:
diff changeset
14 # print('no doc for feed {0}'.format(entry.key))
5bbb1e707e56 add maintainance script
Dirk Olmes <dirk@xanthippe.ping.de>
parents:
diff changeset
15
5bbb1e707e56 add maintainance script
Dirk Olmes <dirk@xanthippe.ping.de>
parents:
diff changeset
16 #feed = '326ab7561eaadee0773c88262906a0a4'
5bbb1e707e56 add maintainance script
Dirk Olmes <dirk@xanthippe.ping.de>
parents:
diff changeset
17 #result = database.view('feedworm/feedEntries_by_feed', startkey=[feed], endkey=[feed, {}])
5bbb1e707e56 add maintainance script
Dirk Olmes <dirk@xanthippe.ping.de>
parents:
diff changeset
18 #for row in result:
5bbb1e707e56 add maintainance script
Dirk Olmes <dirk@xanthippe.ping.de>
parents:
diff changeset
19 # #del database[row.id]
5bbb1e707e56 add maintainance script
Dirk Olmes <dirk@xanthippe.ping.de>
parents:
diff changeset
20 # print(row.id)
5bbb1e707e56 add maintainance script
Dirk Olmes <dirk@xanthippe.ping.de>
parents:
diff changeset
21
5bbb1e707e56 add maintainance script
Dirk Olmes <dirk@xanthippe.ping.de>
parents:
diff changeset
22 feed = '12cd35559a627cc7f4b43d213b24201d'
5bbb1e707e56 add maintainance script
Dirk Olmes <dirk@xanthippe.ping.de>
parents:
diff changeset
23 result = database.view('feedworm/feedEntries_by_feed', startkey=[feed], endkey=[feed, {}])
5bbb1e707e56 add maintainance script
Dirk Olmes <dirk@xanthippe.ping.de>
parents:
diff changeset
24 for row in result:
5bbb1e707e56 add maintainance script
Dirk Olmes <dirk@xanthippe.ping.de>
parents:
diff changeset
25 print(row)