def initSession(self, force=False, customCountry=0):
     printDBG('GroovesharkApi.initSession force[%r]' % force)
     headerParams = dict(self.headerParams)
     headerParams['load_cookie'] = False
     headerParams['header'] = GroovesharkApi.HTTP_HEADER
     sts, data = self.cm.getPage(GroovesharkApi.MAINURL, headerParams)
     if sts:
         content = self.cm.ph.getDataBeetwenMarkers(data, '<div id="content">', '</div>', False)[1]
         data    = self.cm.ph.getDataBeetwenMarkers(data, "var GS = {", "</script>", False)[1]
         config  = self.cm.ph.getSearchGroups(data, "GS.config[^=]*?=[ ]*?([^;]+?);")[0].strip()
         locales = self.cm.ph.getSearchGroups(data, "GS.locales[^=]*?=[ ]*?(\{.+?\});")[0].strip()
         try:
             try:    locales = json.loads(locales)
             except: locales = {"HOME":"Home","POPULAR":"Popular","STATIONS":"Stations","QUEUE":"Queue","SIGN_IN":"Sign in","SIGN_UP":"Sign up","SIGN_IN_SHORT":"Sign in","SIGN_OUT":"Sign out","DOWNLOAD_APP":"Download our app!","ABOUT":"About Grooveshark","PRIVACY":"Privacy Policy","COPYRIGHT":"Copyright","AUDIO_AD_MSG":"Your music will begin soon","GO_ADFREE":"Go Ad-Free","CLOSE_AD":"Close Ad","SKIP_AD":"Skip Ad","ADFREE_COPY":"Enjoy unlimited ad-free streaming with a premium Grooveshark subscription. Visit http://grooveshark.com/upgrade on your computer's web browser to upgrade.","EXPIRED_SITE_MSG":"There was an issue loading the site. Please try refreshing.","STATION_FAILED_MSG":"Something went wrong, please try another station.","QUEUE_DEGRADED_MSG":"Adding {number} songs to your queue may degrade performance over time.","STATION_CLEAR_MSG":"You have music in your queue. Would you like to clear those songs and start {station}?","STATION_LOADING_MSG":"Loading {station} Radio","IOS_PIN_TITLE":"Grooveshark on your homescreen","IOS_PIN_MSG":"Want quick and easy access to the Grooveshark HTML5 webapp? Touch below to pin it to your homescreen. Tap anywhere to close this notification.","GET_APP":"Looking for the Native {platform} App?","GET_IT_HERE":"Get it here","NUM_IN_QUEUE_SINGLE":"{number} song in Queue","NUM_IN_QUEUE_MULTI":"{number} songs in Queue","ADD_TO_QUEUE_SINGLE":"{number} song added to Queue","ADD_TO_QUEUE_MULTI":"{number} songs added to Queue","PLAY_NOW":"Play Now","BACK":"Back","DONE":"Done","ALL":"All","LOADING":"Loading...","RELEASE_TO_LOAD":"Release to load more","SHOW_MORE_SONGS":"Show more songs","SHOW_MORE_ALBUMS":"Show more albums","SHOW_MORE_PLAYLISTS":"Show more playlists","SEE_ALL_STATIONS":"See all stations","NUM_MORE":"{number} more","PLAY_NUM":"Play ({number})","SORT":"Sort","PROFILE":"Profile","NEW_USER":"******","COLLECTION":"Collection","COLLECTION_EMPTY_OTHER":"hasn't collected any songs.","COLLECTION_EMPTY_SELF":"You haven't collected any songs.","FAVORITES":"Favorites","FAVORITES_EMPTY_OTHER":"hasn't favorited any songs.","FAVORITES_EMPTY_SELF":"You haven't favorited any songs.","PLAYLISTS":"Playlists","PLAYLISTS_EMPTY_OTHER":"hasn’t created any playlists yet","PLAYLISTS_EMPTY_SELF":"Playlists are awesome","PLAYLISTS_EMPTY_DESC_SELF":"You should make one, and share it with your friends. Open Grooveshark.com on your computer to create a playlist.","EMPTY_PLAYLIST_SELF":"Add songs to your playlist","EMPTY_PLAYLIST_DESC_SELF":"A full playlist is much more fun. Open Grooveshark.com on your computer to add songs to a playlist.","EMPTY_PLAYLIST_OTHER":"Looks like this playlist is still being worked on","EMPTY_PLAYLIST_DESC_OTHER":"There are no songs in this playlist.","UNFOLLOW":"Unfollow","FOLLOW":"Follow","FOLLOWING":"Following","FOLLOWING_EMPTY_OTHER":"isn't following anybody.","FOLLOWING_EMPTY_SELF":"You aren't following anybody.","RECENT_LISTENS":"Recent Listens","SEARCH_FOR_MUSIC":"Search for music","SONGS":"Songs","ALBUMS":"Albums","NO_SONGS_FOUND":"No songs found","NO_ALBUMS_FOUND":"No albums found","NO_PLAYLISTS_FOUND":"No playlists found","LOGIN_HEADER":"Sign in to Grooveshark","LOGIN_ERROR":"Oh no! Wrong username/password combination.","LOGIN_FORGOT":"Forgot your password?","LOGIN_SUBMIT":"Sign in!","RESET_PW_TITLE":"Reset Your Password","RESET_PW_SPINNER":"Requesting password reset...","RESET_PW_INVALID":"Passwords must match and be between 5 and 32 characters long.","RESET_PW_ERROR":"Either your password reset code is not valid, or it does not match the user provided.","RESET_PW_SUBMIT":"Submit","NEW_PASSWORD":"******","CONFIRM_PASSWORD":"******","USERNAME_OR_EMAIL":"Username or Email","PASSWORD":"******","FORGOT_PW_MSG":"Don't worry, we'll send an email with instructions to access your account.","FORGOT_PW_LOGIN":"******","FORGOT_PW_SUCCESS":"An email has been sent to your email address with login instructions.","FORGOT_PW_SUBMIT":"Reset password","EMAIL":"Email","DISPLAY_NAME":"User Name","VOTE_UP":"I Like This Song","VOTE_DOWN":"Skip It","CONFIRM_CLEAR_QUEUE":"Are you sure you want to empty your Current Songs?","CONFIRM_LEAVE_BROADCAST":"This will remove you from your current Broadcast. Do you want to continue?","NOW_PLAYING":"Now Playing","LOADING_SONG":"Loading song...","LOADING_ALBUM":"Loading album...","LOADING_ALBUMS":"Loading albums...","LOADING_PLAYLIST":"Loading playlist...","LOADING_PLAYLISTS":"Loading playlists...","SEARCHING_FOR":"Searching for {query}","LOGGING_IN":"Logging in...","FORGOT_PW_TITLE":"Forgot Password?","SIGNUP_TITLE":"Create Account","FORGOT_PW_SPINNER":"Requesting password reset...","LOADING_FOLLOWING":"Loading following list...","SORT_POPULARITY":"Popularity","SORT_SONG":"Song Title","SORT_ALBUM":"Album Name","SORT_ARTIST":"Artist Name","SORT_TRACK":"Track Number","SORT_DEFAULT":"Default Order","SORT_DATE":"Date Added","ALL_GENRES":"All Genres","SHARE":"Share","NOW_BROADCASTING":"Now Broadcasting:","NAVIGATION":"Navigation","MULTI_GENRE":"Multi-Genre","BROADCAST_JOIN":"Join Broadcast","TOP_BROADCASTS":"Top Broadcasts","NO_BROADCASTS_TITLE":"No active Broadcasts for this genre!","NO_BROADCASTS_DESC":"Try picking another genre.","BROADCAST_NOW_PLAYING":"Now Playing","BROADCAST_NOW_PLAYING_LIVE":"Live Broadcast by {user}","BROADCAST_NOW_PLAYING_NONE_TITLE":"No song is currently playing.","BROADCAST_NOW_PLAYING_NONE_DESC":"View other broadcasts.","BROADCAST_HISTORY":"History","BROADCAST_NO_HISTORY_TITLE":"No songs have played.","BROADCAST_NO_HISTORY_DESC":"Check back after a song has played","BROADCAST_LEAVE":"Leave","BROADCAST_PLAY":"Play","BROADCAST_PLAYS":"Plays","BROADCAST_LISTENER":"Listener","BROADCAST_LISTENERS":"Listeners","BROADCAST_RECONNECT":"It appears your connection status has changed. Would you like to attempt a reconnect?","BROADCAST_BYLINE":"by","SEE_MORE_BROADCASTS":"See more broadcasts","BROADCASTS":"Broadcasts","BROADCAST":"Broadcast","ST_INDIE":"Indie","ST_ELECTRONICA":"Electronica","ST_CLASSICAL":"Classical","ST_POP":"Pop","ST_RAP":"Rap","ST_COUNTRY":"Country","ST_ALTERNATIVE":"Alternative","ST_HIP_HOP":"Hip Hop","ST_CLASSIC_ROCK":"Classic Rock","ST_AMBIENT":"Ambient","ST_PUNK":"Punk","ST_90S_ALT_ROCK":"90's Alt Rock","ST_BLUES":"Blues","ST_ROCK":"Rock","ST_JAZZ":"Jazz","ST_RNB":"R&B","ST_FOLK":"Folk","ST_DUBSTEP":"Dubstep","ST_80S":"80's","ST_TRANCE":"Trance","ST_BLUEGRASS":"Bluegrass","ST_REGGAE":"Reggae","ST_METAL":"Metal","ST_OLDIES":"Oldies","ST_EXPERIMENTAL":"Experimental","ST_LATIN":"Latin","CONFIRM_PW":"Retype Password","SIGNUP_SUBMIT":"Sign up!","LOGIN_FROM_SIGNUP":"Already registered? Sign in.","NO_ACCOUNT":"No account yet?","SIGNUP_FROM_LOGIN":"******","TOS_AGREE":"By signing up you agree to the {link}","TOS":"Terms of Service","DESCRIPTION":"Description","AMOUNT":"Amount:","CONFIRM":"Confirm","CONTINUE":"Continue","REMOVE":"Remove","CANCEL":"Cancel","TAX":"Tax","TOTAL":"Total","SUPPORT":"Support","CREDIT_CARD":"Credit Card","PAYPAL":"PayPal","REDEEM_CODE":"Redeem Code","CARD_NUMBER":"Card Number","SECURITY_CODE":"Security Code","EXPIRATION_DATE":"Expiration Date","ENTER_REDEEM_CODE":"Enter your Grooveshark code into the box below to redeem:","BILLING_INFORMATION":"Billing Information","SUBSCRIPTION_RECURRING_COPY":"Subscription Recurring","GROOVESHARK_ANYWHERE":"Grooveshark VIP","GROOVESHARK_ANYWHERE_RECURRING":"Grooveshark VIP (Recurring)","GROOVESHARK_PAYMENTS":"Grooveshark Payments","GO_TO_ELLIPSIS":"Go to...","UPGRADE_NOW":"Upgrade Now","PAYMENTS_MUST_SIGN_IN":"Please login or sign up to upgrade to a premium Grooveshark account.","PAYMENTS_RECURRING_PARAGRAPH_1":"Your Grooveshark VIP Subscription is already recurring.","PAYMENTS_RECURRING_PARAGRAPH_2":"If you want to remove this subscription click below.","PAYMENTS_COMPLETE_PARAGRAPH_1":"You've just joined one of the most passionate groups of music lovers on the web, and helped us make Grooveshark an even better place for all of our sharks around the globe.","PAYMENTS_COMPLETE_PARAGRAPH_2":"You're a part of one of the most passionate groups of music lovers on the web, and you've helped us make Grooveshark an even better place for all of our sharks around the globe.","PAYMENTS_COMPLETE_PARAGRAPH_3":"Welcome -- and enjoy.","PAYMENTS_ERROR_REMOVE_RECURRING":"There was an error removing the recurring subscription.","LB_SIGNUP_LOGIN_DONT_HAVE_ACCOUNT":"No account? <a class=\"open-signup\">Sign up!</a>","VIP_ERROR_CARD_NUMBER":"Please ensure your credit card number is correct and try again.","VIP_ERROR_CVD":"Please ensure your security code is correct and try again.","VIP_ERROR_DATE":"Please ensure your expiration date is correct and try again.","ERROR_REDEEM_CODE_INVALID":"The code you entered was not found in our system. Please try again or contact support.","ERROR_REDEEM_CODE_TOO_MUCH":"The code you entered has been used too many times.","ERROR_REDEEM_FAILED":"We ran into a problem while redeeming that code. Please try again.","ERROR_REDEEM_CANCEL_REQUIRED":"In order to redeem your code, you must stop your recurring payments.","ERROR_EXTEND_CANCEL_REQUIRED":"In order to extend your subscription, you must stop your recurring payments.","ERROR_REDEEM_CODE_VERIFY_FAILED":"We ran into a problem while verifying that code. Please try again.","VIP_ERROR_INVALID":"Looks like there was a problem charging your credit card. Please check with your bank or contact support.","PAYPAL_INIT_ERROR_UNKNOWN":"Something went wrong while generating a PayPal transaction. Please try again.","HEADER_THANK_YOU":"Thank You!","IS_RECURRING":"Recurring?","FREE_MONTHS_ALT_SINGLE_LINE":"12 months for the price of 10!","SELL_MONTH_SUB_ALT":"Great low monthly price!","PRICE_PER_MONTH":"${price} / month (USD)","PRICE_PER_YEAR":"${price} / year (USD)","MONTHS":"January,February,March,April,May,June,July,August,September,October,November,December","DAY":"Day","MONTH":"Month","YEAR":"Year","YEAR_PLURAL":"Years","MONTH_PLURAL":"Months","OLDER_13":"You need to be at least 13 years old to sign up","REQUIRED_FIELD":"{fieldName} is a required field","PW_DONT_MATCH":"Passwords do not match","PW_LENGTH_ERR":"Please enter a password between 5 and 32 characters long","EMAIL_TAKEN":"Email already taken","USERNAME_TAKEN":"Username already taken","PREMIUM_REQUIRED":"You must have a Grooveshark VIP account to use this version of Grooveshark.","NO_MP3_SUPPORT":"It looks like your current browser doesn't support HTML5 audio and/or mp3 playback. If you have flash, you can use the full version of Grooveshark, or you can upgrade to a browser that supports HTML5 audio and MP3 playback.","UPGRADE":"Upgrade","CLOSE":"Close","PAYMENTS_BILLING":"Billing","SUBSCRIPTION":"Subscription","SUBSCRIBE":"Subscribe","ON_SALE":"On sale! Normally ${price}/month","SUPPORT_THANKS":"Thank you for your support","EXTEND_SUBSCRIPTION":"Extend Subscription","CANCEL_RECURRING":"Cancel Recurring","UPDATE_RECURRING":"Update Credit Card","CONTACT_BILLING":"Contact Billing Support","GET_GROOVESHARK_ANYWHERE":"Get Grooveshark VIP","ANYWHERE_PERK_1":"Unlimited ad-free streaming","ANYWHERE_PERK_2":"Android app &amp; jailbroken iOS app with <strong>continuous streaming</strong> and <strong>offline playback</strong>","ANYWHERE_PERK_3":"Extended space in your library","ANYWHERE_PERK_4":"Desktop app","MONTH_PRICE":"${price}/month","OR_YEAR_PRICE":"or ${price} a year (USD)","SUBSCRIPTION_ENDS_ON":"Your ${price}/{period} subscription is set to end on <strong>{date}</strong>.","SUBSCRIPTION_RENEWS_ON":"Your ${price}/{period} subscription is set to renew on <strong>{date}</strong>."}
             self.locales = locales
             if 0 < customCountry:
                 self.config = {"country": {"ID":customCountry,"CC1":0,"CC2":0,"CC3":0,"CC4":0,"DMA":0,"IPR":0}}
             else: 
                 self.config = json.loads(config)
             uuid = self._UUID()
             if 'sessionID' not in self.config:
                 self.config['sessionID'] = hex_md5(uuid)
             self.secretKey = hex_md5(self.config["sessionID"])
             self.requestMacro = dict(GroovesharkApi.REQUEST_DATE_FORMAT)
             self.requestMacro['header'].update({"country":self.config["country"], "session":self.config["sessionID"], "uuid":uuid})
         except:
             self.lastApiError = {'code':-1, 'message':self._cleanHtmlStr(content) + _("\nProbably Grooveshark is blocked for the country selected in config. \nPlease check this.")} 
             printExc()
             return False
     else:
         self.lastApiError = {'code':-1, 'message':_("%s connection error.") % GroovesharkApi.MAINURL} 
         return False
     return True
Example #2
0
 def _doLogin(self, login, password):
     lang = GetDefaultLang()
     params = [login, hex_md5(password), lang, self.USER_AGENT]
     sts, data = self._rpcMethodCall("LogIn", params)
     if sts and (None == data or 0 == len(data)): sts = False 
     printDBG(">>>>>>>>>>>>>>>>>>>>>>>>>>>>> data[%s]" % data)
     if not sts:
         SetIPTVPlayerLastHostError(_('Login failed!'))
     elif ('' != login and self._checkStatus(data, 0)) or '' == login: 
         if 'token' in data[0]:
             self.loginToken = data[0]['token']
         else:
             SetIPTVPlayerLastHostError(_('Get token failed!') + '\n' + _('Error message: \"%s\".\nError code: \"%s\".') % (self.lastApiError['code'], self.lastApiError['message']) )
     else:
         SetIPTVPlayerLastHostError(_('Login failed!') + '\n' + _('Error message: \"%s\".\nError code: \"%s\".') % (self.lastApiError['code'], self.lastApiError['message']) )
 def doLogin(self, callback, login, password, lang="en"):
     self.outerCallback = callback
     self.tmpData = {}
     self.login = login
     params = [login, hex_md5(password), lang, OpenSubOrgProvider.USER_AGENT]
     self._methodCall(self.doLoginCallback, "LogIn", params)
 def downloadSubtitleFile(self, cItem):
     printDBG("OpenSubtitlesRest.downloadSubtitleFile")
     retData = {}
     title    = cItem['title']
     fileName = cItem['file_name']
     baseUrl  = cItem['url']
     lang     = cItem['lang']
     encoding = cItem['encoding']
     imdbid   = cItem['imdbid']
     fps      = cItem.get('fps', 0)
     
     urlParams = dict(self.defaultParams)
     urlParams['max_data_size'] = self.getMaxFileSize()
     
     login = config.plugins.iptvplayer.opensuborg_login.value
     password = config.plugins.iptvplayer.opensuborg_password.value
     loginUrl = 'http://api.opensubtitles.org/xml-rpc'
     loginData = '''<methodCall>
                      <methodName>LogIn</methodName>
                        <params>
                          <param>
                            <value><string>{0}</string></value>
                          </param>
                          <param>
                            <value><string>{1}</string></value>
                          </param>
                        <param>
                          <value><string>{2}</string></value>
                        </param>
                        <param>
                          <value><string>{3}</string></value>
                        </param>
                      </params>
                    </methodCall>'''
     
     if baseUrl.startswith('https://'):
         baseUrl = 'http://' + baseUrl.split('://', 1)[-1]
     
     url = baseUrl
     attempt = 0
     while attempt < 3:
         attempt += 1
         sts, data = self.cm.getPage(url, urlParams)
         if not sts:
             params = dict(self.defaultParams)
             params['raw_post_data'] = True
             post_data = loginData.format(login, hex_md5(password), 'en', self.USER_AGENT)
             sts2, data = self.cm.getPage(loginUrl, params, post_data)
             if sts2:
                 data = self.cm.ph.getDataBeetwenMarkers(data, '<name>token</name>', '</string>', False)[1].rsplit('>', 1)[-1].strip()
                 if data != '':
                     url = baseUrl.replace('/filead/', '/sid-%s/filead/' % data)
                     continue
             if login != '': 
                 login = ''
                 password = ''
                 continue
         break
                 
     if not sts:
         SetIPTVPlayerLastHostError(_('Failed to download subtitle.'))
         return retData
     
     try:
         buf = StringIO(data)
         f = gzip.GzipFile(fileobj=buf)
         data = f.read()
     except Exception:
         printExc()
         SetIPTVPlayerLastHostError(_('Failed to gzip.'))
         return retData
     
     if encoding != '':
         try:
             data = data.decode(encoding).encode('UTF-8')
         except Exception:
             encoding = ''
             printExc()
     
     filePath = GetSubtitlesDir(fileName)
     if self.writeFile(filePath, data):
         if encoding != '':
             retData = {'title':title, 'path':filePath, 'lang':lang, 'imdbid':imdbid, 'fps':fps}
         elif self.converFileToUtf8(filePath, filePath, lang):
             retData = {'title':title, 'path':filePath, 'lang':lang, 'imdbid':imdbid, 'fps':fps}
         
     return retData
 def initSession(self, force=False, customCountry=0):
     printDBG('GroovesharkApi.initSession force[%r]' % force)
     headerParams = dict(self.headerParams)
     headerParams['load_cookie'] = False
     headerParams['header'] = GroovesharkApi.HTTP_HEADER
     sts, data = self.cm.getPage(GroovesharkApi.MAINURL, headerParams)
     if sts:
         content = self.cm.ph.getDataBeetwenMarkers(data,
                                                    '<div id="content">',
                                                    '</div>', False)[1]
         data = self.cm.ph.getDataBeetwenMarkers(data, "var GS = {",
                                                 "</script>", False)[1]
         config = self.cm.ph.getSearchGroups(
             data, "GS.config[^=]*?=[ ]*?([^;]+?);")[0].strip()
         locales = self.cm.ph.getSearchGroups(
             data, "GS.locales[^=]*?=[ ]*?(\{.+?\});")[0].strip()
         try:
             try:
                 locales = json.loads(locales)
             except:
                 locales = {
                     "HOME":
                     "Home",
                     "POPULAR":
                     "Popular",
                     "STATIONS":
                     "Stations",
                     "QUEUE":
                     "Queue",
                     "SIGN_IN":
                     "Sign in",
                     "SIGN_UP":
                     "Sign up",
                     "SIGN_IN_SHORT":
                     "Sign in",
                     "SIGN_OUT":
                     "Sign out",
                     "DOWNLOAD_APP":
                     "Download our app!",
                     "ABOUT":
                     "About Grooveshark",
                     "PRIVACY":
                     "Privacy Policy",
                     "COPYRIGHT":
                     "Copyright",
                     "AUDIO_AD_MSG":
                     "Your music will begin soon",
                     "GO_ADFREE":
                     "Go Ad-Free",
                     "CLOSE_AD":
                     "Close Ad",
                     "SKIP_AD":
                     "Skip Ad",
                     "ADFREE_COPY":
                     "Enjoy unlimited ad-free streaming with a premium Grooveshark subscription. Visit http://grooveshark.com/upgrade on your computer's web browser to upgrade.",
                     "EXPIRED_SITE_MSG":
                     "There was an issue loading the site. Please try refreshing.",
                     "STATION_FAILED_MSG":
                     "Something went wrong, please try another station.",
                     "QUEUE_DEGRADED_MSG":
                     "Adding {number} songs to your queue may degrade performance over time.",
                     "STATION_CLEAR_MSG":
                     "You have music in your queue. Would you like to clear those songs and start {station}?",
                     "STATION_LOADING_MSG":
                     "Loading {station} Radio",
                     "IOS_PIN_TITLE":
                     "Grooveshark on your homescreen",
                     "IOS_PIN_MSG":
                     "Want quick and easy access to the Grooveshark HTML5 webapp? Touch below to pin it to your homescreen. Tap anywhere to close this notification.",
                     "GET_APP":
                     "Looking for the Native {platform} App?",
                     "GET_IT_HERE":
                     "Get it here",
                     "NUM_IN_QUEUE_SINGLE":
                     "{number} song in Queue",
                     "NUM_IN_QUEUE_MULTI":
                     "{number} songs in Queue",
                     "ADD_TO_QUEUE_SINGLE":
                     "{number} song added to Queue",
                     "ADD_TO_QUEUE_MULTI":
                     "{number} songs added to Queue",
                     "PLAY_NOW":
                     "Play Now",
                     "BACK":
                     "Back",
                     "DONE":
                     "Done",
                     "ALL":
                     "All",
                     "LOADING":
                     "Loading...",
                     "RELEASE_TO_LOAD":
                     "Release to load more",
                     "SHOW_MORE_SONGS":
                     "Show more songs",
                     "SHOW_MORE_ALBUMS":
                     "Show more albums",
                     "SHOW_MORE_PLAYLISTS":
                     "Show more playlists",
                     "SEE_ALL_STATIONS":
                     "See all stations",
                     "NUM_MORE":
                     "{number} more",
                     "PLAY_NUM":
                     "Play ({number})",
                     "SORT":
                     "Sort",
                     "PROFILE":
                     "Profile",
                     "NEW_USER":
                     "******",
                     "COLLECTION":
                     "Collection",
                     "COLLECTION_EMPTY_OTHER":
                     "hasn't collected any songs.",
                     "COLLECTION_EMPTY_SELF":
                     "You haven't collected any songs.",
                     "FAVORITES":
                     "Favorites",
                     "FAVORITES_EMPTY_OTHER":
                     "hasn't favorited any songs.",
                     "FAVORITES_EMPTY_SELF":
                     "You haven't favorited any songs.",
                     "PLAYLISTS":
                     "Playlists",
                     "PLAYLISTS_EMPTY_OTHER":
                     "hasn’t created any playlists yet",
                     "PLAYLISTS_EMPTY_SELF":
                     "Playlists are awesome",
                     "PLAYLISTS_EMPTY_DESC_SELF":
                     "You should make one, and share it with your friends. Open Grooveshark.com on your computer to create a playlist.",
                     "EMPTY_PLAYLIST_SELF":
                     "Add songs to your playlist",
                     "EMPTY_PLAYLIST_DESC_SELF":
                     "A full playlist is much more fun. Open Grooveshark.com on your computer to add songs to a playlist.",
                     "EMPTY_PLAYLIST_OTHER":
                     "Looks like this playlist is still being worked on",
                     "EMPTY_PLAYLIST_DESC_OTHER":
                     "There are no songs in this playlist.",
                     "UNFOLLOW":
                     "Unfollow",
                     "FOLLOW":
                     "Follow",
                     "FOLLOWING":
                     "Following",
                     "FOLLOWING_EMPTY_OTHER":
                     "isn't following anybody.",
                     "FOLLOWING_EMPTY_SELF":
                     "You aren't following anybody.",
                     "RECENT_LISTENS":
                     "Recent Listens",
                     "SEARCH_FOR_MUSIC":
                     "Search for music",
                     "SONGS":
                     "Songs",
                     "ALBUMS":
                     "Albums",
                     "NO_SONGS_FOUND":
                     "No songs found",
                     "NO_ALBUMS_FOUND":
                     "No albums found",
                     "NO_PLAYLISTS_FOUND":
                     "No playlists found",
                     "LOGIN_HEADER":
                     "Sign in to Grooveshark",
                     "LOGIN_ERROR":
                     "Oh no! Wrong username/password combination.",
                     "LOGIN_FORGOT":
                     "Forgot your password?",
                     "LOGIN_SUBMIT":
                     "Sign in!",
                     "RESET_PW_TITLE":
                     "Reset Your Password",
                     "RESET_PW_SPINNER":
                     "Requesting password reset...",
                     "RESET_PW_INVALID":
                     "Passwords must match and be between 5 and 32 characters long.",
                     "RESET_PW_ERROR":
                     "Either your password reset code is not valid, or it does not match the user provided.",
                     "RESET_PW_SUBMIT":
                     "Submit",
                     "NEW_PASSWORD":
                     "******",
                     "CONFIRM_PASSWORD":
                     "******",
                     "USERNAME_OR_EMAIL":
                     "Username or Email",
                     "PASSWORD":
                     "******",
                     "FORGOT_PW_MSG":
                     "Don't worry, we'll send an email with instructions to access your account.",
                     "FORGOT_PW_LOGIN":
                     "******",
                     "FORGOT_PW_SUCCESS":
                     "An email has been sent to your email address with login instructions.",
                     "FORGOT_PW_SUBMIT":
                     "Reset password",
                     "EMAIL":
                     "Email",
                     "DISPLAY_NAME":
                     "User Name",
                     "VOTE_UP":
                     "I Like This Song",
                     "VOTE_DOWN":
                     "Skip It",
                     "CONFIRM_CLEAR_QUEUE":
                     "Are you sure you want to empty your Current Songs?",
                     "CONFIRM_LEAVE_BROADCAST":
                     "This will remove you from your current Broadcast. Do you want to continue?",
                     "NOW_PLAYING":
                     "Now Playing",
                     "LOADING_SONG":
                     "Loading song...",
                     "LOADING_ALBUM":
                     "Loading album...",
                     "LOADING_ALBUMS":
                     "Loading albums...",
                     "LOADING_PLAYLIST":
                     "Loading playlist...",
                     "LOADING_PLAYLISTS":
                     "Loading playlists...",
                     "SEARCHING_FOR":
                     "Searching for {query}",
                     "LOGGING_IN":
                     "Logging in...",
                     "FORGOT_PW_TITLE":
                     "Forgot Password?",
                     "SIGNUP_TITLE":
                     "Create Account",
                     "FORGOT_PW_SPINNER":
                     "Requesting password reset...",
                     "LOADING_FOLLOWING":
                     "Loading following list...",
                     "SORT_POPULARITY":
                     "Popularity",
                     "SORT_SONG":
                     "Song Title",
                     "SORT_ALBUM":
                     "Album Name",
                     "SORT_ARTIST":
                     "Artist Name",
                     "SORT_TRACK":
                     "Track Number",
                     "SORT_DEFAULT":
                     "Default Order",
                     "SORT_DATE":
                     "Date Added",
                     "ALL_GENRES":
                     "All Genres",
                     "SHARE":
                     "Share",
                     "NOW_BROADCASTING":
                     "Now Broadcasting:",
                     "NAVIGATION":
                     "Navigation",
                     "MULTI_GENRE":
                     "Multi-Genre",
                     "BROADCAST_JOIN":
                     "Join Broadcast",
                     "TOP_BROADCASTS":
                     "Top Broadcasts",
                     "NO_BROADCASTS_TITLE":
                     "No active Broadcasts for this genre!",
                     "NO_BROADCASTS_DESC":
                     "Try picking another genre.",
                     "BROADCAST_NOW_PLAYING":
                     "Now Playing",
                     "BROADCAST_NOW_PLAYING_LIVE":
                     "Live Broadcast by {user}",
                     "BROADCAST_NOW_PLAYING_NONE_TITLE":
                     "No song is currently playing.",
                     "BROADCAST_NOW_PLAYING_NONE_DESC":
                     "View other broadcasts.",
                     "BROADCAST_HISTORY":
                     "History",
                     "BROADCAST_NO_HISTORY_TITLE":
                     "No songs have played.",
                     "BROADCAST_NO_HISTORY_DESC":
                     "Check back after a song has played",
                     "BROADCAST_LEAVE":
                     "Leave",
                     "BROADCAST_PLAY":
                     "Play",
                     "BROADCAST_PLAYS":
                     "Plays",
                     "BROADCAST_LISTENER":
                     "Listener",
                     "BROADCAST_LISTENERS":
                     "Listeners",
                     "BROADCAST_RECONNECT":
                     "It appears your connection status has changed. Would you like to attempt a reconnect?",
                     "BROADCAST_BYLINE":
                     "by",
                     "SEE_MORE_BROADCASTS":
                     "See more broadcasts",
                     "BROADCASTS":
                     "Broadcasts",
                     "BROADCAST":
                     "Broadcast",
                     "ST_INDIE":
                     "Indie",
                     "ST_ELECTRONICA":
                     "Electronica",
                     "ST_CLASSICAL":
                     "Classical",
                     "ST_POP":
                     "Pop",
                     "ST_RAP":
                     "Rap",
                     "ST_COUNTRY":
                     "Country",
                     "ST_ALTERNATIVE":
                     "Alternative",
                     "ST_HIP_HOP":
                     "Hip Hop",
                     "ST_CLASSIC_ROCK":
                     "Classic Rock",
                     "ST_AMBIENT":
                     "Ambient",
                     "ST_PUNK":
                     "Punk",
                     "ST_90S_ALT_ROCK":
                     "90's Alt Rock",
                     "ST_BLUES":
                     "Blues",
                     "ST_ROCK":
                     "Rock",
                     "ST_JAZZ":
                     "Jazz",
                     "ST_RNB":
                     "R&B",
                     "ST_FOLK":
                     "Folk",
                     "ST_DUBSTEP":
                     "Dubstep",
                     "ST_80S":
                     "80's",
                     "ST_TRANCE":
                     "Trance",
                     "ST_BLUEGRASS":
                     "Bluegrass",
                     "ST_REGGAE":
                     "Reggae",
                     "ST_METAL":
                     "Metal",
                     "ST_OLDIES":
                     "Oldies",
                     "ST_EXPERIMENTAL":
                     "Experimental",
                     "ST_LATIN":
                     "Latin",
                     "CONFIRM_PW":
                     "Retype Password",
                     "SIGNUP_SUBMIT":
                     "Sign up!",
                     "LOGIN_FROM_SIGNUP":
                     "Already registered? Sign in.",
                     "NO_ACCOUNT":
                     "No account yet?",
                     "SIGNUP_FROM_LOGIN":
                     "******",
                     "TOS_AGREE":
                     "By signing up you agree to the {link}",
                     "TOS":
                     "Terms of Service",
                     "DESCRIPTION":
                     "Description",
                     "AMOUNT":
                     "Amount:",
                     "CONFIRM":
                     "Confirm",
                     "CONTINUE":
                     "Continue",
                     "REMOVE":
                     "Remove",
                     "CANCEL":
                     "Cancel",
                     "TAX":
                     "Tax",
                     "TOTAL":
                     "Total",
                     "SUPPORT":
                     "Support",
                     "CREDIT_CARD":
                     "Credit Card",
                     "PAYPAL":
                     "PayPal",
                     "REDEEM_CODE":
                     "Redeem Code",
                     "CARD_NUMBER":
                     "Card Number",
                     "SECURITY_CODE":
                     "Security Code",
                     "EXPIRATION_DATE":
                     "Expiration Date",
                     "ENTER_REDEEM_CODE":
                     "Enter your Grooveshark code into the box below to redeem:",
                     "BILLING_INFORMATION":
                     "Billing Information",
                     "SUBSCRIPTION_RECURRING_COPY":
                     "Subscription Recurring",
                     "GROOVESHARK_ANYWHERE":
                     "Grooveshark VIP",
                     "GROOVESHARK_ANYWHERE_RECURRING":
                     "Grooveshark VIP (Recurring)",
                     "GROOVESHARK_PAYMENTS":
                     "Grooveshark Payments",
                     "GO_TO_ELLIPSIS":
                     "Go to...",
                     "UPGRADE_NOW":
                     "Upgrade Now",
                     "PAYMENTS_MUST_SIGN_IN":
                     "Please login or sign up to upgrade to a premium Grooveshark account.",
                     "PAYMENTS_RECURRING_PARAGRAPH_1":
                     "Your Grooveshark VIP Subscription is already recurring.",
                     "PAYMENTS_RECURRING_PARAGRAPH_2":
                     "If you want to remove this subscription click below.",
                     "PAYMENTS_COMPLETE_PARAGRAPH_1":
                     "You've just joined one of the most passionate groups of music lovers on the web, and helped us make Grooveshark an even better place for all of our sharks around the globe.",
                     "PAYMENTS_COMPLETE_PARAGRAPH_2":
                     "You're a part of one of the most passionate groups of music lovers on the web, and you've helped us make Grooveshark an even better place for all of our sharks around the globe.",
                     "PAYMENTS_COMPLETE_PARAGRAPH_3":
                     "Welcome -- and enjoy.",
                     "PAYMENTS_ERROR_REMOVE_RECURRING":
                     "There was an error removing the recurring subscription.",
                     "LB_SIGNUP_LOGIN_DONT_HAVE_ACCOUNT":
                     "No account? <a class=\"open-signup\">Sign up!</a>",
                     "VIP_ERROR_CARD_NUMBER":
                     "Please ensure your credit card number is correct and try again.",
                     "VIP_ERROR_CVD":
                     "Please ensure your security code is correct and try again.",
                     "VIP_ERROR_DATE":
                     "Please ensure your expiration date is correct and try again.",
                     "ERROR_REDEEM_CODE_INVALID":
                     "The code you entered was not found in our system. Please try again or contact support.",
                     "ERROR_REDEEM_CODE_TOO_MUCH":
                     "The code you entered has been used too many times.",
                     "ERROR_REDEEM_FAILED":
                     "We ran into a problem while redeeming that code. Please try again.",
                     "ERROR_REDEEM_CANCEL_REQUIRED":
                     "In order to redeem your code, you must stop your recurring payments.",
                     "ERROR_EXTEND_CANCEL_REQUIRED":
                     "In order to extend your subscription, you must stop your recurring payments.",
                     "ERROR_REDEEM_CODE_VERIFY_FAILED":
                     "We ran into a problem while verifying that code. Please try again.",
                     "VIP_ERROR_INVALID":
                     "Looks like there was a problem charging your credit card. Please check with your bank or contact support.",
                     "PAYPAL_INIT_ERROR_UNKNOWN":
                     "Something went wrong while generating a PayPal transaction. Please try again.",
                     "HEADER_THANK_YOU":
                     "Thank You!",
                     "IS_RECURRING":
                     "Recurring?",
                     "FREE_MONTHS_ALT_SINGLE_LINE":
                     "12 months for the price of 10!",
                     "SELL_MONTH_SUB_ALT":
                     "Great low monthly price!",
                     "PRICE_PER_MONTH":
                     "${price} / month (USD)",
                     "PRICE_PER_YEAR":
                     "${price} / year (USD)",
                     "MONTHS":
                     "January,February,March,April,May,June,July,August,September,October,November,December",
                     "DAY":
                     "Day",
                     "MONTH":
                     "Month",
                     "YEAR":
                     "Year",
                     "YEAR_PLURAL":
                     "Years",
                     "MONTH_PLURAL":
                     "Months",
                     "OLDER_13":
                     "You need to be at least 13 years old to sign up",
                     "REQUIRED_FIELD":
                     "{fieldName} is a required field",
                     "PW_DONT_MATCH":
                     "Passwords do not match",
                     "PW_LENGTH_ERR":
                     "Please enter a password between 5 and 32 characters long",
                     "EMAIL_TAKEN":
                     "Email already taken",
                     "USERNAME_TAKEN":
                     "Username already taken",
                     "PREMIUM_REQUIRED":
                     "You must have a Grooveshark VIP account to use this version of Grooveshark.",
                     "NO_MP3_SUPPORT":
                     "It looks like your current browser doesn't support HTML5 audio and/or mp3 playback. If you have flash, you can use the full version of Grooveshark, or you can upgrade to a browser that supports HTML5 audio and MP3 playback.",
                     "UPGRADE":
                     "Upgrade",
                     "CLOSE":
                     "Close",
                     "PAYMENTS_BILLING":
                     "Billing",
                     "SUBSCRIPTION":
                     "Subscription",
                     "SUBSCRIBE":
                     "Subscribe",
                     "ON_SALE":
                     "On sale! Normally ${price}/month",
                     "SUPPORT_THANKS":
                     "Thank you for your support",
                     "EXTEND_SUBSCRIPTION":
                     "Extend Subscription",
                     "CANCEL_RECURRING":
                     "Cancel Recurring",
                     "UPDATE_RECURRING":
                     "Update Credit Card",
                     "CONTACT_BILLING":
                     "Contact Billing Support",
                     "GET_GROOVESHARK_ANYWHERE":
                     "Get Grooveshark VIP",
                     "ANYWHERE_PERK_1":
                     "Unlimited ad-free streaming",
                     "ANYWHERE_PERK_2":
                     "Android app &amp; jailbroken iOS app with <strong>continuous streaming</strong> and <strong>offline playback</strong>",
                     "ANYWHERE_PERK_3":
                     "Extended space in your library",
                     "ANYWHERE_PERK_4":
                     "Desktop app",
                     "MONTH_PRICE":
                     "${price}/month",
                     "OR_YEAR_PRICE":
                     "or ${price} a year (USD)",
                     "SUBSCRIPTION_ENDS_ON":
                     "Your ${price}/{period} subscription is set to end on <strong>{date}</strong>.",
                     "SUBSCRIPTION_RENEWS_ON":
                     "Your ${price}/{period} subscription is set to renew on <strong>{date}</strong>."
                 }
             self.locales = locales
             if 0 < customCountry:
                 self.config = {
                     "country": {
                         "ID": customCountry,
                         "CC1": 0,
                         "CC2": 0,
                         "CC3": 0,
                         "CC4": 0,
                         "DMA": 0,
                         "IPR": 0
                     }
                 }
             else:
                 self.config = json.loads(config)
             uuid = self._UUID()
             if 'sessionID' not in self.config:
                 self.config['sessionID'] = hex_md5(uuid)
             self.secretKey = hex_md5(self.config["sessionID"])
             self.requestMacro = dict(GroovesharkApi.REQUEST_DATE_FORMAT)
             self.requestMacro['header'].update({
                 "country":
                 self.config["country"],
                 "session":
                 self.config["sessionID"],
                 "uuid":
                 uuid
             })
         except:
             self.lastApiError = {
                 'code':
                 -1,
                 'message':
                 self._cleanHtmlStr(content) +
                 _("\nProbably Grooveshark is blocked for the country selected in config. \nPlease check this."
                   )
             }
             printExc()
             return False
     else:
         self.lastApiError = {
             'code': -1,
             'message': _("%s connection error.") % GroovesharkApi.MAINURL
         }
         return False
     return True
 def doLogin(self, callback, login, password, lang='en'):
     self.outerCallback = callback
     self.tmpData = {}
     self.login = login
     params = [login, hex_md5(password), lang, OpenSubOrgProvider.USER_AGENT]
     self._methodCall(self.doLoginCallback, "LogIn", params)