def listAlbums(url): xbmcplugin.setContent(pluginhandle, "albums") content = getUnicodePage(url) debug(content) content = content.replace("\\","") if 'id="catCorResults"' in content: content = content[:content.find('id="catCorResults"')] args = urlparse.parse_qs(url[1:]) page = args.get('page', None) if page is not None: if int(page[0]) > 1: content = content[content.find('breadcrumb.breadcrumbSearch'):] if siteVersion=="de": if 'nstimmung mit Produkten, wir haben daher die Kategorie' in content: xbmcplugin.endOfDirectory(pluginhandle) xbmc.sleep(100) return spl = content.split('id="result_') videoimage = ScrapeUtils.VideoImage() addDir(translation(30006), "", 'index', "") for i in range(1, len(spl), 1): entry = spl[i] match = re.compile('asin="(.+?)"', re.DOTALL).findall(entry) if match : videoID = match[0] match1 = re.compile('title="(.+?)"', re.DOTALL).findall(entry) title = "" if match1: title = match1[0] else: continue title = cleanInput(title) artist = "" match1 = re.compile('von </span><span class="a-size-small a-color-secondary"><.+?>(.+?)<', re.DOTALL).findall(entry) if match1: artist = match1[0] artist += ": " year = "" match = re.compile('src="(.+?)"', re.DOTALL).findall(entry) thumbUrl = "" if match: thumbUrl = videoimage.ImageFile(match[0]) albumUrl = "" match = re.compile('href="(.+?)"', re.DOTALL).findall(entry) if match: albumUrl = match[0] else: continue addDir(artist + title, albumUrl, "listSongs", thumbUrl) match_nextpage = re.compile('ass="pagnNext".*?href="(.+?)">', re.DOTALL).findall(content) if match_nextpage: addDir(translation(30001), urlMain + match_nextpage[0].replace("&","&"), "listAlbums", "") xbmcplugin.endOfDirectory(pluginhandle) if defaultview_albums: xbmc.executebuiltin('Container.SetViewMode(%s)' % defaultview_albums) xbmc.sleep(100)
def listPlaylists(url): xbmcplugin.setContent(pluginhandle, "albums") raw_content = getUnicodePage(url) debug(raw_content) raw_content = raw_content.replace("\\","") if 'id="catCorResults"' in raw_content: raw_content = raw_content[:raw_content.find('id="catCorResults"')] args = urlparse.parse_qs(url[1:]) page = args.get('page', None) if page is not None: if int(page[0]) > 1: raw_content = raw_content[raw_content.find('breadcrumb.breadcrumbSearch'):] spl = raw_content.split('div id="mainResults"') if len(spl) > 1: content = spl[1] else: content = raw_content spl = content.split('><a class="a-link-normal a-text-normal"') videoimage = ScrapeUtils.VideoImage() for i in range(1, len(spl), 1): entry = spl[i] match = re.compile('asin="(.+?)"', re.DOTALL).findall(entry) if match : videoID = match[0] match1 = re.compile('title="(.+?)"', re.DOTALL).findall(entry) title = "" if match1: title = match1[0] else: continue title = cleanInput(title) artist = "" # match1 = re.compile('von </span><span class="a-size-small a-color-secondary"><.+?>(.+?)<', re.DOTALL).findall(entry) # if match1: # artist = match1[0] # artist += ": " # year = "" match = re.compile('src="(.+?)"', re.DOTALL).findall(entry) thumbUrl = videoimage.ImageFile(match[0]) albumUrl = "" match = re.compile('href="(.+?)"', re.DOTALL).findall(entry) if match: albumUrl = match[0] else: continue addDir(artist + title, albumUrl, "listSongs", thumbUrl) match_nextpage = re.compile('ass="pagnNext".*?href="(.+?)">', re.DOTALL).findall(content) if match_nextpage: addDir(translation(30001), urlMain + match_nextpage[0].replace("&","&"), "listPlaylists", "") xbmcplugin.endOfDirectory(pluginhandle) if defaultview_playlists: xbmc.executebuiltin('Container.SetViewMode(%s)' % defaultview_playlists) xbmc.sleep(100)
def listSongs(url): content = getUnicodePage(url) debug(content) content = content.replace("\\", "") if 'id="catCorResults"' in content: content = content[:content.find('id="catCorResults"')] args = urlparse.parse_qs(url[1:]) page = args.get('page', None) if page is not None: if int(page[0]) > 1: content = content[content.find('breadcrumb.breadcrumbSearch'):] spl = content.split('id="dmusic_tracklist_player_row_') videoimage = ScrapeUtils.VideoImage() album_thumb_match = re.compile('<img alt=".+?" src="(.+?)"', re.DOTALL).findall(content) album_thumb_url = "" if album_thumb_match: album_thumb_url = videoimage.ImageFile(album_thumb_match[0]) artist_match = re.compile('roductInfoArtistLink".+?">(\S.+?)</', re.DOTALL).findall(content) artist = "" run_per_song_check = False if artist_match: artist = artist_match[0] else: run_per_song_check = True album_title = "" album_title_match = re.compile( '<h1 class="a-size-large a-spacing-micro">(.+?)</h1>', re.DOTALL).findall(content) if album_title_match: album_title = album_title_match[0] album_songs = getSongList(content, run_per_song_check) if run_per_song_check == True: for song in album_songs: addLink(song["title"], "playTrack", song["trackID"], album_thumb_url, "", song["track_nr"], song["artist"], song["album_title"], song["year"], show_artist_and_title=True) else: for song in album_songs: addLink(song["title"], "playTrack", song["trackID"], album_thumb_url, "", song["track_nr"], artist, album_title, song["year"]) xbmcplugin.endOfDirectory(pluginhandle) xbmc.sleep(100)