Advertisement
Guest User

wantitall.boo

a guest
Sep 11th, 2011
70
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
BOO 1.37 KB | None | 0 0
  1. import System
  2. import System.Text.RegularExpressions
  3. import AlbumArtDownloader.Scripts
  4. import util
  5.  
  6. class WantItAll(AlbumArtDownloader.Scripts.IScript):
  7.     Name as string:
  8.         get: return "WantItAll"
  9.     Version as string:
  10.         get: return "0.1"
  11.     Author as string:
  12.         get: return "alsaan"
  13.        
  14.     def Search(artist as string, album as string, results as IScriptResults):
  15.    
  16.         artist = StripCharacters("&.'\";:?!", artist)
  17.         album = StripCharacters("&.'\";:?!", album)
  18.        
  19.         searchString = artist + " " + album
  20.         searchString = searchString.Trim().ToLower().Replace(" ", "-")
  21.        
  22.         searchUrl = String.Format("http://www.wantitall.co.za/{0}/Music/p1", searchString)
  23.         html = GetPage(searchUrl)
  24.        
  25.         re = Regex("<li class=\"aproduct\"><a href=\"(?<productPageUrl>/Music[^\"]+)\">.+?<img src=\"(?<thumbnailUrl>[^\"]+)\" alt=\"(?<name>[^\"]+)\"")
  26.         matches = re.Matches(html)
  27.        
  28.         results.EstimatedCount = matches.Count
  29.        
  30.         for match in matches:
  31.             name = match.Groups["name"].Value
  32.             productPageUrl = "http://www.wantitall.co.za" + match.Groups["productPageUrl"].Value
  33.             thumbnailUrl = match.Groups["thumbnailUrl"].Value
  34.            
  35.             if thumbnailUrl != "http://www.wantitall.co.za//images/no_image_small.jpg":
  36.                 results.Add(thumbnailUrl, name, productPageUrl, -1, -1, thumbnailUrl, CoverType.Front)
  37.  
  38.     def RetrieveFullSizeImage(thumbnailUrl):
  39.    
  40.         return thumbnailUrl.Replace("._SL75_","")
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement