Skip to content

Commit

Permalink
modified: ACEStream/Core/APIImplementation/DownloadImpl.py
Browse files Browse the repository at this point in the history
	modified:   ACEStream/Core/APIImplementation/SingleDownload.py
	modified:   ACEStream/Core/BitTornado/BT1/Storage.py
	modified:   ACEStream/Core/BitTornado/BT1/StorageWrapper.py
	modified:   ACEStream/Core/defaults.py
	modified:   ACEStream/Player/BaseApp.py
  • Loading branch information
tarasian666 committed May 21, 2013
1 parent fd8c3af commit dda42f9
Show file tree
Hide file tree
Showing 205 changed files with 37 additions and 184 deletions.
Binary file removed ACEStream/Category/Category.pyc
Binary file not shown.
Binary file removed ACEStream/Category/FamilyFilter.pyc
Binary file not shown.
Binary file removed ACEStream/Category/__init__.pyc
Binary file not shown.
Binary file removed ACEStream/Category/init_category.pyc
Binary file not shown.
Binary file removed ACEStream/Core/API.pyc
Binary file not shown.
Binary file removed ACEStream/Core/APIImplementation/DirectDownload.pyc
Binary file not shown.
2 changes: 1 addition & 1 deletion ACEStream/Core/APIImplementation/DownloadImpl.py
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ def __init__(self, dltype, session, tdef = None, main_url = None):
self.tdef.readonly = True
self.log_prefix = 'DownloadImpl::' + str(DLTYPE_TORRENT) + ':' + binascii.hexlify(self.tdef.get_infohash()) + ':'
if tdef.can_save() != 1:
self.encrypted_storage = True
self.encrypted_storage = False
else:
self.encrypted_storage = globalConfig.get_value('encrypted_storage')
elif self.dltype == DLTYPE_DIRECT:
Expand Down
Binary file removed ACEStream/Core/APIImplementation/DownloadImpl.pyc
Binary file not shown.
Binary file not shown.
Binary file removed ACEStream/Core/APIImplementation/FakeDownload.pyc
Binary file not shown.
Binary file removed ACEStream/Core/APIImplementation/LaunchManyCore.pyc
Binary file not shown.
Binary file not shown.
22 changes: 18 additions & 4 deletions ACEStream/Core/APIImplementation/SingleDownload.py
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@ def __init__(self, infohash, metainfo, kvconfig, multihandler, get_extip_func, l
self.repexer = None
self.log_prefix = 'sd::' + binascii.hexlify(self.infohash) + ':'
self.lock = Lock()
self.stopping = False
self.download_id = binascii.hexlify(self.infohash) + '-' + str(long(time.time())) + '-' + str(random.randint(0, 100000))
try:
self.dldoneflag = Event()
Expand Down Expand Up @@ -288,11 +289,20 @@ def checkpoint(self):
else:
return

def shutdown(self):
def shutdown(self, blocking = True):
if DEBUG:
log(self.log_prefix + 'shutdown: thread', currentThread().getName())
resumedata = None
self.lock.acquire()
if self.stopping:
if DEBUG:
log(self.log_prefix + 'shutdown: already stopping, exit: thread', currentThread().getName())
return
if DEBUG:
log(self.log_prefix + 'shutdown, acquire lock: blocking', blocking, 'thread', currentThread().getName())
locked = self.lock.acquire(blocking)
if DEBUG:
log(self.log_prefix + 'shutdown, got lock: locked', locked, 'thread', currentThread().getName())
self.stopping = True
try:
if self.dow is not None:
if self.repexer:
Expand All @@ -314,7 +324,11 @@ def shutdown(self):
elif DEBUG:
log(self.log_prefix + 'shutdown: regular shutdown: _getstatsfunc', self._getstatsfunc, 'thread', currentThread().getName())
finally:
self.lock.release()
if DEBUG:
log(self.log_prefix + 'shutdown, release lock: thread', currentThread().getName())
self.stopping = False
if locked:
self.lock.release()

return resumedata

Expand Down Expand Up @@ -464,7 +478,7 @@ def fatalerrorfunc(self, data):
else:
log_exc()
self.set_error_func(data)
self.shutdown()
self.shutdown(blocking=False)

def nonfatalerrorfunc(self, e):
log(self.log_prefix + 'nonfatalerrorfunc called', e)
Expand Down
Binary file removed ACEStream/Core/APIImplementation/SingleDownload.pyc
Binary file not shown.
Binary file removed ACEStream/Core/APIImplementation/ThreadPool.pyc
Binary file not shown.
Binary file not shown.
Binary file removed ACEStream/Core/APIImplementation/__init__.pyc
Binary file not shown.
Binary file removed ACEStream/Core/APIImplementation/maketorrent.pyc
Binary file not shown.
Binary file removed ACEStream/Core/APIImplementation/makeurl.pyc
Binary file not shown.
Binary file removed ACEStream/Core/APIImplementation/miscutils.pyc
Binary file not shown.
Binary file removed ACEStream/Core/Base.pyc
Binary file not shown.
Binary file removed ACEStream/Core/BitTornado/BT1/Choker.pyc
Binary file not shown.
Binary file removed ACEStream/Core/BitTornado/BT1/Connecter.pyc
Binary file not shown.
Binary file removed ACEStream/Core/BitTornado/BT1/Downloader.pyc
Binary file not shown.
Binary file removed ACEStream/Core/BitTornado/BT1/DownloaderFeedback.pyc
Binary file not shown.
Binary file removed ACEStream/Core/BitTornado/BT1/Encrypter.pyc
Binary file not shown.
Binary file removed ACEStream/Core/BitTornado/BT1/FileSelector.pyc
Binary file not shown.
Binary file removed ACEStream/Core/BitTornado/BT1/Filter.pyc
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file removed ACEStream/Core/BitTornado/BT1/MessageID.pyc
Binary file not shown.
Binary file removed ACEStream/Core/BitTornado/BT1/NatCheck.pyc
Binary file not shown.
Binary file removed ACEStream/Core/BitTornado/BT1/PiecePicker.pyc
Binary file not shown.
Binary file removed ACEStream/Core/BitTornado/BT1/Rerequester.pyc
Binary file not shown.
Binary file removed ACEStream/Core/BitTornado/BT1/Statistics.pyc
Binary file not shown.
10 changes: 8 additions & 2 deletions ACEStream/Core/BitTornado/BT1/Storage.py
Original file line number Diff line number Diff line change
Expand Up @@ -256,8 +256,14 @@ def _close(self, file):
f.flush()
self.unlock_file(file, f)
f.close()
self.tops[file] = getsize(file)
self.mtimes[file] = getmtime(file)
if os.path.isfile(file):
self.tops[file] = getsize(file)
self.mtimes[file] = getmtime(file)
else:
if DEBUG:
log(self.log_prefix + '_close: missing file', file)
self.tops[file] = 0
self.mtimes[file] = 0
else:
if self.lock_while_reading:
self.unlock_file(file, f)
Expand Down
Binary file removed ACEStream/Core/BitTornado/BT1/Storage.pyc
Binary file not shown.
3 changes: 1 addition & 2 deletions ACEStream/Core/BitTornado/BT1/StorageWrapper.py
Original file line number Diff line number Diff line change
Expand Up @@ -857,8 +857,7 @@ def sync(self):
except IOError as e:
self.failed('IO Error: ' + str(e))
except OSError as e:
log('OS Error: ' + str(e))
#self.failed('OS Error: ' + str(e))
self.failed('OS Error: ' + str(e))

def _move_piece(self, index, newpos):
oldpos = self.places[index]
Expand Down
Binary file removed ACEStream/Core/BitTornado/BT1/StorageWrapper.pyc
Binary file not shown.
Binary file removed ACEStream/Core/BitTornado/BT1/T2T.pyc
Binary file not shown.
Binary file removed ACEStream/Core/BitTornado/BT1/Uploader.pyc
Binary file not shown.
Binary file removed ACEStream/Core/BitTornado/BT1/__init__.pyc
Binary file not shown.
Binary file removed ACEStream/Core/BitTornado/BT1/btformats.pyc
Binary file not shown.
Binary file removed ACEStream/Core/BitTornado/BT1/convert.pyc
Binary file not shown.
Binary file removed ACEStream/Core/BitTornado/BT1/track.pyc
Binary file not shown.
Binary file removed ACEStream/Core/BitTornado/CurrentRateMeasure.pyc
Binary file not shown.
Binary file removed ACEStream/Core/BitTornado/HTTPHandler.pyc
Binary file not shown.
Binary file removed ACEStream/Core/BitTornado/RateLimiter.pyc
Binary file not shown.
Binary file removed ACEStream/Core/BitTornado/RateMeasure.pyc
Binary file not shown.
Binary file removed ACEStream/Core/BitTornado/RawServer.pyc
Binary file not shown.
Binary file removed ACEStream/Core/BitTornado/ServerPortHandler.pyc
Binary file not shown.
Binary file removed ACEStream/Core/BitTornado/SocketHandler.pyc
Binary file not shown.
Binary file removed ACEStream/Core/BitTornado/__init__.pyc
Binary file not shown.
Binary file removed ACEStream/Core/BitTornado/bencode.pyc
Binary file not shown.
Binary file removed ACEStream/Core/BitTornado/bitfield.pyc
Binary file not shown.
Binary file removed ACEStream/Core/BitTornado/clock.pyc
Binary file not shown.
Binary file removed ACEStream/Core/BitTornado/download_bt1.pyc
Binary file not shown.
Binary file removed ACEStream/Core/BitTornado/iprangeparse.pyc
Binary file not shown.
Binary file removed ACEStream/Core/BitTornado/natpunch.pyc
Binary file not shown.
Binary file removed ACEStream/Core/BitTornado/parseargs.pyc
Binary file not shown.
Binary file removed ACEStream/Core/BitTornado/parsedir.pyc
Binary file not shown.
Binary file removed ACEStream/Core/BitTornado/piecebuffer.pyc
Binary file not shown.
Binary file removed ACEStream/Core/BitTornado/subnetparse.pyc
Binary file not shown.
Binary file removed ACEStream/Core/BitTornado/torrentlistparse.pyc
Binary file not shown.
Binary file removed ACEStream/Core/BitTornado/zurllib.pyc
Binary file not shown.
Binary file removed ACEStream/Core/CacheDB/CacheDBHandler.pyc
Binary file not shown.
Binary file removed ACEStream/Core/CacheDB/Notifier.pyc
Binary file not shown.
Binary file removed ACEStream/Core/CacheDB/SqliteCacheDBHandler.pyc
Binary file not shown.
Binary file not shown.
Binary file removed ACEStream/Core/CacheDB/SqliteSeedingStatsCacheDB.pyc
Binary file not shown.
Binary file not shown.
Binary file removed ACEStream/Core/CacheDB/__init__.pyc
Binary file not shown.
Binary file removed ACEStream/Core/CacheDB/cachedb.pyc
Binary file not shown.
Binary file removed ACEStream/Core/CacheDB/maxflow.pyc
Binary file not shown.
Binary file removed ACEStream/Core/CacheDB/sqlitecachedb.pyc
Binary file not shown.
Binary file removed ACEStream/Core/ClosedSwarm/ClosedSwarm.pyc
Binary file not shown.
Binary file removed ACEStream/Core/ClosedSwarm/__init__.pyc
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file removed ACEStream/Core/DecentralizedTracking/__init__.pyc
Binary file not shown.
Binary file removed ACEStream/Core/DecentralizedTracking/mainlineDHT.pyc
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file removed ACEStream/Core/DecentralizedTracking/repex.pyc
Binary file not shown.
Binary file removed ACEStream/Core/DecentralizedTracking/ut_pex.pyc
Binary file not shown.
Binary file removed ACEStream/Core/DirectDownload/Downloader.pyc
Binary file not shown.
Binary file removed ACEStream/Core/DirectDownload/Storage.pyc
Binary file not shown.
Binary file removed ACEStream/Core/DirectDownload/VODTransporter.pyc
Binary file not shown.
Binary file removed ACEStream/Core/DirectDownload/__init__.pyc
Binary file not shown.
Binary file removed ACEStream/Core/Download.pyc
Binary file not shown.
Binary file removed ACEStream/Core/DownloadConfig.pyc
Binary file not shown.
Binary file removed ACEStream/Core/DownloadState.pyc
Binary file not shown.
Binary file removed ACEStream/Core/LiveSourceAuthConfig.pyc
Binary file not shown.
Binary file removed ACEStream/Core/Merkle/__init__.pyc
Binary file not shown.
Binary file removed ACEStream/Core/Merkle/merkle.pyc
Binary file not shown.
Binary file removed ACEStream/Core/NATFirewall/ConnectionCheck.pyc
Binary file not shown.
Binary file removed ACEStream/Core/NATFirewall/DialbackMsgHandler.pyc
Binary file not shown.
Binary file removed ACEStream/Core/NATFirewall/NatCheck.pyc
Binary file not shown.
Binary file removed ACEStream/Core/NATFirewall/ReturnConnHandler.pyc
Binary file not shown.
Binary file removed ACEStream/Core/NATFirewall/TimeoutCheck.pyc
Binary file not shown.
Binary file removed ACEStream/Core/NATFirewall/TimeoutFinder.pyc
Binary file not shown.
Binary file removed ACEStream/Core/NATFirewall/UDPPuncture.pyc
Binary file not shown.
Binary file removed ACEStream/Core/NATFirewall/UPnPThread.pyc
Binary file not shown.
Binary file removed ACEStream/Core/NATFirewall/__init__.pyc
Binary file not shown.
Binary file removed ACEStream/Core/NATFirewall/guessip.pyc
Binary file not shown.
Binary file removed ACEStream/Core/NATFirewall/upnp.pyc
Binary file not shown.
Binary file not shown.
Binary file removed ACEStream/Core/Overlay/SecureOverlay.pyc
Binary file not shown.
Binary file removed ACEStream/Core/Overlay/__init__.pyc
Binary file not shown.
Binary file removed ACEStream/Core/Overlay/permid.pyc
Binary file not shown.
Binary file removed ACEStream/Core/ProxyMode/Helper.pyc
Binary file not shown.
Binary file removed ACEStream/Core/ProxyMode/__init__.pyc
Binary file not shown.
Binary file removed ACEStream/Core/ProxyService/Helper.pyc
Binary file not shown.
Binary file removed ACEStream/Core/ProxyService/ProxyServiceUtil.pyc
Binary file not shown.
Binary file removed ACEStream/Core/ProxyService/__init__.pyc
Binary file not shown.
Binary file removed ACEStream/Core/RequestPolicy.pyc
Binary file not shown.
Binary file removed ACEStream/Core/Search/KeywordSearch.pyc
Binary file not shown.
Binary file removed ACEStream/Core/Search/__init__.pyc
Binary file not shown.
Binary file removed ACEStream/Core/Session.pyc
Binary file not shown.
Binary file removed ACEStream/Core/SessionConfig.pyc
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file removed ACEStream/Core/Subtitles/SubtitleHandler/__init__.pyc
Binary file not shown.
Binary file removed ACEStream/Core/Subtitles/SubtitlesHandler.pyc
Binary file not shown.
Binary file removed ACEStream/Core/Subtitles/__init__.pyc
Binary file not shown.
Binary file removed ACEStream/Core/TS/Service.pyc
Binary file not shown.
Binary file removed ACEStream/Core/TS/__init__.pyc
Binary file not shown.
Binary file removed ACEStream/Core/TS/domutils.pyc
Binary file not shown.
Binary file removed ACEStream/Core/TorrentDef.pyc
Binary file not shown.
Binary file removed ACEStream/Core/Utilities/EncryptedStorage.pyc
Binary file not shown.
Binary file removed ACEStream/Core/Utilities/TSCrypto.pyc
Binary file not shown.
Binary file removed ACEStream/Core/Utilities/__init__.pyc
Binary file not shown.
Binary file removed ACEStream/Core/Utilities/logger.pyc
Binary file not shown.
Binary file removed ACEStream/Core/Utilities/mp4metadata.pyc
Binary file not shown.
Binary file removed ACEStream/Core/Utilities/odict.pyc
Binary file not shown.
Binary file removed ACEStream/Core/Utilities/timeouturlopen.pyc
Binary file not shown.
Binary file removed ACEStream/Core/Utilities/unicode.pyc
Binary file not shown.
Binary file removed ACEStream/Core/Utilities/utilities.pyc
Binary file not shown.
Binary file removed ACEStream/Core/Video/LiveSourceAuth.pyc
Binary file not shown.
Binary file removed ACEStream/Core/Video/MovieTransport.pyc
Binary file not shown.
Binary file removed ACEStream/Core/Video/PiecePickerStreaming.pyc
Binary file not shown.
Binary file removed ACEStream/Core/Video/VideoOnDemand.pyc
Binary file not shown.
Binary file removed ACEStream/Core/Video/VideoStatus.pyc
Binary file not shown.
Binary file removed ACEStream/Core/Video/__init__.pyc
Binary file not shown.
Binary file removed ACEStream/Core/__init__.pyc
Binary file not shown.
Binary file removed ACEStream/Core/debug.pyc
Binary file not shown.
4 changes: 2 additions & 2 deletions ACEStream/Core/defaults.py
Original file line number Diff line number Diff line change
Expand Up @@ -184,8 +184,8 @@
dldefaults['auto_download_limit'] = False
dldefaults['wait_sufficient_speed'] = False
dldefaults['enable_http_support'] = True
dldefaults['player_buffer_time'] = 5
dldefaults['live_buffer_time'] = 10
dldefaults['player_buffer_time'] = 0
dldefaults['live_buffer_time'] = 0
dldefaults['download_finished_callback'] = None
dldefaults['download_failed_callback'] = None
dldefaults['direct_download_url'] = None
Expand Down
Binary file removed ACEStream/Core/defaults.pyc
Binary file not shown.
Binary file removed ACEStream/Core/exceptions.pyc
Binary file not shown.
Binary file removed ACEStream/Core/osutils.pyc
Binary file not shown.
Binary file removed ACEStream/Core/simpledefs.pyc
Binary file not shown.
Binary file removed ACEStream/Debug/__init__.pyc
Binary file not shown.
Binary file removed ACEStream/Debug/console.pyc
Binary file not shown.
Binary file removed ACEStream/GlobalConfig.pyc
Binary file not shown.
180 changes: 7 additions & 173 deletions ACEStream/Player/BaseApp.py
Original file line number Diff line number Diff line change
Expand Up @@ -392,7 +392,7 @@ def OnInitBase(self):
#ga = lambda : GoogleAnalytics.send_event('client', 'startup', VERSION)
#self.run_delayed(ga)
self.tsservice = TSService(self)
self.run_delayed(self.check_auth_level, 0.1)
#self.run_delayed(self.check_auth_level, 0.1)
self.cookie_file = os.path.join(self.state_dir, 'cookies.pickle')
self.cookie_jar = cookielib.CookieJar()
self.load_cookies()
Expand All @@ -406,16 +406,16 @@ def OnInitBase(self):
if DEBUG:
print_exc()

self.check_user_profile()
#self.check_user_profile()
#self.ad_manager = AdManager(self, self.cookie_jar)
if TS_ENV_PLATFORM == 'dune':
default_enabled = False
else:
default_enabled = True
preload_ads_enabled = self.get_preload_ads_enabled(default_enabled)
if DEBUG:
log('baseapp::init: preload_ads_enabled', preload_ads_enabled)
self.run_delayed(self.cleanup_hidden_downloads_task, 1.0)
#preload_ads_enabled = self.get_preload_ads_enabled(default_enabled)
#if DEBUG:
#log('baseapp::init: preload_ads_enabled', preload_ads_enabled)
#self.run_delayed(self.cleanup_hidden_downloads_task, 1.0)
self.run_delayed(self.remove_unknown_downloads, 20.0)
#self.run_delayed(self.check_preload_ads, 1.0, 'check_preload_ads')
if sys.platform == 'win32':
Expand Down Expand Up @@ -929,173 +929,6 @@ def start_download(self, tdef, dlfile, extra_files_indexes = [], developer_id =
#self.run_delayed(func)
return newd

def start_ad_downloads_when_main_started(self, maind, ads):
self.dlinfo_lock.acquire()
try:
if maind not in self.downloads_in_vodmode:
if DEBUG:
log('baseapp::start_ad_downloads_when_main_started: download is not in vod mode, stop trying: hash', binascii.hexlify(maind.get_hash()))
return
ds = maind.network_get_state(usercallback=None, getpeerlist=False, sessioncalling=True)
dlstatus = ds.get_status()
is_vod = ds.is_vod()
playable = ds.get_vod_playable()
if DEBUG:
log('baseapp::start_ad_downloads_when_main_started: hash', binascii.hexlify(maind.get_hash()), 'status', dlstatus_strings[dlstatus], 'is_vod', is_vod, 'playable', playable)
if dlstatus == DLSTATUS_STOPPED_ON_ERROR:
if DEBUG:
log('baseapp::start_ad_downloads_when_main_started: download cannot start, stop trying: hash', binascii.hexlify(maind.get_hash()), 'error', ds.get_error())
return
start_ads = False
if dlstatus == DLSTATUS_DOWNLOADING and is_vod:
if playable:
if DEBUG:
log('baseapp::start_ad_downloads_when_main_started: download is playable, stop trying: hash', binascii.hexlify(maind.get_hash()))
return
if DEBUG:
log('baseapp::start_ad_downloads_when_main_started: download is not playable, start ads: hash', binascii.hexlify(maind.get_hash()))
start_ads = True
else:
if dlstatus == DLSTATUS_SEEDING:
if DEBUG:
log('baseapp::start_ad_downloads_when_main_started: download is finished, stop trying: hash', binascii.hexlify(maind.get_hash()))
return
if DEBUG:
log('baseapp::start_ad_downloads_when_main_started: keep trying: hash', binascii.hexlify(maind.get_hash()))
if start_ads:
self.start_ad_downloads(maind, ads)
else:
start_ad_downloads_when_main_started_lambda = lambda : self.start_ad_downloads_when_main_started(maind, ads)
self.run_delayed(start_ad_downloads_when_main_started_lambda, 1.0)
finally:
self.dlinfo_lock.release()

def start_ad_downloads(self, newd, ads):
ds = newd.network_get_state(usercallback=None, getpeerlist=False, sessioncalling=True)
main_dlstatus = ds.get_status()
main_progress = ds.get_progress()
if DEBUG:
log('baseapp::start_ad_downloads: start ads: main', binascii.hexlify(newd.get_hash()), 'status', dlstatus_strings[main_dlstatus], 'progress', main_progress)
noninterruptable_ads = []
noninterruptable_ads_hash_list = []
interruptable_ads = []
for ad in ads:
if ad['dltype'] == DLTYPE_TORRENT:
ad['dlhash'] = ad['tdef'].get_infohash()
ad['size'] = ad['tdef'].get_length()
elif ad['dltype'] == DLTYPE_DIRECT:
tdef = None
if tdef is None:
ad['dlhash'] = hashlib.sha1(ad['url']).digest()
ad['size'] = 0
else:
ad['tdef'] = tdef
ad['dlhash'] = tdef.get_infohash()
ad['size'] = tdef.get_length()
ad['dltype'] = DLTYPE_TORRENT
if DEBUG:
log('baseapp::start_ad_downloads: got torrent from url: url', ad['url'], 'infohash', binascii.hexlify(ad['dlhash']))
else:
raise ValueError('Unknown download type ' + str(ad['dltype']))
if not ad.has_key('priority'):
if ad['interruptable']:
ad['priority'] = 0
else:
ad['priority'] = -1
if ad['interruptable']:
interruptable_ads.append(ad)
else:
noninterruptable_ads.append(ad)
noninterruptable_ads_hash_list.append(ad['dlhash'])

def start_ad(ad):
d = self.s.get_download(ad['dltype'], ad['dlhash'])
if d is None:
if ad['interruptable'] or ad['wait_preload']:
if DEBUG:
log('baseapp::start_ad_downloads: interruptable or preload ad download is not in downloads, skip: dlhash', binascii.hexlify(ad['dlhash']))
return False
if DEBUG:
log('baseapp::start_ad_downloads: start new ad download: main', binascii.hexlify(newd.get_hash()), 'ad', binascii.hexlify(ad['dlhash']))
if not self.cleanup_hidden_downloads(needed=ad['size'], priority=ad['priority']):
if DEBUG:
log('baseapp::start_ad_downloads: not enough space: hash', binascii.hexlify(ad['dlhash']), 'size', ad['size'])
return False
dcfg = DownloadStartupConfig()
dcfg.set_video_event_callback(lambda d, event, params: self.sesscb_vod_event_callback(d, event, params, newd))
dcfg.set_dest_dir(self.s.get_ads_dir())
dcfg.set_player_buffer_time(1)
dcfg.set_max_conns(50)
dcfg.set_max_conns_to_initiate(60)
dcfg.set_hidden(True)
if ad['dltype'] == DLTYPE_TORRENT:
d = self.s.start_download(ad['tdef'], dcfg)
elif ad['dltype'] == DLTYPE_DIRECT:
dcfg.set_download_failed_callback(self.download_failed_callback)
if ad['predownload']:
dcfg.set_predownload(True)
d = self.s.start_direct_download(ad['url'], dcfg)
else:
if ad['interruptable']:
if main_progress == 1.0:
if DEBUG:
log('baseapp::start_ad_downloads: main content is completed, skip interruptable ad: dlhash', binascii.hexlify(ad['dlhash']))
return False
if ad['interruptable'] or ad['wait_preload']:
ds = d.network_get_state(usercallback=None, getpeerlist=False, sessioncalling=True)
progress = ds.get_progress()
if progress != 1.0:
if DEBUG:
log('baseapp::start_ad_downloads: interruptable or preload ad download is not completed, skip: dlhash', binascii.hexlify(ad['dlhash']), 'progress', progress)
return False
used_by_another_vod = False
for main_d, ads in self.downloads_in_admode.iteritems():
if d in ads:
used_by_another_vod = True
if DEBUG:
log('baseapp::start_ad_downloads: ad download is used by another vod: main', binascii.hexlify(newd.get_hash()), 'other', binascii.hexlify(main_d.get_hash()), 'ad', binascii.hexlify(d.get_hash()))
break

if used_by_another_vod:
start_ad_download_when_seeding_lambda = lambda d = d, newd = newd: self.start_ad_download_when_seeding(d, newd)
self.run_delayed(start_ad_download_when_seeding_lambda, 0.1)
else:
if DEBUG:
log('baseapp::start_ad_downloads: restart existing ad download: main', binascii.hexlify(newd.get_hash()), 'ad', binascii.hexlify(ad['dlhash']))
d.set_video_event_callback(lambda d, event, params: self.sesscb_vod_event_callback(d, event, params, newd))
d.set_player_buffer_time(1)
d.set_max_conns(10)
d.set_max_conns_to_initiate(10)
d.set_hidden(True)
if d.get_type() == DLTYPE_DIRECT:
d.set_download_failed_callback(self.download_failed_callback)
d.restart()
self.downloads_in_admode.setdefault(newd, odict())[d] = {'ad': ad,
'start_params': None,
'completed': False,
'started': None,
'finished': None,
'failed': False}
return True

started_noninterruptable_ads = 0
started_interruptable_ads = 0
for ad in noninterruptable_ads:
if start_ad(ad):
started_noninterruptable_ads += 1

for ad in interruptable_ads:
if start_ad(ad):
started_interruptable_ads += 1

if DEBUG:
log('baseapp::start_ad_downloads: started_noninterruptable_ads', started_noninterruptable_ads, 'started_interruptable_ads', started_interruptable_ads)
if started_noninterruptable_ads == 0 and started_interruptable_ads == 0 and main_dlstatus == DLSTATUS_STOPPED:
if DEBUG:
log('baseapp::start_ad_downloads: no ads started, start main download: main', binascii.hexlify(newd.get_hash()))
newd.restart()
self.add_preload_ads(interruptable_ads, False)

def guess_duration_from_size(self, content_length):
if content_length >= 734003200:
content_duration = 5400
Expand Down Expand Up @@ -2060,6 +1893,7 @@ def gui_states_callback(self, dslist, haspeerlist):
totalspeed)

def update_download_stats(self, ds, force = False):
return
try:
if not force and time.time() - self.last_download_stats < DOWNLOAD_STATS_INTERVAL:
return
Expand Down
Binary file removed ACEStream/Player/BaseApp.pyc
Binary file not shown.
Binary file removed ACEStream/Player/__init__.pyc
Binary file not shown.
Binary file removed ACEStream/Player/common.pyc
Binary file not shown.
Binary file removed ACEStream/Plugin/AtomFeedParser.pyc
Binary file not shown.
Binary file removed ACEStream/Plugin/BackgroundProcess.pyc
Binary file not shown.
Binary file removed ACEStream/Plugin/EngineConsole.pyc
Binary file not shown.
Binary file removed ACEStream/Plugin/Search.pyc
Binary file not shown.
Binary file removed ACEStream/Plugin/__init__.pyc
Binary file not shown.
Binary file removed ACEStream/Plugin/defs.pyc
Binary file not shown.
Binary file removed ACEStream/Policies/RateManager.pyc
Binary file not shown.
Binary file removed ACEStream/Policies/__init__.pyc
Binary file not shown.
Binary file removed ACEStream/Utilities/HardwareIdentity.pyc
Binary file not shown.
Binary file removed ACEStream/Utilities/Instance2Instance.pyc
Binary file not shown.
Binary file removed ACEStream/Utilities/LSO.pyc
Binary file not shown.
Binary file removed ACEStream/Utilities/LinuxSingleInstanceChecker.pyc
Binary file not shown.
Binary file removed ACEStream/Utilities/TimedTaskQueue.pyc
Binary file not shown.
Binary file removed ACEStream/Utilities/__init__.pyc
Binary file not shown.
Binary file removed ACEStream/Video/Ogg.pyc
Binary file not shown.
Binary file removed ACEStream/Video/VideoServer.pyc
Binary file not shown.
Binary file removed ACEStream/Video/__init__.pyc
Binary file not shown.
Binary file removed ACEStream/Video/defs.pyc
Binary file not shown.
Binary file removed ACEStream/Video/utils.pyc
Binary file not shown.
Binary file removed ACEStream/WebUI/WebUI.pyc
Binary file not shown.
Binary file removed ACEStream/WebUI/__init__.pyc
Binary file not shown.
Binary file removed ACEStream/__init__.pyc
Binary file not shown.
Binary file removed ACEStream/env.pyc
Binary file not shown.
Binary file removed ACEStream/version.pyc
Binary file not shown.

0 comments on commit dda42f9

Please sign in to comment.