# Copyright (c) 2004-5 Marek Hnilica. All rights reserved. # Some widely-used functions # Distributed under GPL version 2, or (at your option) later import wx import string def WmaMessage(parent): MessageWma=wx.MessageDialog(parent, "Editing tags in WMA is not supported.\n"\ "Since WMA is proprietary format, this situation is not going to change.\n"\ "The best and recommended solution is to convert the file to open-source format:\n" "either mp3, or Ogg Vorbis; Ogg Vorbis is even considered to be better than wma", 'No write support for WMA',wx.ICON_INFORMATION) MessageWma.ShowModal() MessageWma.Destroy() def PermissionError(parent,fl=[]): msg=wx.MessageDialog(parent,'These files are not writable:\n%s'%string.join(fl,'\n'),'Unable to manipulate with files',wx.ICON_ERROR) msg.ShowModal() msg.Destroy() def GeneralError(parent,label='Error',text='Error during requested operation'): ErrorMessage=wx.MessageDialog(parent,text,label,wx.ICON_ERROR) ErrorMessage.ShowModal() ErrorMessage.Destroy() def EvaluateTagType(file): if string.find(string.lower(file),'.mp3')!=-1: TagType='MP3' elif string.find(string.lower(file),'.ogg')!=-1: TagType='Ogg' elif string.find(string.lower(file),'.wma')!=-1: TagType='Wma' else: print 'Shh... buggy mBox =(' raise SystemExit return TagType def ReturnNumber(string): NewTrackNum='' for i in list(string): if not i.isdigit(): if NewTrackNum: break else: continue NewTrackNum+=i return NewTrackNum