diff --git a/QQtoWY.py b/QQtoWY.py index ce6eafc..b7c59c2 100644 --- a/QQtoWY.py +++ b/QQtoWY.py @@ -32,7 +32,7 @@ def prepare(self): element.send_keys(self.config.password) sleep(0.5) self.browser.execute_script("document.querySelectorAll('[data-action=\"login\"]')[6].click()") - print "login sucess" + print("login sucess") def get_source_playlist(self): response = requests.get(self.config.source_playlist_url) @@ -44,7 +44,7 @@ def get_source_playlist(self): song = detail.select("span[class='songlist__songname_txt']")[0].text singer = detail.select("div[class='songlist__artist']")[0].text song_details.append((clear_string(song), clear_string(singer), '')) - print "get qq playlist success" + print("get qq playlist success") self.source_playlist = song_details def get_target_playlist(self): diff --git a/README.md b/README.md index 49f6161..2f1c103 100644 --- a/README.md +++ b/README.md @@ -17,8 +17,7 @@ Sync playlist between WY and QQ. ### Step 1: input config -input account config in `config.json`.qq account or wy email account - +input config in `config.json`. * If you choose WY to QQ: 1. add your qq account and password in `config.json`[account, password] @@ -37,11 +36,10 @@ run `python run.py` > If you are not sure how to input the correct url config, please see the screenshot in dir `example`. Or you can email me. ### windows exe -1. DO #step 1 -2. unzip win32.zip -3. modify `win32/config.json` according #Step 2. It's better to visit http but not https, I don't know why it will raise IOError when visit https in windows console. -4. run `win32/run.exe` -5. according the notice, input the driver absolute path and chose sync mode. +1. unzip win32.rar +2. Input config in `win32/config.json` according step1 +3. run `win32/run.exe` +4. according the notice, chose sync mode. --------------- ## debug diff --git a/WYtoQQ.py b/WYtoQQ.py index 06b45f7..900c3b0 100644 --- a/WYtoQQ.py +++ b/WYtoQQ.py @@ -34,7 +34,7 @@ def prepare(self): self.wait.until(lambda browser: browser.find_element_by_class_name("popup_user")) user_info = self.browser.find_element_by_class_name("popup_user") user_info.find_element_by_css_selector("*") - print "login sucess" + print("login sucess") def get_source_playlist(self): url = self.config.source_playlist_url.replace('#', 'm') @@ -64,7 +64,7 @@ def get_source_playlist(self): # # don't use album yet # album = '' # song_details.append((song, singer.strip('\n'), album)) - print "get 163 playlist success" + print("get 163 playlist success") self.source_playlist = song_details def get_target_playlist(self): diff --git a/base.py b/base.py index 875da20..b671746 100644 --- a/base.py +++ b/base.py @@ -65,8 +65,8 @@ def sync_song(self): pass def print_result(self): - print "total success:{}".format(len(self.success_list)) - print "total failed:{}, detail:".format(len(self.failed_list)) + print("total success:{}".format(len(self.success_list))) + print("total failed:{}, detail:".format(len(self.failed_list))) for failed in self.failed_list: _print(failed) diff --git a/my_setup.py b/my_setup.py index 07d0147..f90920d 100644 --- a/my_setup.py +++ b/my_setup.py @@ -6,7 +6,7 @@ console=["run.py"], data_files=[ (r'.', glob(r'D:\myproject\syncPlaylist\config.json')), - (r'.', glob(r'D:\ProgramData\Anaconda3\envs\python27\Lib\site-packages\selenium\webdriver\remote\getAttribute.js')), - (r'.', glob(r'D:\ProgramData\Anaconda3\envs\python27\Lib\site-packages\selenium\webdriver\remote\isDisplayed.js')) + (r'.', glob(r'D:\Anaconda3\envs\py27\Lib\site-packages\selenium\webdriver\remote\getAttribute.js')), + (r'.', glob(r'D:\Anaconda3\envs\py27\Lib\site-packages\selenium\webdriver\remote\isDisplayed.js')) ] ) \ No newline at end of file diff --git a/run.py b/run.py index a9c4648..cc0b686 100644 --- a/run.py +++ b/run.py @@ -9,7 +9,7 @@ "Darwin": "https://bitbucket.org/ariya/phantomjs/downloads/phantomjs-2.1.1-macosx.zip" # Mac OS } driver_zip_file = { - "Windows": "phantomjs-2.1.1-macosx.zip", + "Windows": "phantomjs-2.1.1-windows.zip", "Darwin": "phantomjs-2.1.1-macosx.zip" } default_driver_path = { @@ -27,8 +27,9 @@ raise Exception("Please Download driver first!!!") unzip(zip_file_path, 'driver') driver_path = default_driver_path[current_os] - st = os.stat(driver_path) - os.chmod(driver_path, st.st_mode | stat.S_IEXEC) + if current_os != "Windows": + st = os.stat(driver_path) + os.chmod(driver_path, st.st_mode | stat.S_IEXEC) settings.phantomjs_driver_path = driver_path mode = raw_input("Please select sync mode(1: from WY to QQ; 2: from QQ to WY)") if mode in ("1", 1): diff --git a/utils.py b/utils.py index 0f1e9bd..cab863f 100644 --- a/utils.py +++ b/utils.py @@ -28,7 +28,7 @@ def inner_wrapper(*args, **kwargs): if current >= retry_times: raise RetryException() if notice_message: - print notice_message + print(notice_message) current += 1 return inner_wrapper return wrapper @@ -42,7 +42,7 @@ def download(file_path): f = open(phantomjs_file, 'wb') meta = u.info() file_size = int(meta.getheaders("Content-Length")[0]) - print "Downloading: %s Bytes: %s" % (phantomjs_file, file_size) + print("Downloading: %s Bytes: %s" % (phantomjs_file, file_size)) file_size_dl = 0 block_sz = 8192 @@ -53,7 +53,7 @@ def download(file_path): file_size_dl += len(buffer) f.write(buffer) status = "%10d [%3.2f%%]" % (file_size_dl, file_size_dl * 100. / file_size) - print status + print(status) f.close() return phantomjs_file @@ -66,7 +66,7 @@ def unzip(zip_file, file_path): def _print(msg): - print msg.encode('utf8') + print(msg.encode('utf8')) def clear_string(text): diff --git a/win32.rar b/win32.rar new file mode 100644 index 0000000..4f6f7c0 Binary files /dev/null and b/win32.rar differ diff --git a/win32.zip b/win32.zip deleted file mode 100644 index b368227..0000000 Binary files a/win32.zip and /dev/null differ