mirror of
https://github.com/kovidgoyal/calibre.git
synced 2025-07-09 03:04:10 -04:00
Merge from trunk
This commit is contained in:
commit
ad6af10670
@ -1,6 +1,6 @@
|
|||||||
|
|
||||||
__license__ = 'GPL v3'
|
__license__ = 'GPL v3'
|
||||||
__copyright__ = '2009, Darko Miletic <darko.miletic at gmail.com>'
|
__copyright__ = '2009-2011, Darko Miletic <darko.miletic at gmail.com>'
|
||||||
'''
|
'''
|
||||||
elmundo.es
|
elmundo.es
|
||||||
'''
|
'''
|
||||||
@ -10,15 +10,24 @@ from calibre.web.feeds.news import BasicNewsRecipe
|
|||||||
class ElMundo(BasicNewsRecipe):
|
class ElMundo(BasicNewsRecipe):
|
||||||
title = 'El Mundo'
|
title = 'El Mundo'
|
||||||
__author__ = 'Darko Miletic'
|
__author__ = 'Darko Miletic'
|
||||||
description = 'News from Spain'
|
description = 'Lider de informacion en espaniol'
|
||||||
publisher = 'El Mundo'
|
publisher = 'Unidad Editorial Informacion General S.L.U.'
|
||||||
category = 'news, politics, Spain'
|
category = 'news, politics, Spain'
|
||||||
oldest_article = 2
|
oldest_article = 2
|
||||||
max_articles_per_feed = 100
|
max_articles_per_feed = 100
|
||||||
no_stylesheets = True
|
no_stylesheets = True
|
||||||
use_embedded_content = False
|
use_embedded_content = False
|
||||||
encoding = 'iso8859_15'
|
encoding = 'iso8859_15'
|
||||||
language = 'es'
|
language = 'es_ES'
|
||||||
|
masthead_url = 'http://estaticos03.elmundo.es/elmundo/iconos/v4.x/v4.01/bg_h1.png'
|
||||||
|
publication_type = 'newspaper'
|
||||||
|
extra_css = """
|
||||||
|
body{font-family: Arial,Helvetica,sans-serif}
|
||||||
|
.metadata_noticia{font-size: small}
|
||||||
|
h1,h2,h3,h4,h5,h6,.subtitulo {color: #3F5974}
|
||||||
|
.hora{color: red}
|
||||||
|
.update{color: gray}
|
||||||
|
"""
|
||||||
|
|
||||||
conversion_options = {
|
conversion_options = {
|
||||||
'comments' : description
|
'comments' : description
|
||||||
@ -30,22 +39,31 @@ class ElMundo(BasicNewsRecipe):
|
|||||||
keep_only_tags = [dict(name='div', attrs={'class':'noticia'})]
|
keep_only_tags = [dict(name='div', attrs={'class':'noticia'})]
|
||||||
remove_tags_before = dict(attrs={'class':['titular','antetitulo'] })
|
remove_tags_before = dict(attrs={'class':['titular','antetitulo'] })
|
||||||
remove_tags_after = dict(name='div' , attrs={'id':['desarrollo_noticia','tamano']})
|
remove_tags_after = dict(name='div' , attrs={'id':['desarrollo_noticia','tamano']})
|
||||||
|
remove_attributes = ['lang','border']
|
||||||
remove_tags = [
|
remove_tags = [
|
||||||
dict(name='div', attrs={'class':['herramientas','publicidad_google']})
|
dict(name='div', attrs={'class':['herramientas','publicidad_google']})
|
||||||
,dict(name='div', attrs={'id':'modulo_multimedia' })
|
,dict(name='div', attrs={'id':'modulo_multimedia' })
|
||||||
,dict(name='ul', attrs={'class':'herramientas' })
|
,dict(name='ul', attrs={'class':'herramientas' })
|
||||||
,dict(name=['object','link'])
|
,dict(name=['object','link','embed','iframe','base','meta'])
|
||||||
]
|
]
|
||||||
|
|
||||||
feeds = [
|
feeds = [
|
||||||
(u'Portada' , u'http://rss.elmundo.es/rss/descarga.htm?data2=4' )
|
(u'Portada' , u'http://estaticos.elmundo.es/elmundo/rss/portada.xml' )
|
||||||
,(u'Deportes' , u'http://rss.elmundo.es/rss/descarga.htm?data2=14')
|
,(u'Deportes' , u'http://estaticos.elmundo.es/elmundodeporte/rss/portada.xml')
|
||||||
,(u'Economia' , u'http://rss.elmundo.es/rss/descarga.htm?data2=7' )
|
,(u'Economia' , u'http://estaticos.elmundo.es/elmundo/rss/economia.xml' )
|
||||||
,(u'Espana' , u'http://rss.elmundo.es/rss/descarga.htm?data2=8' )
|
,(u'Espana' , u'http://estaticos.elmundo.es/elmundo/rss/espana.xml' )
|
||||||
,(u'Internacional' , u'http://rss.elmundo.es/rss/descarga.htm?data2=9' )
|
,(u'Internacional' , u'http://estaticos.elmundo.es/elmundo/rss/internacional.xml' )
|
||||||
,(u'Cultura' , u'http://rss.elmundo.es/rss/descarga.htm?data2=6' )
|
,(u'Cultura' , u'http://estaticos.elmundo.es/elmundo/rss/cultura.xml' )
|
||||||
,(u'Ciencia/Ecologia', u'http://rss.elmundo.es/rss/descarga.htm?data2=5' )
|
,(u'Ciencia/Ecologia', u'http://estaticos.elmundo.es/elmundo/rss/ciencia.xml' )
|
||||||
,(u'Comunicacion' , u'http://rss.elmundo.es/rss/descarga.htm?data2=26')
|
,(u'Comunicacion' , u'http://estaticos.elmundo.es/elmundo/rss/comunicacion.xml' )
|
||||||
,(u'Television' , u'http://rss.elmundo.es/rss/descarga.htm?data2=76')
|
,(u'Television' , u'http://estaticos.elmundo.es/elmundo/rss/television.xml' )
|
||||||
]
|
]
|
||||||
|
|
||||||
|
def preprocess_html(self, soup):
|
||||||
|
for item in soup.findAll(style=True):
|
||||||
|
del item['style']
|
||||||
|
return soup
|
||||||
|
|
||||||
|
def get_article_url(self, article):
|
||||||
|
return article.get('guid', None)
|
||||||
|
|
||||||
|
Binary file not shown.
Before Width: | Height: | Size: 550 B After Width: | Height: | Size: 1.1 KiB |
BIN
recipes/icons/marca.png
Normal file
BIN
recipes/icons/marca.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 293 B |
BIN
recipes/icons/the_nation.png
Normal file
BIN
recipes/icons/the_nation.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 925 B |
@ -1,14 +1,11 @@
|
|||||||
#!/usr/bin/env python
|
|
||||||
# -*- coding: utf-8 -*-
|
# -*- coding: utf-8 -*-
|
||||||
|
|
||||||
__license__ = 'GPL v3'
|
__license__ = 'GPL v3'
|
||||||
__copyright__ = '2009, Darko Miletic <darko.miletic at gmail.com>'
|
__copyright__ = '2009-2011, Darko Miletic <darko.miletic at gmail.com>'
|
||||||
'''
|
'''
|
||||||
www.marca.com
|
www.marca.com
|
||||||
'''
|
'''
|
||||||
|
|
||||||
from calibre.web.feeds.news import BasicNewsRecipe
|
from calibre.web.feeds.news import BasicNewsRecipe
|
||||||
from calibre.ebooks.BeautifulSoup import Tag
|
|
||||||
|
|
||||||
class Marca(BasicNewsRecipe):
|
class Marca(BasicNewsRecipe):
|
||||||
title = 'Marca'
|
title = 'Marca'
|
||||||
@ -22,35 +19,30 @@ class Marca(BasicNewsRecipe):
|
|||||||
use_embedded_content = False
|
use_embedded_content = False
|
||||||
delay = 1
|
delay = 1
|
||||||
encoding = 'iso-8859-15'
|
encoding = 'iso-8859-15'
|
||||||
language = 'es'
|
language = 'es_ES'
|
||||||
|
publication_type = 'newsportal'
|
||||||
|
masthead_url = 'http://estaticos.marca.com/deporte/img/v3.0/img_marca-com.png'
|
||||||
|
extra_css = """
|
||||||
|
body{font-family: Tahoma,Geneva,sans-serif}
|
||||||
|
h1,h2,h3,h4,h5,h6{font-family: 'LatoBlack',Tahoma,Geneva,sans-serif}
|
||||||
|
.cab_articulo h4 {font-family: Georgia,"Times New Roman",Times,serif}
|
||||||
|
.antetitulo{text-transform: uppercase}
|
||||||
|
"""
|
||||||
|
|
||||||
direction = 'ltr'
|
feeds = [(u'Portada', u'http://estaticos.marca.com/rss/portada.xml')]
|
||||||
|
|
||||||
html2lrf_options = [
|
|
||||||
'--comment' , description
|
|
||||||
, '--category' , category
|
|
||||||
, '--publisher', publisher
|
|
||||||
]
|
|
||||||
|
|
||||||
html2epub_options = 'publisher="' + publisher + '"\ncomments="' + description + '"\ntags="' + category + '"'
|
|
||||||
|
|
||||||
feeds = [(u'Portada', u'http://rss.marca.com/rss/descarga.htm?data2=425')]
|
|
||||||
|
|
||||||
keep_only_tags = [dict(name='div', attrs={'class':['cab_articulo','col_izq']})]
|
|
||||||
|
|
||||||
|
keep_only_tags = [dict(name='div', attrs={'class':['cab_articulo','cuerpo_articulo']})]
|
||||||
|
remove_attributes = ['lang']
|
||||||
remove_tags = [
|
remove_tags = [
|
||||||
dict(name=['object','link','script'])
|
dict(name=['object','link','script','embed','iframe','meta','base'])
|
||||||
,dict(name='div', attrs={'class':['colC','peu']})
|
,dict(name='div', attrs={'class':'tabs'})
|
||||||
,dict(name='div', attrs={'class':['utilidades estirar','bloque_int_corr estirar']})
|
|
||||||
]
|
]
|
||||||
|
|
||||||
remove_tags_after = [dict(name='div', attrs={'class':'bloque_int_corr estirar'})]
|
|
||||||
|
|
||||||
def preprocess_html(self, soup):
|
def preprocess_html(self, soup):
|
||||||
soup.html['dir' ] = self.direction
|
|
||||||
mcharset = Tag(soup,'meta',[("http-equiv","Content-Type"),("content","text/html; charset=utf-8")])
|
|
||||||
soup.head.insert(0,mcharset)
|
|
||||||
for item in soup.findAll(style=True):
|
for item in soup.findAll(style=True):
|
||||||
del item['style']
|
del item['style']
|
||||||
return soup
|
return soup
|
||||||
|
|
||||||
|
def get_article_url(self, article):
|
||||||
|
return article.get('guid', None)
|
||||||
|
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
__license__ = 'GPL v3'
|
__license__ = 'GPL v3'
|
||||||
__copyright__ = '2008 - 2010, Darko Miletic <darko.miletic at gmail.com>'
|
__copyright__ = '2008 - 2011, Darko Miletic <darko.miletic at gmail.com>'
|
||||||
'''
|
'''
|
||||||
thenation.com
|
thenation.com
|
||||||
'''
|
'''
|
||||||
@ -19,7 +19,14 @@ class Thenation(BasicNewsRecipe):
|
|||||||
use_embedded_content = False
|
use_embedded_content = False
|
||||||
delay = 1
|
delay = 1
|
||||||
masthead_url = 'http://www.thenation.com/sites/default/themes/thenation/images/logo-main.gif'
|
masthead_url = 'http://www.thenation.com/sites/default/themes/thenation/images/logo-main.gif'
|
||||||
exra_css = ' body{font-family: Arial,Helvetica,sans-serif;} .print-created{font-size: small;} .caption{display: block; font-size: x-small;} '
|
login_url = 'http://www.thenation.com/user?destination=%3Cfront%3E'
|
||||||
|
publication_type = 'magazine'
|
||||||
|
needs_subscription = 'optional'
|
||||||
|
exra_css = """
|
||||||
|
body{font-family: Arial,Helvetica,sans-serif;}
|
||||||
|
.print-created{font-size: small;}
|
||||||
|
.caption{display: block; font-size: x-small;}
|
||||||
|
"""
|
||||||
|
|
||||||
conversion_options = {
|
conversion_options = {
|
||||||
'comment' : description
|
'comment' : description
|
||||||
@ -28,13 +35,30 @@ class Thenation(BasicNewsRecipe):
|
|||||||
, 'language' : language
|
, 'language' : language
|
||||||
}
|
}
|
||||||
|
|
||||||
keep_only_tags = [ dict(attrs={'class':['print-title','print-created','print-content','print-links']}) ]
|
keep_only_tags = [dict(attrs={'class':['print-title','print-created','print-content','print-links']})]
|
||||||
remove_tags = [dict(name='link')]
|
remove_tags = [dict(name=['link','iframe','base','meta','object','embed'])]
|
||||||
|
remove_attributes = ['lang']
|
||||||
|
|
||||||
feeds = [(u"Editor's Picks", u'http://www.thenation.com/rss/editors_picks')]
|
feeds = [(u"Articles", u'http://www.thenation.com/rss/articles')]
|
||||||
|
|
||||||
def print_version(self, url):
|
def print_version(self, url):
|
||||||
return url.replace('.thenation.com/','.thenation.com/print/')
|
return url.replace('.thenation.com/','.thenation.com/print/')
|
||||||
|
|
||||||
def preprocess_html(self, soup):
|
def get_browser(self):
|
||||||
return self.adeify_images(soup)
|
br = BasicNewsRecipe.get_browser()
|
||||||
|
br.open('http://www.thenation.com/')
|
||||||
|
if self.username is not None and self.password is not None:
|
||||||
|
br.open(self.login_url)
|
||||||
|
br.select_form(nr=1)
|
||||||
|
br['name'] = self.username
|
||||||
|
br['pass'] = self.password
|
||||||
|
br.submit()
|
||||||
|
return br
|
||||||
|
|
||||||
|
def get_cover_url(self):
|
||||||
|
soup = self.index_to_soup('http://www.thenation.com/issue/')
|
||||||
|
item = soup.find('div',attrs={'id':'cover-wrapper'})
|
||||||
|
if item:
|
||||||
|
return item.img['src']
|
||||||
|
return None
|
||||||
|
|
@ -12,7 +12,9 @@ is64bit = platform.architecture()[0] == '64bit'
|
|||||||
iswindows = re.search('win(32|64)', sys.platform)
|
iswindows = re.search('win(32|64)', sys.platform)
|
||||||
isosx = 'darwin' in sys.platform
|
isosx = 'darwin' in sys.platform
|
||||||
isfreebsd = 'freebsd' in sys.platform
|
isfreebsd = 'freebsd' in sys.platform
|
||||||
islinux = not isosx and not iswindows and not isfreebsd
|
isnetbsd = 'netbsd' in sys.platform
|
||||||
|
isbsd = isnetbsd or isfreebsd
|
||||||
|
islinux = not isosx and not iswindows and not isbsd
|
||||||
SRC = os.path.abspath('src')
|
SRC = os.path.abspath('src')
|
||||||
sys.path.insert(0, SRC)
|
sys.path.insert(0, SRC)
|
||||||
sys.resources_location = os.path.join(os.path.dirname(SRC), 'resources')
|
sys.resources_location = os.path.join(os.path.dirname(SRC), 'resources')
|
||||||
|
@ -11,7 +11,7 @@ from distutils import sysconfig
|
|||||||
|
|
||||||
from PyQt4.pyqtconfig import QtGuiModuleMakefile
|
from PyQt4.pyqtconfig import QtGuiModuleMakefile
|
||||||
|
|
||||||
from setup import Command, islinux, isfreebsd, isosx, SRC, iswindows
|
from setup import Command, islinux, isfreebsd, isbsd, isosx, SRC, iswindows
|
||||||
from setup.build_environment import fc_inc, fc_lib, chmlib_inc_dirs, \
|
from setup.build_environment import fc_inc, fc_lib, chmlib_inc_dirs, \
|
||||||
fc_error, poppler_libs, poppler_lib_dirs, poppler_inc_dirs, podofo_inc, \
|
fc_error, poppler_libs, poppler_lib_dirs, poppler_inc_dirs, podofo_inc, \
|
||||||
podofo_lib, podofo_error, poppler_error, pyqt, OSX_SDK, NMAKE, \
|
podofo_lib, podofo_error, poppler_error, pyqt, OSX_SDK, NMAKE, \
|
||||||
@ -21,7 +21,7 @@ from setup.build_environment import fc_inc, fc_lib, chmlib_inc_dirs, \
|
|||||||
jpg_lib_dirs, chmlib_lib_dirs, sqlite_inc_dirs, icu_inc_dirs, \
|
jpg_lib_dirs, chmlib_lib_dirs, sqlite_inc_dirs, icu_inc_dirs, \
|
||||||
icu_lib_dirs
|
icu_lib_dirs
|
||||||
MT
|
MT
|
||||||
isunix = islinux or isosx or isfreebsd
|
isunix = islinux or isosx or isbsd
|
||||||
|
|
||||||
make = 'make' if isunix else NMAKE
|
make = 'make' if isunix else NMAKE
|
||||||
|
|
||||||
@ -205,7 +205,7 @@ if islinux:
|
|||||||
ldflags.append('-lpython'+sysconfig.get_python_version())
|
ldflags.append('-lpython'+sysconfig.get_python_version())
|
||||||
|
|
||||||
|
|
||||||
if isfreebsd:
|
if isbsd:
|
||||||
cflags.append('-pthread')
|
cflags.append('-pthread')
|
||||||
ldflags.append('-shared')
|
ldflags.append('-shared')
|
||||||
cflags.append('-I'+sysconfig.get_python_inc())
|
cflags.append('-I'+sysconfig.get_python_inc())
|
||||||
|
@ -8,7 +8,7 @@ __docformat__ = 'restructuredtext en'
|
|||||||
|
|
||||||
import sys, os, textwrap, subprocess, shutil, tempfile, atexit, stat, shlex
|
import sys, os, textwrap, subprocess, shutil, tempfile, atexit, stat, shlex
|
||||||
|
|
||||||
from setup import Command, islinux, isfreebsd, basenames, modules, functions, \
|
from setup import Command, islinux, isfreebsd, isbsd, basenames, modules, functions, \
|
||||||
__appname__, __version__
|
__appname__, __version__
|
||||||
|
|
||||||
HEADER = '''\
|
HEADER = '''\
|
||||||
@ -116,7 +116,7 @@ class Develop(Command):
|
|||||||
|
|
||||||
|
|
||||||
def pre_sub_commands(self, opts):
|
def pre_sub_commands(self, opts):
|
||||||
if not (islinux or isfreebsd):
|
if not (islinux or isbsd):
|
||||||
self.info('\nSetting up a source based development environment is only '
|
self.info('\nSetting up a source based development environment is only '
|
||||||
'supported on linux. On other platforms, see the User Manual'
|
'supported on linux. On other platforms, see the User Manual'
|
||||||
' for help with setting up a development environment.')
|
' for help with setting up a development environment.')
|
||||||
@ -156,7 +156,7 @@ class Develop(Command):
|
|||||||
self.warn('Failed to compile mount helper. Auto mounting of',
|
self.warn('Failed to compile mount helper. Auto mounting of',
|
||||||
' devices will not work')
|
' devices will not work')
|
||||||
|
|
||||||
if not isfreebsd and os.geteuid() != 0:
|
if not isbsd and os.geteuid() != 0:
|
||||||
return self.warn('Must be run as root to compile mount helper. Auto '
|
return self.warn('Must be run as root to compile mount helper. Auto '
|
||||||
'mounting of devices will not work.')
|
'mounting of devices will not work.')
|
||||||
src = os.path.join(self.SRC, 'calibre', 'devices', 'linux_mount_helper.c')
|
src = os.path.join(self.SRC, 'calibre', 'devices', 'linux_mount_helper.c')
|
||||||
@ -168,7 +168,7 @@ class Develop(Command):
|
|||||||
ret = p.wait()
|
ret = p.wait()
|
||||||
if ret != 0:
|
if ret != 0:
|
||||||
return warn()
|
return warn()
|
||||||
if not isfreebsd:
|
if not isbsd:
|
||||||
os.chown(dest, 0, 0)
|
os.chown(dest, 0, 0)
|
||||||
os.chmod(dest, stat.S_ISUID|stat.S_ISGID|stat.S_IRUSR|stat.S_IWUSR|\
|
os.chmod(dest, stat.S_ISUID|stat.S_ISGID|stat.S_IRUSR|stat.S_IWUSR|\
|
||||||
stat.S_IXUSR|stat.S_IXGRP|stat.S_IXOTH)
|
stat.S_IXUSR|stat.S_IXGRP|stat.S_IXOTH)
|
||||||
|
@ -26,6 +26,11 @@
|
|||||||
</Upgrade>
|
</Upgrade>
|
||||||
<CustomAction Id="PreventDowngrading" Error="Newer version already installed."/>
|
<CustomAction Id="PreventDowngrading" Error="Newer version already installed."/>
|
||||||
|
|
||||||
|
<Property Id="APPLICATIONFOLDER">
|
||||||
|
<RegistrySearch Id='calibreInstDir' Type='raw'
|
||||||
|
Root='HKLM' Key="Software\{app}\Installer" Name="InstallPath" />
|
||||||
|
</Property>
|
||||||
|
|
||||||
<Directory Id='TARGETDIR' Name='SourceDir'>
|
<Directory Id='TARGETDIR' Name='SourceDir'>
|
||||||
<Merge Id="VCRedist" SourceFile="{crt_msm}" DiskId="1" Language="0"/>
|
<Merge Id="VCRedist" SourceFile="{crt_msm}" DiskId="1" Language="0"/>
|
||||||
<Directory Id='ProgramFilesFolder' Name='PFiles'>
|
<Directory Id='ProgramFilesFolder' Name='PFiles'>
|
||||||
@ -43,6 +48,9 @@
|
|||||||
<Environment Id='UpdatePath' Name='PATH' Action='set' System='yes' Part='last' Value='[APPLICATIONFOLDER]' />
|
<Environment Id='UpdatePath' Name='PATH' Action='set' System='yes' Part='last' Value='[APPLICATIONFOLDER]' />
|
||||||
<RegistryValue Root="HKCU" Key="Software\Microsoft\{app}" Name="system_path_updated" Type="integer" Value="1" KeyPath="yes"/>
|
<RegistryValue Root="HKCU" Key="Software\Microsoft\{app}" Name="system_path_updated" Type="integer" Value="1" KeyPath="yes"/>
|
||||||
</Component>
|
</Component>
|
||||||
|
<Component Id="RememberInstallDir" Guid="*">
|
||||||
|
<RegistryValue Root="HKLM" Key="Software\{app}\Installer" Name="InstallPath" Type="string" Value="[APPLICATIONFOLDER]" KeyPath="yes"/>
|
||||||
|
</Component>
|
||||||
</DirectoryRef>
|
</DirectoryRef>
|
||||||
|
|
||||||
<DirectoryRef Id="ApplicationProgramsFolder">
|
<DirectoryRef Id="ApplicationProgramsFolder">
|
||||||
@ -87,7 +95,8 @@
|
|||||||
ConfigurableDirectory="APPLICATIONFOLDER">
|
ConfigurableDirectory="APPLICATIONFOLDER">
|
||||||
|
|
||||||
<Feature Id="MainApplication" Title="Program Files" Level="1"
|
<Feature Id="MainApplication" Title="Program Files" Level="1"
|
||||||
Description="All the files need to run {app}" Absent="disallow">
|
Description="All the files needed to run {app}" Absent="disallow">
|
||||||
|
<ComponentRef Id="RememberInstallDir"/>
|
||||||
</Feature>
|
</Feature>
|
||||||
|
|
||||||
<Feature Id="VCRedist" Title="Visual C++ 8.0 Runtime" AllowAdvertise="no" Display="hidden" Level="1">
|
<Feature Id="VCRedist" Title="Visual C++ 8.0 Runtime" AllowAdvertise="no" Display="hidden" Level="1">
|
||||||
@ -115,7 +124,7 @@
|
|||||||
<Property Id="ARPPRODUCTICON" Value="main_icon" />
|
<Property Id="ARPPRODUCTICON" Value="main_icon" />
|
||||||
|
|
||||||
<Condition
|
<Condition
|
||||||
Message="This application is only supported on Windows XP SP2, or higher.">
|
Message="This application is only supported on Windows XP SP3, or higher.">
|
||||||
<![CDATA[Installed OR (VersionNT >= 501)]]>
|
<![CDATA[Installed OR (VersionNT >= 501)]]>
|
||||||
</Condition>
|
</Condition>
|
||||||
<InstallExecuteSequence>
|
<InstallExecuteSequence>
|
||||||
|
@ -12,8 +12,8 @@ from functools import partial
|
|||||||
warnings.simplefilter('ignore', DeprecationWarning)
|
warnings.simplefilter('ignore', DeprecationWarning)
|
||||||
|
|
||||||
|
|
||||||
from calibre.constants import (iswindows, isosx, islinux, isfreebsd, isfrozen,
|
from calibre.constants import (iswindows, isosx, islinux, isfrozen,
|
||||||
preferred_encoding, __appname__, __version__, __author__,
|
isbsd, preferred_encoding, __appname__, __version__, __author__,
|
||||||
win32event, win32api, winerror, fcntl,
|
win32event, win32api, winerror, fcntl,
|
||||||
filesystem_encoding, plugins, config_dir)
|
filesystem_encoding, plugins, config_dir)
|
||||||
from calibre.startup import winutil, winutilerror
|
from calibre.startup import winutil, winutilerror
|
||||||
@ -31,7 +31,7 @@ if False:
|
|||||||
# Prevent pyflakes from complaining
|
# Prevent pyflakes from complaining
|
||||||
winutil, winutilerror, __appname__, islinux, __version__
|
winutil, winutilerror, __appname__, islinux, __version__
|
||||||
fcntl, win32event, isfrozen, __author__
|
fcntl, win32event, isfrozen, __author__
|
||||||
winerror, win32api, isfreebsd
|
winerror, win32api, isbsd
|
||||||
|
|
||||||
_mt_inited = False
|
_mt_inited = False
|
||||||
def _init_mimetypes():
|
def _init_mimetypes():
|
||||||
|
@ -27,7 +27,9 @@ iswindows = 'win32' in _plat or 'win64' in _plat
|
|||||||
isosx = 'darwin' in _plat
|
isosx = 'darwin' in _plat
|
||||||
isnewosx = isosx and getattr(sys, 'new_app_bundle', False)
|
isnewosx = isosx and getattr(sys, 'new_app_bundle', False)
|
||||||
isfreebsd = 'freebsd' in _plat
|
isfreebsd = 'freebsd' in _plat
|
||||||
islinux = not(iswindows or isosx or isfreebsd)
|
isnetbsd = 'netbsd' in _plat
|
||||||
|
isbsd = isfreebsd or isnetbsd
|
||||||
|
islinux = not(iswindows or isosx or isbsd)
|
||||||
isfrozen = hasattr(sys, 'frozen')
|
isfrozen = hasattr(sys, 'frozen')
|
||||||
isunix = isosx or islinux
|
isunix = isosx or islinux
|
||||||
|
|
||||||
|
@ -8,10 +8,10 @@ from ctypes import cdll, POINTER, byref, pointer, Structure as _Structure, \
|
|||||||
c_ubyte, c_ushort, c_int, c_char, c_void_p, c_byte, c_uint
|
c_ubyte, c_ushort, c_int, c_char, c_void_p, c_byte, c_uint
|
||||||
from errno import EBUSY, ENOMEM
|
from errno import EBUSY, ENOMEM
|
||||||
|
|
||||||
from calibre import iswindows, isosx, isfreebsd, load_library
|
from calibre import iswindows, isosx, isbsd, load_library
|
||||||
|
|
||||||
_libusb_name = 'libusb'
|
_libusb_name = 'libusb'
|
||||||
PATH_MAX = 511 if iswindows else 1024 if (isosx or isfreebsd) else 4096
|
PATH_MAX = 511 if iswindows else 1024 if (isosx or isbsd) else 4096
|
||||||
if iswindows:
|
if iswindows:
|
||||||
class Structure(_Structure):
|
class Structure(_Structure):
|
||||||
_pack_ = 1
|
_pack_ = 1
|
||||||
|
@ -20,7 +20,7 @@ from itertools import izip
|
|||||||
from calibre.customize.conversion import InputFormatPlugin
|
from calibre.customize.conversion import InputFormatPlugin
|
||||||
from calibre.ebooks.chardet import xml_to_unicode
|
from calibre.ebooks.chardet import xml_to_unicode
|
||||||
from calibre.customize.conversion import OptionRecommendation
|
from calibre.customize.conversion import OptionRecommendation
|
||||||
from calibre.constants import islinux, isfreebsd, iswindows
|
from calibre.constants import islinux, isbsd, iswindows
|
||||||
from calibre import unicode_path, as_unicode
|
from calibre import unicode_path, as_unicode
|
||||||
from calibre.utils.localization import get_lang
|
from calibre.utils.localization import get_lang
|
||||||
from calibre.utils.filenames import ascii_filename
|
from calibre.utils.filenames import ascii_filename
|
||||||
@ -302,7 +302,7 @@ class HTMLInput(InputFormatPlugin):
|
|||||||
if getattr(self, '_is_case_sensitive', None) is not None:
|
if getattr(self, '_is_case_sensitive', None) is not None:
|
||||||
return self._is_case_sensitive
|
return self._is_case_sensitive
|
||||||
if not path or not os.path.exists(path):
|
if not path or not os.path.exists(path):
|
||||||
return islinux or isfreebsd
|
return islinux or isbsd
|
||||||
self._is_case_sensitive = not (os.path.exists(path.lower()) \
|
self._is_case_sensitive = not (os.path.exists(path.lower()) \
|
||||||
and os.path.exists(path.upper()))
|
and os.path.exists(path.upper()))
|
||||||
return self._is_case_sensitive
|
return self._is_case_sensitive
|
||||||
|
@ -13,7 +13,7 @@ from functools import partial
|
|||||||
|
|
||||||
from calibre.ebooks import ConversionError, DRMError
|
from calibre.ebooks import ConversionError, DRMError
|
||||||
from calibre.ptempfile import PersistentTemporaryFile
|
from calibre.ptempfile import PersistentTemporaryFile
|
||||||
from calibre.constants import isosx, iswindows, islinux, isfreebsd
|
from calibre.constants import isosx, iswindows, islinux, isbsd
|
||||||
from calibre import CurrentDir
|
from calibre import CurrentDir
|
||||||
|
|
||||||
PDFTOHTML = 'pdftohtml'
|
PDFTOHTML = 'pdftohtml'
|
||||||
@ -23,7 +23,7 @@ if isosx and hasattr(sys, 'frameworks_dir'):
|
|||||||
if iswindows and hasattr(sys, 'frozen'):
|
if iswindows and hasattr(sys, 'frozen'):
|
||||||
PDFTOHTML = os.path.join(os.path.dirname(sys.executable), 'pdftohtml.exe')
|
PDFTOHTML = os.path.join(os.path.dirname(sys.executable), 'pdftohtml.exe')
|
||||||
popen = partial(subprocess.Popen, creationflags=0x08) # CREATE_NO_WINDOW=0x08 so that no ugly console is popped up
|
popen = partial(subprocess.Popen, creationflags=0x08) # CREATE_NO_WINDOW=0x08 so that no ugly console is popped up
|
||||||
if (islinux or isfreebsd) and getattr(sys, 'frozen', False):
|
if (islinux or isbsd) and getattr(sys, 'frozen', False):
|
||||||
PDFTOHTML = os.path.join(sys.executables_location, 'bin', 'pdftohtml')
|
PDFTOHTML = os.path.join(sys.executables_location, 'bin', 'pdftohtml')
|
||||||
|
|
||||||
def pdftohtml(output_dir, pdf_path, no_images):
|
def pdftohtml(output_dir, pdf_path, no_images):
|
||||||
@ -43,7 +43,7 @@ def pdftohtml(output_dir, pdf_path, no_images):
|
|||||||
# This is neccessary as pdftohtml doesn't always (linux) respect absolute paths
|
# This is neccessary as pdftohtml doesn't always (linux) respect absolute paths
|
||||||
pdf_path = os.path.abspath(pdf_path)
|
pdf_path = os.path.abspath(pdf_path)
|
||||||
cmd = [PDFTOHTML, '-enc', 'UTF-8', '-noframes', '-p', '-nomerge', '-nodrm', '-q', pdf_path, os.path.basename(index)]
|
cmd = [PDFTOHTML, '-enc', 'UTF-8', '-noframes', '-p', '-nomerge', '-nodrm', '-q', pdf_path, os.path.basename(index)]
|
||||||
if isfreebsd:
|
if isbsd:
|
||||||
cmd.remove('-nodrm')
|
cmd.remove('-nodrm')
|
||||||
if no_images:
|
if no_images:
|
||||||
cmd.append('-i')
|
cmd.append('-i')
|
||||||
|
@ -12,7 +12,7 @@ from PyQt4.Qt import (QVariant, QFileInfo, QObject, SIGNAL, QBuffer, Qt,
|
|||||||
|
|
||||||
ORG_NAME = 'KovidsBrain'
|
ORG_NAME = 'KovidsBrain'
|
||||||
APP_UID = 'libprs500'
|
APP_UID = 'libprs500'
|
||||||
from calibre.constants import islinux, iswindows, isfreebsd, isfrozen, isosx
|
from calibre.constants import islinux, iswindows, isbsd, isfrozen, isosx
|
||||||
from calibre.utils.config import Config, ConfigProxy, dynamic, JSONConfig
|
from calibre.utils.config import Config, ConfigProxy, dynamic, JSONConfig
|
||||||
from calibre.utils.localization import set_qt_translator
|
from calibre.utils.localization import set_qt_translator
|
||||||
from calibre.ebooks.metadata import MetaInformation
|
from calibre.ebooks.metadata import MetaInformation
|
||||||
@ -628,7 +628,7 @@ class Application(QApplication):
|
|||||||
st = self.style()
|
st = self.style()
|
||||||
if st is not None:
|
if st is not None:
|
||||||
st = unicode(st.objectName()).lower()
|
st = unicode(st.objectName()).lower()
|
||||||
if (islinux or isfreebsd) and st in ('windows', 'motif', 'cde'):
|
if (islinux or isbsd) and st in ('windows', 'motif', 'cde'):
|
||||||
from PyQt4.Qt import QStyleFactory
|
from PyQt4.Qt import QStyleFactory
|
||||||
styles = set(map(unicode, QStyleFactory.keys()))
|
styles = set(map(unicode, QStyleFactory.keys()))
|
||||||
if 'Plastique' in styles and os.environ.get('KDE_FULL_SESSION',
|
if 'Plastique' in styles and os.environ.get('KDE_FULL_SESSION',
|
||||||
@ -697,7 +697,7 @@ def open_local_file(path):
|
|||||||
|
|
||||||
def is_ok_to_use_qt():
|
def is_ok_to_use_qt():
|
||||||
global gui_thread, _store_app
|
global gui_thread, _store_app
|
||||||
if (islinux or isfreebsd) and ':' not in os.environ.get('DISPLAY', ''):
|
if (islinux or isbsd) and ':' not in os.environ.get('DISPLAY', ''):
|
||||||
return False
|
return False
|
||||||
if _store_app is None and QApplication.instance() is None:
|
if _store_app is None and QApplication.instance() is None:
|
||||||
_store_app = QApplication([])
|
_store_app = QApplication([])
|
||||||
|
@ -5,7 +5,7 @@ import sys, logging, os, traceback, time
|
|||||||
from PyQt4.QtGui import QKeySequence, QPainter, QDialog, QSpinBox, QSlider, QIcon
|
from PyQt4.QtGui import QKeySequence, QPainter, QDialog, QSpinBox, QSlider, QIcon
|
||||||
from PyQt4.QtCore import Qt, QObject, SIGNAL, QCoreApplication, QThread
|
from PyQt4.QtCore import Qt, QObject, SIGNAL, QCoreApplication, QThread
|
||||||
|
|
||||||
from calibre import __appname__, setup_cli_handlers, islinux, isfreebsd
|
from calibre import __appname__, setup_cli_handlers, islinux, isbsd
|
||||||
from calibre.ebooks.lrf.lrfparser import LRFDocument
|
from calibre.ebooks.lrf.lrfparser import LRFDocument
|
||||||
|
|
||||||
from calibre.gui2 import ORG_NAME, APP_UID, error_dialog, \
|
from calibre.gui2 import ORG_NAME, APP_UID, error_dialog, \
|
||||||
@ -258,7 +258,7 @@ def file_renderer(stream, opts, parent=None, logger=None):
|
|||||||
level = logging.DEBUG if opts.verbose else logging.INFO
|
level = logging.DEBUG if opts.verbose else logging.INFO
|
||||||
logger = logging.getLogger('lrfviewer')
|
logger = logging.getLogger('lrfviewer')
|
||||||
setup_cli_handlers(logger, level)
|
setup_cli_handlers(logger, level)
|
||||||
if islinux or isfreebsd:
|
if islinux or isbsd:
|
||||||
try: # Set lrfviewer as the default for LRF files for this user
|
try: # Set lrfviewer as the default for LRF files for this user
|
||||||
from subprocess import call
|
from subprocess import call
|
||||||
call('xdg-mime default calibre-lrfviewer.desktop application/lrf', shell=True)
|
call('xdg-mime default calibre-lrfviewer.desktop application/lrf', shell=True)
|
||||||
@ -307,7 +307,7 @@ def main(args=sys.argv, logger=None):
|
|||||||
if hasattr(opts, 'help'):
|
if hasattr(opts, 'help'):
|
||||||
parser.print_help()
|
parser.print_help()
|
||||||
return 1
|
return 1
|
||||||
pid = os.fork() if (islinux or isfreebsd) else -1
|
pid = os.fork() if (islinux or isbsd) else -1
|
||||||
if pid <= 0:
|
if pid <= 0:
|
||||||
app = Application(args)
|
app = Application(args)
|
||||||
app.setWindowIcon(QIcon(I('viewer.png')))
|
app.setWindowIcon(QIcon(I('viewer.png')))
|
||||||
|
@ -20,7 +20,7 @@ from calibre.gui2 import Application, ORG_NAME, APP_UID, choose_files, \
|
|||||||
info_dialog, error_dialog, open_url, available_height
|
info_dialog, error_dialog, open_url, available_height
|
||||||
from calibre.ebooks.oeb.iterator import EbookIterator
|
from calibre.ebooks.oeb.iterator import EbookIterator
|
||||||
from calibre.ebooks import DRMError
|
from calibre.ebooks import DRMError
|
||||||
from calibre.constants import islinux, isfreebsd, isosx, filesystem_encoding
|
from calibre.constants import islinux, isbsd, isosx, filesystem_encoding
|
||||||
from calibre.utils.config import Config, StringConfig, JSONConfig
|
from calibre.utils.config import Config, StringConfig, JSONConfig
|
||||||
from calibre.gui2.search_box import SearchBox2
|
from calibre.gui2.search_box import SearchBox2
|
||||||
from calibre.ebooks.metadata import MetaInformation
|
from calibre.ebooks.metadata import MetaInformation
|
||||||
@ -801,7 +801,7 @@ def main(args=sys.argv):
|
|||||||
|
|
||||||
parser = option_parser()
|
parser = option_parser()
|
||||||
opts, args = parser.parse_args(args)
|
opts, args = parser.parse_args(args)
|
||||||
pid = os.fork() if False and (islinux or isfreebsd) else -1
|
pid = os.fork() if False and (islinux or isbsd) else -1
|
||||||
if pid <= 0:
|
if pid <= 0:
|
||||||
app = Application(args)
|
app = Application(args)
|
||||||
app.setWindowIcon(QIcon(I('viewer.png')))
|
app.setWindowIcon(QIcon(I('viewer.png')))
|
||||||
|
@ -218,7 +218,7 @@ class LibraryServer(ContentServer, MobileServer, XMLServer, OPDSServer, Cache,
|
|||||||
cherrypy.engine.start()
|
cherrypy.engine.start()
|
||||||
except:
|
except:
|
||||||
ip = get_external_ip()
|
ip = get_external_ip()
|
||||||
if not ip or ip == '127.0.0.1':
|
if not ip or ip.startswith('127.'):
|
||||||
raise
|
raise
|
||||||
cherrypy.log('Trying to bind to single interface: '+ip)
|
cherrypy.log('Trying to bind to single interface: '+ip)
|
||||||
cherrypy.config.update({'server.socket_host' : ip})
|
cherrypy.config.update({'server.socket_host' : ip})
|
||||||
|
@ -7,7 +7,7 @@ import sys, os, cPickle, textwrap, stat, importlib
|
|||||||
from subprocess import check_call
|
from subprocess import check_call
|
||||||
|
|
||||||
from calibre import __appname__, prints, guess_type
|
from calibre import __appname__, prints, guess_type
|
||||||
from calibre.constants import islinux, isfreebsd
|
from calibre.constants import islinux, isnetbsd, isbsd
|
||||||
from calibre.customize.ui import all_input_formats
|
from calibre.customize.ui import all_input_formats
|
||||||
from calibre.ptempfile import TemporaryDirectory
|
from calibre.ptempfile import TemporaryDirectory
|
||||||
from calibre import CurrentDir
|
from calibre import CurrentDir
|
||||||
@ -136,17 +136,17 @@ class PostInstall:
|
|||||||
self.icon_resources = []
|
self.icon_resources = []
|
||||||
self.menu_resources = []
|
self.menu_resources = []
|
||||||
self.mime_resources = []
|
self.mime_resources = []
|
||||||
if islinux or isfreebsd:
|
if islinux or isbsd:
|
||||||
self.setup_completion()
|
self.setup_completion()
|
||||||
self.install_man_pages()
|
self.install_man_pages()
|
||||||
if islinux or isfreebsd:
|
if islinux or isbsd:
|
||||||
self.setup_desktop_integration()
|
self.setup_desktop_integration()
|
||||||
self.create_uninstaller()
|
self.create_uninstaller()
|
||||||
|
|
||||||
from calibre.utils.config import config_dir
|
from calibre.utils.config import config_dir
|
||||||
if os.path.exists(config_dir):
|
if os.path.exists(config_dir):
|
||||||
os.chdir(config_dir)
|
os.chdir(config_dir)
|
||||||
if islinux or isfreebsd:
|
if islinux or isbsd:
|
||||||
for f in os.listdir('.'):
|
for f in os.listdir('.'):
|
||||||
if os.stat(f).st_uid == 0:
|
if os.stat(f).st_uid == 0:
|
||||||
import shutil
|
import shutil
|
||||||
@ -195,6 +195,9 @@ class PostInstall:
|
|||||||
'bash-completion')
|
'bash-completion')
|
||||||
if os.path.exists(bc):
|
if os.path.exists(bc):
|
||||||
f = os.path.join(bc, 'calibre')
|
f = os.path.join(bc, 'calibre')
|
||||||
|
else:
|
||||||
|
if isnetbsd:
|
||||||
|
f = os.path.join(self.opts.staging_root, 'share/bash_completion.d/calibre')
|
||||||
else:
|
else:
|
||||||
f = os.path.join(self.opts.staging_etc, 'bash_completion.d/calibre')
|
f = os.path.join(self.opts.staging_etc, 'bash_completion.d/calibre')
|
||||||
if not os.path.exists(os.path.dirname(f)):
|
if not os.path.exists(os.path.dirname(f)):
|
||||||
@ -300,7 +303,7 @@ class PostInstall:
|
|||||||
def install_man_pages(self): # {{{
|
def install_man_pages(self): # {{{
|
||||||
try:
|
try:
|
||||||
from calibre.utils.help2man import create_man_page
|
from calibre.utils.help2man import create_man_page
|
||||||
if isfreebsd:
|
if isbsd:
|
||||||
manpath = os.path.join(self.opts.staging_root, 'man/man1')
|
manpath = os.path.join(self.opts.staging_root, 'man/man1')
|
||||||
else:
|
else:
|
||||||
manpath = os.path.join(self.opts.staging_sharedir, 'man/man1')
|
manpath = os.path.join(self.opts.staging_sharedir, 'man/man1')
|
||||||
@ -316,7 +319,7 @@ class PostInstall:
|
|||||||
continue
|
continue
|
||||||
parser = parser()
|
parser = parser()
|
||||||
raw = create_man_page(prog, parser)
|
raw = create_man_page(prog, parser)
|
||||||
if isfreebsd:
|
if isbsd:
|
||||||
manfile = os.path.join(manpath, prog+'.1')
|
manfile = os.path.join(manpath, prog+'.1')
|
||||||
else:
|
else:
|
||||||
manfile = os.path.join(manpath, prog+'.1'+__appname__+'.bz2')
|
manfile = os.path.join(manpath, prog+'.1'+__appname__+'.bz2')
|
||||||
|
@ -8,14 +8,14 @@ __docformat__ = 'restructuredtext en'
|
|||||||
|
|
||||||
import os, sys
|
import os, sys
|
||||||
|
|
||||||
from calibre.constants import plugins, iswindows, islinux, isfreebsd
|
from calibre.constants import plugins, iswindows, islinux, isbsd
|
||||||
|
|
||||||
_fc, _fc_err = plugins['fontconfig']
|
_fc, _fc_err = plugins['fontconfig']
|
||||||
|
|
||||||
if _fc is None:
|
if _fc is None:
|
||||||
raise RuntimeError('Failed to load fontconfig with error:'+_fc_err)
|
raise RuntimeError('Failed to load fontconfig with error:'+_fc_err)
|
||||||
|
|
||||||
if islinux or isfreebsd:
|
if islinux or isbsd:
|
||||||
Thread = object
|
Thread = object
|
||||||
else:
|
else:
|
||||||
from threading import Thread
|
from threading import Thread
|
||||||
@ -49,7 +49,7 @@ class FontConfig(Thread):
|
|||||||
self.failed = True
|
self.failed = True
|
||||||
|
|
||||||
def wait(self):
|
def wait(self):
|
||||||
if not (islinux or isfreebsd):
|
if not (islinux or isbsd):
|
||||||
self.join()
|
self.join()
|
||||||
if self.failed:
|
if self.failed:
|
||||||
raise RuntimeError('Failed to initialize fontconfig')
|
raise RuntimeError('Failed to initialize fontconfig')
|
||||||
@ -149,7 +149,7 @@ class FontConfig(Thread):
|
|||||||
return fonts if all else (fonts[0] if fonts else None)
|
return fonts if all else (fonts[0] if fonts else None)
|
||||||
|
|
||||||
fontconfig = FontConfig()
|
fontconfig = FontConfig()
|
||||||
if islinux or isfreebsd:
|
if islinux or isbsd:
|
||||||
# On X11 Qt also uses fontconfig, so initialization must happen in the
|
# On X11 Qt also uses fontconfig, so initialization must happen in the
|
||||||
# main thread. In any case on X11 initializing fontconfig should be very
|
# main thread. In any case on X11 initializing fontconfig should be very
|
||||||
# fast
|
# fast
|
||||||
|
@ -4,7 +4,7 @@ __copyright__ = '2009, Kovid Goyal <kovid@kovidgoyal.net>'
|
|||||||
__docformat__ = 'restructuredtext en'
|
__docformat__ = 'restructuredtext en'
|
||||||
|
|
||||||
import time, bz2
|
import time, bz2
|
||||||
from calibre.constants import isfreebsd
|
from calibre.constants import isbsd
|
||||||
|
|
||||||
from calibre.constants import __version__, __appname__, __author__
|
from calibre.constants import __version__, __appname__, __author__
|
||||||
|
|
||||||
@ -58,7 +58,7 @@ def create_man_page(prog, parser):
|
|||||||
lines = [x if isinstance(x, unicode) else unicode(x, 'utf-8', 'replace') for
|
lines = [x if isinstance(x, unicode) else unicode(x, 'utf-8', 'replace') for
|
||||||
x in lines]
|
x in lines]
|
||||||
|
|
||||||
if not isfreebsd:
|
if not isbsd:
|
||||||
return bz2.compress((u'\n'.join(lines)).encode('utf-8'))
|
return bz2.compress((u'\n'.join(lines)).encode('utf-8'))
|
||||||
else:
|
else:
|
||||||
return (u'\n'.join(lines)).encode('utf-8')
|
return (u'\n'.join(lines)).encode('utf-8')
|
||||||
|
@ -13,16 +13,17 @@ def _get_external_ip():
|
|||||||
ipaddr = socket.gethostbyname(socket.gethostname())
|
ipaddr = socket.gethostbyname(socket.gethostname())
|
||||||
except:
|
except:
|
||||||
ipaddr = '127.0.0.1'
|
ipaddr = '127.0.0.1'
|
||||||
if ipaddr == '127.0.0.1':
|
if ipaddr.startswith('127.'):
|
||||||
for addr in ('192.0.2.0', '198.51.100.0', 'google.com'):
|
for addr in ('192.0.2.0', '198.51.100.0', 'google.com'):
|
||||||
try:
|
try:
|
||||||
s = socket.socket(socket.AF_INET, socket.SOCK_DGRAM)
|
s = socket.socket(socket.AF_INET, socket.SOCK_DGRAM)
|
||||||
s.connect((addr, 0))
|
s.connect((addr, 0))
|
||||||
ipaddr = s.getsockname()[0]
|
ipaddr = s.getsockname()[0]
|
||||||
if ipaddr != '127.0.0.1':
|
if not ipaddr.startswith('127.'):
|
||||||
return ipaddr
|
break
|
||||||
except:
|
except:
|
||||||
time.sleep(0.3)
|
time.sleep(0.3)
|
||||||
|
#print 'ipaddr: %s' % ipaddr
|
||||||
return ipaddr
|
return ipaddr
|
||||||
|
|
||||||
_ext_ip = None
|
_ext_ip = None
|
||||||
|
@ -6,7 +6,7 @@ __license__ = 'GPL v3'
|
|||||||
__copyright__ = '2010, Kovid Goyal <kovid@kovidgoyal.net>'
|
__copyright__ = '2010, Kovid Goyal <kovid@kovidgoyal.net>'
|
||||||
__docformat__ = 'restructuredtext en'
|
__docformat__ = 'restructuredtext en'
|
||||||
|
|
||||||
from calibre.constants import iswindows, islinux, isfreebsd
|
from calibre.constants import iswindows, islinux, isbsd
|
||||||
|
|
||||||
class LinuxNetworkStatus(object):
|
class LinuxNetworkStatus(object):
|
||||||
|
|
||||||
@ -47,7 +47,7 @@ class DummyNetworkStatus(object):
|
|||||||
return True
|
return True
|
||||||
|
|
||||||
_network_status = WindowsNetworkStatus() if iswindows else \
|
_network_status = WindowsNetworkStatus() if iswindows else \
|
||||||
LinuxNetworkStatus() if (islinux or isfreebsd) else \
|
LinuxNetworkStatus() if (islinux or isbsd) else \
|
||||||
DummyNetworkStatus()
|
DummyNetworkStatus()
|
||||||
|
|
||||||
def internet_connected():
|
def internet_connected():
|
||||||
|
Loading…
x
Reference in New Issue
Block a user