Compare commits

...

7 Commits

Author SHA1 Message Date
R. M f87bee7732 Changed version 2023-02-22 12:11:36 -03:00
R. M 3aa36c1323 Minor change 2023-02-22 12:10:54 -03:00
R. M 7c60b2cd31 Added -new on MP4Box fixup 2023-02-22 12:06:20 -03:00
R. M 68ff155a9e Changed pywidevine import 2023-02-22 12:04:24 -03:00
R. M 0d41ef0895 Minor change 2023-02-22 12:02:30 -03:00
R. M 575f652813 Fixed music video copyright tag error 2023-02-22 11:54:09 -03:00
R. M 11db7154a1 Changed URL check error message 2023-02-22 11:51:36 -03:00
2 changed files with 9 additions and 9 deletions
+2 -2
View File
@@ -3,7 +3,7 @@ import argparse
import traceback
from .gamdl import Gamdl
__version__ = '1.2'
__version__ = '1.3'
def main():
@@ -124,7 +124,7 @@ def main():
exit(1)
except:
error_count += 1
print(f'* Failed to check URL {i + 1}.')
print(f'Failed to check URL {i + 1}/{len(args.url)}')
if args.print_exceptions:
traceback.print_exc()
for i, url in enumerate(download_queue):
+7 -7
View File
@@ -9,13 +9,10 @@ import functools
import subprocess
import shutil
import gamdl.storefront_ids
from pywidevine import Cdm
from pywidevine import Device
from pywidevine import Cdm, Device, PSSH, WidevinePsshData
import requests
import m3u8
from yt_dlp import YoutubeDL
from pywidevine.pssh import PSSH
from pywidevine.license_protocol_pb2 import WidevinePsshData
from mutagen.mp4 import MP4, MP4Cover
@@ -279,13 +276,12 @@ class Gamdl:
def get_tags_music_video(self, track_id):
metadata = requests.get(f'https://itunes.apple.com/lookup?id={track_id}&entity=album&limit=200&country={self.country}&lang=en_US').json()['results']
metadata = requests.get(f'https://itunes.apple.com/lookup?id={track_id}&entity=album&country={self.country}&lang=en_US').json()['results']
extra_metadata = requests.get(f'https://music.apple.com/music-video/{metadata[0]["trackId"]}', headers = {'X-Apple-Store-Front': f'{self.storefront} t:music31'}).json()['storePlatformData']['product-dv']['results'][str(metadata[0]['trackId'])]
tags = {
'\xa9ART': [metadata[0]["artistName"]],
'\xa9nam': [metadata[0]["trackCensoredName"]],
'\xa9day': [metadata[0]["releaseDate"]],
'cprt': [extra_metadata['copyright']],
'\xa9gen': [metadata[0]['primaryGenreName']],
'stik': [6],
'atID': [metadata[0]['artistId']],
@@ -294,6 +290,8 @@ class Gamdl:
'sfID': [int(self.storefront.split('-')[0])],
'covr': [MP4Cover(self.get_cover(metadata[0]["artworkUrl30"].replace('30x30bb.jpg', '600x600bb.jpg')), MP4Cover.FORMAT_JPEG)]
}
if 'copyright' in extra_metadata:
tags['cprt'] = [extra_metadata['copyright']]
if metadata[0]['trackExplicitness'] == 'notExplicit':
tags['rtng'] = [0]
elif metadata[0]['trackExplicitness'] == 'explicit':
@@ -346,7 +344,7 @@ class Gamdl:
final_location /= f'{self.get_sanizated_string(tags["©ART"][0], True)}/Unknown Album/'
final_location /= f'{file_name}{file_extension}'
try:
if file_extension == '.m4v' and final_location.exists() and MP4(final_location).tags['cnID'][0] != tags['cnID'][0]:
if file_extension == '.m4v' and final_location.exists() and MP4(final_location)['cnID'][0] != tags['cnID'][0]:
final_location = self.get_final_location_overwrite_prevented_music_video(final_location)
except:
pass
@@ -364,6 +362,7 @@ class Gamdl:
decrypted_location_video,
'-itags',
'artist=placeholder',
'-new',
fixed_location
],
check = True
@@ -379,6 +378,7 @@ class Gamdl:
decrypted_location,
'-itags',
'artist=placeholder',
'-new',
fixed_location
],
check = True