From kde-commits Mon May 02 07:49:01 2005 From: James Bellenger Date: Mon, 02 May 2005 07:49:01 +0000 To: kde-commits Subject: kdeextragear-1/amarok/src/scripts/shouter Message-Id: <20050502074901.2BF704A6 () office ! kde ! org> X-MARC-Message: https://marc.info/?l=kde-commits&m=111502015214343 CVS commit by bellenger: * Fixed crashing on switching to a newly appended track * Fixed stream throttling to reflect actual payload. Let UA's sort out their own buffering. After 4+ hours of problem-free streaming I consider this safe for general use. Please report *ANY* problems and we can work on getting them fixed. M +14 -6 Playlist.py 1.5 M +1 -1 Services.py 1.6 M +0 -1 StreamController.py 1.8 --- kdeextragear-1/amarok/src/scripts/shouter/Playlist.py #1.4:1.5 @@ -17,4 +17,5 @@ from xml.dom import minidom from Globals import * +from shutil import copy import ShouterExceptions from sre import * @@ -65,4 +66,5 @@ self.random = PlayerDcop('randomModeStatus').result() == 'true' self.repeat_pl = PlayerDcop('repeatPlaylistStatus').result() == 'true' + self.save_current_playlist() self.load() @@ -79,5 +81,12 @@ if i == -1: raise ShouterExceptions.amarok_not_playing_error - f = self.pl[i] + f = None + try: + f = self.pl[i] + except IndexError: + debug('Caught index error loading i=%d len(pl)=%d. Reloading' % (i, len(self.pl))) + self.reload() + f = self.pl[i] + total = f.length current = PlayerDcop( 'trackCurrentTime' ).result() @@ -319,8 +328,7 @@ fname_new.replace('current', str(fname))) - # I thought there was a better way of copying files somewhere ... - debug('cp %s %s' % (fname_current, fname_new)) - rv = os.system('cp %s %s' % (fname_current, fname_new)) - if rv: + try: + copy(fname_current, fname_new) + return fname_new + except: return False - return fname_new --- kdeextragear-1/amarok/src/scripts/shouter/Services.py #1.5:1.6 @@ -99,5 +99,5 @@ if not br: br = Amarok.get_bitrate(fobj.url) - sleep_factor = 8.0/(br * 1060.0) + sleep_factor = 8.0/(br * 1024.0) fname = fobj.get_fname() --- kdeextragear-1/amarok/src/scripts/shouter/StreamController.py #1.7:1.8 @@ -48,5 +48,4 @@ pls += 'Version=2\n' self.request.send(pls) - raise unmapped_mount_error else: service = None