Giter Site home page Giter Site logo

btsyncindicator's Introduction

btsyncindicator's People

Contributors

beardicus avatar cpbotha avatar flexiondotorg avatar leoetlino avatar marxjohnson avatar pilin avatar tuxpoldo avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

btsyncindicator's Issues

Sometimes 2 instances are started

Sometime 2 instances of btsyncindicator are started. I don't know when this happens. Here the processes after a fresh boot of Ubuntu 12.04 at the first login:

jochen 2688 1 0 08:01 ? 00:00:00 python /usr/lib/btsync-user/btsyncindicator.py --config /home/jochen/.btsync.conf --iconpath /usr/share/icons/hicolor/22x22/status
jochen 2691 1 0 08:01 ? 00:00:00 /bin/sh /usr/lib/btsync-user/btsync-starter
jochen 2699 2691 0 08:01 ? 00:00:00 python /usr/lib/btsync-user/btsyncindicator.py --config /home/jochen/.btsync.conf --iconpath /usr/share/icons/hicolor/22x22/status
jochen 2708 1 0 08:01 ? 00:00:01 /usr/lib/btsync-user/btsync-agent --config /home/jochen/.btsync.conf

Process no. 2699 is started by btsync-starter. But who starts process no. 2688? This is started before launch of btsync-starter, and this is not in my startup programs.

Update dependencies for KDE Plasma 5

Under KDE Plasma 5 (plasma-next) on Arch Linux, libappindicator is necessary for the tray icon to show up. Maybe add this as a dependency?

On second thought, it would be better as an optional dependency, because libappindicator doesn't always build happily.

Menuitem "Enable Debug Logging" does not work as expected

There are two problems related with the implementation of the menu item "Enable Debug Logging".

  1. If verbose debug logging of btsync was activated/deactivated by the user of by another tool (e.g.: /usr/bin/btsync setdebug on), the menu is not updated to reflect the current state.
  2. Even wrong: when btsyncindicator is started, the menu item is always unchecked (also if btsync debug logging is enabled). When the menu item is selected by the user, the connected function toggles the btsync debug logging state and switches the checked state of the menu. In such a case, the checkmark always shows the wrong state.

Doesn't work properly in Ubuntu 13.10

btsyncindicator doesn't display the sync status, etc. in Ubuntu 13.10 Saucy Salamander. Here's how it looks like:

btsyncindicator

I'm using the latest version from the PPA: 1.1.70-4~saucy

Communication Error after updating to BitTorrent Sync 1.4

Reported by forum user krychek:

I'm having a problem on two Ubuntu 14.04 boxes after the latest btsync update:

hostname$ btsync start
hostname$ BitTorrent Sync forked to background. pid = 8506. default port = 8888
WARNING:root:Communication Error caught, displaying error message
WARNING:root:Communication Error caught, displaying error message

I also have an exclamation mark in the btsync icon and and error message: Communication Error 400.

btsyncindicator crash

Reported by M. van Workum via Launchpad:

Hi Leo,

The btsync indicator seems to crash constantly. I does show the indicator with it's menu to open the web interface, but no syncing data.

Traceback (most recent call last):

 File "/usr/lib/btsync-user/btsyncindicator.py", line 220, in
setup_session
   self.token = r.group(1)
AttributeError: 'NoneType' object has no attribute 'group'

I'm using ubuntu 13.10 with gnome-shell. Hope you can do something with this information.

Cheers,

M. van Workum

TypeError on Debian Wheezy

On start the indicator throws this exception:

Traceback (most recent call last):
  File "/usr/lib/btsync-user/btsyncindicator.py", line 254, in setup_session
    self.info[a] = self.get_response_json(response)
  File "/usr/lib/btsync-user/btsyncindicator.py", line 650, in get_response_json
    response_json = response.json()
TypeError: 'dict' object is not callable

Apparently it seems not to have any visible effects, but who knows

Wrong. It has effects. No folders are shown...

Debian Packaging detection too slow

Reported by [email protected]

Hello Leo, Mark!

I'm using bt-sync in ubuntu you're build as PPA. Thank you for your work.
But I've mentioned that daemon started too slow on my laptop (HDD, encrypted partition - slow IO).
I've checked up the source and found that you were using dpkg -S to find what package contains file and later checks if it was btsync-user.
dpkg -S btsyncindicator.py works too slow, it has to process lots of data to make answer. You only want to know if btsync-user is installed.
I advice you to check dpkg -s btsync-user (lowercased "s") - it returns 0 exit code if package is installed, nonzero otherwise. Ant works 100 times faster on my system.

Internal error on certain distributions

Verified on a freshly installed Debian Wheezy. After installing and starting:

BitTorrent Sync forked to background. pid = 19493
/usr/lib/btsync-user/btsyncindicator.py:137: Warning: /build/buildd-glib2.0_2.33.12+really2.32.4-5-i386-eISom6/glib2.0-2.33.12+really2.32.4/./gobject/gsignal.c:2459: signal `child-added' is invalid for instance `0x9798020'
  self.ind.set_menu(self.menu)

At least on Debian it seems not to produce any side effects but it may have some relationship with what's reported here: http://forum.bittorrent.com/topic/19560-debian-and-ubuntu-desktop-unofficial-packages-for-bittorrent-sync/?p=78179

Password parsing

First off thank you for making btsyncindicator, it is a nice tool. I just discovered that the reason I was getting folder statistics on one computer and no statistics and a "!" in the icon was because my password contained a "#" character. After replacing this character in my password and restarting both btsync and btsyncindicator I got the normal statistics. This probably indicates that the password (and perhaps other config values) isn't being parsed out in a reliable manner.

Icon not showing on Gnome 3.8

I just tried this on my setup, and it's working fine save for the fact that no icon appears on the tray button.

This is on Gnome 3.8 on Debian unstable.

I've taken a screenshot. In it you can see the area correctly highlighted, and pressing it shows the menu. There's just an icon missing there :-)

screenshot from 2013-11-14 17 26 19

btsyncindicator not working anymore since latest update (ubuntu ppa)

To produce more log output I modified btsync-starter to add the option --log info when starting the btsyncindicator.py (is this the only way to do it or is there an official way to enable logging of the python script?) and then when I start it the following happens:

--(bernd@Saturn)-(/home/bernd)--
--($)-- btsync start
--(bernd@Saturn)-(/home/bernd)--
--($)-- BitTorrent Sync forked to background. pid = 2557
INFO:root:Opening config file /home/bernd/.config/btsync/btsync-auto.conf
INFO:root:Config loaded
INFO:root:Creating menu
INFO:root:Menu initalisation complete
INFO:root:Requesting Token from http://127.0.0.1:9999/gui/token.html
INFO:requests.packages.urllib3.connectionpool:Starting new HTTP connection (1): 127.0.0.1
INFO:root:Token response <Response [200]>
INFO:root:HTML Response <html><div id='token' style='display:none;'>BuZa4-Bq65kQu7quPGr4pKHyi8imqUNK2Mkc9w3cthOqrBYUsKHczNYXClMAAAAA</div></html>
INFO:root:Token BuZa4-Bq65kQu7quPGr4pKHyi8imqUNK2Mkc9w3cthOqrBYUsKHczNYXClMAAAAA Retrieved
INFO:requests.packages.urllib3.connectionpool:Starting new HTTP connection (1): 127.0.0.1
Traceback (most recent call last):
  File "/usr/lib/btsync-user/btsyncindicator.py", line 254, in setup_session
    self.info[a] = response.json()
AttributeError: 'Response' object has no attribute 'json'

At the same time a yellow KDE notification icon pops up in the notification area (translated from german back into english it reads something like: "an application on your system has crashed (either right now or some time ago)" and the btsyncindicator icon only contains the menu entries "pause syncing", "open web interface", "enable debug logging", "quit bittorrent sync" and it is missing the menu for my shared folders and also does not detect activity (icon not spinning anymore).

These symptoms started happening today after I got a new update from the ppa.

Error with readonly folders

When I startup btsync, I get the error:

Traceback (most recent call last):
 File "/usr/lib/btsync-user/btsyncindicator.py", line 302, in check_status
   submenu = self.build_folder_menu(folder)
 File "/usr/lib/btsync-user/btsyncindicator.py", line 406, in build_folder_menu
   readonly.connect("activate", self.copy_secret,folder['readonlysecret'])
KeyError: 'readonlysecret'

The first folder in my btsync directory is read-only. This seems to fix the issue for me:

--- btsyncindicator.py  2013-11-16 05:20:36.000000000 -0500
+++ btsyncindicator.py 2014-01-23 09:48:11.735236159 -0500
@@ -402,19 +402,20 @@
       menu.append(sep)
       folderitem['bottomsepitem'] = sep
-      readonly = gtk.MenuItem('Get Read Only Secret')
-      readonly.connect("activate", self.copy_secret, folder['readonlysecret'])
-      readwrite = gtk.MenuItem('Get Full Access Secret')
-      readwrite.connect("activate", self.copy_secret, folder['secret'])
+      if folder['iswritable']:
+              readonly = gtk.MenuItem('Get Read Only Secret')
+              readonly.connect("activate", self.copy_secret, folder['readonlysecret'])
+              readwrite = gtk.MenuItem('Get Full Access Secret')
+              readwrite.connect("activate", self.copy_secret, folder['secret'])
-      readonly.show()
-      readwrite.show()
+              readonly.show()
+              readwrite.show()
-      menu.append(readonly)
-      menu.append(readwrite)
+              menu.append(readonly)
+              menu.append(readwrite)
       return menu

Improvements to the menu structure: save space for supporting lots of shares with many participants

Currently every shared directory creates in the menu the following structure:

/my/shared/dir 15.5 MB in 8 files
bookpoldo: Synched on 09/16/13 13:44:10
macpoldo: Synched on 09/15/13 22:23:01
yeasoft-gate2: Synched on 09/16/13 16:23:09
Get Secret                                 -> Read Only
                                              Full Access 

The menu would be more reliable, if it would contain for each share the following structure:

/my/shared/dir -> Share Size: 15.5 MB in 8 files
                  bookpoldo: Synched on 09/16/13 13:44:10
                  macpoldo: Synched on 09/15/13 22:23:01
                  yeasoft-gate2: Synched on 09/16/13 16:23:09
                  -------------------------------------------------
                  Get Read Only Secret
                  Get Full Access Secret

Syntax Error in exception handler

There are some missing type casts (my fault)....

WARNING:root:Communication Error caught, displaying error message
Traceback (most recent call last):
  File "/usr/lib/btsync-user/btsyncindicator.py", line 270, in setup_session
    self.show_error("Communication Error "+response.status_code)
TypeError: cannot concatenate 'str' and 'int' objects

It's quite simple to fix...

Menu Entry "Enable Debug Logging"

Provide a menu entry "Enable Debug Logging" with the following functionality:

PSEUDOCODE BEGIN

VarStorageDir = get_storage_dir_from_config_file

OnMenuEntryUpdate() {
    if file exist $VarStorageDir . "/debug.txt" {
        add checkmark to menu entry
    } else {
        remove checkmark from menu entry
    }
}

OnMenuEntrySelect() {
    if file exist $VarStorageDir . "/debug.txt" {
        delete $VarStorageDir . "/debug.txt"
    } else {
        echo "FFFF" > $VarStorageDir . "/debug.txt"
    }
}

PSEUDOCODE END

Icon Size?

In Ubuntu it seems that the default icon size for indicators is 22x22 - btsync-user packaging installs the icons there, but lintian complains about the wrong size.

What should we do? Create a dedicated directory or adapt the icon size?

W: btsync-user: icon-size-and-directory-name-mismatch usr/share/icons/hicolor/22x22/status/btsync-active.png 17x19
W: btsync-user: icon-size-and-directory-name-mismatch usr/share/icons/hicolor/22x22/status/btsync-attention.png 17x19
W: btsync-user: icon-size-and-directory-name-mismatch usr/share/icons/hicolor/22x22/status/btsync-error.png 17x19
W: btsync-user: icon-size-and-directory-name-mismatch usr/share/icons/hicolor/22x22/status/btsync.png 17x19

Open WebUI from Menu

Provide a menu entry "Open BitTorrent Sync..." that launches the URL of the WebUI. The URL shall be computed based on the information in the btsync configuration file

Menu messed up after reconnection (Part 1)

If btsyncindicator.py is running, and the agent is stopped (let's say that the user changes something in the configuration file and then restarts it) producing a connection error, the btsyncindicator correctly shows the disconnection state in the icon and the menu is cleaned up showing "Lost connection to BitTorrent Sync". After the agent is restarted, the btsyncindicator icon changes back to the connected icon but the menu is not restored correctly:

Menu on first start:

screen shot 2013-10-02 at 6 14 44 pm

Menu when btsync-agent is not running:

screen shot 2013-10-02 at 6 15 34 pm

Menu after reconnecting to btsync-agent:

screen shot 2013-10-02 at 6 16 18 pm

Problems when Web Interface is set to a language that is not English

I am Brazilian, so I tried to set btsync web ui to Portuguese. After doing that the indicator does not work correctly. The reason is that the information it retrieves from th server is translates, so, for example the status "Synced", becomes "Sincronizado". The indicator fails then to parse the information.

In fact, to check this I added a line to the source code to print the information retrieved from the server (at line 249 of current source code of v. 0.10). If I set bitsync web interface to English this is what I get (I ERASED the secrets):

{u'folders': [{u'peers': [{u'status': u'Synced on 10/19/13 09:08:30', u'direct': 1, u'name': u'quorra -- pjssilva'}, {u'status': u'Synced on 10/19/13 09:07:55', u'direct': 1, u'name': u'trinity - pjssilva'}], u'name': u'/home/pjssilva/syncdir', u'iswritable': 1, u'secret': u'ERASED', u'readonlysecret': u'ERASED', u'size': u'112.0 MB in 168 files'}], u'speed': u'0.0 kB/s up, 0.0 kB/s down'}

Look at the status result, it starts with "Synced", a string that is used in the code. Now, If I change the interface to Portuguese (Brasil), it becomes:

{u'folders': [{u'peers': [{u'status': u'Sincronizado em 10/19/13 09:08:30', u'direct': 1, u'name': u'quorra -- pjssilva'}, {u'status': u'Sincronizado em 10/19/13 09:07:55', u'direct': 1, u'name': u'trinity - pjssilva'}], u'name': u'/home/pjssilva/syncdir', u'iswritable': 1, u'secret': u'ERASED', u'readonlysecret': u'ERASED', u'size': u'112.0 MB em 168 arquivos '}], u'speed': u'0.0 kB/s upload, 0.0 kB/s download'}

Now, the status starts with "Sincronizado", which is synced in Portuguese. This was making the indicator behave badly until I switched it back to English.

Compatibility issue with Debian Jessie

User cedricbr reported in the forum:

On debian jessie, i'm getting the following error
No indicator visible. I'm using the newest version of btsync-user and btsync-common

dpkg -l | grep btsync
ii  btsync-common                         1.2.82-1                       amd64        Private network P2P file synchronisation daemon
ii  btsync-user                           1.14.2-1                       all          Private network P2P file synchronisation daemon(s)

BitTorrent Sync forked to background. pid = 9236
/usr/lib/btsync-user/btsyncindicator.py:138: Warning: /tmp/buildd/glib2.0-2.38.2/./gobject/gsignal.c:2475: signal 'child-added' is invalid for instance '0x19af230' of >type 'GtkMenu'
self.ind.set_menu(self.menu)

Improvements to the menu structure: make it as similar as possible to Mac OSX and Windows Version

BitTorrent Sync on Mac OSX and Windows has a very similar interface: there is an indicator on the menu bar / task bar that opens a menu if clicked:

screen shot 2013-09-17 at 9 57 36 pm

In order to make btsyncindicator.py act as similar as possible to the original BitTorrent software, the following changes should be implemented:

  1. Keep the same order and label for menu entries and seprators when possible.
  2. The "Quit" command should be named "Quit BitTorrent Sync" if there is a file /usr/lib/btsync-user/btsync-stopper installed on the system and in that case it should not only quit the indicator but also execute /usr/lib/btsync-user/btsync-stopper
  3. "Send Feedback" is not really needed, but perhaps it would be nice to invoke the browser with http://forum.bittorrent.com/forum/56-bittorrent-sync/
  4. If you want it really identically "Open Web Interface" could be also named "Open BitTorrent Sync..."
  5. ...and if you want to make it really perfect, you will implement also "About BitTorrent Sync" ;-)

screen shot 2013-09-17 at 10 46 34 pm

Debian Packaging btsync-user: Location of bitmaps

btsyncindicator.py searches by default its bitmap files in subdirectory located below btsyncindicator.py itself. Currently the Debian package installs btsyncindicator.py in /usr/lib/btsync-user and the bitmaps in /usr/lib/btsync-user/icons but this does not conforms to the Debian policy - in fact lintian complains:

W: btsync-user: image-file-in-usr-lib usr/lib/btsync-user/icons/btsync-active.png
W: btsync-user: image-file-in-usr-lib usr/lib/btsync-user/icons/btsync-attention.png
W: btsync-user: image-file-in-usr-lib usr/lib/btsync-user/icons/btsync-error.png
W: btsync-user: image-file-in-usr-lib usr/lib/btsync-user/icons/btsync.png

Solution approach 1 (preferred):
Allow the user to override the bitmap subdirectory with a command line parameter

Solution approach 2:
On startup, test if there are bitmap files in the icons/-subsdirectory. If not, use the subdirectory /usr/share/btsync-user/icons

btsyncindicator not working with btsync version 1.3.105

After the refurbishing of the web interface, btsyncindicator.py does not work any more.

There are errors with the encoding:

/usr/lib/btsync-user/btsyncindicator.py:138: Warning: /build/buildd-glib2.0_2.33.12+really2.32.4-5-i386-eISom6/glib2.0-2.33.12+really2.32.4/./gobject/gsignal.c:2459: signal `child-added' is invalid for instance `0x9242020'
  self.ind.set_menu(self.menu)
Traceback (most recent call last):
  File "/usr/lib/btsync-user/btsyncindicator.py", line 315, in check_status
    folder['name'] = self.fix_encoding(folder['name'])
  File "/usr/lib/btsync-user/btsyncindicator.py", line 675, in fix_encoding
    return text.encode('latin-1').decode('utf-8')
  File "/usr/lib/python2.7/encodings/utf_8.py", line 16, in decode
    return codecs.utf_8_decode(input, errors, True)
UnicodeDecodeError: 'utf8' codec can't decode byte 0xd6 in position 15: invalid continuation byte

After applying a workaround (let func fix_encoding simply return text), there are other errors:

/usr/lib/btsync-user/btsyncindicator.py:138: Warning: /build/buildd-glib2.0_2.33.12+really2.32.4-5-i386-eISom6/glib2.0-2.33.12+really2.32.4/./gobject/gsignal.c:2459: signal `child-added' is invalid for instance `0x991c020'
  self.ind.set_menu(self.menu)
Traceback (most recent call last):
  File "/usr/lib/btsync-user/btsyncindicator.py", line 335, in check_status
    submenu = self.build_folder_menu(folder)
  File "/usr/lib/btsync-user/btsyncindicator.py", line 412, in build_folder_menu
    folderitem['sizeitem'] = gtk.MenuItem(folder['size'])
TypeError: GtkMenuItem.__init__() argument 1 must be string or None, not int

Menu messed up after reconnection (Part 2)

In case of disconnection from the btsync agent, btsyncindicator.py reacts by removing the folder menu items, adding an error message as the first disabled menu item and showing an error status icon.

Unfortunately also other functional menu items are removed (and not added back after reconnection).

It would be correct to leave the other functional items (like "Enable Debug Logging" and "Open Web Interface") in the menu and only disable the ones that make not sense ("Open Web Interface") in case of disconnection.

Indicator starting two times after log in

This is not an important issue, but the indicator is starting two times after I log in, that is, there are two icons of BitTorrent Sync.

When closing one, it also closes the other one...

Btsyncindicator broken on new ppa update (March 31 2014)

Environment:

  • Kubuntu 12.04 LTS
  • Btsync via ppa (ppa:tuxpoldo/btsync )

I Btsync updated yesterday and I noticed that the indicator didn't show up in the KDE indicator bar correctly. I stopped and restarted btsync manually (btsync-stopper & btsync-starter), and here is the error from the indicator start:

Traceback (most recent call last):
File "/usr/lib/btsync-user/btsyncindicator.py", line 252, in setup_session
response = requests.get(self.urlroot, params=params, cookies=self.cookies, auth=self.auth)
File "/usr/local/lib/python2.7/dist-packages/requests/api.py", line 55, in get
return request('get', url, *_kwargs)
File "/usr/local/lib/python2.7/dist-packages/requests/api.py", line 44, in request
return session.request(method=method, url=url, *_kwargs)
File "/usr/local/lib/python2.7/dist-packages/requests/sessions.py", line 327, in request
self.cookies = cookiejar_from_dict(cookies, cookiejar=self.cookies, overwrite=False)
File "/usr/local/lib/python2.7/dist-packages/requests/cookies.py", line 410, in cookiejar_from_dict
cookiejar.set_cookie(create_cookie(name, cookie_dict[name]))
File "/usr/local/lib/python2.7/dist-packages/requests/cookies.py", line 256, in getitem
return self._find_no_duplicates(name)
File "/usr/local/lib/python2.7/dist-packages/requests/cookies.py", line 311, in _find_no_duplicates
raise KeyError('name=%r, domain=%r, path=%r' % (name, domain, path))
KeyError: "name=Cookie(version=0, name='GUID', value='qa2jAaS3h5XqiV8zE8cu', port=None, port_specified=False, domain='127.0.0.1', domain_specified=False, domain_initial_dot=False, path='/', path_specified=True, secure=False, expires=None, discard=True, comment=None, comment_url=None, rest={}, rfc2109=False), domain=None, path=None"


Note: btsync and the web UI work properly and the indicator icon does appear, but the defined shares do not appear when right-clicking the indicator icon.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.