fixed some linter errors
This commit is contained in:
@@ -1,7 +1,8 @@
|
||||
#!/usr/bin/python3
|
||||
import os
|
||||
import json
|
||||
import re
|
||||
import requests
|
||||
import time
|
||||
from os.path import isfile
|
||||
from copy import deepcopy
|
||||
from deezspot.libutils.audio_converter import convert_audio, parse_format_string
|
||||
|
||||
@@ -621,6 +621,9 @@ class DeeLogin:
|
||||
not_interface=stock_not_interface,
|
||||
custom_dir_format=None,
|
||||
custom_track_format=None,
|
||||
initial_retry_delay=30,
|
||||
retry_delay_increase=30,
|
||||
max_retries=5,
|
||||
pad_tracks=True,
|
||||
convert_to=None,
|
||||
save_cover=stock_save_cover
|
||||
@@ -675,7 +678,6 @@ class DeeLogin:
|
||||
initial_retry_delay=30,
|
||||
retry_delay_increase=30,
|
||||
max_retries=5,
|
||||
convert_to=None,
|
||||
save_cover=stock_save_cover
|
||||
) -> Episode:
|
||||
|
||||
@@ -711,7 +713,7 @@ class DeeLogin:
|
||||
preferences.recursive_quality = recursive_quality
|
||||
preferences.recursive_download = recursive_download
|
||||
preferences.not_interface = not_interface
|
||||
# No convert_to for episode download
|
||||
# No convert_to for episode download (and preferences.convert_to is not set here)
|
||||
preferences.save_cover = save_cover
|
||||
|
||||
episode = DW_EPISODE(preferences).dw()
|
||||
@@ -732,6 +734,7 @@ class DeeLogin:
|
||||
initial_retry_delay=30,
|
||||
retry_delay_increase=30,
|
||||
max_retries=5,
|
||||
convert_to=None,
|
||||
save_cover=stock_save_cover
|
||||
) -> Smart:
|
||||
|
||||
@@ -775,6 +778,7 @@ class DeeLogin:
|
||||
initial_retry_delay=initial_retry_delay,
|
||||
retry_delay_increase=retry_delay_increase,
|
||||
max_retries=max_retries,
|
||||
convert_to=convert_to,
|
||||
save_cover=save_cover
|
||||
)
|
||||
smart.type = "track"
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
import os
|
||||
from mutagen.flac import FLAC
|
||||
from mutagen.mp3 import MP3
|
||||
from mutagen.id3 import ID3
|
||||
from mutagen.id3 import ID3, TIT2, TPE1, TALB, TDRC, TCON, TRCK, TPOS, TSRC, TPE2, TCOM, USLT, TPUB, COMM, TCOP, TENC, TLAN, TYER, TXXX
|
||||
from mutagen.mp4 import MP4
|
||||
from mutagen import File
|
||||
from deezspot.libutils.logging_utils import logger
|
||||
@@ -83,6 +84,34 @@ def write_tags(track):
|
||||
id3.add(TCOM(encoding=3, text=value))
|
||||
elif key == 'lyrics':
|
||||
id3.add(USLT(encoding=3, lang='eng', desc='', text=value))
|
||||
elif key == 'publisher':
|
||||
id3.add(TPUB(encoding=3, text=value))
|
||||
elif key == 'comment':
|
||||
id3.add(COMM(encoding=3, lang='eng', desc='', text=value))
|
||||
elif key == 'copyright':
|
||||
id3.add(TCOP(encoding=3, text=value))
|
||||
elif key == 'encodedby':
|
||||
id3.add(TENC(encoding=3, text=value))
|
||||
elif key == 'language':
|
||||
id3.add(TLAN(encoding=3, text=value))
|
||||
elif key == 'year' and not metadata.get('date'):
|
||||
id3.add(TYER(encoding=3, text=value))
|
||||
elif key == 'mood':
|
||||
id3.add(TXXX(encoding=3, desc='MOOD', text=value))
|
||||
elif key == 'explicit':
|
||||
id3.add(TXXX(encoding=3, desc='EXPLICIT', text=value))
|
||||
elif key == 'rating':
|
||||
id3.add(TXXX(encoding=3, desc='RATING', text=value))
|
||||
elif key == 'website':
|
||||
id3.add(TXXX(encoding=3, desc='WEBSITE', text=value))
|
||||
elif key == 'replaygain_track_gain':
|
||||
id3.add(TXXX(encoding=3, desc='REPLAYGAIN_TRACK_GAIN', text=value))
|
||||
elif key == 'replaygain_track_peak':
|
||||
id3.add(TXXX(encoding=3, desc='REPLAYGAIN_TRACK_PEAK', text=value))
|
||||
elif key == 'replaygain_album_gain':
|
||||
id3.add(TXXX(encoding=3, desc='REPLAYGAIN_ALBUM_GAIN', text=value))
|
||||
elif key == 'replaygain_album_peak':
|
||||
id3.add(TXXX(encoding=3, desc='REPLAYGAIN_ALBUM_PEAK', text=value))
|
||||
|
||||
audio.tags = id3
|
||||
|
||||
@@ -101,9 +130,15 @@ def write_tags(track):
|
||||
elif key == 'genre':
|
||||
audio['\xa9gen'] = value
|
||||
elif key == 'tracknumber':
|
||||
audio['trkn'] = [(int(value.split('/')[0]), int(value.split('/')[1]))]
|
||||
parts = str(value).split('/')
|
||||
track_num = int(parts[0])
|
||||
total_tracks = int(parts[1]) if len(parts) > 1 else 0
|
||||
audio['trkn'] = [(track_num, total_tracks)]
|
||||
elif key == 'discnumber':
|
||||
audio['disk'] = [(int(value.split('/')[0]), int(value.split('/')[1]))]
|
||||
parts = str(value).split('/')
|
||||
disc_num = int(parts[0])
|
||||
total_discs = int(parts[1]) if len(parts) > 1 else 0
|
||||
audio['disk'] = [(disc_num, total_discs)]
|
||||
elif key == 'isrc':
|
||||
audio['isrc'] = value
|
||||
elif key == 'albumartist':
|
||||
@@ -112,6 +147,20 @@ def write_tags(track):
|
||||
audio['\xa9wrt'] = value
|
||||
elif key == 'lyrics':
|
||||
audio['\xa9lyr'] = value
|
||||
elif key == 'publisher':
|
||||
audio['\xa9pub'] = value
|
||||
elif key == 'comment':
|
||||
audio['\xa9cmt'] = value
|
||||
elif key == 'copyright':
|
||||
audio['\xa9cpy'] = value
|
||||
elif key == 'encodedby':
|
||||
audio['\xa9too'] = value
|
||||
elif key == 'explicit':
|
||||
if value == '1': # True for explicit
|
||||
audio['rtng'] = [4] # Explicit for iTunes
|
||||
elif value == '0': # False for explicit
|
||||
audio['rtng'] = [0] # None
|
||||
# else: do not set rtng if value is not '0' or '1'
|
||||
|
||||
# Save the changes
|
||||
audio.save()
|
||||
|
||||
Reference in New Issue
Block a user