summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMattia Rizzolo <mattia@debian.org>2017-01-04 14:37:19 +0100
committerMattia Rizzolo <mattia@debian.org>2017-01-04 14:37:19 +0100
commit9c28d5475f894bbbeec89a8767cc88b9e9ecf063 (patch)
tree0a44d9d8be4aeee07ca9d91a30efec15d0f742f3
parent2d7ce7ef2319d3acdbd4ebe1a3660307bd2ddf5e (diff)
Add patch from Gaetano Guerriero <x.guerriero@tin.it to be compatible with eyed3 0.7.x
Closes: #844568
-rw-r--r--debian/patches/99b_eyed07_compat.patch188
1 files changed, 188 insertions, 0 deletions
diff --git a/debian/patches/99b_eyed07_compat.patch b/debian/patches/99b_eyed07_compat.patch
new file mode 100644
index 0000000..814e585
--- /dev/null
+++ b/debian/patches/99b_eyed07_compat.patch
@@ -0,0 +1,188 @@
+Description: compatibility with eyed3 0.7.x
+Author: Gaetano Guerriero <x.guerriero@tin.it>
+Bug-Debian: https://bugs.debian.org/844568
+
+
+diff --git a/jack_globals.py b/jack_globals.py
+index 35fe371..1fbb8db 100644
+--- a/jack_globals.py
++++ b/jack_globals.py
+@@ -17,11 +17,11 @@
+ ### along with this program; if not, write to the Free Software
+ ### Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+
+-from jack_constants import *
+ from jack_config import cf
+-from jack_init import eyeD3
++from jack_constants import *
++from jack_generic import debug, error, expand, info, warning
++from jack_init import eyed3
+
+-from jack_generic import info, warning, debug, error, expand
+ #import jack_generic
+ #error = jack_generic.error
+
+@@ -43,5 +43,4 @@ def debug(x):
+ revision = 0 # initial revision of freedb data
+ is_submittable = 0 # well-formed freedb-file?
+
+-id3genres = eyeD3.genres
+-
++id3genres = eyed3.id3.ID3_GENRES
+diff --git a/jack_init.py b/jack_init.py
+index b968428..b317738 100644
+--- a/jack_init.py
++++ b/jack_init.py
+@@ -16,11 +16,12 @@
+ ### along with this program; if not, write to the Free Software
+ ### Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+
++import os
+ import string
+ import sys
+-import os
+-from jack_globals import *
++
+ from jack_generic import *
++from jack_globals import *
+
+ try:
+ from fcntl import F_SETFL
+@@ -33,7 +34,7 @@ except:
+ from FCNTL import O_NONBLOCK
+
+ try:
+- from eyeD3 import eyeD3
++ import eyed3.id3
+ except:
+ print "Please install the eyeD3 module available from http://eyed3.nicfit.net/"
+ sys.exit(1)
+@@ -63,4 +64,3 @@ try:
+ import mutagen.flac as flac
+ except ImportError:
+ flac = None
+-
+diff --git a/jack_tag.py b/jack_tag.py
+index 5a4cd38..0734444 100755
+--- a/jack_tag.py
++++ b/jack_tag.py
+@@ -30,7 +30,7 @@ import jack_misc
+ import jack_m3u
+
+ from jack_init import ogg
+-from jack_init import eyeD3
++from jack_init import eyed3
+ from jack_init import flac
+ from jack_globals import *
+
+@@ -41,6 +41,30 @@ genretxt = None
+ a_artist = None
+ a_title = None
+
++
++def _set_id3_tag(mp3file, version, encoding, a_title, t_name, track_num, t_artist,
++ genre, year, comment, play_count):
++ tag = eyed3.id3.Tag()
++ tag.parse(mp3file)
++ tag.album = a_title
++ tag.title = t_name
++ tag.track_num = track_num
++ tag.artist = t_artist
++
++ old_genre = tag.genre
++ if genre != -1:
++ tag.genre = genre
++ elif old_genre == None:
++ tag.genre = 255
++
++ if year != -1:
++ tag.release_date = year
++ if comment:
++ tag.comments.set(comment)
++ tag.play_count = play_count
++
++ tag.save(mp3file, version, encoding=encoding)
++
+ def tag(freedb_rename):
+ global a_artist, a_title
+
+@@ -99,60 +123,21 @@ def tag(freedb_rename):
+ t_comm = ""
+ if jack_helpers.helpers[cf['_encoder']]['target'] == "mp3":
+ if cf['_write_id3v2']:
+- mp3file = file(mp3name, "rw")
+- tag = eyeD3.Tag()
+- tag.link(mp3file)
+- tag.header.setVersion(eyeD3.ID3_V2_4)
+- tag.setTextEncoding(eyeD3.UTF_8_ENCODING)
+- tag.setAlbum(a_title)
+- tag.setTitle(t_name)
+- tag.setTrackNum((i[NUM],len(jack_ripstuff.all_tracks_orig)))
+- tag.setTitle(t_name)
+- tag.setArtist(t_artist)
+- if cf['_id3_genre'] != -1:
+- tag.setGenre("(%d)" % (cf['_id3_genre']))
+- if cf['_id3_year'] != -1:
+- try:
+- tag.setDate(cf['_id3_year'])
+- except eyeD3.tag.TagException, e:
+- print "Error tagging file: %s" % e
+- tag.setPlayCount(int(i[LEN] * 1000.0 / 75 + 0.5))
+- tag.update()
+- mp3file.close()
++ _set_id3_tag(
++ mp3name, eyed3.id3.ID3_V2_4, 'utf-8', a_title,
++ t_name, (i[NUM],len(jack_ripstuff.all_tracks_orig)),
++ t_artist, cf['_id3_genre'], cf['_id3_year'], None,
++ int(i[LEN] * 1000.0 / 75 + 0.5)
++ )
+ if cf['_write_id3v1']:
+- mp3file = file(mp3name, "rw")
+- tag = eyeD3.Tag()
+- tag.link(mp3file)
+-
+- tag.header.setVersion(eyeD3.ID3_V1_1)
+- tag.setTextEncoding(eyeD3.LATIN1_ENCODING)
+- old_genre = tag.getGenre()
+-
+- tag.setAlbum(a_title)
+- if t_comm:
+- tag.addComment(t_comm)
+- tag.setTitle(t_name2)
+- else:
+- tag.setTitle(t_name)
+- tag.setTrackNum((i[NUM],len(jack_ripstuff.all_tracks_orig)))
+- tag.setTitle(t_name)
+- tag.setArtist(t_artist)
+- if cf['_id3_genre'] != -1:
+- tag.setGenre("(%d)" % (cf['_id3_genre']))
+- elif old_genre == None:
+- tag.setGenre("(255)") # unknown
+- if cf['_id3_year'] != -1:
+- try:
+- tag.setDate(cf['_id3_year'])
+- except eyeD3.tag.TagException, e:
+- print "Error tagging file: %s" % e
+- try:
+- tag.update()
+- except UnicodeEncodeError:
+- if not cf['_write_id3v2']:
+- print
+- print "Track %02d contains data not supported by id3v1; please use --write-id3v2" % i[NUM]
+- mp3file.close()
++ # encoding ??
++ _set_id3_tag(
++ mp3name, eyed3.id3.ID3_V1_1, 'latin1',
++ a_title, t_name,
++ (i[NUM],len(jack_ripstuff.all_tracks_orig)),
++ t_artist, cf['_id3_genre'], cf['_id3_year'], t_comm,
++ int(i[LEN] * 1000.0 / 75 + 0.5)
++ )
+ elif jack_helpers.helpers[cf['_encoder']]['target'] == "flac":
+ if flac:
+ f = flac.FLAC(mp3name)
+@@ -244,4 +229,3 @@ def tag(freedb_rename):
+ if jack_m3u.wavm3u:
+ os.environ["JACK_JUST_RIPPED"] = "\n".join(jack_m3u.wavm3u)
+ jack_m3u.write()
+-