Example #1
0
def search(name):
    artist_album_list = []
    search_list = []
    search_dialog = []
    search_name = str.lower(name)
    for part in search_name.split(" "):
        search_xml = str.lower(get_html_source( cross_url + "&artist=%s" % urllib.quote_plus(part)) )
        print cross_url + cross_url + "&artist=%s" % part 
        #print search_xml
        save_xml(search_xml)
        match = re.search('<message>(.*?)</message>', search_xml )    
        if match: print "not found"
            #xbmcgui.Dialog().ok( "Not Found on XBMCSTUFF", match.group(1) )
            #OK = False
        elif len(part) == 1 or part in ["the","le","de"]: print "Pass"
        else: 
            raw = re.compile( "<cdart>(.*?)</cdart>", re.DOTALL ).findall(search_xml)
            for i in raw:
                album = {}
                album["local_name"] = name
                match = re.search( "<artist>(.*?)</artist>", i )
                if match: album["artist"] = set_entity_or_charref(match.group(1))
                else: album["artist"] = ""
                if not album["artist"] in search_dialog: search_dialog.append(album["artist"]) 
                match = re.search( "<album>(.*?)</album>", i )
                if match: album["title"] = (match.group(1))
                else: album["title"] = ""
                match = re.search( "<thumb>(.*?)</thumb>", i )
                if match: album["thumb"] = (match.group(1))
                else: album["thumb"] = ""
                match = re.search( "<picture>(.*?)</picture>", i )
                if match: album["picture"] = (match.group(1))
                else: album["picture"] = ""
                print album["artist"]
                search_list.append(album)
Example #2
0
def get_media_link(id_media):
    media_url = "http://www.allocine.fr/skin/video/AcVisionData_xml.asp?media=%s" % id_media
    media_data = get_html_source( media_url )
    #save_data(media_data)
    media = {}
    
    match = re.search( '<AcVisionVideo(.*?)/>', media_data , re.DOTALL )
    if match: media_data = match.group(1)
    else : print "problème de récupération info média"
    
    match = re.search( 'title="(.*?)"', media_data )
    if match: media["name"] = set_entity_or_charref(match.group(1))
    else: media["name"] = ""
    print "récupération info média: %s" % media["name"]
    
    for video_quality in [ "ld" , "md" , "hd"]:
        match = re.search( '%s_path="(.*?)"' % video_quality , media_data )
        if match: media[video_quality] = match.group(1)
        else: media[video_quality] = ""
    print media    
    return media
Example #3
0
def get_media_link(id_media):
    media_url = "http://www.allocine.fr/skin/video/AcVisionData_xml.asp?media=%s" % id_media
    media_data = get_html_source(media_url)
    #save_data(media_data)
    media = {}

    match = re.search('<AcVisionVideo(.*?)/>', media_data, re.DOTALL)
    if match: media_data = match.group(1)
    else: print "problème de récupération info média"

    match = re.search('title="(.*?)"', media_data)
    if match: media["name"] = set_entity_or_charref(match.group(1))
    else: media["name"] = ""
    print "récupération info média: %s" % media["name"]

    for video_quality in ["ld", "md", "hd"]:
        match = re.search('%s_path="(.*?)"' % video_quality, media_data)
        if match: media[video_quality] = match.group(1)
        else: media[video_quality] = ""
    print media
    return media
Example #4
0
 def search( self , name ):
     print "#  Search Artist based on name: %s" % name
     error = 0
     select = None
     artist_album_list = []
     search_list = []
     search_dialog = []
     name = str.lower(name)
     search_name = self.remove_special( name )
     search_name = search_name.replace("-", " ") # break up name if hyphens are present
     for part in search_name.split(" "):
         search_xml = str.lower(self.get_html_source( cross_url + "&artist=%s" % urllib.quote_plus(part)) )
         if search_xml =="":
             error = 1
             break
         else:
             #print cross_url + cross_url + "&artist=%s" % part 
             #print search_xml
             match = re.search('<message>(.*?)</message>', search_xml )    
             if match:
                 print "#          Artist(part name): %s  not found on xbmcstuff.com" % repr(part)
             elif len(part) == 1 or part in ["the","le","de"]:
                 pass
             else: 
                 raw = re.compile( "<cdart>(.*?)</cdart>", re.DOTALL ).findall(search_xml)
                 for i in raw:
                     album = {}
                     album["local_name"] = name
                     match = re.search( "<artist>(.*?)</artist>", i )
                     if match:
                         album["artist"] = set_entity_or_charref((match.group(1).replace("&amp;", "&")).replace("'",""))
                         #print "#               Artist Matched: %s" % album["artist"]
                     else:
                         album["artist"] = ""
                     if not album["artist"] in search_dialog:
                         search_dialog.append(album["artist"])                    
                     match = re.search( "<album>(.*?)</album>", i )
                     if match:
                         album["title"] = (match.group(1).replace("&amp;", "&")).replace("'","")
                     else:
                         album["title"] = ""
                     #print "#                         Album Title: %s" % album["title"]
                     match = re.search( "<thumb>(.*?)</thumb>", i )
                     if match:
                         album["thumb"] = (match.group(1))
                     else:
                         album["thumb"] = ""
                     #print "#                         Album Thumb: %s" % album["thumb"]                        
                     match = re.search( "<picture>(.*?)</picture>", i )
                     if match:
                         album["picture"] = (match.group(1))
                     else:
                         album["picture"] = ""                    
                     #print "#                         Album cdART: %s" % album["picture"]
                     search_list.append(album)            
         if search_dialog: 
             select = xbmcgui.Dialog().select( __language__(32032), search_dialog)
             #Onscreen Select Menu
             print select
         if not select == -1:
             for item in search_list : 
                 if item["artist"] == search_list[select]["artist"]:
                     artist_album_list.append(item)
             return artist_album_list    
         else:
             if error == 1:
                 xbmcgui.Dialog().ok( __language__(32066) )
                 #Onscreen Dialog - Error connecting to XBMCSTUFF.COM, Socket Timed out
             else:
                 xbmcgui.Dialog().ok( __language__(32033), "%s %s" % ( __language__(32034), name) )
Example #5
0
def search(name):
    artist_album_list = []
    search_list = []
    search_dialog = []
    search_name = str.lower(name)
    for part in search_name.split(" "):
        search_xml = str.lower(
            get_html_source(cross_url +
                            "&artist=%s" % urllib.quote_plus(part)))
        print cross_url + cross_url + "&artist=%s" % part
        #print search_xml
        save_xml(search_xml)
        match = re.search('<message>(.*?)</message>', search_xml)
        if match:
            print "not found"
            #xbmcgui.Dialog().ok( "Not Found on XBMCSTUFF", match.group(1) )
            #OK = False
        elif len(part) == 1 or part in ["the", "le", "de"]:
            print "Pass"
        else:
            raw = re.compile("<cdart>(.*?)</cdart>",
                             re.DOTALL).findall(search_xml)
            for i in raw:
                album = {}
                album["local_name"] = name
                match = re.search("<artist>(.*?)</artist>", i)
                if match:
                    album["artist"] = set_entity_or_charref(match.group(1))
                else:
                    album["artist"] = ""
                if not album["artist"] in search_dialog:
                    search_dialog.append(album["artist"])
                match = re.search("<album>(.*?)</album>", i)
                if match: album["title"] = (match.group(1))
                else: album["title"] = ""
                match = re.search("<thumb>(.*?)</thumb>", i)
                if match: album["thumb"] = (match.group(1))
                else: album["thumb"] = ""
                match = re.search("<picture>(.*?)</picture>", i)
                if match: album["picture"] = (match.group(1))
                else: album["picture"] = ""
                print album["artist"]
                search_list.append(album)

    if search_dialog:
        select = None
        select = xbmcgui.Dialog().select(Language.getLocalizedString(30020),
                                         search_dialog)
        print "select: %s" % select
        if not select == -1:

            for item in search_list:
                if item["artist"] == search_list[select]["artist"]:
                    artist_album_list.append(item)

    else:
        xbmcgui.Dialog().ok(
            Language.getLocalizedString(30021),
            "%s %s" % (Language.getLocalizedString(30022), name))

    return artist_album_list