Skip to content

Commit

Permalink
add win32 exe
Browse files Browse the repository at this point in the history
  • Loading branch information
Denon committed Jul 13, 2017
1 parent d07db86 commit 0931aa4
Show file tree
Hide file tree
Showing 9 changed files with 21 additions and 22 deletions.
4 changes: 2 additions & 2 deletions QQtoWY.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand All @@ -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):
Expand Down
12 changes: 5 additions & 7 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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]
Expand All @@ -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
Expand Down
4 changes: 2 additions & 2 deletions WYtoQQ.py
Original file line number Diff line number Diff line change
Expand Up @@ -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')
Expand Down Expand Up @@ -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):
Expand Down
4 changes: 2 additions & 2 deletions base.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)

Expand Down
4 changes: 2 additions & 2 deletions my_setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -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'))
]
)
7 changes: 4 additions & 3 deletions run.py
Original file line number Diff line number Diff line change
Expand Up @@ -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 = {
Expand All @@ -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):
Expand Down
8 changes: 4 additions & 4 deletions utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
Expand All @@ -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

Expand All @@ -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):
Expand Down
Binary file added win32.rar
Binary file not shown.
Binary file removed win32.zip
Binary file not shown.

0 comments on commit 0931aa4

Please sign in to comment.