Skip to content

Commit

Permalink
Squashed commit of the following:
Browse files Browse the repository at this point in the history
commit e01d4e4
Author: Travis Shirk <travis@pobox.com>
Date:   Tue Mar 27 18:39:15 2018 -0600

    py27 "fixes"

commit 77066ab
Author: Travis Shirk <travis@pobox.com>
Date:   Tue Mar 27 18:33:35 2018 -0600

    Release prep.. !wip

commit db3a369
Author: Travis Shirk <travis@pobox.com>
Date:   Tue Mar 27 18:08:07 2018 -0600

    new: dev: New test and prep. Closes #76

commit 1d3eb74
Author: Travis Shirk <travis@pobox.com>
Date:   Tue Mar 27 18:07:18 2018 -0600

    new: Mp3AudioFile.initTag now returns the new tag.

commit 06d9f16
Author: Travis Shirk <travis@pobox.com>
Date:   Tue Mar 27 17:07:53 2018 -0600

    fix: Handle missing `fcntl` on Windows. Fixes #135.

commit a91f2f8
Merge: 92150a0 8cc5690
Author: Travis Shirk <travis@pobox.com>
Date:   Mon Mar 26 22:48:56 2018 -0600

    Merge branch 'master' of github.com:nicfit/eyeD3

    * 'master' of github.com:nicfit/eyeD3:
      Update pytest from 3.4.2 to 3.5.0 (#175)
      Update twine from 1.10.0 to 1.11.0 (#173)
      Update sphinx from 1.7.1 to 1.7.2 (#174)
      Update sphinxcontrib-paverutils from 1.16.0 to 1.17.0 (#172)
      Update pytest-runner from 4.0 to 4.2 (#171)

commit 92150a0
Author: Travis Shirk <travis@pobox.com>
Date:   Mon Mar 26 21:10:25 2018 -0600

    fix: In addition to None, "" will now clear dates.

commit 8cc5690
Author: pyup.io bot <github-bot@pyup.io>
Date:   Fri Mar 23 20:50:38 2018 +0100

    Update pytest from 3.4.2 to 3.5.0 (#175)

commit f9130a8
Author: pyup.io bot <github-bot@pyup.io>
Date:   Fri Mar 23 00:07:53 2018 +0100

    Update twine from 1.10.0 to 1.11.0 (#173)

commit 28c3d1f
Author: pyup.io bot <github-bot@pyup.io>
Date:   Fri Mar 23 00:07:37 2018 +0100

    Update sphinx from 1.7.1 to 1.7.2 (#174)

commit 58ff1b9
Author: pyup.io bot <github-bot@pyup.io>
Date:   Thu Mar 22 18:01:40 2018 +0100

    Update sphinxcontrib-paverutils from 1.16.0 to 1.17.0 (#172)

commit c8a0a4a
Author: pyup.io bot <github-bot@pyup.io>
Date:   Sun Mar 18 17:25:58 2018 +0100

    Update pytest-runner from 4.0 to 4.2 (#171)

commit f877ae4
Merge: da02459 bc16a97
Author: Travis Shirk <travis@pobox.com>
Date:   Sat Mar 10 08:28:39 2018 -0700

    Merge branch 'master' of github.com:nicfit/eyeD3

    * 'master' of github.com:nicfit/eyeD3:
      Update twine from 1.9.1 to 1.10.0 (#168)
      Update pytest from 3.4.1 to 3.4.2 (#167)

commit da02459
Author: Travis Shirk <travis@pobox.com>
Date:   Sat Mar 3 22:44:48 2018 -0700

    Clean pytest_cache
  • Loading branch information
nicfit committed Mar 28, 2018
1 parent 86a7d8d commit ee97d26
Show file tree
Hide file tree
Showing 13 changed files with 121 additions and 23 deletions.
1 change: 1 addition & 0 deletions .gitignore
@@ -1,3 +1,4 @@
test*.id3
src/test/data
src/test/eyeD3-test-data*
.idea/
Expand Down
1 change: 1 addition & 0 deletions AUTHORS.rst
Expand Up @@ -32,3 +32,4 @@ and has been contributed to by (ordered by date of first contribution):
* Grun Seid <grunseid@gmail.com>
* pyup-bot <github-bot@pyup.io>
* Chris Newton <redshodan@gmail.com>
* deoren@users.noreply.github.com
41 changes: 41 additions & 0 deletions HISTORY.rst
Expand Up @@ -3,6 +3,47 @@ Release History

.. :changelog:
v0.8.5 (2018-03-27) : 30$ Bag
-----------------------------

New
~~~
- Mp3AudioFile.initTag now returns the new tag.
- Eyed3.core.EP_MAX_SIZE_HINT.
- Added docs for install devel dependencies and test data.

Changes
~~~~~~~
- Similarly to TextFrame, fallback to latin1 for invalid encodings.
- Removed paver as a dep.
- Removed fabfile and mkenv.
- Clean pytest_cache.
- Nicfit.py cc update.

Fix
~~~
- Handle missing `fcntl` on Windows. Fixes #135.
- In addition to None, "" will now clear dates.
- Update index.rst to reflect the code is in a Git repo, not Mercurial (#164)
<deoren@users.noreply.github.com>

Other
~~~~~
- Update pytest from 3.2.2 to 3.5.0 (#175) <github-bot@pyup.io>
- Update twine from 1.9.1 to 1.11.0 (#173) <github-bot@pyup.io>
- Update sphinx from 1.6.5 to 1.7.2 (#174) <github-bot@pyup.io>
- Update sphinxcontrib-paverutils from 1.16.0 to 1.17.0 (#172) <github-
bot@pyup.io>
- Update pytest-runner from 3.0 to 4.2 (#171) <github-bot@pyup.io>
- Update nicfit.py from 0.7 to 0.8 (#161) <github-bot@pyup.io>
- Update ipdb from 0.10.3 to 0.11 (#159) <github-bot@pyup.io>
- Update factory-boy from 2.9.2 to 2.10.0 (#150) <github-bot@pyup.io>
- Update pyaml from 17.10.0 to 17.12.1 (#138) <github-bot@pyup.io>
- Update python-magic to 0.4.15 (#130) <github-bot@pyup.io>
- Update pip-tools from 1.10.1 to 1.11.0 (#129) <github-bot@pyup.io>
- Update check-manifest from 0.35 to 0.36 (#125) <github-bot@pyup.io>


v0.8.4 (2017-11-17) : The Cold Vein
-------------------------------------

Expand Down
1 change: 1 addition & 0 deletions Makefile
Expand Up @@ -72,6 +72,7 @@ clean-pyc:
clean-test:
rm -fr .tox/
rm -f .coverage
find . -name '.pytest_cache' -type d -exec rm -rf {} +

clean-patch:
find . -name '*.rej' -exec rm -f '{}' \;
Expand Down
6 changes: 3 additions & 3 deletions requirements/dev.txt
@@ -1,4 +1,4 @@
Sphinx==1.7.1
Sphinx==1.7.2
check-manifest==0.36
cogapp==2.5.1
flake8==3.5.0
Expand All @@ -11,7 +11,7 @@ pss==1.41
pyaml==17.12.1
sphinx-issues==0.4.0
sphinx_rtd_theme==0.2.4
sphinxcontrib-paverutils==1.16.0
sphinxcontrib-paverutils==1.17.0
tox==2.9.1
twine==1.10.0
twine==1.11.0
wheel==0.30.0
4 changes: 2 additions & 2 deletions requirements/test.txt
@@ -1,4 +1,4 @@
factory-boy==2.10.0
pytest==3.4.2
pytest==3.5.0
pytest-cov==2.5.1
pytest-runner==4.0
pytest-runner==4.2
2 changes: 1 addition & 1 deletion src/eyed3/__about__.py
Expand Up @@ -16,7 +16,7 @@ def __parse_version(v): # pragma: nocover

__version__ = "0.9a0"
__release_name__ = ""
__years__ = "2002-2017"
__years__ = "2002-2018"

_, __release__, __version_info__ = __parse_version(__version__)
__project_name__ = "eyeD3"
Expand Down
8 changes: 4 additions & 4 deletions src/eyed3/__init__.py
Expand Up @@ -28,11 +28,11 @@ def __init__(self, *args):
self.message = args[0]


from .utils.log import log
from .core import load
from .utils.log import log # noqa: E402
from .core import load # noqa: E402

del sys
del locale

__all__= ["log", "load", "version", "LOCAL_ENCODING", "LOCAL_FS_ENCODING",
"Error"]
__all__ = ["log", "load", "version", "LOCAL_ENCODING", "LOCAL_FS_ENCODING",
"Error"]
20 changes: 10 additions & 10 deletions src/eyed3/core.py
Expand Up @@ -343,19 +343,19 @@ def __lt__(self, rhs):
if not rhs:
return False

for l, r in ((self.year, rhs.year),
(self.month, rhs.month),
(self.day, rhs.day),
(self.hour, rhs.hour),
(self.minute, rhs.minute),
(self.second, rhs.second)):
for left, right in ((self.year, rhs.year),
(self.month, rhs.month),
(self.day, rhs.day),
(self.hour, rhs.hour),
(self.minute, rhs.minute),
(self.second, rhs.second)):

l = l if l is not None else -1
r = r if r is not None else -1
left = left if left is not None else -1
right = right if right is not None else -1

if l < r:
if left < right:
return True
elif l > r:
elif left > right:
return False

return False
Expand Down
4 changes: 2 additions & 2 deletions src/eyed3/id3/tag.py
Expand Up @@ -500,7 +500,7 @@ def _getRecordingDate(self):
return self._getDate(b"TDRC") or self._getV23RecordingDate()

def _setRecordingDate(self, date):
if date is None:
if date in (None, ""):
for fid in (b"TDRC", b"TYER", b"TDAT", b"TIME"):
self._setDate(fid, None)
elif self.version == ID3_V2_4:
Expand Down Expand Up @@ -568,7 +568,7 @@ def _setDate(self, fid, date):
assert(fid in frames.DATE_FIDS or
fid in frames.DEPRECATED_DATE_FIDS)

if date is None:
if date in (None, ""):
try:
del self.frame_set[fid]
except KeyError:
Expand Down
1 change: 1 addition & 0 deletions src/eyed3/mp3/__init__.py
Expand Up @@ -202,6 +202,7 @@ def initTag(self, version=id3.ID3_DEFAULT_VERSION):
self.tag = id3.Tag()
self.tag.version = version
self.tag.file_info = id3.FileInfo(self.path)
return self.tag

@core.AudioFile.tag.setter
def tag(self, t):
Expand Down
2 changes: 1 addition & 1 deletion src/eyed3/utils/console.py
Expand Up @@ -476,7 +476,7 @@ def getTtySize(fd=sys.stdout, check_tty=True):
try:
data = fcntl.ioctl(fd, termios.TIOCGWINSZ, '\0' * 4)
hw = struct.unpack("hh", data)
except (OSError, IOError):
except (OSError, IOError, NameError):
pass
if not hw:
try:
Expand Down
53 changes: 53 additions & 0 deletions src/test/id3/test_tag.py
Expand Up @@ -22,6 +22,7 @@
import eyed3
from eyed3.core import Date
from eyed3.id3 import frames
from eyed3.mp3 import Mp3AudioFile
from eyed3.compat import unicode, BytesType
from eyed3.id3 import Tag, ID3_DEFAULT_VERSION, ID3_V2_3, ID3_V2_4
from ..compat import *
Expand Down Expand Up @@ -1192,3 +1193,55 @@ def testReadOnly():
with pytest.raises(RuntimeError):
t._saveV2Tag(None, None, None)


def testIssue76(audiofile):
"""
https://github.com/nicfit/eyeD3/issues/76
"""
tag = audiofile.initTag(ID3_V2_4)
tag.setTextFrame("TPE1", u"Confederacy of Ruined Lives")
tag.setTextFrame("TPE2", u"Take as needed for pain")
tag.setTextFrame("TSOP", u"In the name of suffering")
tag.setTextFrame("TSO2", u"Dope sick")
tag.save()

audiofile = eyed3.load(audiofile.path)
tag = audiofile.tag
assert (set(tag.frame_set.keys()) ==
set([b"TPE1", b"TPE2", b"TSOP", b"TSO2"]))
assert tag.getTextFrame("TSO2") == u"Dope sick"
assert tag.getTextFrame("TSOP") == u"In the name of suffering"
assert tag.getTextFrame("TPE2") == u"Take as needed for pain"
assert tag.getTextFrame("TPE1") == u"Confederacy of Ruined Lives"

audiofile.tag.lyrics.set(u"some lyrics")
audiofile = eyed3.load(audiofile.path)
tag = audiofile.tag
assert (set(tag.frame_set.keys()) ==
set([b"TPE1", b"TPE2", b"TSOP", b"TSO2"]))
assert tag.getTextFrame("TSO2") == u"Dope sick"
assert tag.getTextFrame("TSOP") == u"In the name of suffering"
assert tag.getTextFrame("TPE2") == u"Take as needed for pain"
assert tag.getTextFrame("TPE1") == u"Confederacy of Ruined Lives"

# Convert to v2.3 and verify conversions
tag.save(version=ID3_V2_3)
audiofile = eyed3.load(audiofile.path)
tag = audiofile.tag
assert (set(tag.frame_set.keys()) ==
set([b"TPE1", b"TPE2", b"XSOP", b"TSO2"]))
assert tag.getTextFrame("TSO2") == u"Dope sick"
assert tag.getTextFrame("TPE2") == u"Take as needed for pain"
assert tag.getTextFrame("TPE1") == u"Confederacy of Ruined Lives"
assert tag.frame_set[b"XSOP"][0].text == "In the name of suffering"

# Convert to v2.4 and verify conversions
tag.save(version=ID3_V2_4)
audiofile = eyed3.load(audiofile.path)
tag = audiofile.tag
assert (set(tag.frame_set.keys()) ==
set([b"TPE1", b"TPE2", b"TSOP", b"TSO2"]))
assert tag.getTextFrame("TSO2") == u"Dope sick"
assert tag.getTextFrame("TPE2") == u"Take as needed for pain"
assert tag.getTextFrame("TPE1") == u"Confederacy of Ruined Lives"
assert tag.getTextFrame("TSOP") == u"In the name of suffering"

0 comments on commit ee97d26

Please sign in to comment.