Skip to content
This repository has been archived by the owner on Dec 17, 2019. It is now read-only.

修复各种网络错误 #259

Open
wants to merge 46 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
46 commits
Select commit Hold shift + click to select a range
ae9912a
1.修复中文验证码无法通过校验问题
Sep 23, 2016
65baa66
1.修复中文验证码无法通过校验问题
Sep 23, 2016
b8787e6
已经基本修复各种网络错误
Sep 23, 2016
87f628c
验证码问题,需要解决,考虑改写Qt吧
Oct 7, 2016
827b3b3
验证码问题
Nov 18, 2016
ed162eb
头像修复
Nov 25, 2016
2dccc6c
头像
Nov 25, 2016
8270aab
edit .gitignore
xbbsky Dec 2, 2016
4cfbe99
Merge pull request #1 from xbbsky/master
Dec 15, 2016
656acc1
readme
Dec 15, 2016
12aa270
Merge remote-tracking branch 'origin/master'
Dec 15, 2016
949ab07
readme
Dec 15, 2016
77f023c
readme
Dec 15, 2016
0484ce3
readme
Dec 15, 2016
7b90fe6
修复最近出现的无法登录
Feb 12, 2017
182d6bf
继续修复登录错误
Mar 9, 2017
3847155
修复get_user_uk错误
Mar 9, 2017
f6fcb3b
update readme
Apr 5, 2017
160a487
update gitigro
Apr 5, 2017
4ec6da0
Create .travis.yml
Apr 5, 2017
6b97b79
Update .travis.yml
Apr 5, 2017
88a0de6
Update .travis.yml
Apr 5, 2017
eeb558f
Update .travis.yml
Apr 5, 2017
63f5458
cookies 有效期修改为1个月
Apr 6, 2017
e5b5cdf
merge bug-cookies
Apr 6, 2017
a0e40f3
merge develop
Apr 6, 2017
eb96024
Merge branch 'master' of github.com:Yufeikang/bcloud
Apr 6, 2017
39545ae
更正上传页面“删除选中的任务”的提示信息
wkcn May 10, 2017
6af75b4
Merge pull request #12 from wkcn/master
May 11, 2017
cb5c7c7
Refresh translations
hosiet May 26, 2017
2e60b5a
Update Simplified Chinese translation.
hosiet May 26, 2017
1169dad
Merge pull request #22 from debiancn/upstream
May 27, 2017
3b08c30
fix #23
Jun 1, 2017
4d19e37
fix issues-23
Jun 1, 2017
378ad4f
fix issues-23
Jun 1, 2017
42c0748
fix #24
Jun 1, 2017
cc5cd5a
fix issues-24
Jun 1, 2017
e034caa
fix issues-24
Jun 1, 2017
474c387
add requirements.txt fix #33
Jun 16, 2017
ef4be49
merge issues-33
Jun 16, 2017
6bf9876
缺少lxml依赖
Jun 19, 2017
2579a71
merge issues-37
Jun 19, 2017
b9d75ce
debian packaging for forked bcloud.
hosiet Jun 28, 2017
d6a6000
Merge pull request #39 from debiancn/master
Jun 28, 2017
8845bd4
Update README.md
Nov 9, 2017
f166e70
Update README.md
Nov 9, 2017
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
49 changes: 48 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1 +1,48 @@
test/
*.pyc
__pycache__
# Built application files
*.apk
*.ap_

# Files for the ART/Dalvik VM
*.dex

# Java class files
*.class

# Generated files
bin/
gen/
out/

# Gradle files
.gradle/
build/

# Local configuration file (sdk path, etc)
local.properties

# Proguard folder generated by Eclipse
proguard/

# Log Files
*.log

# Android Studio Navigation editor temp files
.navigation/

# Android Studio captures folder
captures/

# Intellij
*.iml
.idea/workspace.xml
.idea/tasks.xml
.idea/gradle.xml
.idea/libraries
.idea/
# Keystore files
*.jks

# External native build folder generated in Android Studio 2.2 and later
.externalNativeBuild
14 changes: 14 additions & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
language: python
python:
- "3.2"
- "3.3"
- "3.4"
- "3.5"
- "3.6"
# command to install dependencies
install:
# Build/test dependencies
#- pip3 install -r requirements.txt
# Get fab to test fab
- python setup.py install

4 changes: 4 additions & 0 deletions HISTORY
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
v3.9.0 - 2016.11.25
* 修复各种网络错误 (by @Yufeikang).
* 修复验证码问题 (by @Yufeikang).

v3.8.2 - 2015.12.25
* Fixed: failed to get bdstoken (pull#214, by @zhaihj).

Expand Down
30 changes: 28 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,21 @@
# 公告

很遗憾这个项目要和大家说再见了,因为下列原因:

*1.这个项目使用的是百度webAPi,api不稳定经常变动
*2.这个项目的界面构建语言是GTK,跨平台性能差,不易扩展

结束并不代表彻底结束,因为身在墙内,不可避免还不得不依赖百度网盘。最近没时间去调试百度的api,一直使用的是baidupcs的命令行版本,一直很稳定,作者也一直很勤劳的维护。而且baidupcs可以使用多线程加快下载速度。我使用的过程中速度还比较满意。所以,打算新开一个项目,使用electrion和react来构建GUI界面,使用baidupcs作为核心引擎构建一个全新的,跨平台的百度网盘自由版。

**所谓重生吧,因为我的个人时间有限。希望有兴趣的朋友可以和我一起加入到这个项目一起开发,一起学习。另外,如果有朋友比较擅长做UI或者交互,可以贡献力量的欢迎👏加入。希望我们能做出漂亮又实用的工具**


关于
=====
bcloud 是[百度网盘](http://pan.baidu.com)的Linux桌面客户端.

>[原项目地址](https://github.com/LiuLang/bcloud),大神@Liulang很久没有维护了。最近迁移到linux平台发现了这个好工具,还好自己学过Python,稍微修改了一下,现在可以使用了。如果没有大的变故,我来维护这个项目,方便国内的Linux党。如有问题,欢迎issues

已经支持的Linux系统/版本:

* ArchLinux
Expand All @@ -14,9 +28,11 @@ bcloud 是[百度网盘](http://pan.baidu.com)的Linux桌面客户端.
* OpenSuse 13
* Ubuntu 14.04
* Ubuntu 13.10
* Ubuntu 16.04
* Linux Mint 17



类似项目
=======
[bypy](https://github.com/houtianze/bypy) 终端里使用的百度网盘客户端, 它
Expand All @@ -28,8 +44,18 @@ bcloud 是[百度网盘](http://pan.baidu.com)的Linux桌面客户端.

安装
=======
请用户直接到 [bcloud-packages](https://github.com/LiuLang/bcloud-packages)
下载发行版相对应的安装包, 比如deb, rpm等..
需要Python3支持
安装执行:
```
python3 setup.py install
```
卸载执行:
```bash
python setup.py install --record files.txt #记录安装后文件的路径

cat files.txt | xargs rm -rf #删除这些文件
```
**最近有不少用户反馈安装后无法启动,原因大多数是因为缺少某些依赖的模块。我已经添加了部分依赖到requiements.txt文件中。如还有报错请大家issues的时候附上log**

Q&A
===
Expand Down
38 changes: 22 additions & 16 deletions bcloud/App.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@

# Copyright (C) 2014-2015 LiuLang <[email protected]>
# Use of this source code is governed by GPLv3 license that can be found
# in http://www.gnu.org/licenses/gpl-3.0.html
Expand All @@ -9,17 +8,21 @@
import traceback

import gi

gi.require_version('Gdk', '3.0')
from gi.repository import Gdk
from gi.repository import Gio
from gi.repository import GLib
from gi.repository import GObject

gi.require_version('Gtk', '3.0')
from gi.repository import Gtk

gi.require_version('Notify', '0.7')
from gi.repository import Notify

from bcloud import Config

Config.check_first()
_ = Config._
from bcloud import const
Expand All @@ -41,16 +44,18 @@
from bcloud.FileWatcher import WatchFileChange

try:
# Ubuntu Unity uses appindicator instead of status icon
# Ubuntu Unity uses appindicator instead of status icon
import gi

gi.require_version('AppIndicator3', '0.1')
from gi.repository import AppIndicator3 as AppIndicator
except ImportError:
logger.debug(traceback.format_exc())


if Config.GTK_LE_36:
GObject.threads_init()
(ICON_COL, NAME_COL, TOOLTIP_COL, COLOR_COL) = list(range(4))
BLINK_DELTA = 250 # 字体闪烁间隔, 250 miliseconds
BLINK_DELTA = 250 # 字体闪烁间隔, 250 miliseconds
BLINK_SUSTAINED = 3 # 字体闪烁持续时间, 5 seconds

# 用于处理拖放上传
Expand All @@ -61,7 +66,6 @@


class App:

profile = None
cookie = None
tokens = None
Expand Down Expand Up @@ -174,7 +178,7 @@ def on_app_startup(self, app):
key, mod = Gtk.accelerator_parse('F5')
self.window.connect('activate-default', self.reload_current_page)
self.window.add_accelerator('activate-default',
self.accel_group, key, mod, Gtk.AccelFlags.VISIBLE)
self.accel_group, key, mod, Gtk.AccelFlags.VISIBLE)

def on_app_activate(self, app):
if not self.profile:
Expand Down Expand Up @@ -312,6 +316,7 @@ def update_quota(self, quota_info, error=None):

def update_avatar(self):
'''更新用户头像'''

def do_update_avatar(info, error=None):
if error or not info:
logger.error('Failed to get user avatar: %s, %s' %
Expand All @@ -323,6 +328,7 @@ def do_update_avatar(info, error=None):
self.profile['username'],
uname,
])

if not self.profile['display-avatar']:
return
self.img_avatar.props.tooltip_text = ''
Expand Down Expand Up @@ -375,7 +381,7 @@ def init_filewatcher(self):
enable_sync = self.profile['enable-sync']
if enable_sync:
sync_dir = self.profile['sync-dir']
#self.filewatcher = WatchFileChange(sync_dir, self.upload_page.add_bg_task)
# self.filewatcher = WatchFileChange(sync_dir, self.upload_page.add_bg_task)
self.filewatcher = WatchFileChange(sync_dir, self)
self.filewatcher.start()

Expand Down Expand Up @@ -411,8 +417,8 @@ def on_nav_selection_changed(self, nav_selection):
def init_status_icon(self):
def on_status_icon_popup_menu(status_icon, event_button, event_time):
menu.popup(None, None,
lambda a,b: Gtk.StatusIcon.position_menu(menu, status_icon),
None, event_button, event_time)
lambda a, b: Gtk.StatusIcon.position_menu(menu, status_icon),
None, event_button, event_time)

def on_status_icon_activate(status_icon):
if self.window.props.visible:
Expand All @@ -433,15 +439,15 @@ def on_status_icon_activate(status_icon):
menu.append(sep_item)

pause_upload_item = Gtk.MenuItem.new_with_label(
_('Pause Upload Tasks'))
_('Pause Upload Tasks'))
pause_upload_item.connect('activate',
lambda item: self.upload_page.pause_tasks())
lambda item: self.upload_page.pause_tasks())
menu.append(pause_upload_item)

pause_download_item = Gtk.MenuItem.new_with_label(
_('Pause Download Tasks'))
_('Pause Download Tasks'))
pause_download_item.connect('activate',
lambda item: self.download_page.pause_tasks())
lambda item: self.download_page.pause_tasks())
menu.append(pause_download_item)

sep_item = Gtk.SeparatorMenuItem()
Expand All @@ -456,8 +462,8 @@ def on_status_icon_activate(status_icon):

if 'AppIndicator' in globals():
self.status_icon = AppIndicator.Indicator.new(Config.NAME,
Config.NAME,
AppIndicator.IndicatorCategory.APPLICATION_STATUS)
Config.NAME,
AppIndicator.IndicatorCategory.APPLICATION_STATUS)
self.status_icon.set_menu(menu)
self.status_icon.set_status(AppIndicator.IndicatorStatus.ACTIVE)
else:
Expand All @@ -476,7 +482,7 @@ def blink():
row[COLOR_COL] = self.default_color
return False
return True

start_time = time.time()
for index, p in enumerate(self.notebook):
if p == page:
Expand Down
16 changes: 12 additions & 4 deletions bcloud/Config.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@

# Copyright (C) 2014-2015 LiuLang <[email protected]>
# Use of this source code is governed by GPLv3 license that can be found
# in http://www.gnu.org/licenses/gpl-3.0.html
Expand Down Expand Up @@ -35,8 +34,10 @@
DBUS_APP_NAME = 'org.liulang.bcloud'
APPNAME = 'BCloud'
VERSION = bcloud.__version__
HOMEPAGE = 'https://github.com/LiuLang/bcloud'
# https://github.com/LiuLang/bcloud/pulls
'''
LiuLang大神不知什么原因不再维护该代码了。我来试试
'''
HOMEPAGE = 'https://github.com/Yufeikang/bcloud'
AUTHORS = [
'Alexzhang <[email protected]>',
'Aetf <[email protected]>',
Expand All @@ -50,8 +51,9 @@
'Zhenbo Li <[email protected]>',
'slawdan <[email protected]>',
'Zihao Wang <[email protected]>',
'Kang <[email protected]>'
]
COPYRIGHT = 'Copyright (c) 2014-2015 LiuLang'
COPYRIGHT = 'Copyright (c) 2014-2016 LiuLang'
DESCRIPTION = _('Baidu Pan client for GNU/Linux desktop users.')

CACHE_DIR = os.path.join(HOME_DIR, '.cache', NAME)
Expand All @@ -68,13 +70,15 @@
'profiles': [],
}


def check_first():
'''这里, 要创建基本的目录结构'''
if not os.path.exists(CONF_DIR):
os.makedirs(CONF_DIR, exist_ok=True)
if not os.path.exists(CACHE_DIR):
os.makedirs(CACHE_DIR, exist_ok=True)


def load_conf():
'''获取基本设定信息, 里面存放着所有可用的profiles, 以及默认的profile'''
if os.path.exists(_conf_file):
Expand All @@ -84,24 +88,28 @@ def load_conf():
dump_conf(_base_conf)
return _base_conf


def dump_conf(conf):
with open(_conf_file, 'w') as fh:
json.dump(conf, fh)


def get_cache_path(profile_name):
'''获取这个帐户的缓存目录, 如果不存在, 就创建它'''
path = os.path.join(CACHE_DIR, profile_name, 'cache')
if not os.path.exists(path):
os.makedirs(path, exist_ok=True)
return path


def get_tmp_path(profile_name):
'''获取这个帐户的临时文件目录, 可以存放验证码图片, 上传时的文件分片等'''
path = os.path.join(CACHE_DIR, profile_name, 'tmp')
if not os.path.exists(path):
os.makedirs(path, exist_ok=True)
return path


def load_color_schema():
if not os.path.exists(COLOR_SCHEMA):
return []
Expand Down
Loading