mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-07-09 03:04:10 -04:00
IGN:Speed up book deletion from the database and update Physics Today recipe
This commit is contained in:
parent
94d0473c97
commit
4d150760d3
@ -216,12 +216,9 @@ class BooksModel(QAbstractTableModel):
|
|||||||
|
|
||||||
|
|
||||||
def delete_books(self, indices):
|
def delete_books(self, indices):
|
||||||
ids = [ self.id(i) for i in indices ]
|
ids = map(self.id, indices)
|
||||||
for id in ids:
|
for id in ids:
|
||||||
row = self.db.index(id)
|
self.db.delete_book(id, notify=False)
|
||||||
self.beginRemoveRows(QModelIndex(), row, row)
|
|
||||||
self.db.delete_book(id)
|
|
||||||
self.endRemoveRows()
|
|
||||||
self.count_changed()
|
self.count_changed()
|
||||||
self.clear_caches()
|
self.clear_caches()
|
||||||
self.reset()
|
self.reset()
|
||||||
|
@ -729,7 +729,7 @@ class LibraryDatabase2(LibraryDatabase):
|
|||||||
if notify:
|
if notify:
|
||||||
self.notify('metadata', [id])
|
self.notify('metadata', [id])
|
||||||
|
|
||||||
def delete_book(self, id):
|
def delete_book(self, id, notify=True):
|
||||||
'''
|
'''
|
||||||
Removes book from the result cache and the underlying database.
|
Removes book from the result cache and the underlying database.
|
||||||
'''
|
'''
|
||||||
@ -744,6 +744,7 @@ class LibraryDatabase2(LibraryDatabase):
|
|||||||
self.conn.commit()
|
self.conn.commit()
|
||||||
self.clean()
|
self.clean()
|
||||||
self.data.books_deleted([id])
|
self.data.books_deleted([id])
|
||||||
|
if notify:
|
||||||
self.notify('delete', [id])
|
self.notify('delete', [id])
|
||||||
|
|
||||||
def remove_format(self, index, format, index_is_id=False, notify=True):
|
def remove_format(self, index, format, index_is_id=False, notify=True):
|
||||||
|
@ -1,5 +1,6 @@
|
|||||||
import re
|
import re
|
||||||
from calibre.web.feeds.news import BasicNewsRecipe
|
from calibre.web.feeds.news import BasicNewsRecipe
|
||||||
|
from calibre import strftime
|
||||||
|
|
||||||
class Physicstoday(BasicNewsRecipe):
|
class Physicstoday(BasicNewsRecipe):
|
||||||
title = u'Physicstoday'
|
title = u'Physicstoday'
|
||||||
@ -8,6 +9,7 @@ class Physicstoday(BasicNewsRecipe):
|
|||||||
publisher = 'American Institute of Physics'
|
publisher = 'American Institute of Physics'
|
||||||
category = 'Physics'
|
category = 'Physics'
|
||||||
language = _('English')
|
language = _('English')
|
||||||
|
cover_url = strftime('http://ptonline.aip.org/journals/doc/PHTOAD-home/jrnls/images/medcover%m_%Y.jpg')
|
||||||
oldest_article = 30
|
oldest_article = 30
|
||||||
max_articles_per_feed = 100
|
max_articles_per_feed = 100
|
||||||
no_stylesheets = True
|
no_stylesheets = True
|
||||||
@ -17,8 +19,10 @@ class Physicstoday(BasicNewsRecipe):
|
|||||||
remove_tags_before = dict(name='h1')
|
remove_tags_before = dict(name='h1')
|
||||||
remove_tags = [dict(name='div', attrs={'class':'highslide-footer'})]
|
remove_tags = [dict(name='div', attrs={'class':'highslide-footer'})]
|
||||||
remove_tags = [dict(name='div', attrs={'class':'highslide-header'})]
|
remove_tags = [dict(name='div', attrs={'class':'highslide-header'})]
|
||||||
|
#remove_tags = [dict(name='a', attrs={'class':'highslide'})]
|
||||||
preprocess_regexps = [
|
preprocess_regexps = [
|
||||||
(re.compile(r'<!--start PHTOAD_tail.jsp -->.*</body>', re.DOTALL|re.IGNORECASE),
|
#(re.compile(r'<!--start PHTOAD_tail.jsp -->.*</body>', re.DOTALL|re.IGNORECASE),
|
||||||
|
(re.compile(r'<!-- END ARTICLE and footer section -->.*</body>', re.DOTALL|re.IGNORECASE),
|
||||||
lambda match: '</body>'),
|
lambda match: '</body>'),
|
||||||
]
|
]
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user