def Playlist_getPlaylistDetail(playlist_id): playlist_o = NEM_Browser.Browser_Request("playlistDetail", {"id": playlist_id}) ids_str = "" for tracker_id_o in playlist_o["playlist"]["trackIds"]: ids_str += str(tracker_id_o["id"]) + "," ids_str = ids_str[0:-1] playlist_o["playlist"]["tracks"] = NEM_Track.Track_getSongDetails( ids_str)["songs"] return playlist_o
def _download_fromSoupInfos(infos): global_data = NEM_Data.Data_getData() download_path = global_data["config"]["download"]["path"] tmp_path = os.path.join(download_path, global_data["config"]["download"]["tempPath"]) if not os.path.exists(download_path): os.mkdir(download_path) if not os.path.exists(tmp_path): os.mkdir(tmp_path) for id, info in infos.items(): file_path = os.path.join(download_path, info["download_path"]) if not os.path.exists(file_path): if not os.path.exists(os.path.split(file_path)[0]): os.makedirs(os.path.split(file_path)[0]) file_tmp_path = os.path.join(tmp_path, os.path.split(file_path)[1]) cover_path = file_tmp_path + os.path.splitext(info['album_cover_url'])[-1] NEM_Browser.Browser_Download(info["url"], file_tmp_path) NEM_Browser.Browser_Download(info['album_cover_url'], cover_path) if Utils_MetaTools.Utils_Meta_setMusicInfo(file_tmp_path, { "TALB": info['album_name'], "TIT2": info['name'], "TPE1": info['artist'], "APIC": cover_path, "STRICT": global_data["config"]["output"]["strictCover"], "TRANSCODE": global_data["config"]["output"]["transcodeToMP3"], "TRANSPATH": os.path.join(download_path, global_data["config"]["nameTemplate"]["convertedPath"] .replace("%seg", os.path.sep) .replace("%sourcePath", os.path.splitext(info["download_path"])[0] + ".mp3")) }) == 1: shutil.move(file_tmp_path, os.path.splitext(file_path)[0] + ".m4a") os.remove(cover_path) else: try: os.remove(cover_path) shutil.move(file_tmp_path, file_path) except Exception: traceback.print_exc()
def Track_getSongDetails(tracks): return NEM_Browser.Browser_Request("trackGetDetail", {"ids": tracks})
def Track_getSongUrl(tracks): return NEM_Browser.Browser_Request("trackGetURL", {"id": tracks})
import NEM_Action import NEM_Autorun import NEM_Browser import NEM_Data import NEM_Env if __name__ == "__main__": NEM_Data.Data_NemData("file", "data.json") NEM_Env.ENV_getProtected() NEM_Browser.Browser_CheckLogin() # NEM_Browser.Browser_Request("userPlayList", ) # print(NEM_Data.Data_getData()) # print(NEM_Playlist.Playlist_getUserPlaylist()) # print(NEM_Playlist.Playlist_getPlaylistDetail(3136952023)) # print(NEM_Playlist.Playlist_getPlaylistCreate("test")) # print() # Utils_MetaTools.Utils_Meta_setMusicInfo("9c0e_16dd_8cde_16b6909c93cb93aad35d756a61f5e347.mp3", { # "TALB": "China-w", # "TIT2": "China-w", # "TPE1": "Arealy仁辰/南有乔木", # "APIC": "109951163104126448.jpg" # }) # NEM_Action.Action_downloadPlaylist(6768969597, True) # NEM_Action.Action_downloadFavourite() # id = NEM_Action.Action_radar_to_pl() # NEM_Action.Action_downloadPlaylist(id, is_radar=True) # id = NEM_Action.Action_RecommendToPlaylist() # NEM_Action.Action_downloadPlaylist(id, is_recommend=True) print("Init successfully") NEM_Autorun.Autorun()
def Playlist_getUserPlaylist(): global_data = NEM_Data.Data_getData() user_id = global_data["user"]["id"] return NEM_Browser.Browser_Request("userPlayList", {"uid": user_id})
def Playlist_getRecommendSongs(): return NEM_Browser.Browser_Request("recommendSong", None)["data"]["dailySongs"]
def Playlist_getPlaylistAdd(playlist_id, tracks): return NEM_Browser.Browser_Request("playlistAdd", { "op": "add", "pid": playlist_id, "tracks": tracks })
def Playlist_getPlaylistCreate(playlist_name): return NEM_Browser.Browser_Request("playlistCreate", {"name": playlist_name})