Author: dmeyer
Date: Wed Feb 13 15:10:40 2008
New Revision: 3079
Log:
strutils updates
Modified:
trunk/beacon/src/client.py
trunk/beacon/src/fusefs.py
trunk/beacon/src/item.py
trunk/beacon/src/server/parser.py
trunk/beacon/test/clear_thumbnails.py
trunk/display/src/lcdproc.py
trunk/epg/src/sources/schedulesdirect.py
trunk/feedmanager/src/core.py
trunk/feedmanager/src/manager.py
trunk/metadata/src/core.py
trunk/metadata/src/image/IPTC.py
trunk/metadata/src/image/png.py
trunk/metadata/src/misc/directory.py
Modified: trunk/beacon/src/client.py
==============================================================================
--- trunk/beacon/src/client.py (original)
+++ trunk/beacon/src/client.py Wed Feb 13 15:10:40 2008
@@ -41,7 +41,6 @@
# kaa imports
import kaa
import kaa.rpc
-import kaa.strutils
from kaa.weakref import weakref
# kaa.beacon imports
@@ -131,7 +130,7 @@
if self.status == DISCONNECTED:
return None
if isinstance(url, unicode):
- url = kaa.strutils.unicode_to_str(url)
+ url = kaa.unicode_to_str(url)
if url.find('://') > 0:
kwargs['scheme'] = url[:url.find('://')]
kwargs['name'] = url
Modified: trunk/beacon/src/fusefs.py
==============================================================================
--- trunk/beacon/src/fusefs.py (original)
+++ trunk/beacon/src/fusefs.py Wed Feb 13 15:10:40 2008
@@ -158,7 +158,7 @@
#
# val = self._filename_map[file].get(name)
# if isinstance(val, unicode):
- # val = unicode_to_str(val)
+ # val = kaa.unicode_to_str(val)
# val = str(val)
if size == 0:
Modified: trunk/beacon/src/item.py
==============================================================================
--- trunk/beacon/src/item.py (original)
+++ trunk/beacon/src/item.py Wed Feb 13 15:10:40 2008
@@ -33,7 +33,7 @@
import logging
# kaa imports
-from kaa.strutils import str_to_unicode
+import kaa
# kaa.beacon imports
from thumbnail import Thumbnail
@@ -127,7 +127,7 @@
if t:
return t
# generate some title and save local it for future use
- t = str_to_unicode(get_title(self._beacon_data['name'],
self.isfile()))
+ t = kaa.str_to_unicode(get_title(self._beacon_data['name'],
self.isfile()))
self._beacon_data['title'] = t
return t
Modified: trunk/beacon/src/server/parser.py
==============================================================================
--- trunk/beacon/src/server/parser.py (original)
+++ trunk/beacon/src/server/parser.py Wed Feb 13 15:10:40 2008
@@ -40,7 +40,6 @@
# kaa imports
import kaa
-from kaa.strutils import str_to_unicode
import kaa.metadata
import kaa.imlib2
@@ -270,7 +269,7 @@
# try to set a good title
# FIXME: if a file is renamed later, this tite should also update
title = get_title(item._beacon_data['name'])
- metadata['title'] = str_to_unicode(title)
+ metadata['title'] = kaa.str_to_unicode(title)
#
Modified: trunk/beacon/test/clear_thumbnails.py
==============================================================================
--- trunk/beacon/test/clear_thumbnails.py (original)
+++ trunk/beacon/test/clear_thumbnails.py Wed Feb 13 15:10:40 2008
@@ -1,6 +1,6 @@
import os
import sys
-import kaa.strutils
+import kaa
import kaa.metadata
verbose = False
@@ -32,7 +32,7 @@
os.unlink(thumbnail)
num_deleted += 1
continue
- uri = kaa.strutils.unicode_to_str(uri)
+ uri = kaa.unicode_to_str(uri)
if not uri.startswith('file://'):
if FORCE:
os.unlink(thumbnail)
Modified: trunk/display/src/lcdproc.py
==============================================================================
--- trunk/display/src/lcdproc.py (original)
+++ trunk/display/src/lcdproc.py Wed Feb 13 15:10:40 2008
@@ -38,7 +38,6 @@
# kaa imports
import kaa
-from kaa.strutils import unicode_to_str
# get logging object
log = logging.getLogger('lcd')
@@ -154,7 +153,7 @@
if type in ('string', 'title', 'scroller'):
if isinstance(args[-1], unicode):
- a = unicode_to_str(args[-1])
+ a = kaa.unicode_to_str(args[-1])
args[-1] = '"%s"' % args[-1].replace('"', '\\"').replace('\n', '')
self._send('widget_set %s %s %s' % \
(self.name, id, ' '.join([str(i) for i in args ])))
Modified: trunk/epg/src/sources/schedulesdirect.py
==============================================================================
--- trunk/epg/src/sources/schedulesdirect.py (original)
+++ trunk/epg/src/sources/schedulesdirect.py Wed Feb 13 15:10:40 2008
@@ -40,7 +40,6 @@
# kaa imports
import kaa
-from kaa.strutils import str_to_unicode
from config_schedulesdirect import config
# get logging object
Modified: trunk/feedmanager/src/core.py
==============================================================================
--- trunk/feedmanager/src/core.py (original)
+++ trunk/feedmanager/src/core.py Wed Feb 13 15:10:40 2008
@@ -42,7 +42,6 @@
import kaa
import kaa.net.url
import kaa.beacon
-from kaa.strutils import str_to_unicode, unicode_to_str
# get manager module
import manager
@@ -62,7 +61,7 @@
if self.url.endswith('/'):
ext = os.path.splitext(self['url'])[1]
basename = self['title'].replace('/', '') + ext
- self['basename'] = unicode_to_str(basename)
+ self['basename'] = kaa.unicode_to_str(basename)
return self.get(attr)
def fetch(self, filename):
@@ -129,7 +128,7 @@
for node in d.childNodes:
if not node.nodeName == 'entry':
continue
- fname = unicode_to_str(node.getAttribute('filename')) or None
+ fname = kaa.unicode_to_str(node.getAttribute('filename')) or
None
self._entries.append((node.getAttribute('url'), fname))
@@ -152,7 +151,7 @@
e = doc.createElement('entry')
e.setAttribute('url', url)
if fname:
- e.setAttribute('filename', str_to_unicode(fname))
+ e.setAttribute('filename', kaa.str_to_unicode(fname))
d.appendChild(e)
@@ -162,7 +161,7 @@
Download image and store it to the image dir. Returns image
filename.
"""
- url = unicode_to_str(url)
+ url = kaa.unicode_to_str(url)
fname = md5.md5(url).hexdigest() + os.path.splitext(url)[1]
fname = os.path.join(self.IMAGEDIR, fname)
if os.path.isfile(fname):
@@ -217,7 +216,7 @@
pass
elif not self._download:
# use url as name
- entry['name'] = unicode_to_str(entry.url)
+ entry['name'] = kaa.unicode_to_str(entry.url)
i = kaa.beacon.add_item(parent=beacondir, **entry)
else:
# download
Modified: trunk/feedmanager/src/manager.py
==============================================================================
--- trunk/feedmanager/src/manager.py (original)
+++ trunk/feedmanager/src/manager.py Wed Feb 13 15:10:40 2008
@@ -36,7 +36,6 @@
# kaa imports
import kaa
-from kaa.strutils import unicode_to_str
# fallback RSS parser
import rss
@@ -123,8 +122,8 @@
for d in c.childNodes:
if not d.nodeName == 'directory':
continue
- dirname = unicode_to_str(d.childNodes[0].data.strip())
- url = unicode_to_str(c.getAttribute('url'))
+ dirname = kaa.unicode_to_str(d.childNodes[0].data.strip())
+ url = kaa.unicode_to_str(c.getAttribute('url'))
feed = _get_feed(url, dirname)
feed._readxml(c)
_feeds.append(feed)
Modified: trunk/metadata/src/core.py
==============================================================================
--- trunk/metadata/src/core.py (original)
+++ trunk/metadata/src/core.py Wed Feb 13 15:10:40 2008
@@ -37,7 +37,7 @@
import sys
# kaa imports
-from kaa.strutils import str_to_unicode, unicode_to_str
+import kaa
import fourcc
@@ -145,7 +145,7 @@
def __str__(self):
- return unicode_to_str(unicode(self))
+ return kaa.unicode_to_str(unicode(self))
def __repr__(self):
@@ -181,7 +181,7 @@
if value is None and getattr(self, key, None) is None:
return
if isinstance(value, str):
- value = str_to_unicode(value)
+ value = kaa.str_to_unicode(value)
setattr(self, key, value)
if not key in self._keys:
self._keys.append(key)
@@ -200,10 +200,10 @@
continue
if key == 'image':
if isinstance(value, unicode):
- setattr(self, key, unicode_to_str(value))
+ setattr(self, key, kaa.unicode_to_str(value))
continue
if isinstance(value, str):
- setattr(self, key, str_to_unicode(value))
+ setattr(self, key, kaa.str_to_unicode(value))
if isinstance(value, unicode):
setattr(self, key, value.strip().rstrip().replace(u'\0', u''))
if isinstance(value, list) and value and isinstance(value[0],
Media):
@@ -219,9 +219,9 @@
value = table.get(tag, None)
if value is not None:
if not isinstance(value, (str, unicode)):
- value = str_to_unicode(str(value))
+ value = kaa.str_to_unicode(str(value))
elif isinstance(value, str):
- value = str_to_unicode(value)
+ value = kaa.str_to_unicode(value)
value = value.strip().rstrip().replace(u'\0', u'')
setattr(self, attr, value)
Modified: trunk/metadata/src/image/IPTC.py
==============================================================================
--- trunk/metadata/src/image/IPTC.py (original)
+++ trunk/metadata/src/image/IPTC.py Wed Feb 13 15:10:40 2008
@@ -34,7 +34,9 @@
# python imports
from struct import unpack
-from kaa.strutils import str_to_unicode
+
+# kaa imports
+import kaa
mapping = {
'by-line title': 'title',
@@ -176,7 +178,7 @@
if intro != 0x1c:
return flatten(iptc)
(tag, record, dataset, length) = unpack("!BBBH", data[offset:offset+5])
- val = str_to_unicode(data[offset+5:offset+length+5])
+ val = kaa.str_to_unicode(data[offset+5:offset+length+5])
offset += length + 5
name = c_datasets.get(dataset)
if not name:
Modified: trunk/metadata/src/image/png.py
==============================================================================
--- trunk/metadata/src/image/png.py (original)
+++ trunk/metadata/src/image/png.py Wed Feb 13 15:10:40 2008
@@ -37,7 +37,7 @@
import logging
# kaa imports
-from kaa.strutils import str_to_unicode
+import kaa
# import kaa.metadata.image core
import core
@@ -93,7 +93,7 @@
log.debug('latin-1 Text found.')
(data, crc) = struct.unpack('>%isI' % length,file.read(length+4))
(key, value) = data.split('\0')
- self.meta[key] = str_to_unicode(value)
+ self.meta[key] = kaa.str_to_unicode(value)
elif type == 'zTXt':
log.debug('Compressed Text found.')
@@ -109,13 +109,13 @@
(key,compression,decompressed))
else:
log.debug("%s has unknown Compression %c" % (key,compression))
- self.meta[key] = str_to_unicode(value)
+ self.meta[key] = kaa.str_to_unicode(value)
elif type == 'iTXt':
log.debug('International Text found.')
(data,crc) = struct.unpack('>%isI' % length,file.read(length+4))
(key, value) = data.split('\0')
- self.meta[key] = str_to_unicode(value)
+ self.meta[key] = kaa.str_to_unicode(value)
else:
file.seek(length+4,1)
Modified: trunk/metadata/src/misc/directory.py
==============================================================================
--- trunk/metadata/src/misc/directory.py (original)
+++ trunk/metadata/src/misc/directory.py Wed Feb 13 15:10:40 2008
@@ -37,7 +37,7 @@
import sys
# kaa imports
-from kaa.strutils import unicode_to_str
+import kaa
# kaa.metadata imports
import kaa.metadata.core as core
@@ -79,7 +79,7 @@
bins = BinsParser(binsxml)
for key, value in bins.items():
if key == 'sampleimage':
- image = os.path.join(directory, unicode_to_str(value))
+ image = os.path.join(directory, kaa.unicode_to_str(value))
if os.path.isfile(image):
self._set('image', image)
continue
-------------------------------------------------------------------------
This SF.net email is sponsored by: Microsoft
Defy all challenges. Microsoft(R) Visual Studio 2008.
http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/
_______________________________________________
Freevo-cvslog mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/freevo-cvslog