drgould / gmusic-ratings-sync

Sync iTunes song ratings to Google Music
10 stars 2 forks source link

Error after intersecting #2

Open rgonzruiz opened 11 years ago

rgonzruiz commented 11 years ago

I get the following error (and ratings don't get updated on Google Music):

    3992  songs retrieved...

Google Music song retrieval complete Computing the intersection of the song lists... Total Google Music songs: 3992 Total iTunes songs: 4028 Intersecting... Songs ready for ratings sync: 2258 Song list intersection computed Syncing song ratings... Traceback (most recent call last): File "sync.py", line 20, in sync.start() File "D:\Python27\ratingssync.py", line 94, in start self.__sync_song_ratings(api, song_list) File "D:\Python27\ratingssync.py", line 272, in __sync_song_ratings api.change_song_metadata(songs) File "", line 2, in change_song_metadata File "D:\Python27\lib\site-packages\gmusicapi\utils\utils.py", line 505, in wr apper return function(_args, _kw) File "", line 2, in change_song_metadata File "D:\Python27\lib\site-packages\gmusicapi\utils\utils.py", line 482, in wr apper return function(_args, _kw) File "D:\Python27\lib\site-packages\gmusicapi\clients\webclient.py", line 100, in change_song_metadata res = self._make_call(webclient.ChangeSongMetadata, songs) File "D:\Python27\lib\site-packages\gmusicapi\clients\shared.py", line 67, in _make_call return protocol.perform(self.session, self.validate, _args, _kwargs) File "D:\Python27\lib\site-packages\gmusicapi\protocol\shared.py", line 208, i n perform response = session.send(req_kwargs, cls.required_auth) File "D:\Python27\lib\site-packages\gmusicapi\session.py", line 68, in send return self._send_with_auth(req_kwargs, desired_auth, rsession) File "D:\Python27\lib\site-packages\gmusicapi\session.py", line 122, in send with_auth return rsession.request(_req_kwargs) File "D:\Python27\lib\site-packages\requests\sessions.py", line 354, in reques t resp = self.send(prep, *_send_kwargs) File "D:\Python27\lib\site-packages\requests\sessions.py", line 460, in send r = adapter.send(request, **kwargs) File "D:\Python27\lib\site-packages\requests\adapters.py", line 246, in send raise ConnectionError(e) requests.exceptions.ConnectionError: HTTPSConnectionPool(host='play.google.com', port=443): Max retries exceeded with url: /music/services/modifyentries?u=0&xt= CjUKATASMEFNLVdiWGpWV2liS1Izc2NQNDRLaTcydkZkb1gtMEJLZnc6MTM3ODk2NTE3MzUwNQ%3D%3D (Caused by <class 'socket.error'>: [Errno 10054] An existing connection was for cibly closed by the remote host)

Any idea on how to fix this? Thanks!

jmbeach commented 10 years ago

I also get this error, but only when I choose to not only sync unrated music. i.e. if I type "n" at the third prompt it fails, but if I type "y" it succeeds. A quick fix is to highlight all of your google music songs (if your library is 1:1 with iTunes) and remove the ratings for every song. Then rerun the scan. However, I'm sure the developer can look into the problem. For me, the trace-back says,

File "sync.py", line 20, in <module>
    sync.start()
  File "/home/Jared Beach/gmusic-ratings-sync-master/ratingssync.py", line 90, in start
    only_no_rating=self.only_no_rating)
  File "/home/Jared Beach/gmusic-ratings-sync-master/ratingssync.py", line 248, in __get_intersection
    matches = [it_song for it_song in matches if it_song['year'] == gm_song['year']]
KeyError: 'year'

After opening up the file ratingssync.py and changing line 248 from

matches = [it_song for it_song in matches if it_song['year'] == gm_song['year']]

to

matches = [it_song for it_song in matches if it_song['year'] is not None and it_song['year'] == gm_song['year']]

the program seems to work fine. I suggest that a null check is added from the get go of the program.