def save_ranking_artworks(self, dir_path, order='popular-1-month', type='visual-art', content='all', category='all', limit=30):
     print(f'download {order} {content} {category} ranking\n')
     dir_path = utils.make_dir(dir_path, f'{order} {content} {category} ranking')
     artworks = self.ranking_artworks(order, type, content, category, limit, dir_path)
     if not artworks:
         print(f'{order} {content} {category} ranking is up-to-date\n')
         return
     with ThreadPool(self.threads) as pool:
         files = pool.map(partial(self.save_artwork, dir_path), artworks)
     print(f'\ndownload for {order} {content} {category} ranking completed\n')
     combined_files = utils.counter(files)
     utils.set_files_mtime(combined_files['name'], dir_path)
     return combined_files
 def save_user_artworks(self, user_id, dir_path):
     print(f'download artworks for user {user_id}\n')
     dir_path = utils.make_dir(dir_path, user_id)
     artworks = self.user_artworks(user_id, dir_path)
     if not artworks:
         print(f'user {user_id} is up-to-date\n')
         return
     with ThreadPool(self.threads) as pool:
         files = pool.map(partial(self.save_artwork, dir_path), artworks)
     print(f'\ndownload for user {user_id} completed\n')
     combined_files = utils.counter(files)
     utils.set_files_mtime(combined_files['name'], dir_path)
     return combined_files
Esempio n. 3
0
 def save_rankings(self, mode, content, date, limit, dir_path):
     print(f"download {mode} {content} rankings\n")
     dir_path = utils.make_dir(dir_path, f"{mode} {content} rankings")
     artworks = self.rankings_artworks(mode, content, date, limit, dir_path)
     if not artworks:
         print(f"{mode} {content} rankings are up-to-date\n")
         return
     with ThreadPool(self.threads) as pool:
         files = pool.map(partial(self.save_artwork, dir_path), artworks)
     print(f"\ndownload for {mode} {content} rankings completed\n")
     combined_files = utils.dict_counter(files)
     utils.set_files_mtime(combined_files["names"], dir_path)
     return combined_files
Esempio n. 4
0
 def save_bookmarks(self, user_id, dir_path):
     username = self.user(user_id)["name"]
     print(f"download bookmarks for user {username}\n")
     dir_path = utils.make_dir(dir_path, str(user_id) + " bookmarks")
     artworks = self.user_bookmarks_artworks(user_id, dir_path)
     if not artworks:
         print(f"user {username} is up-to-date\n")
         return
     with ThreadPool(self.threads) as pool:
         files = pool.map(partial(self.save_artwork, dir_path), artworks)
     print(f"\ndownload for user {username} completed\n")
     combined_files = utils.dict_counter(files)
     utils.set_files_mtime(combined_files["names"], dir_path)
     return combined_files
Esempio n. 5
0
 def save_artist(self, artist_id, dir_path, stop=None):
     gallery = self.gallery(artist_id)
     artist_name = gallery["artist_name"]
     print(f"download for author {artist_name} begins\n")
     dir_path = utils.make_dir(dir_path, artist_name)
     artwork_urls = self.artist_artworks(artist_id, stop)
     if not artwork_urls:
         print(f"author {artist_name} is up-to-date\n")
         return
     with ThreadPool(self.threads) as pool:
         files = pool.map(partial(self.save_artwork, dir_path), artwork_urls)
     print(f"\ndownload for author {artist_name} completed\n")
     combined_files = utils.counter(files)
     utils.set_files_mtime(combined_files["name"], dir_path)
     return combined_files
Esempio n. 6
0
 def save_collection_artworks(self, collection, dir_path):
     collection_metadata = self.collection_metadata(collection)
     collection_name = collection_metadata["name"]
     collection_owner = collection_metadata["owner"]["username"]
     amount = collection_metadata["size"]
     print(
         f'download {amount} artworks for collection {collection_name} by {collection_owner}\n'
     )
     dir_path = utils.make_dir(dir_path, collection_name)
     artworks = self.collection_artworks(collection, dir_path)
     if not artworks:
         print(f'collection {collection_name} is up-to-date\n')
         return
     with ThreadPool(self.threads) as pool:
         files = pool.map(partial(self.save_artwork, dir_path), artworks)
     print(f'\ndownload for collection {collection_name} completed\n')
     combined_files = utils.counter(files)
     utils.set_files_mtime(combined_files['name'], dir_path)
     return combined_files