def __update_for_url(self, url): """ Update charts for url @param url as str """ if not get_network_available(): return debug("ItunesCharts::__update_for_url(): %s => %s" % (url, self.__LIMIT)) web = Web() ids = self.__get_ids(url) position = len(ids) while ids: sleep(10) (itunes_id, itunes_genre) = ids.pop(0) album = self.__get_album(itunes_id) if self.__stop: return if album is None or not album.subitems: position -= 1 continue album.mtime = self.__time + position for item in album.subitems: item.mtime = self.__time debug("ItunesCharts::__update_for_url(): %s - %s" % (album.name, album.artists)) t = TagReader() with SqlCursor(Lp().db) as sql: genre_ids = t.add_genres(itunes_genre) sql.commit() genre_ids.append(Type.ITUNES) web.save_album_thread(album, DbPersistent.CHARTS, genre_ids) position -= 1
def __update_for_url(self, url): """ Update charts for url @param url as str """ if not get_network_available(): return debug("SpotifyCharts::__update_for_url(): %s" % (url)) ids = self.__get_ids(url) web = Web() search = SpotifySearch() position = len(ids) while ids: sleep(10) track_id = ids.pop(0) album = search.get_track(track_id) if self.__stop: return if album is None or not album.subitems: position -= 1 continue for item in album.subitems: item.mtime = self.__time + position debug("SpotifyCharts::__update_for_url(): %s - %s - %s" % ( album.name, album.artists, track_id)) web.save_album_thread(album, DbPersistent.CHARTS, [Type.SPOTIFY]) position -= 1
def __update_for_url(self, url): """ Update charts for url @param url as str """ if not get_network_available(): return debug("ItunesCharts::__update_for_url(): %s => %s" % (url, self.__LIMIT)) web = Web() ids = self.__get_ids(url) position = len(ids) while ids: sleep(10) (itunes_id, itunes_genre) = ids.pop(0) album = self.__get_album(itunes_id) if self.__stop: return if album is None or not album.subitems: position -= 1 continue album.mtime = self.__time + position for item in album.subitems: item.mtime = self.__time debug("ItunesCharts::__update_for_url(): %s - %s" % ( album.name, album.artists)) t = TagReader() with SqlCursor(Lp().db) as sql: genre_ids = t.add_genres(itunes_genre) sql.commit() genre_ids.append(Type.ITUNES) web.save_album_thread(album, DbPersistent.CHARTS, genre_ids) position -= 1