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

哥们~~help me... #47

Closed
hbykdx2014 opened this issue Sep 11, 2014 · 4 comments
Closed

哥们~~help me... #47

hbykdx2014 opened this issue Sep 11, 2014 · 4 comments
Labels

Comments

@hbykdx2014
Copy link

我有一个小小的想法,纵观全网,只有你可能能help me 了~~.
你帮忙开发一个展示百度网盘内容结构的软件或者插件吧~~

就是软件夹套叠关系...

比如  树枝结构~~  类似/ home var etc....

我不是搞it的,所以表达很不清楚~~希望你能明白我的意思

就是让别人清楚知道我这个盘里有什么...能自动生成关系图那就是屌爆了..

O(∩_∩)O谢谢   [email protected]等待你的回复哦~~

@LiuLang
Copy link
Collaborator

LiuLang commented Sep 11, 2014

On 09/11/2014 09:40 PM, hbykdx2014 wrote:

我有一个小小的想法,纵观全网,只有你可能能help me 了~~.
你帮忙开发一个展示百度网盘内容结构的软件或者插件吧~~

就是软件夹套叠关系...

比如  树枝结构~~  类似/ home var etc....

我不是搞it的,所以表达很不清楚~~希望你能明白我的意思

就是让别人清楚知道我这个盘里有什么...能自动生成关系图那就是屌爆了..

O(∩_∩)O谢谢   [email protected]等待你的回复哦~~


Reply to this email directly or view it on GitHub:
#47

像这样的?
file:///proc
|-- 1
| |-- attr
| | |-- current
| | |-- exec
| | |-- fscreate
| | |-- keycreate
| | |-- prev
| | `-- sockcreate
| |-- autogroup
| |-- auxv
| |-- cgroup
| |-- clear_refs
| |-- cmdline
| |-- comm
| |-- coredump_filter
| |-- cpuset
| |-- cwd -> (null)
| |-- environ
| |-- exe -> (null)
| |-- fd
| | [Permission denied]
| |-- fdinfo
| | [Permission denied]
| |-- gid_map
| |-- io
| |-- limits
| |-- loginuid
| |-- map_files
| | [Permission denied]
| |-- maps
| |-- mem
| |-- mountinfo
| |-- mounts
| |-- mountstats
| |-- net

@hbykdx2014
Copy link
Author

√,非常对~~ 能表示这种关系就行.

2014-09-11 21:58 GMT+08:00 LiuLang [email protected]:

On 09/11/2014 09:40 PM, hbykdx2014 wrote:

我有一个小小的想法,纵观全网,只有你可能能help me 了~~.
你帮忙开发一个展示百度网盘内容结构的软件或者插件吧~~

就是软件夹套叠关系...

比如 树枝结构~~ 类似/ home var etc....

我不是搞it的,所以表达很不清楚~~希望你能明白我的意思

就是让别人清楚知道我这个盘里有什么...能自动生成关系图那就是屌爆了..

O(∩_∩)O谢谢 [email protected]等待你的回复哦~~


Reply to this email directly or view it on GitHub:
#47

像这样的?
file:///proc
|-- 1
| |-- attr
| | |-- current
| | |-- exec
| | |-- fscreate
| | |-- keycreate
| | |-- prev
| | `-- sockcreate
| |-- autogroup
| |-- auxv
| |-- cgroup
| |-- clear_refs
| |-- cmdline
| |-- comm
| |-- coredump_filter
| |-- cpuset
| |-- cwd -> (null)
| |-- environ
| |-- exe -> (null)
| |-- fd
| | [Permission denied]
| |-- fdinfo
| | [Permission denied]
| |-- gid_map
| |-- io
| |-- limits
| |-- loginuid
| |-- map_files
| | [Permission denied]
| |-- maps
| |-- mem
| |-- mountinfo
| |-- mounts
| |-- mountstats
| |-- net


Reply to this email directly or view it on GitHub
#47 (comment).

@LiuLang
Copy link
Collaborator

LiuLang commented Sep 12, 2014

写了一个小脚本, 使用方法是:
先安装bcloud, 然后把下面的脚本保成bcloud-tree.py, 然后在终端里运行它:
$ python3 bcloud-tree.py
会弹出登录窗口, 登录后就自动遍历你的网盘目录, 并将内容输入到终端, 你也可以将输出的内容重定向到一个文件里, 比如:
$ python3 bcloud-tree.py > my-bcloud-tree
如果需要, 也可以自定义输入格式, 只需要修改一下tree()函数就行了.

#!/usr/bin/env python3

# Copyright (C) 2014 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

'''
Traverse directories of Baidu Pan
'''

import sys

from gi.repository import Gtk

from bcloud import gutil
from bcloud import pcs
from bcloud.SigninDialog import SigninDialog


class App(object):

    def __init__(self):
        self.app = Gtk.Application.new('org.liulang.bcloud_tree', 0)
        self.app.connect('startup', self.on_app_startup)
        self.app.connect('activate', self.on_app_activate)
        self.app.connect('shutdown', self.on_app_shutdown)
        self.profile = None

    def run(self):
        self.app.run([])

    def on_app_startup(self, app):
        self.window = Gtk.ApplicationWindow.new(app)
        self.window.set_default_size(200, 200)
        self.app.add_window(self.window)

        self.label = Gtk.Label()
        self.label.set_text('Signin ...')
        self.window.add(self.label)

    def on_app_activate(self, app):
        self.window.show_all()
        dialog = SigninDialog(self, auto_signin=False)
        dialog.run()
        dialog.destroy()
        if self.cookie and self.tokens:
            self.label.set_text('Fetching directory tree now...')
            gutil.async_call(self.tree, callback=self.on_list_dir_finished)
        else:
            self.label.set_text('Failed to sign in')

    def on_app_shutdown(self, app):
        pass

    def tree(self, parent='/', indent=0):
        parent_, files = pcs.list_dir_all(self.cookie, self.tokens, parent)
        indent_str = ' ' * indent
        for file_ in files:
            suf = '/' if file_['isdir'] else ''
            print(indent_str, file_['server_filename'], suf, sep='')
            if file_['isdir']:
                self.tree(file_['path'], indent + 2)

    def on_list_dir_finished(self, *args):
        self.label.set_text('Finished!')

if __name__ == '__main__':
    app = App()
    app.run()

@hbykdx2014
Copy link
Author

钦佩,感激[?]

On Fri, Sep 12, 2014 at 1:04 PM, LiuLang [email protected] wrote:

写了一个小脚本, 使用方法是:
先安装bcloud, 然后把下面的脚本保成bcloud-tree.py, 然后在终端里运行它:
$ python3 bcloud-tree.py
会弹出登录窗口, 登录后就自动遍历你的网盘目录, 并将内容输入到终端, 你也可以将输出的内容重定向到一个文件里, 比如:
$ python3 bcloud-tree.py > my-bcloud-tree
如果需要, 也可以自定义输入格式, 只需要修改一下tree()函数就行了.

#!/usr/bin/env python3

Copyright (C) 2014 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

'''
Traverse directories of Baidu Pan
'''

import sys

from gi.repository import Gtk

from bcloud import gutil
from bcloud import pcs
from bcloud.SigninDialog import SigninDialog

class App(object):

def __init__(self):
    self.app = Gtk.Application.new('org.liulang.bcloud_tree', 0)
    self.app.connect('startup', self.on_app_startup)
    self.app.connect('activate', self.on_app_activate)
    self.app.connect('shutdown', self.on_app_shutdown)
    self.profile = None

def run(self):
    self.app.run([])

def on_app_startup(self, app):
    self.window = Gtk.ApplicationWindow.new(app)
    self.window.set_default_size(200, 200)
    self.app.add_window(self.window)

    self.label = Gtk.Label()
    self.label.set_text('Signin ...')
    self.window.add(self.label)

def on_app_activate(self, app):
    self.window.show_all()
    dialog = SigninDialog(self, auto_signin=False)
    dialog.run()
    dialog.destroy()
    if self.cookie and self.tokens:
        self.label.set_text('Fetching directory tree now...')
        gutil.async_call(self.tree, callback=self.on_list_dir_finished)
    else:
        self.label.set_text('Failed to sign in')

def on_app_shutdown(self, app):
    pass

def tree(self, parent='/', indent=0):
    parent_, files = pcs.list_dir_all(self.cookie, self.tokens, parent)
    indent_str = ' ' * indent
    for file_ in files:
        suf = '/' if file_['isdir'] else ''
        print(indent_str, file_['server_filename'], suf, sep='')
        if file_['isdir']:
            self.tree(file_['path'], indent + 2)

def on_list_dir_finished(self, *args):
    self.label.set_text('Finished!')

if name == 'main':
app = App()
app.run()


Reply to this email directly or view it on GitHub
#47 (comment).

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

No branches or pull requests

2 participants