Skip to content

Commit

Permalink
Filename counter fix
Browse files Browse the repository at this point in the history
  • Loading branch information
gsteph committed Jun 18, 2014
1 parent b712ee9 commit c37bcec
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions python/gui.py
Original file line number Diff line number Diff line change
Expand Up @@ -247,10 +247,11 @@ def _ContextSelection(self, event, flag=None):
filename = filename.replace('title', strip(song[name], "<>:\"/\|?*"))
filename = filename.replace('album', strip(song["AlbumName"], "<>:\"/\|?*"))
c = 2
while os.path.exists(os.path.join(dest, filename+'.mp3')):
filename = filename + ' (%d)' % c
fn = filename
while os.path.exists(os.path.join(dest, fn+'.mp3')) or fn+'.mp3' in [i['filename'] for i in self.downloads]:
fn = filename + ' (%d)' % c
c += 1
filename += '.mp3'
filename = fn + '.mp3'
t = t_download(self, song)
t.download = {"progress":"Initializing", "thread":t, "filename":filename, "album":song["AlbumName"]}
self.downloads.append(t.download)
Expand Down

0 comments on commit c37bcec

Please sign in to comment.