[prev in list] [next in list] [prev in thread] [next in thread]
List: kde-commits
Subject: kdeextragear-1/amarok/src/scripts/shouter
From: James Bellenger <jbellenger () pristine ! gm>
Date: 2005-04-15 8:02:14
Message-ID: 20050415080214.719A1492 () office ! kde ! org
[Download RAW message or body]
CVS commit by bellenger:
Much improved reencoding.
M +2 -2 Encoder.py 1.4
M +13 -11 FormatHelper.py 1.4
M +7 -3 ShouterRequest.py 1.5
--- kdeextragear-1/amarok/src/scripts/shouter/Encoder.py #1.3:1.4
@@ -94,5 +94,5 @@
debug( 'chunking %d' % self.pos )
- self.fd, self.fname = tempfile.mkstemp(suffix='.chunk', prefix='shouter-', \
dir='/tmp') + self.fd, self.fname = tempfile.mkstemp(suffix='.chunk%d' % \
self.pos, prefix='shouter-', dir='/tmp') try:
helper = self.start_format.lower() + 'Helper().chunk("%s", "%s", %d, \
%d)' @@ -219,5 +219,5 @@
buf = f.read(size)
f.close()
- debug('read_from size=%d pos=%d c_i=%d chunk.tell=%d c.pos=%d len(buf)=%d' % \
(size, pos, c_i, temp, c.pos, len(buf))) + #debug('read_from size=%d pos=%d \
c_i=%d chunk.tell=%d c.pos=%d len(buf)=%d' % (size, pos, c_i, temp, c.pos, len(buf))) \
return buf
--- kdeextragear-1/amarok/src/scripts/shouter/FormatHelper.py #1.3:1.4
@@ -56,18 +56,20 @@
# = pos/bitrate * 344.53125
# FIXME: Use actual bitrate and sample rate, though this doesn't
- # really make a big difference.
- debug( 'ogg chunk pos=%d chunk_size=%d' % (pos, chunk_size))
+ # make a big difference.
br = 160.0
- cut1 = pos/br * 344.53125
- tf = tempfile.NamedTemporaryFile(suffix='.temp', prefix='shouter-', \
dir='/tmp') + cut1, cut2 = (pos/br * 344.53125), (chunk_size/br * 344.53125)
+ chunk_cut1 = tempfile.NamedTemporaryFile(suffix='.temp', prefix='shouter-', \
dir='/tmp') + trash = tempfile.NamedTemporaryFile(suffix='.temp', \
prefix='shouter-', dir='/tmp') +
+ debug( 'pos=%d\tcut1=%d\tcut2=%d' % (pos, cut1, cut2))
+ cmd = 'vcut \'%s\' \'%s\' \'%s\' %d'
if pos:
- cmd = 'vcut "%s" "%s" %s %d' % (mastername, tf.name, chunkname, cut1)
- os.popen(cmd)
+ os.popen(cmd % (mastername, trash.name, chunk_cut1.name, cut1))
+ os.popen(cmd % (chunk_cut1.name, chunkname, trash.name, cut2))
+ chunk_cut1.close()
+ else:
+ os.popen(cmd % (mastername, chunkname, trash.name, cut2))
- cut2 = (chunk_size)/br * 344.53125
- cmd = 'vcut "%s" "%s" %s %d' % (mastername, chunkname, tf.name, cut2)
- os.popen(cmd)
- tf.close()
- debug('Finished cutting ogg at %d and %d' % (cut1, cut2))
+ trash.close()
def decode(self, oggname, wavname):
--- kdeextragear-1/amarok/src/scripts/shouter/ShouterRequest.py #1.4:1.5
@@ -299,7 +299,4 @@
debug('stream byte_counter=%d pos=%d file=%s' % (self.byte_counter, pos, \
file)) buf = 0
- if bitrate==0: bitrate = self._get_bitrate(file)
- size = os.stat(file)[6]
- sleep_factor = 8.0/(bitrate * 1024.0)
#f = open( file, 'r' )
@@ -311,4 +308,11 @@
f = FileProvider(file)
+ if bitrate==0:
+ if f.reencoding: bitrate = self.cfg.stream_br
+ else: bitrate = self._get_bitrate(file)
+
+ size = os.stat(file)[6]
+ sleep_factor = 8.0/(bitrate * 1024.0)
+
# this isn't quite right, but is of relatively little consequence
# as the headers themselves are very small
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic