Fix upload

This commit is contained in:
sigma67 2020-03-27 12:24:54 +01:00
commit 09c10beb8a
No known key found for this signature in database
GPG key ID: 1545A01D4474BAF0
2 changed files with 3 additions and 2 deletions

View file

@ -35,7 +35,7 @@ class TestYTMusic(unittest.TestCase):
def test_upload_song(self):
response = youtube_auth.upload_song('../12 - Turning Point.mp3')
self.assertEqual(response, 'OK')
self.assertEqual(response, 'STATUS_SUCCEEDED')
def test_delete_uploaded_song(self):
results = youtube_auth.get_uploaded_songs()

View file

@ -27,6 +27,7 @@ class YTMusic:
"""
self.auth = auth
file = auth if auth else pkg_resources.resource_filename('ytmusicapi', 'headers.json')
with open(file) as json_file:
self.headers = json.load(json_file)
@ -441,7 +442,7 @@ class YTMusic:
files={'file': file},
headers=headers)
prepped = req.prepare()
filesize = str(int(prepped.headers['content-length']) -500)
filesize = prepped.headers['content-length']
body = "filename=" + ntpath.basename(filepath)
headers['content-type'] = 'application/x-www-form-urlencoded;charset=utf-8'