# Version 1.0 (the License).  You may not copy or use this file, in either
# source code or executable form, except in compliance with the License.  You
# may obtain a copy of the License at http://www.bittorrent.com/license/.
#
# Software distributed under the License is distributed on an AS IS basis,
# WITHOUT WARRANTY OF ANY KIND, either express or implied.  See the License
# for the specific language governing rights and limitations under the
# License.

# Original version written by Henry 'Pi' James, modified by (at least)
# John Hoffman and Uoti Urpala

from __future__ import division

from BitTorrent.platform import install_translation
install_translation()

SPEW_SCROLL_RATE = 1

import sys
import os
import threading
from time import time, strftime

from BitTorrent.download import Feedback, Multitorrent
from BitTorrent.defaultargs import get_defaults
from BitTorrent.parseargs import printHelp
from BitTorrent.zurllib import urlopen
from BitTorrent.bencode import bdecode
from BitTorrent.ConvertedMetainfo import ConvertedMetainfo
from BitTorrent.prefs import Preferences
Beispiel #2
0
assert sys.version_info >= (2, 2,
                            1), _("Python %s or newer required") % '2.2.1'
import os
import time

branch = None
if os.access('.cdv', os.F_OK):
    branch = os.path.split(os.path.realpath(os.path.split(sys.argv[0])[0]))[1]

from BitTorrent.language import languages, language_names
from BitTorrent.platform import get_home_dir, is_frozen_exe

if os.name == 'posix':
    if os.uname()[0] == "Darwin":
        from BitTorrent.platform import install_translation
        install_translation()

# hackery to get around bug in py2exe that tries to write log files to
# application directories, which may not be writable by non-admin users
if is_frozen_exe:
    baseclass = sys.stderr.__class__

    class Stderr(baseclass):
        logroot = get_home_dir()

        if logroot is None:
            logroot = os.path.splitdrive(sys.executable)[0]
            if logroot[-1] != os.sep:
                logroot += os.sep
        logname = os.path.splitext(os.path.split(
            sys.executable)[1])[0] + '_errors.log'
import sys
import codecs

# we do this first, since BitTorrent/__init__.py installs a stderr proxy.

# py2exe'd Blackholes don't have encoding
encoding = getattr(sys.stdout, "encoding", None) 
# and sometimes encoding is None anyway
if encoding is not None:
    stdout_writer = codecs.getwriter(encoding)
    # don't fail if we can't write a value in the sydout encoding
    sys.stdout = stdout_writer(sys.stdout, 'replace')
    stderr_writer = codecs.getwriter(encoding)
    sys.stderr = stderr_writer(sys.stderr, 'replace')

from BitTorrent.platform import install_translation
install_translation(unicode=True)
_ = _ # not a typo
Beispiel #4
0
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program.  If not, see <http://www.gnu.org/licenses/>.

import sys
import codecs

# we do this first, since BitTorrent/__init__.py installs a stderr proxy.

# py2exe'd Blackholes don't have encoding
encoding = getattr(sys.stdout, "encoding", None) 
# and sometimes encoding is None anyway
if encoding is not None:
    stdout_writer = codecs.getwriter(encoding)
    # don't fail if we can't write a value in the sydout encoding
    sys.stdout = stdout_writer(sys.stdout, 'replace')
    stderr_writer = codecs.getwriter(encoding)
    sys.stderr = stderr_writer(sys.stderr, 'replace')

from BitTorrent.platform import install_translation
install_translation(unicode=True)
_ = _ # not a typo