CC-2612 : Upgrade: Push DB metadata into the file before upgrade
testing saving non ascii characters to file.
This commit is contained in:
parent
6848963904
commit
7e64e1ba22
2 changed files with 14 additions and 7 deletions
|
@ -91,8 +91,13 @@ class AirtimeMetadata:
|
||||||
for key in m.keys() :
|
for key in m.keys() :
|
||||||
if key in self.airtime2mutagen:
|
if key in self.airtime2mutagen:
|
||||||
value = m[key]
|
value = m[key]
|
||||||
if ((value is not None) and (len(str(value)) > 0)):
|
if (value is not None):
|
||||||
airtime_file[self.airtime2mutagen[key]] = str(value)
|
self.logger.debug("Saving %s to file", key)
|
||||||
|
self.logger.debug(value)
|
||||||
|
if isinstance(value, basestring) and (len(value) > 0):
|
||||||
|
airtime_file[self.airtime2mutagen[key]] = unicode(value, "utf-8")
|
||||||
|
elif isinstance(value, int):
|
||||||
|
airtime_file[self.airtime2mutagen[key]] = str(value)
|
||||||
|
|
||||||
|
|
||||||
airtime_file.save()
|
airtime_file.save()
|
||||||
|
@ -144,9 +149,6 @@ class AirtimeMetadata:
|
||||||
|
|
||||||
if isinstance(md['MDATA_KEY_TRACKNUMBER'], basestring):
|
if isinstance(md['MDATA_KEY_TRACKNUMBER'], basestring):
|
||||||
match = re.search('^(\d*/\d*)?', md['MDATA_KEY_TRACKNUMBER'])
|
match = re.search('^(\d*/\d*)?', md['MDATA_KEY_TRACKNUMBER'])
|
||||||
self.logger.debug("parsing track number")
|
|
||||||
self.logger.debug(md['MDATA_KEY_TRACKNUMBER'])
|
|
||||||
self.logger.debug(match.group(0))
|
|
||||||
|
|
||||||
if match.group(0) is not u'':
|
if match.group(0) is not u'':
|
||||||
md['MDATA_KEY_TRACKNUMBER'] = int(md['MDATA_KEY_TRACKNUMBER'].split("/")[0])
|
md['MDATA_KEY_TRACKNUMBER'] = int(md['MDATA_KEY_TRACKNUMBER'].split("/")[0])
|
||||||
|
|
|
@ -91,8 +91,13 @@ class AirtimeMetadata:
|
||||||
for key in m.keys() :
|
for key in m.keys() :
|
||||||
if key in self.airtime2mutagen:
|
if key in self.airtime2mutagen:
|
||||||
value = m[key]
|
value = m[key]
|
||||||
if ((value is not None) and (len(str(value)) > 0)):
|
if (value is not None):
|
||||||
airtime_file[self.airtime2mutagen[key]] = str(value)
|
self.logger.debug("Saving %s to file", key)
|
||||||
|
self.logger.debug(value)
|
||||||
|
if isinstance(value, basestring) and (len(value) > 0):
|
||||||
|
airtime_file[self.airtime2mutagen[key]] = unicode(value, "utf-8")
|
||||||
|
elif isinstance(value, int):
|
||||||
|
airtime_file[self.airtime2mutagen[key]] = str(value)
|
||||||
|
|
||||||
|
|
||||||
airtime_file.save()
|
airtime_file.save()
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue