Comments (5)
Hi ibeex,
Thanks for your report!
I have got an idea why it doesn't work, so if you've got the time, please try to change line 230 from
return self._unpad(codecs.decode(b[3:], 'UTF-16'))
to
return codecs.decode(self._unpad(b[3:]), 'UTF-16')
Changing the code as shown above will first remove the zero-termination byte and then decode the string, instead of doing it the other way around.
Since UTF16 always expects get 2 bytes per character as input, but the byte string may be zero-terminated, making giving the bytestring an odd length, so there's a byte "missing", leading to truncated data
.
from tinytag.
Still the same, I am not sure that this mp3 is actually utf-16, mediainfo can read tags but all python libs can't read artist, album tags.
here is new error
/Users/ib/Documents/Python/tst/tinytag/tinytag/__init__.py in _decode_string(self, b)
228 return self._unpad(codecs.decode(b[1:], 'ISO-8859-1'))
229 if b[0:3] == b'\x01\xff\xfe':
--> 230 return codecs.decode(self._unpad(b[3:]), 'UTF-16')
231 return self._unpad(codecs.decode(b, 'ISO-8859-1'))
232
/usr/local/Cellar/python/2.7.6/Frameworks/Python.framework/Versions/2.7/lib/python2.7/encodings/utf_16.pyc in decode(input, errors)
14
15 def decode(input, errors='strict'):
---> 16 return codecs.utf_16_decode(input, errors, True)
17
18 class IncrementalEncoder(codecs.IncrementalEncoder):
UnicodeDecodeError: 'utf16' codec can't decode byte 0x4c in position 0: truncated data
from tinytag.
Ok, could you please upload the MP3 somewhere, so I can try to find out the problem on my own?
from tinytag.
here it is https://dl.dropboxusercontent.com/u/373323/07%20Lemonworld.mp3
from tinytag.
Hey @ibeex, I have fixed the problem and added the first few bytes of the mp3 you send to the test suite. Please try it out again now, and feel free to reopen this issue, or open another one, if you find something :)
from tinytag.
Related Issues (20)
- [BUG] multiple text tags in MP4 does only return the first HOT 2
- this one file... HOT 3
- [BUG] TinyTag cannot properly read metadata of two folders HOT 3
- Feature Request: Adding Song Titles HOT 2
- [BUG] AIFF text should be treated as UTF-8 HOT 2
- [BUG] Incorrect bitrate and duration for VBR mp3s HOT 5
- [BUG] UnicodeDecodeError on valid MP3 file
- Make use of code linting HOT 1
- How to handle filebuffer instead of filenames
- [BUG] Some mp3 files report 1/2 of actual duration HOT 2
- Some MP3‘s genre cannot be read correctly since v1.8.0
- [Question] - detect image encoding / format HOT 1
- tag artist, quando adicionado mais de um artista a string fica mal formatada. HOT 1
- [BUG] struct.error: unpack requires a buffer of 4 bytes HOT 8
- [BUG] Parsing mp3 file w/ valid TDRC tag does not populate year HOT 4
- Replace deprecated aifc module HOT 3
- [BUG] TDRC tag not captured as "year" HOT 2
- [BUG] Can't read `extra` tags from .m4a files HOT 1
- Expose a list of supported file extensions HOT 4
- Fail to read track_total, but it is ok in foobar
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from tinytag.