|
@@ -11,9 +11,6 @@ import sys
|
|
|
|
|
|
import symuid
|
|
|
|
|
|
-# freeform keys start with '----'
|
|
|
-# http://mutagen.readthedocs.io/en/latest/api/mp4.html
|
|
|
-TRACK_UUID_MP4_TAG = '----:symuid:uuid'
|
|
|
PATH_DEFAULT_IGNORE_REGEX = r'\.(itdb|itc2|itl|jpg|midi?|plist|xml|zip)$'
|
|
|
|
|
|
|
|
@@ -21,14 +18,6 @@ def generate_uuid():
|
|
|
return subprocess.check_output(['uuid', '-v', '4', '-F', 'BIN']).strip()
|
|
|
|
|
|
|
|
|
-def assign_uuid_mp4(mp4_file):
|
|
|
- mp4_file[TRACK_UUID_MP4_TAG] = [mutagen.mp4.MP4FreeForm(
|
|
|
- data=generate_uuid(),
|
|
|
- # https://mutagen.readthedocs.io/en/latest/api/mp4.html#mutagen.mp4.AtomDataType.UUID
|
|
|
- dataformat=mutagen.mp4.AtomDataType.UUID,
|
|
|
- )]
|
|
|
-
|
|
|
-
|
|
|
def log_path(track_path, msg, stream=sys.stdout):
|
|
|
stream.write("{!r}: {}\n".format(track_path, msg))
|
|
|
|
|
@@ -45,10 +34,7 @@ def symuid_sync(path, path_ignore_regex, show_ignored=False):
|
|
|
unsupported_cb=lambda p, e: log_path_error(p, 'unsupported type, skipped'),
|
|
|
):
|
|
|
if track._iface.get_uuid() is None:
|
|
|
- if isinstance(track._iface, symuid.tag_interface.MP4):
|
|
|
- assign_uuid_mp4(track._iface._mutagen_file)
|
|
|
- else:
|
|
|
- track._iface.set_uuid(generate_uuid())
|
|
|
+ track._iface.set_uuid(generate_uuid())
|
|
|
track._iface.save()
|
|
|
log_path(track.path, 'assigned uuid {!r}'.format(track._iface.get_uuid()))
|
|
|
|