Pull from trunk

This commit is contained in:
Kovid Goyal 2009-04-16 10:34:54 -07:00
commit c822d25916
8 changed files with 51 additions and 32 deletions

View File

@ -2,7 +2,7 @@ __license__ = 'GPL v3'
__copyright__ = '2008, Kovid Goyal kovid@kovidgoyal.net'
__docformat__ = 'restructuredtext en'
__appname__ = 'calibre'
__version__ = '0.5.6'
__version__ = '0.5.7'
__author__ = "Kovid Goyal <kovid@kovidgoyal.net>"
'''
Various run time constants.

View File

@ -209,7 +209,7 @@ class Device(_Device):
time.sleep(6)
drives = {}
wmi = __import__('wmi', globals(), locals(), [], -1)
c = wmi.WMI()
c = wmi.WMI(find_classes=False)
for drive in c.Win32_DiskDrive():
if self.windows_match_device(str(drive.PNPDeviceID), self.WINDOWS_MAIN_MEM):
drives['main'] = self.windows_get_drive_prefix(drive)

View File

@ -12,6 +12,7 @@ from PyQt4.Qt import QMenu, QAction, QActionGroup, QIcon, SIGNAL, QPixmap, \
from calibre.customize.ui import available_input_formats, available_output_formats
from calibre.devices import devices
from calibre.constants import iswindows
from calibre.gui2.dialogs.choose_format import ChooseFormatDialog
from calibre.parallel import Job
from calibre.devices.scanner import DeviceScanner
@ -71,7 +72,14 @@ class DeviceManager(Thread):
if connected and not device[1]:
try:
dev = device[0]()
dev.open()
if iswindows:
import pythoncom
pythoncom.CoInitialize()
try:
dev.open()
finally:
if iswindows:
pythoncom.CoUninitialize()
self.device = dev
self.device_class = dev.__class__
self.connected_slot(True)

View File

@ -69,6 +69,7 @@ else:
DOWNLOAD_DIR = '/var/www/calibre.kovidgoyal.net/htdocs/downloads'
MOBILEREAD = 'https://dev.mobileread.com/dist/kovid/calibre/'
#MOBILEREAD = 'http://calibre.kovidgoyal.net/downloads/'
class OS(dict):
"""Dictionary with a default value for unknown keys."""
@ -197,6 +198,8 @@ else:
import sys, os, shutil, tarfile, subprocess, tempfile, urllib2, re, stat
MOBILEREAD='https://dev.mobileread.com/dist/kovid/calibre/'
#MOBILEREAD='http://calibre.kovidgoyal.net/downloads/'
class TerminalController:
BOL = '' #: Move the cursor to the beginning of the line

Binary file not shown.

After

Width:  |  Height:  |  Size: 50 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 36 KiB

View File

@ -128,6 +128,12 @@ class BasicNewsRecipe(object):
#:
extra_css = None
#: If True empty feeds are removed from the output.
#: This option has no effect if parse_index is overriden in
#: the sub class. It is meant only for recipes that return a list
#: of feeds using :member:`feeds` or :method:`get_feeds`.
remove_empty_feeds = False
#: List of regular expressions that determines which links to follow
#: If empty, it is ignored. For example::
#:
@ -985,6 +991,11 @@ class BasicNewsRecipe(object):
self.log.exception(msg)
remove = [f for f in parsed_feeds if len(f) == 0 and
self.remove_empty_feeds]
for f in remove:
parsed_feeds.remove(f)
return parsed_feeds
@classmethod

View File

@ -11,20 +11,23 @@ from calibre import strftime
from calibre.web.feeds.news import BasicNewsRecipe
class Vreme(BasicNewsRecipe):
title = 'Vreme'
__author__ = 'Darko Miletic'
description = 'Politicki Nedeljnik Srbije'
publisher = 'Vreme d.o.o.'
category = 'news, politics, Serbia'
no_stylesheets = True
remove_javascript = True
needs_subscription = True
INDEX = 'http://www.vreme.com'
LOGIN = 'http://www.vreme.com/account/index.php'
remove_javascript = True
use_embedded_content = False
language = _('Serbian')
extra_css = '@font-face {font-family: "serif1";src:url(res:///opt/sony/ebook/FONT/tt0011m_.ttf)} body{text-align: justify; font-family: serif1, serif} .article_description{font-family: serif1, serif}'
title = 'Vreme'
__author__ = 'Darko Miletic'
description = 'Politicki Nedeljnik Srbije'
publisher = 'NP Vreme d.o.o.'
category = 'news, politics, Serbia'
delay = 1
no_stylesheets = True
needs_subscription = True
INDEX = 'http://www.vreme.com'
LOGIN = 'http://www.vreme.com/account/login.php?url=%2F'
remove_javascript = True
use_embedded_content = False
encoding = 'utf-8'
language = _('Serbian')
lang = 'sr-Latn-RS'
direction = 'ltr'
extra_css = '@font-face {font-family: "serif1";src:url(res:///opt/sony/ebook/FONT/tt0011m_.ttf)} body{text-align: justify; font-family: serif1, serif} .article_description{font-family: serif1, serif}'
html2lrf_options = [
'--comment' , description
@ -52,20 +55,11 @@ class Vreme(BasicNewsRecipe):
articles = []
soup = self.index_to_soup(self.INDEX)
for item in soup.findAll('span', attrs={'class':'toc2'}):
for item in soup.findAll(['h3','h4']):
description = ''
title_prefix = ''
descript_title_tag = item.findPreviousSibling('span', attrs={'class':'toc1'})
if descript_title_tag:
title_prefix = self.tag_to_string(descript_title_tag) + ' '
descript_tag = item.findNextSibling('span', attrs={'class':'toc3'})
if descript_tag:
description = self.tag_to_string(descript_tag)
feed_link = item.find('a')
if feed_link and feed_link.has_key('href'):
if feed_link and feed_link.has_key('href') and feed_link['href'].startswith('/cms/view.php'):
url = self.INDEX + feed_link['href']
title = title_prefix + self.tag_to_string(feed_link)
date = strftime(self.timefmt)
@ -93,14 +87,17 @@ class Vreme(BasicNewsRecipe):
del item['face']
for item in soup.findAll(size=True):
del item['size']
mtag = '<meta http-equiv="Content-Language" content="sr-Latn-RS"/>'
soup.head.insert(0,mtag)
soup.html['lang'] = self.lang
soup.html['dir' ] = self.direction
mtag = '<meta http-equiv="Content-Language" content="' + self.lang + '"/>'
mtag += '\n<meta http-equiv="Content-Type" content="text/html; charset=' + self.encoding + '"/>'
soup.head.insert(0,mtag)
return soup
def get_cover_url(self):
cover_url = None
soup = self.index_to_soup(self.INDEX)
cover_item = soup.find('img',attrs={'alt':'Naslovna strana broja'})
cover_item = soup.find('div',attrs={'id':'najava'})
if cover_item:
cover_url = self.INDEX + cover_item['src']
cover_url = self.INDEX + cover_item.img['src']
return cover_url