118 Commits
v0.16 ... v0.17

Author SHA1 Message Date
e9600fa5ec Bumped version to 0.17 2019-01-01 05:36:29 -06:00
42a5b67386 Merge branch 'master' into next 2018-12-31 11:51:33 -06:00
58e6940bad Added changes in GUI for communities 2018-12-31 11:51:13 -06:00
3b685fe164 Added rendering to audio playlists in the newsfeed buffer 2018-12-31 11:50:48 -06:00
a531e8ee19 Fixes a traceback when adding an unsupported post to db. Closes #15 2018-12-31 11:50:11 -06:00
a51a1458be Changed URL schema of issue reporter 2018-12-31 11:48:47 -06:00
f029b9034d Load communities in a buffer dedicated to them 2018-12-30 10:41:47 -06:00
7c1766825b Updated reference to latest version in readme [skip ci] 2018-12-27 13:05:04 -06:00
8ac2fa3334 Updated changelog [skip ci] 2018-12-27 12:27:51 -06:00
6c64246ca8 Fixed unresponsiveness of dialogs during updates 2018-12-27 11:30:37 -06:00
57968875f0 Modified update channel 2018-12-27 11:15:08 -06:00
009b1cddcd Fixed merge conflict 2018-12-27 11:12:48 -06:00
8f52ae6f0c Updated calls to autoupdate feature for alpha channel 2018-12-27 11:11:30 -06:00
54247b8b90 Merge branch 'next' into 'master'
Modifications to release process. Closes #14

Closes #14

See merge request manuelcortez/socializer!1
2018-12-27 18:29:46 +03:00
762fa93c23 Modifications to release process. Closes #14 2018-12-27 18:29:46 +03:00
2e025ebf20 Modify gitlab CI configuration to generate both alpha and stable versions 2018-12-27 09:19:28 -06:00
833c089a27 Added script to write data for versions in the alpha channel 2018-12-27 09:15:32 -06:00
a410c2a2f6 Removed weekly channel for now as there are no idea on how to track updates, yet 2018-12-27 09:01:07 -06:00
fae791ff71 Added update channel settings to general tab 2018-12-27 08:30:51 -06:00
729b410d63 Updater now accepts updates from the gitlab repo URL 2018-12-26 12:27:44 -06:00
b9bb17dd69 Added new update data 2018-12-26 12:24:12 -06:00
03286a44b9 Fixed a small issue in chat text controls 2018-12-25 19:08:36 -06:00
1cff350fed Added 2FA for kate's tokens, finally. Closes #13 2018-12-25 18:55:50 -06:00
f191ed42da Added oggenc2.exe to the list of requirement files 2018-12-25 17:13:38 -06:00
46ba62d346 Added support for voice messages 2018-12-24 17:54:18 -06:00
dd07501c5c Added audio recorder controller. 2018-12-24 17:53:59 -06:00
68e48205f3 Added basic interface to audio recorder dialog 2018-12-24 17:53:28 -06:00
3aaeafbfc0 Added new recording facilities to sound.py 2018-12-24 17:53:09 -06:00
a34e9637fe Chats will not be able to sent twice when pressing enter repeatedly 2018-12-24 12:52:58 -06:00
4af259ffed Added 2FA partially. #13 2018-12-24 12:32:00 -06:00
6165b80147 Updated changelog 2018-12-24 11:52:19 -06:00
33fd9c1b4d Updated requirements 2018-12-24 09:03:08 -06:00
c442aac0a9 Updated patched VK and core methods 2018-12-24 08:54:53 -06:00
081f51dfd2 Updated changelog 2018-12-24 08:53:42 -06:00
27b6d068ed Added a few comments to session 2018-12-24 08:53:28 -06:00
b4adf42644 Replaced eyed3 for mutagen for tag parsing 2018-12-24 08:52:48 -06:00
527d4670d4 Implemented two factor authentication for alternative tokens 2018-12-23 10:06:06 -06:00
17c6b7d282 Added a bug reporting feature in the help menu 2018-12-22 08:08:30 -06:00
2a729ffcc2 Avoid adding removed newsfeed posts to the database and log unhandled posts 2018-12-22 05:40:39 -06:00
3ffbf556f2 Pass user_id when retrieving video and audio albums 2018-12-22 05:39:58 -06:00
5f04ac3bee Fixed issues in get_selection() in certian buffers 2018-12-22 05:39:21 -06:00
bd05860f11 Updated changelog 2018-12-21 17:02:46 -06:00
3887dce508 Handles case when an audio object has been deleted by the user 2018-12-21 16:21:19 -06:00
651b66198f Title and artist will be taken from ID3 tags in audio files 2018-12-21 16:20:31 -06:00
77fac967bc Updated changelog 2018-12-21 08:22:18 -06:00
c8375ca138 Fixed an incorrect handling in attachments for chat messages 2018-12-21 08:18:39 -06:00
34c5824255 Started adding the new attachment dialog to chat buffers 2018-12-21 05:54:52 -06:00
abcbbe9ae2 Finished rework of attachments methods for wall posts 2018-12-21 05:27:35 -06:00
fb06df8578 Started an effort to merge the attachment dialogs in socializer. It will be possible to add both local files and files already present in VK 2018-12-20 17:46:54 -06:00
d71721ab87 Added audio uploading support in posts. Needs improvements to detect its ID3 tags 2018-12-20 17:29:23 -06:00
93e6cd36a7 Try to handle better exceptions in the chat server 2018-12-20 16:58:29 -06:00
ca3873f055 Fixed a condition that was raising a traceback when adding an audio attachment 2018-12-20 16:05:20 -06:00
ba14699dfb Updated code to handle unread messsages 2018-12-20 15:36:32 -06:00
e3dae698d9 Removed pandoc reference from Readme 2018-12-20 13:44:31 -06:00
b8eee58b01 Updated changelog 2018-12-20 13:41:42 -06:00
344d2f3dac Added very basic test 2018-12-20 11:59:35 -06:00
bc863a3345 Converts src directory in a package so unittest will work properly here 2018-12-20 11:59:10 -06:00
6ffe47b2d8 Added schedules to pipeline 2018-12-20 11:45:08 -06:00
30ecfd4370 Fixed a memory leak in the app when audio and video albums are updated 2018-12-20 08:33:16 -06:00
48e3e39514 Attempt to add two factor auth to socializer. Needs testing 2018-12-19 17:34:51 -06:00
909fd9d68c Use patched VK api only if kate tokens are enabled 2018-12-19 17:34:28 -06:00
b9ccc083ae fixed a typo 2018-12-19 17:33:40 -06:00
42549d9bb9 Re-added count for audio buffers in session settings 2018-12-19 17:31:42 -06:00
ce93a83305 Fixed localization in profiles 2018-12-19 17:31:10 -06:00
08f6e5d3d9 Updated languageHandler 2018-12-19 05:00:45 -06:00
dfa597f2d0 Added changelog as a translatable document. Copy license appropiately 2018-12-19 04:58:34 -06:00
ea917c470e attempt to add changelog and license to doc in CI built 2018-12-19 04:47:48 -06:00
945f310eae Updated changelog 2018-12-19 04:33:23 -06:00
ea005587de Chat widget now is multiline. Add new lines with shift+enter 2018-12-19 04:32:47 -06:00
eb545f3763 Reconfigure CI. Documentation now is part of the CI process 2018-12-18 17:50:02 -06:00
378d373a04 Added markdown to requirements 2018-12-18 17:45:11 -06:00
6bcbc655ed First doc integration in CI 2018-12-18 17:42:56 -06:00
8bea1859c8 Removed unneeded import 2018-12-18 17:40:37 -06:00
8b10bf7242 Improved documentation builder for integrating it in the gitlab CI proces 2018-12-18 17:36:52 -06:00
3949ae5185 Removed edit profile setting for now, as it is not implemented yet 2018-12-18 16:36:30 -06:00
ac2b9c6a1e Added set status option 2018-12-18 16:32:14 -06:00
126ec7a881 Fixed a few issues when calling update_all_buffers 2018-12-18 15:22:16 -06:00
90999fc3d6 Readded popular and suggested audios 2018-12-18 13:18:21 -06:00
9d2615c221 Added a patched version of jconfig to support non-ascii paths 2018-12-18 11:48:53 -06:00
28d5c2d5d7 Pointed out a few issues in russian translations 2018-12-18 05:53:13 -06:00
d250d3dcb6 Updated changelog 2018-12-18 05:32:41 -06:00
207e38e619 Removed old files 2018-12-18 04:23:04 -06:00
61084d6526 Update readme 2018-12-18 04:16:40 -06:00
ea15edd45c Revert CI settings to default building time 2018-12-18 04:12:14 -06:00
4c118e161b Added bs4 to the list of dependencies 2018-12-18 04:00:18 -06:00
4430aff718 Build stuff in windows servers 2018-12-18 03:55:24 -06:00
5cd8e8a834 Testing CI 2018-12-18 03:53:38 -06:00
20a01c8c52 Removes dist and build folders when done 2018-12-18 03:53:13 -06:00
0a5822e64e Added a patched version of vk_api to use kate's user agent 2018-12-17 21:55:26 -06:00
977dcb7dc3 Improvement to unread messages: Mark as unread only messages sent by another user 2018-12-17 17:47:15 -06:00
9296ef5333 authenticate properly in alternative tokens 2018-12-17 17:01:37 -06:00
49c96963f8 Build artifacts only when tags are applied 2018-12-17 01:03:25 -06:00
934744362f Change name to artifacts zip file 2018-12-17 00:59:23 -06:00
e1b79af4a5 Improved dist for CI 2018-12-17 00:56:08 -06:00
9b89612edb Fixed artifacts 2018-12-17 00:45:10 -06:00
196a965aea 3rd attempt 2018-12-17 00:39:24 -06:00
aad538ecfc Second attempt to generate artifacts 2018-12-17 00:29:12 -06:00
1c51225277 Attempt to improve artifacts 2018-12-17 00:25:28 -06:00
766879d47c Second update to CI 2018-12-17 00:13:29 -06:00
d52a7ae08c Finished CI file (needs testing) 2018-12-17 00:09:39 -06:00
803a84638e Updated CI status file 2018-12-17 00:03:36 -06:00
d163cd60f5 Updated contributions 2018-12-16 23:41:51 -06:00
ec895f3e12 Updated translation related files 2018-12-16 23:25:44 -06:00
41c9bcc6ce Updated CI config 2018-12-16 17:30:50 -06:00
325db8ab3c Added script to prepare a zipped version ofsocializer 2018-12-16 17:30:31 -06:00
f31a7b736b Added test CI file 2018-12-16 07:23:45 -06:00
c2c79ca9ec Online notification is shown onli at startup 2018-12-16 02:20:14 -06:00
0e96ed1519 Fixed actions when there are no posts in a buffer 2018-12-16 02:06:36 -06:00
d43f5f5320 Skip restricted songs from playback 2018-12-16 00:53:02 -06:00
4b51126239 Mark unread messags as read and play sound when unread messages are focused 2018-12-16 00:41:47 -06:00
a21d0f8a73 Updated changelog 2018-12-15 21:19:10 -06:00
0e83d1e39f Access to audio albums is fully restored 2018-12-15 21:11:25 -06:00
bb500779d9 Allow use of kate mobile's tokens for accessing all methods 2018-12-15 21:09:17 -06:00
815bd4b49e Updated changelog 2018-12-14 16:57:44 -06:00
619595fd65 Updated changelog 2018-12-14 16:52:46 -06:00
127207414c Added a replacement tokes as an entry point for an experiment 2018-12-14 15:31:15 -06:00
ba72e80279 Tokens will not expire in 24 hours 2018-12-14 15:30:44 -06:00
4b5d271ab4 Handles non-english charset encoding for filesystem paths 2018-12-14 15:27:20 -06:00
64 changed files with 2664 additions and 782 deletions

52
.gitlab-ci.yml Normal file
View File

@@ -0,0 +1,52 @@
# Jobs to build the two channels in Socializer.
alpha:
type: deploy
tags:
- windows
script:
- pip install --upgrade pip
- pip install --upgrade -r requirements.txt
- copy changelog.md doc\changelog.md
- cd doc
- python documentation_importer.py
- cd ..\src
- python ..\doc\generator.py
- python write_version_data.py
- python setup.py py2exe
- cd ..
- cd scripts
- python prepare_zipversion.py
- cd ..
- move src\socializer.zip socializer.zip
only:
- master
artifacts:
paths:
- socializer.zip
name: socializer
expire_in: 1 week
stable:
type: deploy
tags:
- windows
script:
- pip install --upgrade pip
- pip install --upgrade -r requirements.txt
- copy changelog.md doc\changelog.md
- cd doc
- python documentation_importer.py
- cd ..\src
- python ..\doc\generator.py
- python setup.py py2exe
- cd ..
- cd scripts
- python prepare_zipversion.py
- cd ..
- move src\socializer.zip socializer.zip
only:
- tags
artifacts:
paths:
- socializer.zip
name: socializer

View File

@@ -1,5 +1,7 @@
# socializer
[![pipeline status](https://code.manuelcortez.net/manuelcortez/socializer/badges/master/pipeline.svg)](https://code.manuelcortez.net/manuelcortez/socializer/commits/master)
> Note: this project has two different main repositories. [Here is the official repository, hosted in my Gitlab Instance,](https://code.manuelcortez.net/manuelcortez/socializer) [Here is a mirror repository hosted in GitHub.](https://github.com/manuelcortez/socializer) Github repository will accept pull requests and issues reported by github users, while Gitlab's repository will provide the wiki, documentation, and support for user reported issues.
A desktop application for handling [vk.com](http://vk.com) in an easy way.
@@ -10,9 +12,9 @@ Socializer's functionality is far to be perfect, in fact there are lots of metho
Before downloading, take in to account the following: This source code is completely experimental. The current functionality in this application is not very useful. If you decide to use nightly build versions, take into account that this doesn't work as an application for everyday use yet.
Version: 2016.07.9
Build date: Jul 9 2016
[Download socializer](https://github.com/manuelcortez/socializer/blob/master/nightly/socializer-nightly-build.zip?raw=true)
Version: 0.16
Build date: Dec 14 2018
[Download socializer](https://code.manuelcortez.net/manuelcortez/socializer/-/jobs/artifacts/master/raw/socializer.zip?job=alpha)
I have started this effort as an open source project on Feb 13, 2016. Pull requests and bug reports are welcome.
@@ -22,7 +24,6 @@ For other dependencies, do pip install --upgrade -r requirements.txt
* [Python,](http://python.org) version 2.7.15
* [PyEnchant,](http://pythonhosted.org/pyenchant/) version 1.6.6.
* [Pandoc](http://pandoc.org/installing.html) for generating the changelog.
## Documentation

View File

@@ -1,19 +1,48 @@
# Changelog
## Changes in the current build ()
## changes in this version
* Added two more buffers: "Followers" and "I follow", located in the people buffer, under "friendship requests".
* Added support for Two factor authentication (2FA). ([#13,](https://code.manuelcortez.net/manuelcortez/socializer/issues/13))
* Added update channels in socializer. You can subscribe to the "stable" or "alpha" channel from the preferences dialog and you will receive updates published for those:
* The stable channel will have releases every month, approximately, and is the channel where the code will be more tested and with less bugs. All support and help will be provided for the stable versions only.
* The alpha channel will have releases every time a change is added to socializer, it may even include several releases in the same day, but we will try to release only a new version every day. Support will not be provided for alpha versions, as they will be used to test the latest code in the application.
* Now it is possible to send voice messages from socializer. Voice messages are available from the "add" button in any conversation buffer.
* tokens generated by socializer will never expire. ([#3,](https://code.manuelcortez.net/manuelcortez/socializer/issues/3))
* In order to use all methods available in VK, socializer will use tokens of kate mobile for Android. It means you may receive an email by saying that you've authorised Kate for accessing your account from an Android device.
* Audio albums are loaded correctly.
* It is possible to play audios added by friends appearing in the news feed.
* Adding and removing an audio file to your library works.
* Unread messages will play a sound when focused.
* Unread messages will be marked as read when user focuses them.
* Socializer will handle restricted audio tracks. Restricted songs are not allowed to be played in the user's country. Before, playing a restricted track was generating an exception and playback could not resume. Now, playing an audio track will display an error notification.
* Fixed an error when people were trying to open a post in an empty buffer, or accessing the menu when there are no posts in the buffer.
* Now Socializer will not send a notification every 5 minutes.
* the chat widget now is a multiline text control. It means it is possible to add a new line by pressing shift+Enter, and send the message by pressing enter.
* Socializer should handle connection errors when loading items in buffers and retry in 2 minutes. Also, connection errors in the chat server are handled and chat should be able to reconnect by itself.
* When trying to add an audio or video to an album, if the current user does not have any album, it will display an error instead of a traceback.
* Added popular and suggested songs. This will not work when using alternative tokens.
* Now it is possible to update the status message, located in your profile.
* Now it is possible to upload an audio from your computer when adding attachments in a wall post. When adding attachments to a post or message in a conversation, you will have two options: upload from your computer and add a file from your VK profile.
* Updated Russian translation: thanks to Дарья Ратникова.
* Fixed some conditions, especially when rendering items in feeds, that were making the client to crash.
* new versions will include documentation and changelog.
* A new option for reporting issues directly from the help menu has been added. Issues will be publicly available in the [Project Issues page](https://code.manuelcortez.net/manuelcortez/socializer/issues)
## Changes in version 0.16 (13.12.2018)
* Added two more buffers: "Pending requests" and "I follow", located in the people buffer, under "friendship requests".
* Added an experimental photo viewer. Will show options for displaying the next and previous photo if the current post contains multiple images. Fullscreen button still doesn't work.
* Improved chats, now they should be more stable. Also you will be able to send the message by pressing enter in the text box. If you are trying to send the same message multiple times, you will be warned.
* Improved the chat features present in the application. Read documentation to get a full understanding about how it works now.
* Added video management (my videos, video albums and video search). For playing videos, you will be redirected to a website in your browser due to the VK'S policy.
* Added a setting that allows you to specify if you want socializer to load images when you are opening posts. It could be useful for slow connections or those who don't want images to be loaded.
* Added basic tagging for users in posts and comments. You can tag only people in your friends buffer.
* Added a basic user profile viewer.
* Added support for listening voice messages in chats. Currently it is not possible to send them, until the new API will be released.
* Added support for listening voice messages in chats. Currently it is not possible to send them.
* Fixed an error that was making Socializer unable to display chat history properly. It was showing the first 200 items in a conversation instead the last 200 items. Now chat will be displayed accordingly.
* Changed the chat history widget from list of items to a read only text box, similar to how it was displayed in skype. Now the widget should be fully visible and messages will work in the same way.
* It is possible to play songs sent in a chat message by opening them from the attachments panel.
* Reimplemented most of the audio playback methods.
* Reimplemented most of the audio playback methods (audio albums buffer still not working).
* Added some notifications and chat notifications when friends are online and offline. Most notifications can be configured from settings.
## Changes in build 2016.07.08 (08/07/2016)
@@ -59,7 +88,4 @@
* Added more options in the search audio dialog. Now users could use more parameters and searches will be more precise.
* Added a new attachments' list. When a post is opened, this list will show up if there are attachments in the current post (attachments are audio, photos, video and links). You will be able to interact with the supported data (at the moment only photos, videos, audio and links are supported, more will be added in future).
* Added a changelog file which could be opened from the help menu.
* Added a preferences dialogue and a new application menu in the menu bar. From this dialogue you can change the number of items to be loaded for every buffer.
---
© 2016, manuel cortéz.
* Added a preferences dialogue and a new application menu in the menu bar. From this dialogue you can change the number of items to be loaded for every buffer.

View File

@@ -2,7 +2,7 @@
""" This script converts the hold documentation (saved in markdown files) in a python file with a list of strings to translate it using gettext."""
def prepare_documentation_in_file(fileSource, fileDest):
""" This takes documentation written in a markdown file and put all the contents in a python file, to create a internationalized documentation.
""" This takes documentation written in a markdown file and put all the contents in a python file, to create a translatable documentation.
@fileSource str: A markdown(.md) file.
@fileDest str: A file where this will put the new strings"""
@@ -18,11 +18,10 @@ def prepare_documentation_in_file(fileSource, fileDest):
newvar = "_(u\"\"\"%s\"\"\"),\n" % (i[:-1])
else:
newvar = "_(u\"\"\"%s\"\"\"),\n" % (i)
# print i[-1:]
f2.write(newvar)
f1.close()
f2.write("]")
f2.close()
prepare_documentation_in_file("manual.md", "strings.py")
prepare_documentation_in_file("manual.md", "strings.py")
prepare_documentation_in_file("changelog.md", "changelog.py")

View File

@@ -1,20 +1,32 @@
# -*- coding: utf-8 -*-
import markdown
import os
import shutil
from codecs import open as _open
import languageHandler
languageHandler.setLanguage("en")
import documentation_importer
import strings
import changelog
# the list of supported language codes of TW Blue
# the list of supported language codes
languages = ["en", "es"]
def generate_document(language):
import strings
def generate_document(language, document_type="documentation"):
reload(languageHandler)
languageHandler.setLanguage(language)
reload(strings)
markdown_file = markdown.markdown("\n".join(strings.documentation[1:]), extensions=["markdown.extensions.toc"])
if document_type == "documentation":
translation_file = "socializer-documentation"
languageHandler.setLanguage(language, translation_file)
reload(strings)
markdown_file = markdown.markdown("\n".join(strings.documentation[1:]), extensions=["markdown.extensions.toc"])
title = strings.documentation[0]
filename = "manual.html"
elif document_type == "changelog":
translation_file = "socializer-changelog"
languageHandler.setLanguage(language, translation_file)
reload(changelog)
markdown_file = markdown.markdown("\n".join(changelog.documentation[1:]), extensions=["markdown.extensions.toc"])
title = changelog.documentation[0]
filename = "changelog.html"
first_html_block = """<!doctype html>
<html lang="%s">
<head>
@@ -23,20 +35,25 @@ def generate_document(language):
</head>
<body>
<header><h1>%s</h1></header>
""" % (language, strings.documentation[0], strings.documentation[0])
""" % (language, title, title)
first_html_block = first_html_block+ markdown_file
first_html_block = first_html_block + "\n</body>\n</html>"
if not os.path.exists(language):
os.mkdir(language)
mdfile = _open("%s/manual.html" % language, "w", encoding="utf-8")
if not os.path.exists(os.path.join("documentation", language)):
os.mkdir(os.path.join("documentation", language))
mdfile = _open(os.path.join("documentation", language, filename), "w", encoding="utf-8")
mdfile.write(first_html_block)
mdfile.close()
def create_documentation():
print("Creating documentation in the supported languages...\n")
if not os.path.exists("documentation"):
os.mkdir("documentation")
if os.path.exists(os.path.join("documentation", "license.txt")) == False:
shutil.copy(os.path.join("..", "license.txt"), os.path.join("documentation", "license.txt"))
for i in languages:
print("Creating documentation for: %s" % (i,))
generate_document(i)
generate_document(i, "changelog")
print("Done")
create_documentation()

View File

@@ -80,7 +80,7 @@ def getAvailableLanguages():
"""
#Make a list of all the locales found in NVDA's locale dir
l=[x for x in os.listdir("locales") if not x.startswith('.')]
l=[x for x in l if os.path.isfile('locales/%s/LC_MESSAGES/socializer-doc.mo' % x)]
l=[x for x in l if os.path.isfile('locales/%s/LC_MESSAGES/twblue-documentation.mo' % x)]
#Make sure that en (english) is in the list as it may not have any locale files, but is default
if 'en' not in l:
l.append('en')
@@ -117,7 +117,7 @@ def makePgettext(translations):
return unicode(message)
return pgettext
def setLanguage(lang):
def setLanguage(lang, translation_file="socializer-documentation"):
system = platform.system()
global curLang
try:
@@ -127,10 +127,10 @@ def setLanguage(lang):
localeName=locale.windows_locale[windowsLCID]
else:
localeName=locale.getlocale()[0]
trans=gettext.translation('socializer-doc', localedir="locales", languages=[localeName])
trans=gettext.translation(translation_file, localedir="locales", languages=[localeName])
curLang=localeName
else:
trans=gettext.translation("socializer-doc", localedir="locales", languages=[lang])
trans=gettext.translation(translation_file, localedir="locales", languages=[lang])
curLang=lang
localeChanged=False
#Try setting Python's locale to lang
@@ -150,7 +150,7 @@ def setLanguage(lang):
LCID=localeNameToWindowsLCID(lang)
ctypes.windll.kernel32.SetThreadLocale(LCID)
except IOError:
trans=gettext.translation("socializer-doc",fallback=True)
trans=gettext.translation(translation_file,fallback=True)
curLang="en"
trans.install(unicode=True)
# Install our pgettext function.

View File

@@ -1,105 +1,145 @@
socializer's manual
Socializer's manual
## Introduction
Socializer is an application to use [VK.com](https://vk.com) in an easy and accessible way with minimal CPU resource usage. Socializer will allow you to interact with the VK social network by giving you access to the most relevant features such as:
* Basic post creation in your wall (including photos).
* Audio addition, removal, download and search.
* audio albums management (create, delete and add audios).
* (limited) audio support. (*)
* Post comments.
* like, unlike and repost other's posts.
* Open other's timelines so you could track someone's friends, posts or audio files.
* Open other's timelines so you could track their friends, posts or audio files.
* Basic chat features.
Note: When new features are added to socializer they will be added to this section.
\* Audio support in socializer is limited due to the restrictions VK has decided to apply for third party applications on december 2016.
## Running
## Usage
If you are using a built version, unzip the file in a new directory with no special characters, and open the socializer.exe file. If you haven't configured your VK account, you will see a dialogue, just press yes and a new dialogue will prompt for an user email or phone number and the password for your account. Take into account that the provided information will be saved in a config file as plain text. This application will need your information for renegotiating the access token when it expires.
In order to use socializer, you must have an account in the [VK](https://vk.com) website. The process for registering an account is very accessible and is not covered in this manual. In the documentation, it is assumed you have a registered account on VK and you are able to sign in in the website by providing your phone number or email address, and a password. You will require this data for signing in the application later.
Note: Every time you grant access to socializer, probably You will receive an email from VK by telling you that someone has accessed to your account. It means that a new token has been negotiated between VK and socializer by using an authomatic process, you should ignore those advices, unless you receive an email when you are not logged in VK with socializer or other application. You can see your authorised applications in the configuration section in the VK website. New tokens are renegotiated every 24 hours.
## authorising the application
First of all, it's necessary to authorise the application so it can access your VK account and act on your behalf. The authorisation process is quite simple, and will be required only once. In order to start the authorisation process, you just need to run the executable file called "socializer.exe" (on some computers it will appear only as socializer, depending if windows explorer is set to display file extensions or not). You may like to place a Windows shortcut in your desktop for an easier access to the application.
If this is the first time you have launched socializer, you will see a message dialog asking you to proceed with the account authorisation process. It consists in providing the authentication data you normally use to sign in VK. It is very important to know that this data will be stored in a folder called config, located in the same folder where are the socializer files. Your config folder is a very important storage for your authentication data, so you must be sure you never will share it with anyone, mostly because your data is stored as plain text (this will be fixed in a future release and your data will be properly encrypted). Socializer will need your authentication data for acting in your behalf and offering you a better experience that what it could do with a simple access token. You must provide your phone number or email address in the first text box, and your password in the second. When pressing OK, your data will be saved and the application will start to retrieve all the required information for showing your buffers.
Once started, the application will start loading your data (posts, audio files, conversations, friends). When done, it will show you a notification indicating that the program is ready.
## General concepts
Before starting to describe Socializer's usage, we'll explain some concepts that will be used extensively throughout this manual.
### Buffer
A buffer is a list of items that will manage the data which arrives from VK, after being processed by the application. When you configure your account on Socializer and start it, many buffers are created. Each of them may contain some of the items which this program works with: Newsfeed posts, wall posts, audio and video files, friendship requests and conversations. According to the buffer you are focusing, you will be able to do different actions with these items.
All buffers will be updated in one of the following ways:
* Periodically: Most buffers containing posts, audio or video files and people, will be updated periodically to reflect the new additions to them. Updates will be every 2 minutes for every buffer, so if you posted something and did not see the post in the buffer, you may need to wait a moment. There is an option, located in the buffer menu on the menu bar, which allows you to trigger a manual update in the current buffer.
* Real time: Conversation buffers will be updated every time someone sends a message to you. When an user sends you a message, if there is not a conversation buffer created to receive the message, a new conversation buffer will be opened automatically and the message will be placed on it. If you already have an opened conversation for the user sending the message, the message will be placed at the end of the buffer. A different sound will indicate whether a new conversation has been opened or an existing buffer gets updated.
### item
An item is an element representing some data provided by VK. Items are separated in buffers which stores items of the same type: Audio buffers will contain only audio files, wall buffers will be full of wall posts. The only exception to this rule is the newsfeed buffer, which can contain different kind of items. Actions are available in a per-item basis, allowing certain items to be treated differently than others and showing different dialogs, depending in the kind of data VK sends for them. All items show a menu with their available actions by focusing them in the list and pressing the menu key or a right mouse click.
The following is a brief description of the kind of items socializer can work with, and what actions are available for those.
* Newsfeed post: It represents a post displayed in your "home" page on VK. It may contain a variety of information based in what you or your friends do. A newsfeed item may contain information about new audios added to your friend's library, new people added to friends, wall posts, reposts and new photos added. Depending on the kind of data VK has supplied, the item can open a dialog showing information about the post, a list displaying the people added to friends, or a dialog displaying information for every audio added to library. Take into account that it is not possible to play an audio item from the newsfeed buffer due to limits placed by VK, however, you may add it to your library and play it from your "my music" folder. If a wall post contains a long message, the first 140 characters will be displayed only. You can open the post to read the full message in the dialog. Available options for this item are different depending in the information the item contains. You can open or view the profile of the user that generated the item, like, dislike or add a comment to a post.
* Wall post: Represent a post in an user's wall. This posts will be similar to wall posts displayed in the newsfeed. If a wall post contains a long message, the first 140 characters will be displayed only. You can open the post to read the full message in the dialog. When opened (by pressing enter or the open option in the associated menu), it will show a dialogue where you can read the message, see and interact with attachment files (by searching the list and pressing enter in the focused attachment to open it), see the photos included in the post, read information related to likes and times the post has been shared, and read all comments. Additionally, you can share the post, indicate you like it, or add a comment. You can cycle through every item in the dialog by pressing tab.
* Audio: It represent an audio uploaded to the VK'S platform. Actions available for this item are only opening the audio in a dialog and play it due to limitations in access to audio features. When opened, it will be displayed in a dialog allowing you to read the title of the song, artist name, duration and a few buttons: play and download. You can control playback of audio items from the buffer by using the player menu on the menu bar.
* Video: It represent a video uploaded to the VK'S platform. Actions available for this item are opening the video in your default web browser and move it to a video album. When opened, it will open a web browser and play the video automatically due to VK limitations in access to video files.
* person: It contains information about a VK user, this item is present in all buffers under the "people" category. Actions available for this item are view user profile, send message and create a timeline, which is a special buffer to track all posts, friends or audios owned by the user. When opened, it will display the profile of this user in a dialog and will provide actions to send a message to the user, or view other sections of her/his profile.
* Message: A message appears only in conversation buffers and represents a chat message. It may include a list of attached files that will be displayed in a separated list. You can tab to that list (from the history) and press enter in the attached file you want to open. Chat items are marked as read automatically as soon as they are focused.
## Main interface
If you have used [TWBlue](https://github.com/manuelcortez/twblue) before, the socializer's interface is quite similar. Once you have authorised your account, you will see a window with the following elements:
The graphical user interface of Socializer consists of a window containing:
* A tree view at the left of the window, where you will see the list of buffers. These buffers are divided in three categories, posts, music and people. You could expand each category for seeing the child buffers. There are some additional buffers, timelines and chats, wich will be filled with timelines for your friends or with chats, when you start or receive a chat session.
* A button for making a post to your wall.
* In audio buffers, Two buttons: Play and play all.
* In audio album buffers, a button for loading music. By default, albums are empty, you have to press the load button for getting the album's items.
* A list where you will see the posts for the currently selected buffer.
* In people buffers, like the friends buffer, a button for sending a message to your friends. Pressing that button will cause a chat buffer to be created.
* A status bar where the program will put some useful information about what it's doing at the moment.
* And a menu bar.
* a menu bar accomodating five menus (application, Me, buffer, player and help),
* One tree view,
* One list of items
* Some buttons, depending which is the focused buffer.
When socializer starts, it will try to load your news items, wall, audios (your audios, recommended and populars) and friends. At the moment there are only a few supported actions for these items:
The actions that are available for every item will be described later.
* Audio files: You can play the currently selected song, view the song's details (including lyrics, if available), add or remove from your library, and download it to a desired place in your hard drive. You can find audio files in your news feed or in your own audios buffers. You can find audios as post's attachments. You can create an audios timeline for displaying other's audios.
* News feed's post: In your news feed buffer, you can press return in any post and socializer will open a new dialogue which can be different, depending in the kind of post you are when the return key was pressed. For example it will open the post if you are focusing a "normal" post, a list of people if you are in a post wich indicates that someone has added friends, an audio displayer if you are in a post wich indicates that someone has added an audio, etc.
* Wall posts: It will show the post in a dialogue so you could interact with its attachments, view and post comments, or like/unlike/share the post.
* You can send a message to someone by pressing the send message button in the buffer where you are, if available. Deactivated accounts cannot receive messages.
In summary, the GUI contains two core components. These are the controls you will find while pressing the Tab key within the program's interface, and the different elements present on the menu bar.
### Making a post
### Buttons in the application
When you press the post button, a new dialogue will show up. This dialogue allows you to post something in your wall. In this dialogue you have to write a message. You can translate your message and fix your spelling mistakes. Also you can post an URL address, socializer will try to add it as an attachment, so you will not have to worry about this. When you're ready, just press the send button and it'll be done.
* Post: this button opens up a dialogue box to write a post in your wall. For the moment, only posting in your own wall is supported. You can upload a picture by pressing the "attach" button and the photo button in the dialog which will appear, check spelling or translate your message by selecting one of the available buttons in the dialogue box. In addition, you can tag a friend in your post by pressing the corresponding button for that purpose. Also it is possible to configure the privacy settings for your post by allowing all users or just your friends to read it. Press the send button to send the post.
* Play: In audio buffers, plays the focused song. In video buffers, this button will open a web browser for playing the focused video, due to a limitation VK placed to third party developers with videos.
* Play all: In audio buffers, play all songs starting from the focused buffer, until the last item in the list.
* Send message: Send a message to a friend, which will open a conversation buffer if it does not exist already. Conversation buffers contain a full conversation, accommodating chat messages, between the current user and someone else. You can type your message in the provided box and press enter to send it to your friend. Additionally, you can add an attachment (for the moment, only attaching an audio file from your library is supported) and open attachments sent in the focused message by pressing tab and finding them in the attachments list.
If you want to add some photos, you can press the attach button, then press the kind of attachment you want to add. After this, select the file you want to add and you will see it in the list, once processed. When you are done with attachments, press the OK button, and continue with your post. When you are ready, press the send button. Your post could take some time to be published, depending in the amount of files you have added, but it should be displayed in your wall and newsfeed as soon as it is posted.
Bear in mind that buttons will appear according to which actions are possible on the list you are browsing.
### Working with posts in news feed
## Menus
You can press the return key in any post in your news feed for opening a new dialogue with some information. The information and dialogue will be different if you are viewing a friendship's notification (when someone has added some friends), an audio file, or a regular post.
If you open a regular post in your newsfeed, you will be able to see the comments in a list, indicate if you do like or dislike the post, repost or add a new comment. If the post has some attachments, you'll find a list populated with them, you can press return in an attachment to execute its default action, wich will be different depending on the kind of attachment that you are viewing.
For friend notifications, you can only view the new added friends in a list and there are some kind of posts that aren't handled. It should be improved.
Additionally, you can press the menu Key or the right click for displaying a menu with some quick actions available for the post you are focusing. These actions are different for every post type.
### Working with songs
Note: the following applies to audio timelines too.
If you want to play or view audio's details, you'll have to navigate to the tree view, and, using the down arrow, look for "my audios", "populars" or "Recommendations". You will see two more buttons, play and play all. The play button will play the currently selected audio, and the play all button will play audios in the current buffer, starting with the current selected item. You can go to the song's list, look for a desired song and press the play button, or Ctrl+return, which is a keyboard shorcut. Take in to account that there are some keyboard shorcuts that only work in the list of items.
You can play audio from any buffer, just press ctrl+return for making the audio playback possible.
If someone has added multiple audios at once to his library, you will see something like this in your newsfeed: "(friend) has added 4 audios: audio 1, audio2, audio3 and audio4". You can press return in the post for opening the audio's details dialogue, where you will be able to see a list with these audios. By default the first detected song is selected, which means that you could read its details by pressing tab, download or add it to your library. If you change the audio in the list, the information will be updated and you will see details and actions will take effect in the new selected audio.
When an audio file is playing, you can press f5 and f6 for decreasing and increasing volume, respectively, or control+shift+return for play/pause.
If you want to see some details for the selected audio file, you can do it by pressing the return key. You will be able to read some useful information (title, artist, duration and the lyric, if available). Also you will be able to download the song to your hard drive, you have to press the download button in the details' dialogue.
When the download starts, you can close the details dialogue and check the status bar in the main window for seeing the current progress.
Additionally, you can search for audios by using the menu bar, in the buffer menu, select search, then audio. It will display a dialog where you have to set your search preferences.
If you press the menu key, you will see a menu where you will be able to do some actions, for example, add the audio to an album, or add/remove the song from your library.
## menu Bar
You can go to the menu bar by pressing ALT. Right now, there are three menus, application, buffer and help:
Visually, Towards the top of the main application window, can be found a menu bar which contains many of the same functions as listed in the previous section, together with some additional items. To access the menu bar, press the alt key. You will find five menus listed: application, Me, buffer, player and help. This section describes the items on each one of them.
### Application menu
* Create. Here you can create some things in VK. The only supported item at this moment is the audio album.
* Delete: Removes items from the VK servers. The only supported item here is the audio album.
* you can set your preferences by opening the preferences dialog located in this menu.
* Create: opens a menu where you can create a new album. At the moment, only video albums are supported.
* Delete: opens a menu where you can delete an already existing album owned by yourself. Only video albums are supported at this time.
* Preferences: Opens a dialogue which lets you configure settings for the entire application.
### Me menu
* Profile: Opens a menu with several options to do in your profile:
* View profile: Displays your profile in a dialog in the application.
* Open in browser: Redirects you to your profile in vk.com.
### Buffer menu
* new timeline: This option allows you to create a new timeline. This kind of buffers is capable of download all posts in an user's profile.
* search: This submenu allows you to create a new buffer, at the moment, you can create only a kind of buffer, an audio search. The audio search will be located in the music category and will have the last 299 results of your query.
* Update current buffer: perform an update operation in the selected buffer, which will retrieve the new items.
* Load previous items: Get the previous items for the currently focused buffer.
* Remove buffer: Tries to remove the current buffer. Default buffers can't be removed.
* New timeline: Lets you open a user's timeline by choosing the user in a dialog box. You can choose which items you want to track: wall posts, friends or audio items. It is created when you press enter. If you invoke this option relative to a user that has no items of the kind you specified, the operation will fail. If you try creating an existing timeline the program will warn you and will not create it again.
* Search: Shows a menu where you can search for audios or videos on VK. Search results will be created in a new buffer inside "music" or "videos".
* Update buffer: Performs a manual update operation in the buffer, which will retrieve all new items present in the social network since the last update.
* Load previous items: This allows more items to be loaded for the specified buffer. Bear in mind that not all buffers support this setting.
* Destroy: dismisses the list you're on, if possible.
The help menu is self explanatory.
### Player menu
## Contributing
* Play: Plays the currently focused audio item, if the current buffer contains audio files. If not, plays the focused audio in the "my music" buffer.
* Play all: Plays all audio items in the current buffer or the "my music" buffer, starting by the currently focused audio item until the last audio in the list.
* Stop: Stops audio playback.
* Previous: Plays the previous audio in the buffer or the last item in the list, if the current audio was the first on the buffer.
* Next: Plays the Next audio in the buffer or the first item in the list, if the current audio was the last on the buffer.
* Shuffle: Plays all audios in the current buffer or the "my music" buffer shuffled.
* Volume up: Increases volume by 5%.
* Volume down: decreases volume by 5%.
* Mute: Mutes audio playback, setting volume to 0%.
If you notice some errors in this document, or features that are not documented yet, you can suggest those changes by contacting me (more information can be find in the following section).
### help menu
## contact
* About Socializer: shows the credits of the program.
* Documentation: opens up this file, where you can read some useful program concepts.
* Check for updates: every time you open the program it automatically checks for new versions. If an update is available, it will ask you if you want to download the update. If you accept, the updating process will commence. When complete, Socializer will be restarted. This item checks for new updates without having to restart the application.
* Changelog: opens up a document with the list of changes from the current version to the earliest.
If you have questions, don't esitate to contact me in [Twitter,](https://twitter.com/manuelcortez00) or sending me an email to manuel(at)manuelcortez(dot)net. Just replace the words in parentheses with the original signs.
## Keyboard shortcuts
## configuration
### The general tab
### The chats tab
## License and source code
Socializer is free software, licensed under the GNU GPL license, either version 2 or, at your option, any later version. You can view the license in the file named license.txt, or online at <http://www.gnu.org/licenses/old-licenses/gpl-2.0.html>.
The source code of the program is available at <https://code.manuelcortez.net/manuelcortez/socializer>.
## Contact
If you still have questions after reading this document, if you wish to collaborate to the project in some other way, or if you simply want to get in touch with the application developer, follow the VK account of [Manuel Cortez.](https://vk.com/manuelcortez) You can also visit [The project website.](https://manuelcortez.net/socializer)
## Credits
Socializer is developed and mantained by [Manuel Cortez,](https://manuelcortez.net) with contributions by [Anibal Hernandez](https://dragodark.com)
We would also like to thank the translators of Socializer, who have allowed the spreading of the application.
* English: Manuel Cortéz.
* Spanish: Manuel Cortéz.
* Russian: Valeria K.

View File

@@ -1,67 +1,95 @@
# -*- coding: utf-8 -*-
documentation = [
_(u"""socializer's manual """),
_(u"""Socializer's manual """),
"",_(u"""## Introduction"""),
"",_(u"""Socializer is an application to use [VK.com](https://vk.com) in an easy and accessible way with minimal CPU resource usage. Socializer will allow you to interact with the VK social network by giving you access to the most relevant features such as:"""),
"",_(u"""* Basic post creation in your wall (including photos)."""),
_(u"""* Audio addition, removal, download and search."""),
_(u"""* audio albums management (create, delete and add audios)."""),
_(u"""* (limited) audio support. (*)"""),
_(u"""* Post comments."""),
_(u"""* like, unlike and repost other's posts."""),
_(u"""* Open other's timelines so you could track someone's friends, posts or audio files."""),
_(u"""* Open other's timelines so you could track their friends, posts or audio files."""),
_(u"""* Basic chat features."""),
"",_(u"""Note: When new features are added to socializer they will be added to this section."""),
"",_(u"""## Running"""),
"",_(u"""If you are using a built version, unzip the file in a new directory with no special characters, and open the socializer.exe file. If you haven't configured your VK account, you will see a dialogue, just press yes and a new dialogue will prompt for an user email or phone number and the password for your account. Take into account that the provided information will be saved in a config file as plain text. This application will need your information for renegotiating the access token when it expires."""),
"",_(u"""Note: Every time you grant access to socializer, probably You will receive an email from VK by telling you that someone has accessed to your account. It means that a new token has been negotiated between VK and socializer by using an authomatic process, you should ignore those advices, unless you receive an email when you are not logged in VK with socializer or other application. You can see your authorised applications in the configuration section in the VK website. New tokens are renegotiated every 24 hours."""),
"",_(u"""\* Audio support in socializer is limited due to the restrictions VK has decided to apply for third party applications on december 2016."""),
"",_(u"""## Usage"""),
"",_(u"""In order to use socializer, you must have an account in the [VK](https://vk.com) website. The process for registering an account is very accessible and is not covered in this manual. In the documentation, it is assumed you have a registered account on VK and you are able to sign in in the website by providing your phone number or email address, and a password. You will require this data for signing in the application later."""),
"",_(u"""## authorising the application"""),
"",_(u"""First of all, it's necessary to authorise the application so it can access your VK account and act on your behalf. The authorisation process is quite simple, and will be required only once. In order to start the authorisation process, you just need to run the executable file called "socializer.exe" (on some computers it will appear only as socializer, depending if windows explorer is set to display file extensions or not). You may like to place a Windows shortcut in your desktop for an easier access to the application."""),
"",_(u"""If this is the first time you have launched socializer, you will see a message dialog asking you to proceed with the account authorisation process. It consists in providing the authentication data you normally use to sign in VK. It is very important to know that this data will be stored in a folder called config, located in the same folder where are the socializer files. Your config folder is a very important storage for your authentication data, so you must be sure you never will share it with anyone, mostly because your data is stored as plain text (this will be fixed in a future release and your data will be properly encrypted). Socializer will need your authentication data for acting in your behalf and offering you a better experience that what it could do with a simple access token. You must provide your phone number or email address in the first text box, and your password in the second. When pressing OK, your data will be saved and the application will start to retrieve all the required information for showing your buffers."""),
"",_(u"""Once started, the application will start loading your data (posts, audio files, conversations, friends). When done, it will show you a notification indicating that the program is ready."""),
"",_(u"""## General concepts"""),
"",_(u"""Before starting to describe Socializer's usage, we'll explain some concepts that will be used extensively throughout this manual."""),
"",_(u"""### Buffer"""),
"",_(u"""A buffer is a list of items that will manage the data which arrives from VK, after being processed by the application. When you configure your account on Socializer and start it, many buffers are created. Each of them may contain some of the items which this program works with: Newsfeed posts, wall posts, audio and video files, friendship requests and conversations. According to the buffer you are focusing, you will be able to do different actions with these items."""),
"",_(u"""All buffers will be updated in one of the following ways:"""),
"",_(u"""* Periodically: Most buffers containing posts, audio or video files and people, will be updated periodically to reflect the new additions to them. Updates will be every 2 minutes for every buffer, so if you posted something and did not see the post in the buffer, you may need to wait a moment. There is an option, located in the buffer menu on the menu bar, which allows you to trigger a manual update in the current buffer."""),
_(u"""* Real time: Conversation buffers will be updated every time someone sends a message to you. When an user sends you a message, if there is not a conversation buffer created to receive the message, a new conversation buffer will be opened automatically and the message will be placed on it. If you already have an opened conversation for the user sending the message, the message will be placed at the end of the buffer. A different sound will indicate whether a new conversation has been opened or an existing buffer gets updated."""),
"",_(u"""### item"""),
"",_(u"""An item is an element representing some data provided by VK. Items are separated in buffers which stores items of the same type: Audio buffers will contain only audio files, wall buffers will be full of wall posts. The only exception to this rule is the newsfeed buffer, which can contain different kind of items. Actions are available in a per-item basis, allowing certain items to be treated differently than others and showing different dialogs, depending in the kind of data VK sends for them. All items show a menu with their available actions by focusing them in the list and pressing the menu key or a right mouse click."""),
"",_(u"""The following is a brief description of the kind of items socializer can work with, and what actions are available for those."""),
"",_(u"""* Newsfeed post: It represents a post displayed in your "home" page on VK. It may contain a variety of information based in what you or your friends do. A newsfeed item may contain information about new audios added to your friend's library, new people added to friends, wall posts, reposts and new photos added. Depending on the kind of data VK has supplied, the item can open a dialog showing information about the post, a list displaying the people added to friends, or a dialog displaying information for every audio added to library. Take into account that it is not possible to play an audio item from the newsfeed buffer due to limits placed by VK, however, you may add it to your library and play it from your "my music" folder. If a wall post contains a long message, the first 140 characters will be displayed only. You can open the post to read the full message in the dialog. Available options for this item are different depending in the information the item contains. You can open or view the profile of the user that generated the item, like, dislike or add a comment to a post."""),
_(u"""* Wall post: Represent a post in an user's wall. This posts will be similar to wall posts displayed in the newsfeed. If a wall post contains a long message, the first 140 characters will be displayed only. You can open the post to read the full message in the dialog. When opened (by pressing enter or the open option in the associated menu), it will show a dialogue where you can read the message, see and interact with attachment files (by searching the list and pressing enter in the focused attachment to open it), see the photos included in the post, read information related to likes and times the post has been shared, and read all comments. Additionally, you can share the post, indicate you like it, or add a comment. You can cycle through every item in the dialog by pressing tab."""),
_(u"""* Audio: It represent an audio uploaded to the VK'S platform. Actions available for this item are only opening the audio in a dialog and play it due to limitations in access to audio features. When opened, it will be displayed in a dialog allowing you to read the title of the song, artist name, duration and a few buttons: play and download. You can control playback of audio items from the buffer by using the player menu on the menu bar."""),
_(u"""* Video: It represent a video uploaded to the VK'S platform. Actions available for this item are opening the video in your default web browser and move it to a video album. When opened, it will open a web browser and play the video automatically due to VK limitations in access to video files."""),
_(u"""* person: It contains information about a VK user, this item is present in all buffers under the "people" category. Actions available for this item are view user profile, send message and create a timeline, which is a special buffer to track all posts, friends or audios owned by the user. When opened, it will display the profile of this user in a dialog and will provide actions to send a message to the user, or view other sections of her/his profile."""),
_(u"""* Message: A message appears only in conversation buffers and represents a chat message. It may include a list of attached files that will be displayed in a separated list. You can tab to that list (from the history) and press enter in the attached file you want to open. Chat items are marked as read automatically as soon as they are focused."""),
"",_(u"""## Main interface"""),
"",_(u"""If you have used [TWBlue](https://github.com/manuelcortez/twblue) before, the socializer's interface is quite similar. Once you have authorised your account, you will see a window with the following elements:"""),
"",_(u"""* A tree view at the left of the window, where you will see the list of buffers. These buffers are divided in three categories, posts, music and people. You could expand each category for seeing the child buffers. There are some additional buffers, timelines and chats, wich will be filled with timelines for your friends or with chats, when you start or receive a chat session."""),
_(u"""* A button for making a post to your wall."""),
_(u"""* In audio buffers, Two buttons: Play and play all."""),
_(u"""* In audio album buffers, a button for loading music. By default, albums are empty, you have to press the load button for getting the album's items."""),
_(u"""* A list where you will see the posts for the currently selected buffer."""),
_(u"""* In people buffers, like the friends buffer, a button for sending a message to your friends. Pressing that button will cause a chat buffer to be created."""),
_(u"""* A status bar where the program will put some useful information about what it's doing at the moment."""),
_(u"""* And a menu bar."""),
"",_(u"""When socializer starts, it will try to load your news items, wall, audios (your audios, recommended and populars) and friends. At the moment there are only a few supported actions for these items:"""),
"",_(u"""* Audio files: You can play the currently selected song, view the song's details (including lyrics, if available), add or remove from your library, and download it to a desired place in your hard drive. You can find audio files in your news feed or in your own audios buffers. You can find audios as post's attachments. You can create an audios timeline for displaying other's audios."""),
_(u"""* News feed's post: In your news feed buffer, you can press return in any post and socializer will open a new dialogue which can be different, depending in the kind of post you are when the return key was pressed. For example it will open the post if you are focusing a "normal" post, a list of people if you are in a post wich indicates that someone has added friends, an audio displayer if you are in a post wich indicates that someone has added an audio, etc."""),
_(u"""* Wall posts: It will show the post in a dialogue so you could interact with its attachments, view and post comments, or like/unlike/share the post."""),
_(u"""* You can send a message to someone by pressing the send message button in the buffer where you are, if available. Deactivated accounts cannot receive messages."""),
"",_(u"""### Making a post"""),
"",_(u"""When you press the post button, a new dialogue will show up. This dialogue allows you to post something in your wall. In this dialogue you have to write a message. You can translate your message and fix your spelling mistakes. Also you can post an URL address, socializer will try to add it as an attachment, so you will not have to worry about this. When you're ready, just press the send button and it'll be done."""),
"",_(u"""If you want to add some photos, you can press the attach button, then press the kind of attachment you want to add. After this, select the file you want to add and you will see it in the list, once processed. When you are done with attachments, press the OK button, and continue with your post. When you are ready, press the send button. Your post could take some time to be published, depending in the amount of files you have added, but it should be displayed in your wall and newsfeed as soon as it is posted."""),
"",_(u"""### Working with posts in news feed"""),
"",_(u"""You can press the return key in any post in your news feed for opening a new dialogue with some information. The information and dialogue will be different if you are viewing a friendship's notification (when someone has added some friends), an audio file, or a regular post."""),
"",_(u"""If you open a regular post in your newsfeed, you will be able to see the comments in a list, indicate if you do like or dislike the post, repost or add a new comment. If the post has some attachments, you'll find a list populated with them, you can press return in an attachment to execute its default action, wich will be different depending on the kind of attachment that you are viewing."""),
"",_(u"""For friend notifications, you can only view the new added friends in a list and there are some kind of posts that aren't handled. It should be improved."""),
"",_(u"""Additionally, you can press the menu Key or the right click for displaying a menu with some quick actions available for the post you are focusing. These actions are different for every post type."""),
"",_(u"""### Working with songs"""),
"",_(u"""Note: the following applies to audio timelines too."""),
"",_(u"""If you want to play or view audio's details, you'll have to navigate to the tree view, and, using the down arrow, look for "my audios", "populars" or "Recommendations". You will see two more buttons, play and play all. The play button will play the currently selected audio, and the play all button will play audios in the current buffer, starting with the current selected item. You can go to the song's list, look for a desired song and press the play button, or Ctrl+return, which is a keyboard shorcut. Take in to account that there are some keyboard shorcuts that only work in the list of items."""),
"",_(u"""You can play audio from any buffer, just press ctrl+return for making the audio playback possible."""),
"",_(u"""If someone has added multiple audios at once to his library, you will see something like this in your newsfeed: "(friend) has added 4 audios: audio 1, audio2, audio3 and audio4". You can press return in the post for opening the audio's details dialogue, where you will be able to see a list with these audios. By default the first detected song is selected, which means that you could read its details by pressing tab, download or add it to your library. If you change the audio in the list, the information will be updated and you will see details and actions will take effect in the new selected audio."""),
"",_(u"""When an audio file is playing, you can press f5 and f6 for decreasing and increasing volume, respectively, or control+shift+return for play/pause."""),
"",_(u"""If you want to see some details for the selected audio file, you can do it by pressing the return key. You will be able to read some useful information (title, artist, duration and the lyric, if available). Also you will be able to download the song to your hard drive, you have to press the download button in the details' dialogue."""),
"",_(u"""When the download starts, you can close the details dialogue and check the status bar in the main window for seeing the current progress."""),
"",_(u"""Additionally, you can search for audios by using the menu bar, in the buffer menu, select search, then audio. It will display a dialog where you have to set your search preferences."""),
"",_(u"""If you press the menu key, you will see a menu where you will be able to do some actions, for example, add the audio to an album, or add/remove the song from your library."""),
"",_(u"""## menu Bar"""),
"",_(u"""You can go to the menu bar by pressing ALT. Right now, there are three menus, application, buffer and help:"""),
"",_(u"""The graphical user interface of Socializer consists of a window containing:"""),
"",_(u"""* a menu bar accomodating five menus (application, Me, buffer, player and help),"""),
_(u"""* One tree view,"""),
_(u"""* One list of items"""),
_(u"""* Some buttons, depending which is the focused buffer."""),
"",_(u"""The actions that are available for every item will be described later."""),
"",_(u"""In summary, the GUI contains two core components. These are the controls you will find while pressing the Tab key within the program's interface, and the different elements present on the menu bar."""),
"",_(u"""### Buttons in the application"""),
"",_(u"""* Post: this button opens up a dialogue box to write a post in your wall. For the moment, only posting in your own wall is supported. You can upload a picture by pressing the "attach" button and the photo button in the dialog which will appear, check spelling or translate your message by selecting one of the available buttons in the dialogue box. In addition, you can tag a friend in your post by pressing the corresponding button for that purpose. Also it is possible to configure the privacy settings for your post by allowing all users or just your friends to read it. Press the send button to send the post."""),
_(u"""* Play: In audio buffers, plays the focused song. In video buffers, this button will open a web browser for playing the focused video, due to a limitation VK placed to third party developers with videos."""),
_(u"""* Play all: In audio buffers, play all songs starting from the focused buffer, until the last item in the list."""),
_(u"""* Send message: Send a message to a friend, which will open a conversation buffer if it does not exist already. Conversation buffers contain a full conversation, accommodating chat messages, between the current user and someone else. You can type your message in the provided box and press enter to send it to your friend. Additionally, you can add an attachment (for the moment, only attaching an audio file from your library is supported) and open attachments sent in the focused message by pressing tab and finding them in the attachments list."""),
"",_(u"""Bear in mind that buttons will appear according to which actions are possible on the list you are browsing."""),
"",_(u"""## Menus"""),
"",_(u"""Visually, Towards the top of the main application window, can be found a menu bar which contains many of the same functions as listed in the previous section, together with some additional items. To access the menu bar, press the alt key. You will find five menus listed: application, Me, buffer, player and help. This section describes the items on each one of them."""),
"",_(u"""### Application menu"""),
"",_(u"""* Create. Here you can create some things in VK. The only supported item at this moment is the audio album."""),
_(u"""* Delete: Removes items from the VK servers. The only supported item here is the audio album."""),
_(u"""* you can set your preferences by opening the preferences dialog located in this menu."""),
"",_(u"""* Create: opens a menu where you can create a new album. At the moment, only video albums are supported."""),
_(u"""* Delete: opens a menu where you can delete an already existing album owned by yourself. Only video albums are supported at this time."""),
_(u"""* Preferences: Opens a dialogue which lets you configure settings for the entire application."""),
"",_(u"""### Me menu"""),
"",_(u"""* Profile: Opens a menu with several options to do in your profile:"""),
_(u""" * View profile: Displays your profile in a dialog in the application."""),
_(u""" * Open in browser: Redirects you to your profile in vk.com."""),
"",_(u"""### Buffer menu"""),
"",_(u"""* new timeline: This option allows you to create a new timeline. This kind of buffers is capable of download all posts in an user's profile."""),
_(u"""* search: This submenu allows you to create a new buffer, at the moment, you can create only a kind of buffer, an audio search. The audio search will be located in the music category and will have the last 299 results of your query."""),
_(u"""* Update current buffer: perform an update operation in the selected buffer, which will retrieve the new items."""),
_(u"""* Load previous items: Get the previous items for the currently focused buffer."""),
_(u"""* Remove buffer: Tries to remove the current buffer. Default buffers can't be removed."""),
"",_(u"""The help menu is self explanatory."""),
"",_(u"""## Contributing"""),
"",_(u"""If you notice some errors in this document, or features that are not documented yet, you can suggest those changes by contacting me (more information can be find in the following section)."""),
"",_(u"""## contact"""),
"",_(u"""If you have questions, don't esitate to contact me in [Twitter,](https://twitter.com/manuelcortez00) or sending me an email to manuel(at)manuelcortez(dot)net. Just replace the words in parentheses with the original signs."""),
"",_(u"""* New timeline: Lets you open a user's timeline by choosing the user in a dialog box. You can choose which items you want to track: wall posts, friends or audio items. It is created when you press enter. If you invoke this option relative to a user that has no items of the kind you specified, the operation will fail. If you try creating an existing timeline the program will warn you and will not create it again."""),
_(u"""* Search: Shows a menu where you can search for audios or videos on VK. Search results will be created in a new buffer inside "music" or "videos"."""),
_(u"""* Update buffer: Performs a manual update operation in the buffer, which will retrieve all new items present in the social network since the last update."""),
_(u"""* Load previous items: This allows more items to be loaded for the specified buffer. Bear in mind that not all buffers support this setting."""),
_(u"""* Destroy: dismisses the list you're on, if possible."""),
"",_(u"""### Player menu"""),
"",_(u"""* Play: Plays the currently focused audio item, if the current buffer contains audio files. If not, plays the focused audio in the "my music" buffer."""),
_(u"""* Play all: Plays all audio items in the current buffer or the "my music" buffer, starting by the currently focused audio item until the last audio in the list."""),
_(u"""* Stop: Stops audio playback."""),
_(u"""* Previous: Plays the previous audio in the buffer or the last item in the list, if the current audio was the first on the buffer."""),
_(u"""* Next: Plays the Next audio in the buffer or the first item in the list, if the current audio was the last on the buffer."""),
_(u"""* Shuffle: Plays all audios in the current buffer or the "my music" buffer shuffled."""),
_(u"""* Volume up: Increases volume by 5%."""),
_(u"""* Volume down: decreases volume by 5%."""),
_(u"""* Mute: Mutes audio playback, setting volume to 0%."""),
"",_(u"""### help menu"""),
"",_(u"""* About Socializer: shows the credits of the program."""),
_(u"""* Documentation: opens up this file, where you can read some useful program concepts."""),
_(u"""* Check for updates: every time you open the program it automatically checks for new versions. If an update is available, it will ask you if you want to download the update. If you accept, the updating process will commence. When complete, Socializer will be restarted. This item checks for new updates without having to restart the application."""),
_(u"""* Changelog: opens up a document with the list of changes from the current version to the earliest."""),
"",_(u"""## Keyboard shortcuts"""),
"",_(u"""## configuration"""),
"",_(u"""### The general tab"""),
"",_(u"""### The chats tab"""),
"",_(u"""## License and source code"""),
"",_(u"""Socializer is free software, licensed under the GNU GPL license, either version 2 or, at your option, any later version. You can view the license in the file named license.txt, or online at <http://www.gnu.org/licenses/old-licenses/gpl-2.0.html>."""),
"",_(u"""The source code of the program is available at <https://code.manuelcortez.net/manuelcortez/socializer>."""),
"",_(u"""## Contact"""),
"",_(u"""If you still have questions after reading this document, if you wish to collaborate to the project in some other way, or if you simply want to get in touch with the application developer, follow the VK account of [Manuel Cortez.](https://vk.com/manuelcortez) You can also visit [The project website.](https://manuelcortez.net/socializer)"""),
"",_(u"""## Credits"""),
"",_(u"""Socializer is developed and mantained by [Manuel Cortez,](https://manuelcortez.net) with contributions by [Anibal Hernandez](https://dragodark.com)"""),
"",_(u"""We would also like to thank the translators of Socializer, who have allowed the spreading of the application."""),
"",_(u"""* English: Manuel Cortéz."""),
_(u"""* Spanish: Manuel Cortéz."""),
_(u"""* Russian: Valeria K."""),
]

View File

@@ -1,15 +0,0 @@
#! /usr/bin/env python# -*- coding: iso-8859-1 -*-
import shutil
def create_build():
os.chdir("../src")
print "Current path is {0}".format(os.getcwd())
subprocess.call(["C:\python27x86\python.exe", "setup.py", "py2exe"])
def create_archive():
print "Creating zip archive..."
shutil.make_archive("socializer-nightly-build", "zip", "socializer")
shutil.rmtree("socializer")
create_build()
create_archive()

Binary file not shown.

View File

@@ -1,12 +1,16 @@
wxpython
pywin32
markdown
vk_api
bs4
configobj
pypubsub==3.3.0
requests-oauthlib
future
arrow
backports.functools_lru_cache
yandex.translate
mutagen
# forked repositories previously found at http://q-continuum.net
git+https://code.manuelcortez.net/manuelcortez/libloader
git+https://code.manuelcortez.net/manuelcortez/platform_utils

View File

@@ -0,0 +1,15 @@
#! /usr/bin/env python# -*- coding: iso-8859-1 -*-
import shutil
import os
def create_archive():
os.chdir("..\\src")
print "Creating zip archive..."
shutil.make_archive("socializer", "zip", "dist")
if os.path.exists("dist"):
shutil.rmtree("dist")
if os.path.exists("build"):
shutil.rmtree("build")
os.chdir("..\\scripts")
create_archive()

View File

@@ -8,10 +8,11 @@ msgid ""
msgstr ""
"Project-Id-Version: PACKAGE VERSION\n"
"Report-Msgid-Bugs-To: \n"
"POT-Creation-Date: 2016-06-29 13:16-0500\n"
"POT-Creation-Date: 2018-12-16 06:25-0600\n"
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
"Language-Team: LANGUAGE <LL@li.org>\n"
"Language: \n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=CHARSET\n"
"Content-Transfer-Encoding: 8bit\n"
@@ -20,51 +21,13 @@ msgstr ""
msgid "User default"
msgstr ""
#, python-format
msgid "%d day, "
msgstr ""
#, python-format
msgid "%d days, "
msgstr ""
#, python-format
msgid "%d hour, "
msgstr ""
#, python-format
msgid "%d hours, "
msgstr ""
#, python-format
msgid "%d minute, "
msgstr ""
#, python-format
msgid "%d minutes, "
msgstr ""
#, python-format
msgid "%s second"
msgstr ""
#, python-format
msgid "%s seconds"
msgstr ""
msgid "Downloading {0}"
msgstr ""
msgid "Downloading {0} ({1}%)"
msgstr ""
msgid "Ready"
msgstr ""
#. Translators: This is the text displayed in the attachments dialog, when the user adds a photo.
msgid "Photo"
msgstr ""
msgid "Select the audio files you want to send"
msgstr ""
msgid "Write your post"
msgstr ""
@@ -99,6 +62,7 @@ msgid "Select the album where you want to move this song"
msgstr ""
#. Translators: Used when the user has moved an audio to an album.
#. Translators: Used when the user has moved an video to an album.
msgid "Moved"
msgstr ""
@@ -108,9 +72,64 @@ msgstr ""
msgid "Loading album..."
msgstr ""
msgid "Opening video in webbrowser..."
msgstr ""
msgid "Video added to your library"
msgstr ""
msgid "Removed video from library"
msgstr ""
msgid "Select the album where you want to move this video"
msgstr ""
msgid "You have been sending a message that is already sent. Try to update the buffer if you can't see the new message in the history."
msgstr ""
msgid "Playing..."
msgstr ""
msgid "Opening URL..."
msgstr ""
msgid "Opening document in web browser..."
msgstr ""
msgid "Opening video in web browser..."
msgstr ""
msgid "Opening photo in web browser..."
msgstr ""
#, python-brace-format
msgid "{0} {1} now is your friend."
msgstr ""
#, python-brace-format
msgid "You've deleted the friends request to {0} {1}."
msgstr ""
#, python-brace-format
msgid "You've declined the friend request of {0} {1}."
msgstr ""
#, python-brace-format
msgid "{0} {1} is following you."
msgstr ""
msgid "Native"
msgstr ""
msgid "Custom"
msgstr ""
msgid "Preferences"
msgstr ""
msgid "Ready"
msgstr ""
#. Translators: Name for the posts tab in the tree view.
msgid "Posts"
msgstr ""
@@ -130,21 +149,31 @@ msgstr ""
msgid "My audios"
msgstr ""
msgid "Populars"
msgstr ""
msgid "Recommendations"
msgstr ""
msgid "Albums"
msgstr ""
#. Translators: name for the videos category in the tree view.
msgid "Video"
msgstr ""
msgid "My videos"
msgstr ""
msgid "People"
msgstr ""
msgid "Friends"
msgstr ""
msgid "Friendship requests"
msgstr ""
msgid "Pending requests"
msgstr ""
msgid "I follow"
msgstr ""
msgid "Chats"
msgstr ""
@@ -155,37 +184,66 @@ msgid "Logging in VK"
msgstr ""
#. Translators: {0} will be replaced with the name of a buffer.
#, python-brace-format
msgid "Loading items for {0}"
msgstr ""
msgid "Chat server reconnected"
msgstr ""
msgid "This file could not be played because it is not allowed in your country"
msgstr ""
#. Translators: {0} will be replaced with the search term.
#, python-brace-format
msgid "Search for {0}"
msgstr ""
#. Translators: {0} will be replaced with an user.
#, python-brace-format
msgid "{0}'s audios"
msgstr ""
#. Translators: {0} will be replaced with an user.
#, python-brace-format
msgid "{0}'s wall posts"
msgstr ""
#. Translators: {0} will be replaced with an user.
#, python-brace-format
msgid "{0}'s friends"
msgstr ""
#. Translators: {0} will be replaced with an user.
#, python-brace-format
msgid "Chat with {0}"
msgstr ""
#, python-brace-format
msgid "{0} is online."
msgstr ""
#, python-brace-format
msgid "{0} is offline."
msgstr ""
#. Translators: {0} Will be replaced with an audio album's title.
#. Translators: {0} Will be replaced with a video album's title.
#. Translators: {0} will be replaced with an audio album's title.
#. Translators: {0} will be replaced with a video album's title.
#, python-brace-format
msgid "Album: {0}"
msgstr ""
msgid "Select the album you want to delete"
msgstr ""
msgid "Socializer"
msgstr ""
msgid "Chat disconnected. Trying to connect in 60 seconds"
msgstr ""
msgid "Friends of friends"
msgstr ""
@@ -198,43 +256,40 @@ msgstr ""
msgid "New comment"
msgstr ""
#. Translators: {0} will be replaced with a song's title and {1} with the artist.
#, python-brace-format
msgid "Playing {0} by {1}"
msgstr ""
#. Translators: This string is user when socializer can't find the right user information.
#. Translators: This string is used when socializer can't find the right user information.
msgid "Unknown username"
msgstr ""
msgid "Link"
msgstr ""
msgid "no description available"
msgstr ""
msgid "Video"
msgstr ""
msgid "Audio"
msgstr ""
msgid "{0} file"
#, python-brace-format
msgid "{0} > {1}"
msgstr ""
#. Translators: {0} will be replaced with an user.
#, python-brace-format
msgid "repost from {0}"
msgstr ""
#. Translators: {0} will be replaced with the user who is posting, and {2} with the wall owner.
#. Translators: {0} will be replaced with the user who is posting, and {1} with the wall owner.
#, python-brace-format
msgid "Post from {0} in the {1}'s wall"
msgstr ""
#, python-brace-format
msgid "Post from {0}"
msgstr ""
msgid "Untitled link"
msgstr ""
#. Translators: {0} is the number of the current photo and {1} is the total number of photos.
#, python-brace-format
msgid "Loaded photo {0} of {1}"
msgstr ""
msgid "&Dislike"
msgstr ""
@@ -253,24 +308,81 @@ msgstr ""
msgid "You don't like this comment"
msgstr ""
msgid "Opening URL..."
msgstr ""
msgid "Opening document in web browser..."
msgstr ""
msgid "Opening video in web browser..."
msgstr ""
msgid "Opening photo in web browser..."
msgstr ""
#, python-brace-format
msgid "Comment from {0}"
msgstr ""
#, python-brace-format
msgid "{0} added the following friends"
msgstr ""
msgid "Profile"
msgstr ""
msgid "Information for groups is not supported, yet."
msgstr ""
msgid "MMMM D"
msgstr ""
msgid "MMMM D, YYYY"
msgstr ""
#, python-brace-format
msgid "{name}'s profile"
msgstr ""
msgid "Work "
msgstr ""
msgid "Student "
msgstr ""
#, python-brace-format
msgid "In {0}"
msgstr ""
msgid "Single"
msgstr ""
#, python-brace-format
msgid "Dating with {0} {1}"
msgstr ""
msgid "Dating"
msgstr ""
#, python-brace-format
msgid "Engaged with {0} {1}"
msgstr ""
#, python-brace-format
msgid "Married with {0} {1}"
msgstr ""
msgid "It's complicated"
msgstr ""
msgid "Actively searching"
msgstr ""
msgid "In love"
msgstr ""
msgid "Relationship: "
msgstr ""
#. Translators: This is the date of last seen
#, python-brace-format
msgid "{0}"
msgstr ""
msgid "Opening website..."
msgstr ""
msgid "No URL addresses were detected."
msgstr ""
#, python-format
msgid "Misspelled word: %s"
msgstr ""
@@ -296,6 +408,7 @@ msgstr ""
msgid "Replace a&ll"
msgstr ""
#, python-brace-format
msgid "An error has occurred. There are no dictionaries available for the selected language in {0}"
msgstr ""
@@ -578,49 +691,117 @@ msgstr ""
msgid "Yiddish"
msgstr ""
msgid "autodetect"
msgstr ""
msgid "Translate message"
msgstr ""
msgid "&Source language"
msgid "Target language"
msgstr ""
msgid "&Target language"
msgid "photo with no description available"
msgstr ""
#. Translators: This is the date of last seen
msgid "{0}"
#, python-brace-format
msgid "video: {0}"
msgstr ""
msgid "Account deactivated"
msgstr ""
#, python-brace-format
msgid "{0} has shared the {1}'s post"
msgstr ""
#, python-brace-format
msgid "{0} has added an audio: {1}"
msgstr ""
#, python-brace-format
msgid "{0} has added {1} audios: {2}"
msgstr ""
msgid "{0} hadded friends: {1}"
#, python-brace-format
msgid "{0} added friends: {1}"
msgstr ""
#, python-brace-format
msgid "{0} has added a video: {1}"
msgstr ""
#, python-brace-format
msgid "{0} has added {1} videos: {2}"
msgstr ""
msgid "dddd, MMMM D, YYYY H:m:s"
msgid "H:mm."
msgstr ""
msgid "H:mm. dddd, MMMM D, YYYY"
msgstr ""
msgid "Audio removed from library"
msgstr ""
msgid "Video not available"
msgstr ""
msgid "Voice message not available"
msgstr ""
#, python-format
msgid "%d day, "
msgstr ""
#, python-format
msgid "%d days, "
msgstr ""
#, python-format
msgid "%d hour, "
msgstr ""
#, python-format
msgid "%d hours, "
msgstr ""
#, python-format
msgid "%d minute, "
msgstr ""
#, python-format
msgid "%d minutes, "
msgstr ""
#, python-format
msgid "%s second"
msgstr ""
#, python-format
msgid "%s seconds"
msgstr ""
#, python-brace-format
msgid "Downloading {0}"
msgstr ""
#, python-brace-format
msgid "Downloading {0} ({1}%)"
msgstr ""
msgid "Link"
msgstr ""
msgid "no description available"
msgstr ""
msgid "Audio"
msgstr ""
#, python-brace-format
msgid "{0} file"
msgstr ""
msgid "Voice message"
msgstr ""
msgid "In order to continue, you need to configure your VK account before. Would you like to autorhise a new account now?"
msgstr ""
@@ -672,6 +853,7 @@ msgstr ""
msgid "Information needed"
msgstr ""
#, python-brace-format
msgid "Your {0} version is up to date"
msgstr ""
@@ -690,6 +872,7 @@ msgstr ""
msgid "Restricted access"
msgstr ""
#, python-brace-format
msgid "Access to user's audio is denied by the owner. Error code {0}"
msgstr ""
@@ -699,7 +882,9 @@ msgstr ""
msgid "Do you really want to delete this Album? this will be deleted from VK too."
msgstr ""
msgid "Audio album"
#. self.audio_album = create.Append(wx.NewId(), _(u"Audio album"))
#. self.delete_audio_album = delete.Append(wx.NewId(), _(u"Audio album"))
msgid "Video album"
msgstr ""
msgid "Create"
@@ -708,6 +893,18 @@ msgstr ""
msgid "Delete"
msgstr ""
msgid "View profile"
msgstr ""
msgid "Edit profile"
msgstr ""
msgid "Open in browser"
msgstr ""
msgid "Set status message"
msgstr ""
msgid "&New timeline"
msgstr ""
@@ -726,9 +923,40 @@ msgstr ""
msgid "Application"
msgstr ""
msgid "Me"
msgstr ""
msgid "Buffer"
msgstr ""
msgid "Play"
msgstr ""
msgid "Play all"
msgstr ""
msgid "Stop"
msgstr ""
msgid "Previous"
msgstr ""
msgid "Next"
msgstr ""
msgid "Shuffle"
msgstr ""
msgid "Volume up"
msgstr ""
msgid "Volume down"
msgstr ""
msgid "Mute"
msgstr ""
#, python-brace-format
msgid "About {0}"
msgstr ""
@@ -741,6 +969,9 @@ msgstr ""
msgid "Chan&gelog"
msgstr ""
msgid "Audio player"
msgstr ""
msgid "Help"
msgstr ""
@@ -765,6 +996,9 @@ msgstr ""
msgid "Post to this profile"
msgstr ""
msgid "View user profile"
msgstr ""
msgid "&Open"
msgstr ""
@@ -777,15 +1011,24 @@ msgstr ""
msgid "Move to album"
msgstr ""
msgid "View profile"
msgstr ""
msgid "Send a message"
msgstr ""
msgid "Open timeline"
msgstr ""
msgid "View friends in common"
msgstr ""
msgid "Accept"
msgstr ""
msgid "Decline"
msgstr ""
msgid "Keep as follower"
msgstr ""
msgid "Unlike"
msgstr ""
@@ -810,6 +1053,9 @@ msgstr ""
msgid "&Photo"
msgstr ""
msgid "Audio file"
msgstr ""
msgid "Remove attachment"
msgstr ""
@@ -828,12 +1074,33 @@ msgstr ""
msgid "Number of items to load for newsfeed and wall buffers (maximun 100)"
msgstr ""
msgid "Number of items to load in audio buffers (maximun 1000)"
msgid "Number of items to load in video buffers (maximun 200)"
msgstr ""
msgid "Load images in posts"
msgstr ""
msgid "Show notifications when users are online"
msgstr ""
msgid "Show notifications when users are offline"
msgstr ""
msgid "Open unread conversations at startup"
msgstr ""
msgid "Move focus to new conversations"
msgstr ""
msgid "Notification type"
msgstr ""
msgid "General"
msgstr ""
msgid "Chat settings"
msgstr ""
msgid "Save"
msgstr ""
@@ -858,6 +1125,9 @@ msgstr ""
msgid "Attach"
msgstr ""
msgid "Tag a friend"
msgstr ""
msgid "Spelling &correction"
msgstr ""
@@ -870,9 +1140,6 @@ msgstr ""
msgid "Spelling correction"
msgstr ""
msgid "Audio player"
msgstr ""
msgid "Message"
msgstr ""
@@ -891,15 +1158,26 @@ msgstr ""
msgid "Likes"
msgstr ""
msgid "Previous photo"
msgstr ""
msgid "View in full screen"
msgstr ""
msgid "Next photo"
msgstr ""
msgid "Loading data..."
msgstr ""
msgid "Actions"
msgstr ""
#, python-brace-format
msgid "{0} people like this"
msgstr ""
#, python-brace-format
msgid "Shared {0} times"
msgstr ""
@@ -936,22 +1214,43 @@ msgstr ""
msgid "Friend"
msgstr ""
msgid "Name"
msgstr ""
msgid "Status"
msgstr ""
msgid "Last seen"
msgstr ""
msgid "Birthdate"
msgstr ""
msgid "Current city"
msgstr ""
msgid "Home Town"
msgstr ""
msgid "Website"
msgstr ""
msgid "Visit website"
msgstr ""
msgid "Occupation"
msgstr ""
msgid "Basic information"
msgstr ""
msgid "audio Search"
msgstr ""
msgid "&Search"
msgstr ""
msgid "Try to &correct for mistakes in the search term"
msgstr ""
msgid "Search only songs with associated &lyrics"
msgstr ""
msgid "Search by"
msgstr ""
msgid "&artist"
msgid "video Search"
msgstr ""
msgid "&Sort order by: "
@@ -966,6 +1265,34 @@ msgstr ""
msgid "Popularity"
msgstr ""
msgid "Search only for videos in &High definition"
msgstr ""
msgid "S&afe search"
msgstr ""
msgid "Tag friends"
msgstr ""
msgid "All friends"
msgstr ""
msgid "Select"
msgstr ""
msgid "Tagged users"
msgstr ""
msgid "Remove"
msgstr ""
msgid "Available attachments"
msgstr ""
msgid "Selected attachments"
msgstr ""
#, python-brace-format
msgid "New timeline for {0}"
msgstr ""
@@ -1005,26 +1332,23 @@ msgstr ""
msgid "Notification"
msgstr ""
msgid "Name"
msgstr ""
msgid "Photos"
msgstr ""
msgid "Created at"
msgstr ""
msgid "History"
msgid "Add"
msgstr ""
msgid "post"
msgid "History"
msgstr ""
msgid "Write a message"
msgstr ""
msgid "Last seen"
msgstr ""
msgid "Send message"
msgstr ""
msgid "Video&s"
msgstr ""

0
src/__init__.py Normal file
View File

View File

@@ -1,12 +1,22 @@
# -*- coding: utf-8 -*-
name = "Socializer"
version = "0.16"
version = "0.17"
author = u"Manuel Cortez"
authorEmail = "manuel@manuelcortez.net"
copyright = u"Copyright (C) 2016-2018, Manuel Cortez"
description = unicode(name+" Is an accessible VK client for Windows.")
url = "https://manuelcortez.net/socializer"
update_url = "https://code.manuelcortez.net/manuelcortez/socializer/raw/master/update-files/socializer.json"
# The short name will be used for detecting translation files. See languageHandler for more details.
short_name = "socializer"
translators = [u"Valeria K (Russian)", u"Manuel Cortez (Spanish)"]
translators = [u"Darya Ratnikova (Russian)", u"Manuel Cortez (Spanish)"]
bts_name = "socializer"
bts_access_token = "U29jaWFsaXplcg"
bts_url = "https://issues.manuelcortez.net"
### Update information
# URL to retrieve the latest updates for the stable branch.
update_stable_url = "https://code.manuelcortez.net/manuelcortez/socializer/raw/master/update-files/socializer.json"
# URL to retrieve update information for the "next" branch. This is a channel made for alpha versions.
# Every commit will trigger an update, so users wanting to have the bleeding edge code will get it as soon as it is committed here and build by a runner.
update_next_url = "https://code.manuelcortez.net/api/v4/projects/4/repository/commits/master"
# Short_id of the last commit, this is set to none here because it will be set manually by the building tools.
update_next_version = "03286a44"

View File

@@ -1,4 +1,5 @@
# -*- coding: cp1252 -*-
import os
import config_utils
import paths
import logging
@@ -12,5 +13,5 @@ app = None
def setup ():
global app
log.debug("Loading global app settings...")
app = config_utils.load_config(paths.config_path(MAINFILE), paths.app_path(MAINSPEC))
app = config_utils.load_config(os.path.join(paths.config_path(), MAINFILE), os.path.join(paths.app_path(), MAINSPEC))

View File

@@ -1,45 +1,123 @@
# -*- coding: utf-8 -*-
""" Attachment upload methods for different kind of posts in VK. This should become the framework for posting attachment files to the social network."""
""" Attachment controller for different kind of posts in VK.
this controller will take care of preparing data structures to be uploaded later, when the user decides to start the upload process by sending the post.
"""
import os
import logging
import widgetUtils
import audioRecorder
from mutagen.id3 import ID3
from sessionmanager.utils import seconds_to_string
from wxUI.dialogs import attach as gui
from wxUI.dialogs import selector
log = logging.getLogger("controller.attach")
from wxUI.menus import attachMenu
class attachFromLocal(object):
""" Controller used in some sections of the application, mainly for uploading photos from the local computer to VK.
This controller will not upload the contents by itself, but will generate the data structures for being send over the VK API.
At the current time, only photo uploading is supported."""
log = logging.getLogger(__file__)
def __init__(self, voice_messages=False):
class attach(object):
""" Controller used in some sections of the application, it can do the following:
* Handle all user input related to adding local or online files (online files are those already uploaded in vk).
* Prepare local files to be uploaded once a post will be sent (no uploading work is done here, but structured dicts will be generated).
* Parse online files and allow addition of them as attachment, so this controller will add both local and online files in the same dialog.
"""
def __init__(self, session, voice_messages=False):
""" Constructor.
@ session sessionmanager.session object: an object capable of calling all VK methods and accessing the session database.
@voice_messages bool: If True, will add a button for sending voice messages. Functionality for this button has not been added yet.
"""
self.session = session
# Self.attachments will hold a reference to all attachments added to the dialog.
self.attachments = list()
# Type is just a reference, as there will be local and online based attachments.
self.type = "local"
self.dialog = gui.attachDialog(voice_messages)
widgetUtils.connect_event(self.dialog.photo, widgetUtils.BUTTON_PRESSED, self.upload_image)
widgetUtils.connect_event(self.dialog.photo, widgetUtils.BUTTON_PRESSED, self.on_image)
widgetUtils.connect_event(self.dialog.audio, widgetUtils.BUTTON_PRESSED, self.on_audio)
if voice_messages:
widgetUtils.connect_event(self.dialog.voice_message, widgetUtils.BUTTON_PRESSED, self.upload_voice_message)
widgetUtils.connect_event(self.dialog.remove, widgetUtils.BUTTON_PRESSED, self.remove_attachment)
self.dialog.get_response()
log.debug("Attachments controller started.")
self.dialog.get_response()
def on_image(self, *args, **kwargs):
""" display menu for adding image attachments. """
m = attachMenu()
# disable add from VK as it is not supported in images, yet.
m.add.Enable(False)
widgetUtils.connect_event(m, widgetUtils.MENU, self.upload_image, menuitem=m.upload)
self.dialog.PopupMenu(m, self.dialog.photo.GetPosition())
def on_audio(self, *args, **kwargs):
""" display menu to add audio attachments."""
m = attachMenu()
widgetUtils.connect_event(m, widgetUtils.MENU, self.upload_audio, menuitem=m.upload)
widgetUtils.connect_event(m, widgetUtils.MENU, self.add_audio, menuitem=m.add)
self.dialog.PopupMenu(m, self.dialog.audio.GetPosition())
def upload_image(self, *args, **kwargs):
""" allows uploading an image from the computer. In theory
""" allows uploading an image from the computer.
"""
image, description = self.dialog.get_image()
if image != None:
# Define data structure for this attachment, as will be required by VK API later.
imageInfo = {"type": "photo", "file": image, "description": description}
log.debug("Image data to upload: %r" % (imageInfo,))
imageInfo = {"type": "photo", "file": image, "description": description, "from": "local"}
self.attachments.append(imageInfo)
# Translators: This is the text displayed in the attachments dialog, when the user adds a photo.
info = [_(u"Photo"), os.path.basename(image)]
info = [_(u"Photo"), description]
self.dialog.attachments.insert_item(False, *info)
self.dialog.remove.Enable(True)
def upload_audio(self, *args, **kwargs):
""" Allows uploading an audio file from the computer. Only mp3 files are supported. """
audio = self.dialog.get_audio()
if audio != None:
# Define data structure for this attachment, as will be required by VK API later.
# Let's extract the ID3 tags to show them in the list and send them to VK, too.
audio_tags = ID3(audio)
if "TIT2" in audio_tags:
title = audio_tags["TIT2"].text[0]
else:
title = _(u"Untitled")
if "TPE1" in audio_tags:
artist = audio_tags["TPE1"].text[0]
else:
artist = _(u"Unknown artist")
audioInfo = {"type": "audio", "file": audio, "from": "local", "title": title, "artist": artist}
self.attachments.append(audioInfo)
# Translators: This is the text displayed in the attachments dialog, when the user adds an audio file.
info = [_(u"Audio file"), u"{title} - {artist}".format(title=title, artist=artist)]
self.dialog.attachments.insert_item(False, *info)
self.dialog.remove.Enable(True)
def upload_voice_message(self, *args, **kwargs):
a = audioRecorder.audioRecorder()
if a.file != None and a.duration != 0:
audioInfo = {"type": "voice_message", "file": a.file, "from": "local"}
self.attachments.append(audioInfo)
# Translators: This is the text displayed in the attachments dialog, when the user adds an audio file.
info = [_(u"Voice message"), seconds_to_string(a.duration,)]
self.dialog.attachments.insert_item(False, *info)
self.dialog.remove.Enable(True)
def add_audio(self, *args, **kwargs):
""" Allow adding an audio directly from the user's audio library."""
# Let's reuse the already downloaded audios.
list_of_audios = self.session.db["me_audio"]["items"]
audios = []
for i in list_of_audios:
audios.append(u"{0}, {1}".format(i["title"], i["artist"]))
select = selector.selectAttachment(_(u"Select the audio files you want to send"), audios)
if select.get_response() == widgetUtils.OK and select.attachments.GetCount() > 0:
attachments = select.get_all_attachments()
for i in attachments:
info = dict(type="audio", id=list_of_audios[i]["id"], owner_id=list_of_audios[i]["owner_id"])
info["from"] = "online"
self.attachments.append(info)
# Translators: This is the text displayed in the attachments dialog, when the user adds an audio file.
info2 = [_(u"Audio file"), u"{0} - {1}".format(list_of_audios[i]["title"], list_of_audios[i]["artist"])]
self.dialog.attachments.insert_item(False, *info2)
self.check_remove_status()
def remove_attachment(self, *args, **kwargs):
""" Remove the currently focused item from the attachments list."""
current_item = self.dialog.attachments.get_selected()
@@ -54,46 +132,3 @@ class attachFromLocal(object):
""" Checks whether the remove button should remain enabled."""
if len(self.attachments) == 0 and self.dialog.attachments.get_count() == 0:
self.dialog.remove.Enable(False)
class attachFromOnline(object):
""" this was the previously working audio attachment uploader. As VK has deprecated their Audio API for third party clients, this class will not work.
However, I have decided to keep this here so in future it may be modified to attach different kind of online based attachments, such as posted photos, videos, etc.
"""
def __init__(self, session):
""" Default constructor.
@session vk.session: An VK session, capable of calling methods from the VK API.
"""
self.session = session
# Self.attachments will hold a reference to all attachments added to the dialog.
self.attachments = list()
# Define type as online.
self.type = "online"
self.dialog = gui.attachDialog()
widgetUtils.connect_event(self.dialog.audio, widgetUtils.BUTTON_PRESSED, self.add_audio)
# widgetUtils.connect_event(self.dialog.remove, widgetUtils.BUTTON_PRESSED, self.remove_attachment)
self.dialog.get_response()
log.debug("Attachments controller started.")
def add_audio(self, *args, **kwargs):
""" Allow adding an audio directly from the user's audio library."""
list_of_audios = self.session.vk.client_audio.get()
# list_of_audios = list_of_audios["items"]
audios = []
for i in list_of_audios:
audios.append(u"{0}, {1}".format(i["title"], i["artist"]))
select = selector.selectAttachment(_(u"Select the audio files you want to send"), audios)
if select.get_response() == widgetUtils.OK and select.attachments.GetCount() > 0:
attachments = select.get_all_attachments()
for i in attachments:
list_of_audios[i]["type"] = "audio"
self.attachments.append(list_of_audios[i])
def parse_attachments(self):
""" Retrieve all attachments and convert them to data structures required by VK API."""
result = ""
for i in self.attachments:
# Define data structures required by VK API.
preresult = "{0}{1}_{2}".format(i["type"], i["owner_id"], i["id"])
result = preresult+","
return result

View File

@@ -0,0 +1,131 @@
# -*- coding: utf-8 -*-
import time
import os
import tempfile
import sound_lib
import widgetUtils
import sound
import output
from wxUI.dialogs import audioRecorder as gui
from mysc.thread_utils import call_threaded
class audioRecorder(object):
def __init__(self):
self.dialog = gui.audioRecorderDialog()
self.recorded = False
self.recording = None
self.duration = 0
self.playing = None
widgetUtils.connect_event(self.dialog.play, widgetUtils.BUTTON_PRESSED, self.on_play)
widgetUtils.connect_event(self.dialog.pause, widgetUtils.BUTTON_PRESSED, self.on_pause)
widgetUtils.connect_event(self.dialog.record, widgetUtils.BUTTON_PRESSED, self.on_record)
widgetUtils.connect_event(self.dialog.discard, widgetUtils.BUTTON_PRESSED, self.on_discard)
if self.dialog.get_response() == widgetUtils.OK:
self.postprocess()
def on_pause(self, *args, **kwargs):
if self.dialog.get("pause") == _(u"Pause"):
self.recording.pause()
self.dialog.set("pause", _(u"&Resume"))
elif self.dialog.get("pause") == _(u"Resume"):
self.recording.play()
self.dialog.set("pause", _(U"&Pause"))
def on_record(self, *args, **kwargs):
if self.recording != None:
self.stop_recording()
self.dialog.disable_control("pause")
else:
self.start_recording()
self.dialog.enable_control("pause")
def start_recording(self):
self.dialog.disable_control("attach_exists")
self.file = tempfile.mktemp(suffix='.wav')
self.recording = sound.get_recording(self.file)
self.duration = time.time()
self.recording.play()
self.dialog.set("record", _(u"&Stop"))
output.speak(_(u"Recording"))
def stop_recording(self):
self.recording.stop()
self.duration = int(time.time()-self.duration)
self.recording.free()
output.speak(_(u"Stopped"))
self.recorded = True
self.dialog.set("record", _(u"&Record"))
self.file_attached()
def file_attached(self):
self.dialog.set("pause", _(u"&Pause"))
self.dialog.disable_control("record")
self.dialog.enable_control("play")
self.dialog.enable_control("discard")
self.dialog.disable_control("attach_exists")
self.dialog.enable_control("attach")
self.dialog.play.SetFocus()
def on_discard(self, *args, **kwargs):
if self.playing:
self._stop()
if self.recording != None:
self.cleanup()
self.dialog.disable_control("attach")
self.dialog.disable_control("play")
self.file = None
self.dialog.enable_control("record")
self.dialog.enable_control("attach_exists")
self.dialog.record.SetFocus()
self.dialog.disable_control("discard")
self.recording = None
output.speak(_(u"Discarded"))
def on_play(self, *args, **kwargs):
if not self.playing:
call_threaded(self._play)
else:
self._stop()
def _play(self):
output.speak(_(u"Playing..."))
# try:
self.playing = sound_lib.stream.FileStream(file=unicode(self.file), flags=sound_lib.stream.BASS_UNICODE)
self.playing.play()
self.dialog.set("play", _(u"&Stop"))
try:
while self.playing.is_playing:
pass
self.dialog.set("play", _(u"&Play"))
self.playing.free()
self.playing = None
except:
pass
def _stop(self):
output.speak(_(u"Stopped"))
self.playing.stop()
self.playing.free()
self.dialog.set("play", _(u"&Play"))
self.playing = None
def postprocess(self):
if self.file.lower().endswith('.wav'):
output.speak(_(u"Recoding audio..."))
sound.recode_audio(self.file)
self.wav_file = self.file
self.file = '%s.ogg' % self.file[:-4]
def cleanup(self):
if self.playing and self.playing.is_playing:
self.playing.stop()
if self.recording != None:
if self.recording.is_playing:
self.recording.stop()
try:
self.recording.free()
except:
pass
os.remove(self.file)
if hasattr(self, 'wav_file'):
os.remove(self.wav_file)

View File

@@ -16,6 +16,7 @@ import attach
from pubsub import pub
from vk_api.exceptions import VkApiError
from vk_api import upload
from requests.exceptions import ReadTimeout, ConnectionError
from wxUI.tabs import home
from sessionmanager import session, renderers, utils
from mysc.thread_utils import call_threaded
@@ -29,6 +30,10 @@ class baseBuffer(object):
def get_post(self):
""" Return the currently focused post."""
# Handle case where there are no items in the buffer.
if self.tab.list.get_count() == 0:
wx.Bell()
return None
return self.session.db[self.name]["items"][self.tab.list.get_selected()]
def __init__(self, parent=None, name="", session=None, composefunc=None, *args, **kwargs):
@@ -36,7 +41,7 @@ class baseBuffer(object):
@parent wx.Treebook: parent for the buffer panel,
@name str: Name for saving this buffer's data in the local storage variable,
@session sessionmanager.session.vkSession: Session for performing operations in the Vk API. This session should be logged in when this class is instanciated.
@composefunc str: This function will be called for composing the result which will be put in the listCtrl. Composefunc should existss in the sessionmanager.session module.
@composefunc str: This function will be called for composing the result which will be put in the listCtrl. Composefunc should exist in the sessionmanager.renderers module.
args and kwargs will be passed to get_items() without any filtering. Be careful there.
"""
super(baseBuffer, self).__init__()
@@ -67,7 +72,7 @@ class baseBuffer(object):
self.tab = home.homeTab(parent)
def insert(self, item, reversed=False):
""" Add a new item to the list. Uses session.composefunc for parsing the dictionary and create a valid result for putting it in the list."""
""" Add a new item to the list. Uses renderers.composefunc for parsing the dictionary and create a valid result for putting it in the list."""
item_ = getattr(renderers, self.compose_function)(item, self.session)
self.tab.list.insert_item(reversed, *item_)
@@ -83,6 +88,9 @@ class baseBuffer(object):
log.error(u"Error {0}: {1}".format(err.code, err.message))
retrieved = err.code
return retrieved
except ReadTimeout, ConnectionError:
log.exception("Connection error when updating buffer %s. Will try again in 2 minutes" % (self.name,))
return False
if show_nextpage == False:
if self.tab.list.get_count() > 0 and num > 0:
v = [i for i in self.session.db[self.name]["items"][:num]]
@@ -126,19 +134,32 @@ class baseBuffer(object):
def upload_attachments(self, attachments):
""" Upload attachments to VK before posting them.
Returns attachments formatted as string, as required by VK API.
Currently this function only supports photos."""
Currently this function only supports photos and audios."""
# To do: Check the caption and description fields for this kind of attachments.
local_attachments = ""
uploader = upload.VkUpload(self.session.vk.session_object)
for i in attachments:
if i["type"] == "photo":
if i["from"] == "online":
local_attachments += "{0}{1}_{2},".format(i["type"], i["owner_id"], i["id"])
elif i["from"] == "local" and i["type"] == "photo":
photos = i["file"]
description = i["description"]
r = uploader.photo_wall(photos, caption=description)
id = r[0]["id"]
owner_id = r[0]["owner_id"]
# self.session.vk.client.photos.edit(photo_id=id, owner_id=owner_id, caption=description)
local_attachments += "photo{0}_{1},".format(owner_id, id)
elif i["from"] == "local" and i["type"] == "audio":
audio = i["file"]
title = "untitled"
artist = "unnamed"
if "artist" in i:
artist = i["artist"]
if "title" in i:
title = i["title"]
r = uploader.audio(audio, title=title, artist=artist)
id = r["id"]
owner_id = r["owner_id"]
local_attachments += "audio{0}_{1},".format(owner_id, id)
return local_attachments
def connect_events(self):
@@ -156,7 +177,7 @@ class baseBuffer(object):
if pos != 0:
self.tab.PopupMenu(menu, pos)
else:
self.tab.PopupMenu(menu, ev.GetPosition())
self.tab.PopupMenu(menu, self.tab.list.list.GetPosition())
def show_menu_by_key(self, ev):
""" Show contextual menu when menu key is pressed"""
@@ -169,6 +190,8 @@ class baseBuffer(object):
""" Returns contextual menu options. They will change according to the focused item"""
m = menus.postMenu()
p = self.get_post()
if p == None:
return
if p.has_key("likes") == False:
m.like.Enable(False)
elif p["likes"]["user_likes"] == 1:
@@ -186,6 +209,8 @@ class baseBuffer(object):
def do_like(self, *args, **kwargs):
""" Set like in the currently focused post."""
post = self.get_post()
if post == None:
return
user = post[self.user_key]
id = post[self.post_key]
if post.has_key("type"):
@@ -201,6 +226,8 @@ class baseBuffer(object):
def do_dislike(self, *args, **kwargs):
""" Set dislike (undo like) in the currently focused post."""
post = self.get_post()
if post == None:
return
user = post[self.user_key]
id = post[self.post_key]
if post.has_key("type"):
@@ -215,10 +242,12 @@ class baseBuffer(object):
def do_comment(self, *args, **kwargs):
""" Make a comment into the currently focused post."""
post = self.get_post()
if post == None:
return
comment = messages.comment(title=_(u"Add a comment"), caption="", text="")
if comment.message.get_response() == widgetUtils.OK:
msg = comment.message.get_text().encode("utf-8")
post = self.get_post()
try:
user = post[self.user_key]
id = post[self.post_key]
@@ -254,13 +283,17 @@ class baseBuffer(object):
def play_audio(self, *args, **kwargs):
""" Play audio in currently focused buffer, if possible."""
post = self.get_post()
if post == None:
return
if post.has_key("type") and post["type"] == "audio":
pub.sendMessage("play-audio", audio_object=post["audio"]["items"][0])
return True
def open_person_profile(self, *args, **kwargs):
""" Views someone's user profile."""
""" Views someone's profile."""
selected = self.get_post()
if selected == None:
return
# Check all possible keys for an user object in VK API.
keys = ["from_id", "source_id", "id"]
for i in keys:
@@ -270,6 +303,8 @@ class baseBuffer(object):
def open_post(self, *args, **kwargs):
""" Opens the currently focused post."""
post = self.get_post()
if post == None:
return
if post.has_key("type") and post["type"] == "audio":
a = posts.audio(self.session, post["audio"]["items"])
a.dialog.get_response()
@@ -290,6 +325,8 @@ class baseBuffer(object):
def get_users(self):
""" Returns source user in the post."""
post = self.get_post()
if post == None:
return
if post.has_key("type") == False:
return [post["from_id"]]
else:
@@ -299,6 +336,8 @@ class baseBuffer(object):
""" Function executed when the item in a list is selected.
For this buffer it updates the date of posts in the list."""
post = self.get_post()
if post == None:
return
original_date = arrow.get(post["date"])
created_at = original_date.humanize(locale=languageHandler.curLang[:2])
self.tab.list.list.SetItem(self.tab.list.get_selected(), 2, created_at)
@@ -312,10 +351,13 @@ class feedBuffer(baseBuffer):
retrieved = True
try:
num = getattr(self.session, "get_page")(show_nextpage=show_nextpage, name=self.name, *self.args, **self.kwargs)
except ValueError:
except VkApiError as err:
log.error(u"Error {0}: {1}".format(err.code, err.message))
retrieved = err.code
return retrieved
except ReadTimeout, ConnectionError:
log.exception("Connection error when updating buffer %s. Will try again in 2 minutes" % (self.name,))
return False
if show_nextpage == False:
if self.tab.list.get_count() > 0 and num > 0:
v = [i for i in self.session.db[self.name]["items"][:num]]
@@ -346,6 +388,21 @@ class feedBuffer(baseBuffer):
self.user_key = "from_id"
self.post_key = "id"
class communityBuffer(feedBuffer):
def create_tab(self, parent):
self.tab = home.communityTab(parent)
def connect_events(self):
super(communityBuffer, self).connect_events()
widgetUtils.connect_event(self.tab.load, widgetUtils.BUTTON_PRESSED, self.load_community)
def load_community(self, *args, **kwargs):
output.speak(_(u"Loading community..."))
self.can_get_items = True
self.tab.load.Enable(False)
wx.CallAfter(self.get_items)
class audioBuffer(feedBuffer):
""" this buffer was supposed to be used with audio elements
but is deprecated as VK removed its audio support for third party apps."""
@@ -386,6 +443,8 @@ class audioBuffer(feedBuffer):
def open_post(self, *args, **kwargs):
selected = self.tab.list.get_selected()
if selected == -1:
return
audios = [self.session.db[self.name]["items"][selected]]
a = posts.audio(self.session, audios)
a.dialog.get_response()
@@ -395,6 +454,8 @@ class audioBuffer(feedBuffer):
selected = self.tab.list.get_selected()
if selected == -1:
selected = 0
if self.name not in self.session.db:
return
audios = [i for i in self.session.db[self.name]["items"][selected:]]
pub.sendMessage("play-audios", audios=audios)
return True
@@ -423,6 +484,8 @@ class audioBuffer(feedBuffer):
def add_to_library(self, *args, **kwargs):
post = self.get_post()
if post == None:
return
args = {}
args["audio_id"] = post["id"]
if post.has_key("album_id"):
@@ -434,6 +497,8 @@ class audioBuffer(feedBuffer):
def remove_from_library(self, *args, **kwargs):
post = self.get_post()
if post == None:
return
args = {}
args["audio_id"] = post["id"]
args["owner_id"] = self.session.user_id
@@ -443,9 +508,14 @@ class audioBuffer(feedBuffer):
self.tab.list.remove_item(self.tab.list.get_selected())
def move_to_album(self, *args, **kwargs):
if len(self.session.audio_albums) == 0:
return commonMessages.no_audio_albums()
post = self.get_post()
if post == None:
return
album = selector.album(_(u"Select the album where you want to move this song"), self.session)
if album.item == None: return
id = self.get_post()["id"]
id = post["id"]
response = self.session.vk.client.audio.moveToAlbum(album_id=album.item, audio_ids=id)
if response == 1:
# Translators: Used when the user has moved an audio to an album.
@@ -453,6 +523,8 @@ class audioBuffer(feedBuffer):
def get_menu(self):
p = self.get_post()
if p == None:
return
m = menus.audioMenu()
widgetUtils.connect_event(m, widgetUtils.MENU, self.open_post, menuitem=m.open)
widgetUtils.connect_event(m, widgetUtils.MENU, self.play_audio, menuitem=m.play)
@@ -500,18 +572,17 @@ class videoBuffer(feedBuffer):
""" Due to inheritance this method should be called play_audio, but play the currently focused video.
Opens a webbrowser pointing to the video's URL."""
selected = self.tab.list.get_selected()
if self.tab.list.get_count() == 0:
return
if selected == -1:
selected = 0
output.speak(_(u"Opening video in webbrowser..."))
webbrowser.open_new_tab(self.session.db[self.name]["items"][selected]["player"])
# print self.session.db[self.name]["items"][selected]
return True
def open_post(self, *args, **kwargs):
selected = self.tab.list.get_selected()
audios = [self.session.db[self.name]["items"][selected]]
a = posts.audio(self.session, audios)
a.dialog.get_response()
a.dialog.Destroy()
pass
def remove_buffer(self, mandatory=False):
if "me_video" == self.name:
@@ -537,6 +608,8 @@ class videoBuffer(feedBuffer):
def add_to_library(self, *args, **kwargs):
post = self.get_post()
if post == None:
return
args = {}
args["video_id"] = post["id"]
if post.has_key("album_id"):
@@ -548,6 +621,8 @@ class videoBuffer(feedBuffer):
def remove_from_library(self, *args, **kwargs):
post = self.get_post()
if post == None:
return
args = {}
args["video_id"] = post["id"]
args["owner_id"] = self.session.user_id
@@ -557,9 +632,14 @@ class videoBuffer(feedBuffer):
self.tab.list.remove_item(self.tab.list.get_selected())
def move_to_album(self, *args, **kwargs):
if len(self.session.video_albums) == 0:
return commonMessages.no_video_albums()
post= self.get_post()
if post == None:
return
album = selector.album(_(u"Select the album where you want to move this video"), self.session, "video_albums")
if album.item == None: return
id = self.get_post()["id"]
id = post["id"]
response = self.session.vk.client.video.addToAlbum(album_ids=album.item, video_id=id, target_id=self.session.user_id, owner_id=self.get_post()["owner_id"])
if response == 1:
# Translators: Used when the user has moved an video to an album.
@@ -568,6 +648,8 @@ class videoBuffer(feedBuffer):
def get_menu(self):
""" We'll use the same menu that is used for audio items, as the options are exactly the same"""
p = self.get_post()
if p == None:
return
m = menus.audioMenu()
# widgetUtils.connect_event(m, widgetUtils.MENU, self.open_post, menuitem=m.open)
# widgetUtils.connect_event(m, widgetUtils.MENU, self.play_audio, menuitem=m.play)
@@ -651,7 +733,8 @@ class chatBuffer(baseBuffer):
msg = self.get_focused_post()
if msg == False: # Handle the case where the last line of the control cannot be matched to anything.
return
if msg.has_key("read_state") and msg["read_state"] == 0 and msg["id"] not in self.reads:
if msg.has_key("read_state") and msg["read_state"] == 0 and msg["id"] not in self.reads and msg.has_key("out") and msg["out"] == 0:
self.session.soundplayer.play("message_unread.ogg")
self.reads.append(msg["id"])
self.session.db[self.name]["items"][-1]["read_state"] = 1
# print msg
@@ -676,19 +759,23 @@ class chatBuffer(baseBuffer):
self.tab.set_focus_function(self.onFocus)
def catch_enter(self, event, *args, **kwargs):
if event.GetKeyCode() == wx.WXK_RETURN:
self.send_chat_to_user()
shift=event.ShiftDown()
if event.GetKeyCode() == wx.WXK_RETURN and shift == False:
return self.send_chat_to_user()
event.Skip()
def get_items(self, show_nextpage=False):
def get_items(self, show_nextpage=False, unread=False):
if self.can_get_items == False: return
retrieved = True # Control variable for handling unauthorised/connection errors.
try:
num = getattr(self.session, "get_messages")(name=self.name, *self.args, **self.kwargs)
except ValueError as err:
except VkApiError as err:
log.error(u"Error {0}: {1}".format(err.code, err.message))
retrieved = err.code
return retrieved
except ReadTimeout, ConnectionError:
log.exception("Connection error when updating buffer %s. Will try again in 2 minutes" % (self.name,))
return False
if show_nextpage == False:
if self.tab.history.GetValue() != "" and num > 0:
v = [i for i in self.session.db[self.name]["items"][:num]]
@@ -699,22 +786,61 @@ class chatBuffer(baseBuffer):
else:
if num > 0:
[self.insert(i, False) for i in self.session.db[self.name]["items"][:num]]
if unread:
self.session.db[self.name]["items"][-1].update(read_state=0)
return retrieved
def add_attachment(self, *args, **kwargs):
a = attach.attachFromOnline(self.session)
r = a.parse_attachments()
if r != "":
self.attachments_to_be_sent = r
a = attach.attach(self.session, True)
if len(a.attachments) != 0:
self.attachments_to_be_sent = a.attachments
def send_chat_to_user(self, *args, **kwargs):
text = self.tab.text.GetValue()
if text == "" and not hasattr(self, "attachments_to_be_sent"):
wx.Bell()
return
self.tab.text.SetValue("")
call_threaded(self._send_message, text=text)
def _send_message(self, text):
def upload_attachments(self, attachments):
""" Upload attachments to VK before posting them.
Returns attachments formatted as string, as required by VK API.
"""
local_attachments = ""
uploader = upload.VkUpload(self.session.vk.session_object)
for i in attachments:
if i["from"] == "online":
local_attachments += "{0}{1}_{2},".format(i["type"], i["owner_id"], i["id"])
elif i["from"] == "local" and i["type"] == "photo":
photos = i["file"]
description = i["description"]
r = uploader.photo_messages(photos)
id = r[0]["id"]
owner_id = r[0]["owner_id"]
local_attachments += "photo{0}_{1},".format(owner_id, id)
elif i["from"] == "local" and i["type"] == "audio":
audio = i["file"]
title = "untitled"
artist = "unnamed"
if "artist" in i:
artist = i["artist"]
if "title" in i:
title = i["title"]
r = uploader.audio(audio, title=title, artist=artist)
id = r["id"]
owner_id = r["owner_id"]
local_attachments += "audio{0}_{1},".format(owner_id, id)
elif i["from"] == "local" and i["type"] == "voice_message":
r = uploader.audio_message(i["file"], peer_id=self.kwargs["user_id"])
id = r["audio_message"]["id"]
owner_id = r["audio_message"]["owner_id"]
local_attachments += "audio_message{0}_{1},".format(owner_id, id)
return local_attachments
def _send_message(self, text, attachments=[]):
if hasattr(self, "attachments_to_be_sent"):
self.attachments_to_be_sent = self.upload_attachments(self.attachments_to_be_sent)
try:
# Let's take care about the random_id attribute.
# This should be unique per message and should be changed right after the message has been sent.
@@ -728,8 +854,6 @@ class chatBuffer(baseBuffer):
except ValueError as ex:
if ex.code == 9:
output.speak(_(u"You have been sending a message that is already sent. Try to update the buffer if you can't see the new message in the history."))
finally:
self.tab.text.SetValue("")
def __init__(self, *args, **kwargs):
super(chatBuffer, self).__init__(*args, **kwargs)
@@ -792,6 +916,11 @@ class chatBuffer(baseBuffer):
else:
log.debug("Unhandled attachment: %r" % (attachment,))
def clear_reads(self):
for i in self.session.db[self.name]["items"]:
if "read_state" in i and i["read_state"] == 0:
i["read_state"] = 1
class peopleBuffer(feedBuffer):
def create_tab(self, parent):
@@ -802,11 +931,16 @@ class peopleBuffer(feedBuffer):
widgetUtils.connect_event(self.tab.new_chat, widgetUtils.BUTTON_PRESSED, self.new_chat)
def new_chat(self, *args, **kwargs):
user_id = self.session.db[self.name]["items"][self.tab.list.get_selected()]["id"]
user = self.get_post()
if user == None:
return
user_id = user["id"]
pub.sendMessage("new-chat", user_id=user_id)
def onFocus(self, *args, **kwargs):
post = self.session.db[self.name]["items"][self.tab.list.get_selected()]
post = self.get_post()
if post == None:
return
if post.has_key("last_seen") == False: return
original_date = arrow.get(post["last_seen"]["time"])
created_at = original_date.humanize(locale=languageHandler.curLang[:2])
@@ -857,10 +991,13 @@ class requestsBuffer(peopleBuffer):
retrieved = True
try:
ids = self.session.vk.client.friends.getRequests(*self.args, **self.kwargs)
except ValueError as err:
except VkApiError as err:
log.error(u"Error {0}: {1}".format(err.code, err.message))
retrieved = err.code
return retrieved
except ReadTimeout, ConnectionError:
log.exception("Connection error when updating buffer %s. Will try again in 2 minutes" % (self.name,))
return False
num = self.session.get_page(name=self.name, show_nextpage=show_nextpage, endpoint="get", parent_endpoint="users", count=1000, user_ids=", ".join([str(i) for i in ids["items"]]), fields="uid, first_name, last_name, last_seen")
if show_nextpage == False:
if self.tab.list.get_count() > 0 and num > 0:
@@ -876,6 +1013,8 @@ class requestsBuffer(peopleBuffer):
https://vk.com/dev/friends.add
"""
person = self.get_post()
if person == None:
return
result = self.session.vk.client.friends.add(user_id=person["id"])
if result == 2:
msg = _(u"{0} {1} now is your friend.").format(person["first_name"], person["last_name"])
@@ -888,6 +1027,8 @@ class requestsBuffer(peopleBuffer):
https://vk.com/dev/friends.delete
"""
person = self.get_post()
if person == None:
return
result = self.session.vk.client.friends.delete(user_id=person["id"])
if "out_request_deleted" in result:
msg = _(u"You've deleted the friends request to {0} {1}.").format(person["first_name"], person["last_name"])
@@ -902,6 +1043,8 @@ class requestsBuffer(peopleBuffer):
https://vk.com/dev/friends.add
"""
person = self.get_post()
if person == None:
return
result = self.session.vk.client.friends.add(user_id=person["id"], follow=1)
if result == 2:
msg = _(u"{0} {1} is following you.").format(person["first_name"], person["last_name"])

View File

@@ -16,6 +16,22 @@ class configuration(object):
else:
return _(u"Custom")
def get_update_channel_type(self, value):
if value == _(u"Stable"):
return "stable"
elif value == _(u"Weekly"):
return "weekly"
else:
return "alpha"
def get_update_channel_label(self, value):
if value == "stable":
return _(u"Stable")
elif value == "weekly":
return _(u"Weekly")
else:
return _(u"Alpha")
def __init__(self, session):
self.session = session
self.dialog = configurationUI.configurationDialog(_(u"Preferences"))
@@ -26,6 +42,7 @@ class configuration(object):
self.dialog.set_value("general", "wall_buffer_count", self.session.settings["buffers"]["count_for_wall_buffers"])
self.dialog.set_value("general", "video_buffers_count", self.session.settings["buffers"]["count_for_video_buffers"])
self.dialog.set_value("general", "load_images", self.session.settings["general"]["load_images"])
self.dialog.set_value("general", "update_channel", self.get_update_channel_label(self.session.settings["general"]["update_channel"]))
self.dialog.create_chat()
self.dialog.set_value("chat", "notify_online", self.session.settings["chat"]["notify_online"])
self.dialog.set_value("chat", "notify_offline", self.session.settings["chat"]["notify_offline"])
@@ -38,6 +55,18 @@ class configuration(object):
def save_configuration(self):
self.session.settings["buffers"]["count_for_video_buffers"] = self.dialog.get_value("general", "video_buffers_count")
self.session.settings["general"]["load_images"] = self.dialog.get_value("general", "load_images")
update_channel = self.get_update_channel_type(self.dialog.get_value("general", "update_channel"))
if update_channel != self.session.settings["general"]["update_channel"]:
if update_channel == "stable":
self.session.settings["general"]["update_channel"] = update_channel
elif update_channel == "weekly":
dialog = configurationUI.weekly_channel()
if dialog == widgetUtils.YES:
self.session.settings["general"]["update_channel"] = update_channel
elif update_channel == "alpha":
dialog = configurationUI.alpha_channel()
if dialog == widgetUtils.YES:
self.session.settings["general"]["update_channel"] = update_channel
self.session.settings["chat"]["notify_online"] = self.dialog.get_value("chat", "notify_online")
self.session.settings["chat"]["notify_offline"] = self.dialog.get_value("chat", "notify_offline")
self.session.settings["chat"]["open_unread_conversations"] = self.dialog.get_value("chat", "open_unread_conversations")

View File

@@ -2,7 +2,7 @@
import threading
from vk_api.longpoll import VkLongPoll, VkEventType
from pubsub import pub
from requests.exceptions import ReadTimeout
from requests.exceptions import ReadTimeout, ConnectionError
from logging import getLogger
log = getLogger("controller.longpolThread")
@@ -23,5 +23,5 @@ class worker(threading.Thread):
pub.sendMessage("user-online", event=event)
elif event.type == VkEventType.USER_OFFLINE:
pub.sendMessage("user-offline", event=event)
except ReadTimeout:
except:
pub.sendMessage("longpoll-read-timeout")

View File

@@ -25,6 +25,7 @@ from wxUI import (mainWindow, commonMessages)
from wxUI.dialogs import search as searchDialogs
from wxUI.dialogs import timeline, creation
from update import updater
from issueReporter import issueReporter
log = logging.getLogger("controller.main")
@@ -55,7 +56,7 @@ class Controller(object):
self.create_controls()
self.window.Show()
self.connect_events()
call_threaded(updater.do_update)
call_threaded(updater.do_update, update_type=self.session.settings["general"]["update_channel"])
def create_controls(self):
log.debug("Creating controls for the window...")
@@ -67,15 +68,14 @@ class Controller(object):
self.buffers.append(home)
# Translators: Newsfeed's name in the tree view.
self.window.insert_buffer(home.tab, _(u"Home"), self.window.search("posts"))
self.repeatedUpdate = RepeatingTimer(180, self.update_all_buffers)
self.repeatedUpdate = RepeatingTimer(120, self.update_all_buffers)
self.repeatedUpdate.start()
self.readMarker = RepeatingTimer(120, self.mark_as_read)
self.readMarker = RepeatingTimer(60, self.mark_as_read)
self.readMarker.start()
feed = buffers.feedBuffer(parent=self.window.tb, name="me_feed", composefunc="render_status", session=self.session, endpoint="get", parent_endpoint="wall", extended=1, count=self.session.settings["buffers"]["count_for_wall_buffers"])
self.buffers.append(feed)
# Translators: Own user's wall name in the tree view.
self.window.insert_buffer(feed.tab, _(u"My wall"), self.window.search("posts"))
### Disabled audio stuff for now.
audios = buffers.empty(parent=self.window.tb, name="audios")
self.buffers.append(audios)
# Translators: name for the music category in the tree view.
@@ -84,12 +84,13 @@ class Controller(object):
audio = buffers.audioBuffer(parent=self.window.tb, name="me_audio", composefunc="render_audio", session=self.session, endpoint="get", parent_endpoint="audio")
self.buffers.append(audio)
self.window.insert_buffer(audio.tab, _(u"My audios"), self.window.search("audios"))
# p_audio = buffers.audioBuffer(parent=self.window.tb, name="popular_audio", composefunc="render_audio", session=self.session, endpoint="getPopular", parent_endpoint="audio", full_list=True, count=self.session.settings["buffers"]["count_for_audio_buffers"])
# self.buffers.append(p_audio)
# self.window.insert_buffer(p_audio.tab, _(u"Populars"), self.window.search("audios"))
# r_audio = buffers.audioBuffer(parent=self.window.tb, name="recommended_audio", composefunc="render_audio", session=self.session, endpoint="getRecommendations", parent_endpoint="audio", full_list=True, count=self.session.settings["buffers"]["count_for_audio_buffers"])
# self.buffers.append(r_audio)
# self.window.insert_buffer(r_audio.tab, _(u"Recommendations"), self.window.search("audios"))
if self.session.settings["vk"]["use_alternative_tokens"] == False:
p_audio = buffers.audioBuffer(parent=self.window.tb, name="popular_audio", composefunc="render_audio", session=self.session, endpoint="getPopular", parent_endpoint="audio", full_list=True, count=self.session.settings["buffers"]["count_for_audio_buffers"])
self.buffers.append(p_audio)
self.window.insert_buffer(p_audio.tab, _(u"Populars"), self.window.search("audios"))
r_audio = buffers.audioBuffer(parent=self.window.tb, name="recommended_audio", composefunc="render_audio", session=self.session, endpoint="getRecommendations", parent_endpoint="audio", full_list=True, count=self.session.settings["buffers"]["count_for_audio_buffers"])
self.buffers.append(r_audio)
self.window.insert_buffer(r_audio.tab, _(u"Recommendations"), self.window.search("audios"))
albums = buffers.empty(parent=self.window.tb, name="albums")
self.buffers.append(albums)
self.window.insert_buffer(albums.tab, _(u"Albums"), self.window.search("audios"))
@@ -118,6 +119,10 @@ class Controller(object):
outgoing_requests = buffers.requestsBuffer(parent=self.window.tb, name="friend_requests_sent", composefunc="render_person", session=self.session, count=1000, out=1)
self.buffers.append(outgoing_requests)
self.window.insert_buffer(outgoing_requests.tab, _(u"I follow"), self.window.search("requests"))
# communities= buffers.empty(parent=self.window.tb, name="communities")
# self.buffers.append(communities)
# Translators: name for the videos category in the tree view.
# self.window.add_buffer(communities.tab, _(u"Communities"))
chats = buffers.empty(parent=self.window.tb, name="chats")
self.buffers.append(chats)
self.window.add_buffer(chats.tab, _(u"Chats"))
@@ -168,6 +173,8 @@ class Controller(object):
pub.subscribe(self.get_chat, "order-sent-message")
widgetUtils.connect_event(self.window, widgetUtils.MENU, self.view_my_profile, menuitem=self.window.view_profile)
widgetUtils.connect_event(self.window, widgetUtils.MENU, self.view_my_profile_in_browser, menuitem=self.window.open_in_browser)
widgetUtils.connect_event(self.window, widgetUtils.MENU, self.set_status, menuitem=self.window.set_status)
widgetUtils.connect_event(self.window, widgetUtils.MENU, self.on_report_error, menuitem=self.window.report)
def disconnect_events(self):
log.debug("Disconnecting some events...")
@@ -198,10 +205,11 @@ class Controller(object):
self.create_longpoll_thread()
self.status_setter = RepeatingTimer(280, self.set_online)
self.status_setter.start()
self.set_online()
self.create_unread_messages()
call_threaded(self.set_online, notify=True)
call_threaded(self.create_unread_messages)
wx.CallAfter(self.get_audio_albums, self.session.user_id)
wx.CallAfter(self.get_video_albums, self.session.user_id)
# wx.CallAfter(self.get_communities, self.session.user_id)
def create_longpoll_thread(self, notify=False):
try:
@@ -220,7 +228,8 @@ class Controller(object):
def update_all_buffers(self):
log.debug("Updating buffers...")
self.session.audio_albums = self.session.vk.client.audio.getAlbums(owner_id=self.session.user_id)["items"]
self.get_audio_albums(self.session.user_id, create_buffers=False)
self.get_video_albums(self.session.user_id, create_buffers=False)
for i in self.buffers:
if hasattr(i, "get_items"):
i.get_items()
@@ -231,6 +240,11 @@ class Controller(object):
call_threaded(utils.download_file, url, filename, self.window)
def play_audio(self, audio_object):
# Restricted audios does not include an URL paramether.
# Restriction can be due to licensed content to unauthorized countries.
if "url" in audio_object and audio_object["url"] =="":
self.notify(message=_(u"This file could not be played because it is not allowed in your country"))
return
call_threaded(player.player.play, audio_object)
def play_audios(self, audios):
@@ -257,7 +271,7 @@ class Controller(object):
b.get_more_items()
def check_for_updates(self, *args, **kwargs):
update = updater.do_update()
update = updater.do_update(update_type=self.session.settings["general"]["update_channel"])
if update == False:
commonMessages.no_update_available()
@@ -363,7 +377,7 @@ class Controller(object):
if i.kwargs.has_key("user_id") and i.kwargs["user_id"] == user_id: return i
return None
def chat_from_id(self, user_id, setfocus=True):
def chat_from_id(self, user_id, setfocus=True, unread=False):
b = self.search_chat_buffer(user_id)
if b != None:
pos = self.window.search(b.name)
@@ -371,14 +385,14 @@ class Controller(object):
self.window.change_buffer(pos)
return b.tab.text.SetFocus()
return
buffer = buffers.chatBuffer(parent=self.window.tb, name="{0}_messages".format(user_id,), composefunc="render_message", session=self.session, count=200, user_id=user_id, rev=0)
buffer = buffers.chatBuffer(parent=self.window.tb, name="{0}_messages".format(user_id,), composefunc="render_message", session=self.session, count=200, user_id=user_id, rev=0, extended=True, fields="id, user_id, date, read_state, out, body, attachments, deleted")
self.buffers.append(buffer)
# Translators: {0} will be replaced with an user.
self.window.insert_buffer(buffer.tab, _(u"Chat with {0}").format(self.session.get_user_name(user_id, "ins")), self.window.search("chats"))
if setfocus:
pos = self.window.search(buffer.name)
self.window.change_buffer(pos)
wx.CallAfter(buffer.get_items)
wx.CallAfter(buffer.get_items, unread=unread)
if setfocus: buffer.tab.text.SetFocus()
return True
@@ -401,27 +415,30 @@ class Controller(object):
def get_chat(self, obj=None):
""" Searches or creates a chat buffer with the id of the user that is sending or receiving a message.
obj vk_api.longpoll.EventType: an event wich defines some data from the vk's long poll server."""
message = {}
# If someone else sends a message to the current user.
if obj.to_me:
buffer = self.search_chat_buffer(obj.user_id)
uid = obj.user_id
message.update(out=0)
# If the current user sends a message to someone else.
else:
buffer = self.search_chat_buffer(obj.peer_id)
uid = obj.peer_id
# If there is no buffer, we must create one in a wxThread so it will not crash.
if buffer == None:
wx.CallAfter(self.chat_from_id, uid, setfocus=self.session.settings["chat"]["automove_to_conversations"])
wx.CallAfter(self.chat_from_id, uid, setfocus=self.session.settings["chat"]["automove_to_conversations"], unread=True)
self.session.soundplayer.play("conversation_opened.ogg")
return
# If the chat already exists, let's create a dictionary wich will contains data of the received message.
message = {"id": obj.message_id, "user_id": uid, "date": obj.timestamp, "body": obj.text, "attachments": obj.attachments}
message.update(id=obj.message_id, user_id=uid, date=obj.timestamp, body=obj.text, attachments=obj.attachments, read_state=0)
# if attachments is true, let's request for the full message with attachments formatted in a better way.
# Todo: code improvements. We shouldn't need to request the same message again just for these attachments.
if len(message["attachments"]) != 0:
message_ids = message["id"]
results = self.session.vk.client.messages.getById(message_ids=message_ids)
message = results["items"][0]
message.update(read_state=0)
if obj.from_me:
message["from_id"] = self.session.user_id
else:
@@ -437,12 +454,13 @@ class Controller(object):
rendered_message = renderers.render_message(message, self.session)
output.speak(rendered_message[0])
def set_online(self):
def set_online(self, notify=False):
try:
r = self.session.vk.client.account.setOnline()
except:
log.error("Error in setting online for the current user")
self.window.notify("Socializer", "online now!")
if notify:
self.window.notify("Socializer", "online now!")
def set_offline(self):
try:
@@ -462,61 +480,72 @@ class Controller(object):
time.sleep(2)
return self.create_unread_messages()
for i in msgs["items"]:
wx.CallAfter(self.chat_from_id, i["message"]["user_id"], setfocus=False)
wx.CallAfter(self.chat_from_id, i["message"]["user_id"], setfocus=False, unread=True)
def mark_as_read(self):
ids = ""
for i in self.buffers:
if hasattr(i, "reads"):
for z in i.reads:
ids = ids+"%d," % (z,)
if hasattr(i, "reads") and len(i.reads) != 0:
response = self.session.vk.client.messages.markAsRead(peer_id=i.kwargs["user_id"])
i.clear_reads()
i.reads = []
if ids != "":
response = self.session.vk.client.messages.markAsRead(message_ids=ids)
time.sleep(1)
def get_audio_albums(self, user_id=None):
try:
log.debug("Create audio albums...")
def get_audio_albums(self, user_id=None, create_buffers=True):
log.debug("Create audio albums...")
if self.session.settings["vk"]["use_alternative_tokens"]:
albums = self.session.vk.client_audio.get_albums(owner_id=user_id)
except VkApiError as ex:
if ex.code == 6:
log.exception("Something went wrong when getting albums. Waiting a second to retry")
time.sleep(2)
return self.get_audio_albums(user_id=user_id)
elif ex.code == 10:
return
else:
albums = self.session.vk.client.audio.getPlaylists(owner_id=user_id)
albums = albums["items"]
self.session.audio_albums = albums
for i in albums:
buffer = buffers.audioAlbum(parent=self.window.tb, name="{0}_audio_album".format(i["id"],), composefunc="render_audio", session=self.session, endpoint="get", parent_endpoint="audio", owner_id=user_id, album_id=i["id"])
buffer.can_get_items = False
# Translators: {0} Will be replaced with an audio album's title.
name_ = _(u"Album: {0}").format(i["title"],)
self.buffers.append(buffer)
self.window.insert_buffer(buffer.tab, name_, self.window.search("albums"))
buffer.get_items()
# inserts a pause of 1 second here, so we'll avoid errors 6 in VK.
time.sleep(0.3)
if create_buffers:
for i in albums:
buffer = buffers.audioAlbum(parent=self.window.tb, name="{0}_audio_album".format(i["id"],), composefunc="render_audio", session=self.session, endpoint="get", parent_endpoint="audio", owner_id=user_id, album_id=i["id"])
buffer.can_get_items = False
# Translators: {0} Will be replaced with an audio album's title.
name_ = _(u"Album: {0}").format(i["title"],)
self.buffers.append(buffer)
self.window.insert_buffer(buffer.tab, name_, self.window.search("albums"))
# buffer.get_items()
# inserts a pause of 1 second here, so we'll avoid errors 6 in VK.
# time.sleep(0.3)
def get_video_albums(self, user_id=None):
try:
log.debug("Create video albums...")
albums = self.session.vk.client.video.getAlbums(owner_id=user_id)
except VkApiError as ex:
if ex.code == 6:
log.exception("Something went wrong when getting albums. Waiting a second to retry")
time.sleep(2)
return self.get_audio_albums(user_id=user_id)
def get_video_albums(self, user_id=None, create_buffers=True):
log.debug("Create video albums...")
albums = self.session.vk.client.video.getAlbums(owner_id=user_id)
self.session.video_albums = albums["items"]
for i in albums["items"]:
buffer = buffers.videoAlbum(parent=self.window.tb, name="{0}_video_album".format(i["id"],), composefunc="render_video", session=self.session, endpoint="get", parent_endpoint="video", count=self.session.settings["buffers"]["count_for_video_buffers"], user_id=user_id, album_id=i["id"])
buffer.can_get_items = False
# Translators: {0} Will be replaced with a video album's title.
name_ = _(u"Album: {0}").format(i["title"],)
self.buffers.append(buffer)
self.window.insert_buffer(buffer.tab, name_, self.window.search("video_albums"))
buffer.get_items()
# inserts a pause of 1 second here, so we'll avoid errors 6 in VK.
time.sleep(0.3)
if create_buffers:
for i in albums["items"]:
buffer = buffers.videoAlbum(parent=self.window.tb, name="{0}_video_album".format(i["id"],), composefunc="render_video", session=self.session, endpoint="get", parent_endpoint="video", count=self.session.settings["buffers"]["count_for_video_buffers"], user_id=user_id, album_id=i["id"])
buffer.can_get_items = False
# Translators: {0} Will be replaced with a video album's title.
name_ = _(u"Album: {0}").format(i["title"],)
self.buffers.append(buffer)
self.window.insert_buffer(buffer.tab, name_, self.window.search("video_albums"))
# buffer.get_items()
# inserts a pause of 1 second here, so we'll avoid errors 6 in VK.
# time.sleep(0.3)
def get_communities(self, user_id=None, create_buffers=True):
log.debug("Create community buffers...")
groups= self.session.vk.client.groups.get(user_id=user_id, extended=1, fields="city, country, place, description, wiki_page, members_count, counters, start_date, finish_date, can_post, can_see_all_posts, activity, status, contacts, links, fixed_post, verified, site, can_create_topic")
print groups.keys()
self.session.groups=groups["items"]
# Let's feed the local database cache with new groups coming from here.
data= dict(profiles=[], groups=groups["items"])
self.session.process_usernames(data)
if create_buffers:
for i in groups["items"]:
print i.keys()
buffer = buffers.communityBuffer(parent=self.window.tb, name="{0}_community".format(i["id"],), composefunc="render_status", session=self.session, endpoint="get", parent_endpoint="wall", count=self.session.settings["buffers"]["count_for_wall_buffers"], owner_id=-1*i["id"])
buffer.can_get_items = False
# Translators: {0} Will be replaced with a video album's title.
name_ =i["name"]
self.buffers.append(buffer)
self.window.insert_buffer(buffer.tab, name_, self.window.search("communities"))
# buffer.get_items()
# inserts a pause of 1 second here, so we'll avoid errors 6 in VK.
# time.sleep(0.3)
def create_audio_album(self, *args, **kwargs):
d = creation.audio_album()
@@ -649,4 +678,15 @@ class Controller(object):
time.sleep(60)
if hasattr(self, "longpoll"):
del self.longpoll
self.create_longpoll_thread(notify=True)
self.create_longpoll_thread(notify=True)
def set_status(self, *args, **kwargs):
dlg = wx.TextEntryDialog(self.window, _(u"Write your status message"), _(u"Set status"))
if dlg.ShowModal() == widgetUtils.OK:
result = dlg.GetValue()
info = self.session.vk.client.account.saveProfileInfo(status=result)
commonMessages.updated_status()
dlg.Destroy()
def on_report_error(self, *args, **kwargs):
r = issueReporter.reportBug()

View File

@@ -70,7 +70,7 @@ class post(object):
checker.clean()
def show_attach_dialog(self, *args, **kwargs):
a = attach.attachFromLocal()
a = attach.attach(self.session)
if len(a.attachments) != 0:
self.attachments = a.attachments

View File

@@ -91,7 +91,8 @@ class audioPlayer(object):
def play_all(self, list_of_urls, shuffle=False):
self.stop()
self.queue = list_of_urls
# Skip all country restricted tracks as they are not playable here.
self.queue = [i for i in list_of_urls if i["url"] != ""]
if shuffle:
random.shuffle(self.queue)
self.play(self.queue[0])

View File

@@ -57,10 +57,10 @@ class userProfile(object):
# VK can display dd.mm or dd.mm.yyyy birthdates. So let's compare the string lenght to handle both cases accordingly.
if len(person["bdate"]) <= 5: # dd.mm
d = arrow.get(person["bdate"], "D.M")
self.dialog.main_info.set("bdate", d.format(_(u"MMMM D"), locale=languageHandler.getLanguage()))
self.dialog.main_info.set("bdate", d.format(_(u"MMMM D"), locale=languageHandler.curLang[:2]))
else: # mm.dd.yyyy
d = arrow.get(person["bdate"], "D.M.YYYY")
self.dialog.main_info.set("bdate", d.format(_(u"MMMM D, YYYY"), locale=languageHandler.getLanguage()))
self.dialog.main_info.set("bdate", d.format(_(u"MMMM D, YYYY"), locale=languageHandler.curLang[:2]))
# Format current city and home town
city = ""
if person.has_key("home_town") and person["home_town"] != "":
@@ -126,7 +126,7 @@ class userProfile(object):
if person.has_key("last_seen") and person["last_seen"] != False:
original_date = arrow.get(person["last_seen"]["time"])
# Translators: This is the date of last seen
last_seen = _(u"{0}").format(original_date.humanize(locale=languageHandler.getLanguage()),)
last_seen = _(u"{0}").format(original_date.humanize(locale=languageHandler.curLang[:2]),)
self.dialog.main_info.enable("last_seen")
self.dialog.main_info.set("last_seen", last_seen)
self.person = person

View File

@@ -7,5 +7,5 @@ log = logging.getLogger("fixes.fix_requests")
def fix():
log.debug("Applying fix for requests...")
os.environ["REQUESTS_CA_BUNDLE"] = paths.app_path("cacert.pem")
log.debug("Changed CA path to %s" % (paths.app_path("cacert.pem"),))
os.environ["REQUESTS_CA_BUNDLE"] = os.path.join(paths.app_path().decode(paths.fsencoding), "cacert.pem").encode(paths.fsencoding)
log.debug("Changed CA path to %s" % (os.environ["REQUESTS_CA_BUNDLE"].decode(paths.fsencoding)))

View File

View File

@@ -0,0 +1,63 @@
# -*- coding: utf-8 -*-
############################################################
# Copyright (c) 2018 Manuel Cortez <manuel@manuelcortez.net>
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 2 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
#
############################################################
import wx
import platform
import requests
import widgetUtils
import application
import paths
from requests.auth import HTTPBasicAuth
from mysc.thread_utils import call_threaded
from . import wx_ui
class reportBug(object):
def __init__(self):
self.dialog = wx_ui.reportBugDialog()
widgetUtils.connect_event(self.dialog.ok, widgetUtils.BUTTON_PRESSED, self.send)
self.dialog.get_response()
def do_report(self, *args, **kwargs):
r = requests.post(*args, **kwargs)
if r.status_code > 300:
wx.CallAfter(self.dialog.error)
wx.CallAfter(self.dialog.progress.Destroy)
wx.CallAfter(self.dialog.success, r.json()["data"]["issue"]["id"])
def send(self, *args, **kwargs):
if self.dialog.get("summary") == "" or self.dialog.get("description") == "" or self.dialog.get("first_name") == "" or self.dialog.get("last_name") == "":
self.dialog.no_filled()
return
if self.dialog.get("agree") == False:
self.dialog.no_checkbox()
return
title = self.dialog.get("summary")
body = self.dialog.get("description")
issue_type = "issue" # for now just have issue
app_type = paths.mode
app_version = application.version
reporter_name = u"{first_name} {last_name}".format(first_name=self.dialog.get("first_name"), last_name=self.dialog.get("last_name"))
reporter_contact_type = "email" # For now just email is supported in the issue reporter
reporter_contact_handle = self.dialog.get("email")
operating_system = platform.platform()
json = dict(title=title, issue_type=issue_type, body=body, operating_system=operating_system, app_type=app_type, app_version=app_version, reporter_name=reporter_name, reporter_contact_handle=reporter_contact_handle, reporter_contact_type=reporter_contact_type)
auth=HTTPBasicAuth(application.bts_name, application.bts_access_token)
url = "{bts_url}/issue/new".format(bts_url=application.bts_url)
call_threaded(self.do_report, url, json=json, auth=auth)
self.dialog.show_progress()
self.dialog.EndModal(wx.ID_OK)

109
src/issueReporter/wx_ui.py Normal file
View File

@@ -0,0 +1,109 @@
# -*- coding: utf-8 -*-
############################################################
# Copyright (c) 2018 Manuel cortez <manuel@manuelcortez.net>
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 2 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
#
############################################################
import wx
import widgetUtils
import application
class reportBugDialog(widgetUtils.BaseDialog):
def __init__(self):
super(reportBugDialog, self).__init__(parent=None, id=wx.NewId())
self.SetTitle(_(u"Report an error"))
panel = wx.Panel(self)
sizer = wx.BoxSizer(wx.VERTICAL)
summaryLabel = wx.StaticText(panel, -1, _(u"Briefly describe what happened. You will be able to thoroughly explain it later"), size=wx.DefaultSize)
self.summary = wx.TextCtrl(panel, -1)
dc = wx.WindowDC(self.summary)
dc.SetFont(self.summary.GetFont())
self.summary.SetSize(dc.GetTextExtent("a"*80))
summaryB = wx.BoxSizer(wx.HORIZONTAL)
summaryB.Add(summaryLabel, 0, wx.ALL, 5)
summaryB.Add(self.summary, 0, wx.ALL, 5)
sizer.Add(summaryB, 0, wx.ALL, 5)
first_nameLabel = wx.StaticText(panel, -1, _(u"First Name"), size=wx.DefaultSize)
self.first_name = wx.TextCtrl(panel, -1)
dc = wx.WindowDC(self.first_name)
dc.SetFont(self.first_name.GetFont())
self.first_name.SetSize(dc.GetTextExtent("a"*40))
first_nameB = wx.BoxSizer(wx.HORIZONTAL)
first_nameB.Add(first_nameLabel, 0, wx.ALL, 5)
first_nameB.Add(self.first_name, 0, wx.ALL, 5)
sizer.Add(first_nameB, 0, wx.ALL, 5)
last_nameLabel = wx.StaticText(panel, -1, _(u"Last Name"), size=wx.DefaultSize)
self.last_name = wx.TextCtrl(panel, -1)
dc = wx.WindowDC(self.last_name)
dc.SetFont(self.last_name.GetFont())
self.last_name.SetSize(dc.GetTextExtent("a"*40))
last_nameB = wx.BoxSizer(wx.HORIZONTAL)
last_nameB.Add(last_nameLabel, 0, wx.ALL, 5)
last_nameB.Add(self.last_name, 0, wx.ALL, 5)
sizer.Add(last_nameB, 0, wx.ALL, 5)
emailLabel = wx.StaticText(panel, -1, _(u"Email address (Will not be public)"), size=wx.DefaultSize)
self.email = wx.TextCtrl(panel, -1)
dc = wx.WindowDC(self.email)
dc.SetFont(self.email.GetFont())
self.email.SetSize(dc.GetTextExtent("a"*30))
emailB = wx.BoxSizer(wx.HORIZONTAL)
emailB.Add(emailLabel, 0, wx.ALL, 5)
emailB.Add(self.email, 0, wx.ALL, 5)
sizer.Add(emailB, 0, wx.ALL, 5)
descriptionLabel = wx.StaticText(panel, -1, _(u"Here, you can describe the bug in detail"), size=wx.DefaultSize)
self.description = wx.TextCtrl(panel, -1, style=wx.TE_MULTILINE)
dc = wx.WindowDC(self.description)
dc.SetFont(self.description.GetFont())
(x, y) = dc.GetMultiLineTextExtent("0"*2000)
self.description.SetSize((x, y))
descBox = wx.BoxSizer(wx.HORIZONTAL)
descBox.Add(descriptionLabel, 0, wx.ALL, 5)
descBox.Add(self.description, 0, wx.ALL, 5)
sizer.Add(descBox, 0, wx.ALL, 5)
self.agree = wx.CheckBox(panel, -1, _(u"I know that the {0} bug system will get my email address to contact me and fix the bug quickly").format(application.name,))
self.agree.SetValue(False)
sizer.Add(self.agree, 0, wx.ALL, 5)
self.ok = wx.Button(panel, wx.ID_OK, _(u"Send report"))
self.ok.SetDefault()
cancel = wx.Button(panel, wx.ID_CANCEL, _(u"Cancel"))
btnBox = wx.BoxSizer(wx.HORIZONTAL)
btnBox.Add(self.ok, 0, wx.ALL, 5)
btnBox.Add(cancel, 0, wx.ALL, 5)
sizer.Add(btnBox, 0, wx.ALL, 5)
panel.SetSizer(sizer)
self.SetClientSize(sizer.CalcMin())
def no_filled(self):
wx.MessageDialog(self, _(u"You must fill out the following fields: first name, last name, email address and issue information."), _(u"Error"), wx.OK|wx.ICON_ERROR).ShowModal()
def no_checkbox(self):
wx.MessageDialog(self, _(u"You need to mark the checkbox to provide us your email address to contact you if it is necessary."), _(u"Error"), wx.ICON_ERROR).ShowModal()
def success(self, id):
wx.MessageDialog(self, _(u"Thanks for reporting this bug! In future versions, you may be able to find it in the changes list. You have received an email with more information regarding your report. You've reported the bug number %i") % (id), _(u"reported"), wx.OK).ShowModal()
self.Destroy()
def error(self):
wx.MessageDialog(self, _(u"Something unexpected occurred while trying to report the bug. Please, try again later"), _(u"Error while reporting"), wx.ICON_ERROR|wx.OK).ShowModal()
self.Destroy()
def show_progress(self):
self.progress = wx.ProgressDialog(title=_(u"Sending report..."), message=_(u"Please wait while your report is being send."), maximum=100, parent=self)
self.progress.ShowModal()

File diff suppressed because it is too large Load Diff

View File

@@ -1,4 +1,6 @@
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
import os
import logging
from logging.handlers import RotatingFileHandler
import paths
@@ -19,12 +21,12 @@ logger.setLevel(logging.DEBUG)
#handlers
app_handler = RotatingFileHandler(paths.logs_path(APP_LOG_FILE), mode="w")
app_handler = RotatingFileHandler(os.path.join(paths.logs_path(), APP_LOG_FILE), mode="w")
app_handler.setFormatter(formatter)
app_handler.setLevel(logging.DEBUG)
logger.addHandler(app_handler)
error_handler = logging.FileHandler(paths.logs_path(ERROR_LOG_FILE), mode="w")
error_handler = logging.FileHandler(os.path.join(paths.logs_path(), ERROR_LOG_FILE), mode="w")
error_handler.setFormatter(formatter)
error_handler.setLevel(logging.ERROR)
logger.addHandler(error_handler)

View File

@@ -21,7 +21,7 @@ def setup():
log.debug("Starting Socializer %s" % (application.version,))
config.setup()
log.debug("Using %s %s" % (platform.system(), platform.architecture()[0]))
log.debug("Application path is %s" % (paths.app_path(),))
log.debug("Application path is %s" % (paths.app_path().decode(paths.fsencoding),))
log.debug("config path is %s" % (paths.config_path(),))
output.setup()
languageHandler.setLanguage(config.app["app-settings"]["language"])

View File

@@ -1,4 +1,6 @@
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
import sys
import platform
import os
import sys
@@ -9,47 +11,38 @@ from functools import wraps
mode = "portable"
directory = None
fsencoding = sys.getfilesystemencoding()
#log = logging.getLogger("paths")
def merge_paths(func):
@wraps(func)
def merge_paths_wrapper(*a):
return unicode(os.path.join(func(), *a))
return merge_paths_wrapper
@merge_paths
def app_path():
return paths_.app_path()
@merge_paths
def config_path():
global mode, directory
if mode == "portable":
if directory != None: path = os.path.join(directory, "config")
elif directory == None: path = app_path(u"config")
if directory != None: path = os.path.join(directory.decode(fsencoding), "config")
elif directory == None: path = os.path.join(app_path().decode(fsencoding), "config")
elif mode == "installed":
path = data_path("config")
path = os.path.join(data_path().decode(fsencoding), "config")
if not os.path.exists(path):
# log.debug("%s path does not exist, creating..." % (path,))
os.mkdir(path)
return path
@merge_paths
def logs_path():
global mode, directory
if mode == "portable":
if directory != None: path = os.path.join(directory, "logs")
elif directory == None: path = app_path(u"logs")
if directory != None: path = os.path.join(directory.decode(fsencoding), "logs")
elif directory == None: path = os.path.join(app_path().decode(fsencoding), "logs")
elif mode == "installed":
path = data_path("logs")
path = os.path.join(data_path().decode(fsencoding), "logs")
if not os.path.exists(path):
# log.debug("%s path does not exist, creating..." % (path,))
os.mkdir(path)
return path
@merge_paths
def data_path(app_name='TW blue'):
def data_path(app_name='socializer'):
if platform.system() == "Windows":
data_path = os.path.join(os.getenv("AppData"), app_name)
else:
@@ -58,22 +51,19 @@ def data_path(app_name='TW blue'):
os.mkdir(data_path)
return data_path
@merge_paths
def locale_path():
return app_path(u"locales")
return os.path.join(app_path().decode(fsencoding), "locales")
@merge_paths
def sound_path():
return app_path(u"sounds")
return os.path.join(app_path().decode(fsencoding), "sounds")
@merge_paths
def com_path():
global mode, directory
if mode == "portable":
if directory != None: path = os.path.join(directory, "com_cache")
elif directory == None: path = app_path(u"com_cache")
if directory != None: path = os.path.join(directory.decode(fsencoding), "com_cache")
elif directory == None: path = os.path.join(app_path().decode(fsencoding), "com_cache")
elif mode == "installed":
path = data_path(u"com_cache")
path = os.path.join(data_path().decode(fsencoding), "com_cache")
if not os.path.exists(path):
# log.debug("%s path does not exist, creating..." % (path,))
os.mkdir(path)

View File

@@ -2,14 +2,17 @@
user = string(default="")
password = string(default="")
token = string(default="")
use_alternative_tokens = boolean(default=False)
[general]
reverse_timelines = boolean(default=False)
load_images = boolean(default=True)
update_channel = string(default="stable")
[buffers]
count_for_wall_buffers = integer(default=100)
count_for_video_buffers = integer(default=200)
count_for_audio_buffers = integer(default=1000)
[sound]
volume = float(default=1.0)

View File

@@ -0,0 +1,16 @@
import os
import ssl
import utils
try:
context = ssl.create_default_context()
der_certs = context.get_ca_certs(binary_form=True)
pem_certs = [ssl.DER_cert_to_PEM_cert(der) for der in der_certs]
path = os.path.join(utils.getBundleDir(), 'nativecacerts.pem')
with open(path, 'w') as outfile:
for pem in pem_certs:
outfile.write(pem + '\n')
os.environ['REQUESTS_CA_BUNDLE'] = path
except:
pass

101
src/sessionmanager/core.py Normal file
View File

@@ -0,0 +1,101 @@
import _sslfixer
import webbrowser
import random
import requests
import string
from wxUI import two_factor_auth
class AuthenticationError(Exception):
pass
class ValidationError(Exception):
pass
class C2DMError(Exception):
pass
client_id = '2685278'
client_secret = 'lxhD8OD7dMsqtXIm5IUY'
api_ver='5.92'
scope = 'all'
user_agent = 'KateMobileAndroid/47-427 (Android 6.0.1; SDK 23; armeabi-v7a; samsung SM-G900F; ru)'
android_id = '4119748609680577006'
android_token = '5228540069896927210'
api_url = 'https://api.vk.com/method/'
def requestAuth(login, password, scope=scope):
if not (login or password):
raise ValueError
url = 'https://oauth.vk.com/token?grant_type=password&2fa_supported=1&force_sms=1&client_id='+client_id+'&client_secret='+client_secret+'&username='+login+'&password='+password+'&v='+api_ver+'&scope='+scope
headers = {
'User-Agent': user_agent
}
r = requests.get(url, headers=headers)
# If a 401 error is raised, we need to use 2FA here.
# see https://vk.com/dev/auth_direct (switch lang to russian, english docs are very incomplete in the matter)
if r.status_code == 401 and "phone_mask" in r.text:
t = r.json()
code, remember = two_factor_auth()
url = 'https://oauth.vk.com/token?grant_type=password&client_id='+client_id+'&client_secret='+client_secret+'&username='+login+'&password='+password+'&v='+api_ver+'&scope='+scope+'&code='+code
r = requests.get(url, headers=headers)
if r.status_code == 200 and 'access_token' in r.text:
res = r.json()
access_token = res['access_token']
user_id = str(res['user_id'])
return access_token, user_id
else:
raise AuthenticationError(r.text)
def getReceipt(user_id):
if not user_id:
raise ValueError
url = 'https://android.clients.google.com/c2dm/register3'
headers = {
'Authorization': 'AidLogin {0}:{1}'.format(android_id, android_token),
'app': 'com.perm.kate',
'Gcm-ver': '11951438',
'Gcm-cert': 'ca7036ce4c5abe56b9f4439ea275171ceb0d35a4',
#'User-Agent': 'Android-GCM/1.5 (klte NJH47F)',
'content-type': 'application/x-www-form-urlencoded',
}
data = {
'X-subtype': '54740537194',
'X-X-subscription': '54740537194',
'X-X-subtype': '54740537194',
'X-app_ver': '427',
'X-kid': '|ID|1|',
#'X-osv': '23',
'X-cliv': 'iid-9452000',
'X-gmsv': '11951438',
'X-X-kid': '|ID|1|',
'X-appid': ''.join(random.choice(string.ascii_letters + string.digits) for _ in range(11)),
'X-scope': 'id'+user_id,
'X-subscription': '54740537194',
'X-app_ver_name': '47',
'app': 'com.perm.kate',
'sender': '54740537194',
'device': android_id,
'cert': 'ca7036ce4c5abe56b9f4439ea275171ceb0d35a4',
'app_ver': '427',
'gcm_ver': '11951438'
}
r = requests.post(url, headers=headers, data=data)
if r.status_code == 200 and 'token' in r.text:
return r.text[13:]
else:
raise C2DMError(r.text)
def validateToken(token, receipt):
if not (token or receipt):
raise ValueError
url = api_url+'auth.refreshToken?access_token='+token+'&receipt='+receipt+'&v='+api_ver
headers = {'User-Agent': user_agent}
r = requests.get(url, headers=headers)
if r.status_code == 200 and 'token' in r.text:
res = r.json()
received_token = res['response']['token']
if token == received_token or received_token is None :
raise ValidationError(r.text)
else:
return received_token
else:
raise ValidationError(r.text)

View File

@@ -0,0 +1,27 @@
# -*- coding: utf-8 -*-
""" Modified Jconfig base class """
import logging
import json
from codecs import open
from jconfig import jconfig
log = logging.getLogger('jconfig_patched')
class Config(jconfig.Config):
log.info("Instantiated patched jconfig instance")
def load(self, filename, **kwargs):
try:
with open(filename, 'r', encoding="utf-8") as f:
settings = json.load(f)
except (IOError, ValueError):
settings = {}
settings.setdefault(self.section_name, {})
return settings
def save(self):
with open(self._filename, 'w', encoding="utf-8") as f:
json.dump(self._settings, f, indent=2, sort_keys=True)

View File

@@ -87,7 +87,7 @@ def render_newsfeed_item(status, session):
if message == "":
message = "no description available"
# Handle audio rendering.
elif status["type"] == "audio":
elif status["type"] == "audio" and "audio" in status:
# removes deleted audios.
status["audio"] = clean_audio(status["audio"])
if status["audio"]["count"] == 1:
@@ -98,6 +98,16 @@ def render_newsfeed_item(status, session):
composed_audio = render_audio(status["audio"]["items"][i], session)
prem += u"{0} - {1}, ".format(composed_audio[0], composed_audio[1])
message = _(u"{0} has added {1} audios: {2}").format(user, status["audio"]["count"], prem)
# Handle audio playlists
elif status["type"] == "audio_playlist":
if status["audio_playlist"]["count"] == 1:
message = _(u"{0} has added an audio album: {1}, {2}").format(user, status["audio_playlist"]["items"][0]["title"], status["audio_playlist"]["items"][0]["description"])
else:
prestring = ""
for i in xrange(0, status["audio_playlist"]["count"]):
prestring += u"{0} - {1}, ".format(status["audio_playlist"]["items"][i]["title"], status["audio_playlist"]["items"][i]["description"])
message = _(u"{0} has added {1} audio albums: {2}").format(user, status["audio_playlist"]["count"], prestring)
# handle new friends for people in the news buffer.
elif status["type"] == "friend":
msg_users = u""

View File

@@ -1,4 +1,6 @@
# -*- coding: utf-8 -*-
""" Session object for Socializer. A session is the only object to call VK API methods, save settings and access to the cache database and sound playback mechanisms. """
import os
import logging
import languageHandler
import paths
@@ -12,14 +14,20 @@ log = logging.getLogger("session")
sessions = {}
# Saves possible set of identifier keys for VK'S data types
# Save possible set of identifier keys for VK'S data types
# see https://vk.com/dev/datatypes for more information.
# I've added the Date identifier (this is a field in unix time format), for special objects (like friendship indicators) because these objects doesn't have an own identifier.
# I've added the Date identifier (this is a field in unix time format), for special objects (like friendship indicators) because these objects don't have an own identifier.
identifiers = ["aid", "gid", "uid", "pid", "id", "post_id", "nid", "date"]
# Different VK post types, present in the newsfeed buffer. This is useful for filtering by post and remove deleted posts.
post_types = dict(audio="audio", friend="friends", video="video", post="post_type", audio_playlist="audio_playlist")
def find_item(list, item):
""" Finds an item in a list by taking an identifier"""
# determines the kind of identifier that we are using
""" Find an item in a list by taking an identifier.
@list list: A list of dict objects.
@ item dict: A dictionary containing at least an identifier.
"""
# determine the kind of identifier that we are using
global identifiers
identifier = None
for i in identifiers:
@@ -35,13 +43,14 @@ def find_item(list, item):
return False
class vkSession(object):
""" The only session available in socializer. Manages everything related to a model in an MVC app: calls to VK, sound handling, settings and a cache database."""
def order_buffer(self, name, data, show_nextpage):
""" Put new items on the local database. Useful for cursored buffers
name str: The name for the buffer stored in the dictionary.
data list: A list with items and some information about cursors.
""" Put new items on the local cache database.
@name str: The name for the buffer stored in the dictionary.
@data list: A list with items and some information about cursors.
returns the number of items that has been added in this execution"""
global post_types
first_addition = False
num = 0
if self.db.has_key(name) == False:
@@ -52,6 +61,14 @@ class vkSession(object):
if i.has_key("type") and (i["type"] == "wall_photo" or i["type"] == "photo_tag" or i["type"] == "photo"):
log.debug("Skipping unsupported item... %r" % (i,))
continue
# for some reason, VK sends post data if the post has been deleted already.
# Example of this behaviour is when you upload an audio and inmediately delete the audio, VK still sends the post stating that you uploaded an audio file,
# But without the audio data, making socializer to render an empty post.
# Here we check if the post contains data of the type it advertises.
if i.get("type") != None and post_types.get(i["type"]) not in i:
log.error("Detected invalid or unsupported post. Skipping...")
log.error(i)
continue
if find_item(self.db[name]["items"], i) == False:
# if i not in self.db[name]["items"]:
if first_addition == True or show_nextpage == True:
@@ -84,15 +101,16 @@ class vkSession(object):
file_ = "%s/session.conf" % (self.session_id,)
# try:
log.debug("Creating config file %s" % (file_,))
self.settings = Configuration(paths.config_path(file_), paths.app_path("session.defaults"))
self.settings = Configuration(os.path.join(paths.config_path(), file_), os.path.join(paths.app_path(), "session.defaults"))
self.soundplayer = sound.soundSystem(self.settings["sound"])
# except:
# log.exception("The session configuration has failed.")
def login(self):
try:
self.vk.login(self.settings["vk"]["user"], self.settings["vk"]["password"], filename=paths.config_path(self.session_id+"/vkconfig.json"))
self.settings["vk"]["token"] = self.vk.client._session.access_token
config_filename = os.path.join(paths.config_path(), self.session_id, "vkconfig.json")
self.vk.login(self.settings["vk"]["user"], self.settings["vk"]["password"], token=self.settings["vk"]["token"], alt_token=self.settings["vk"]["use_alternative_tokens"], filename=config_filename)
self.settings["vk"]["token"] = self.vk.session_object.token["access_token"]
self.settings.write()
self.logged = True
self.get_my_data()
@@ -127,13 +145,15 @@ class vkSession(object):
def get_page(self, name="", show_nextpage=False, endpoint="", *args, **kwargs):
data = None
if "audio" in endpoint:
if "audio" in endpoint and self.settings["vk"]["use_alternative_tokens"]:
log.info("Using alternative audio methods.")
c = self.vk.client_audio
else:
c = self.vk.client
if kwargs.has_key("parent_endpoint"):
p = kwargs["parent_endpoint"]
if "audio" in p:
if "audio" in p and self.settings["vk"]["use_alternative_tokens"]:
log.info("Using alternative audio methods.")
c = self.vk.client_audio
kwargs.pop("parent_endpoint")
try:
@@ -219,4 +239,4 @@ class vkSession(object):
def get_my_data(self):
log.debug("Getting user identifier...")
user = self.vk.client.users.get(fields="uid, first_name, last_name")
self.user_id = user[0]["id"]
self.user_id = user[0]["id"]

View File

@@ -23,10 +23,9 @@ class sessionManagerController(object):
def fill_list(self):
log.debug("Filling the session list...")
for i in os.listdir(paths.config_path()):
if os.path.isdir(paths.config_path(i)):
if os.path.isdir(os.path.join(paths.config_path(), i)):
log.debug("Adding session %s" % (i,))
strconfig = "%s/session.conf" % (paths.config_path(i))
config_test = Configuration(strconfig)
config_test = Configuration(os.path.join(paths.config_path(), i, "session.conf"))
name = config_test["vk"]["user"]
if name != "" and config_test["vk"]["password"] != "":
self.session = i
@@ -39,9 +38,8 @@ class sessionManagerController(object):
location = (str(time.time())[-6:])
log.debug("Creating session in the %s path" % (location,))
s = session.vkSession(location)
path = paths.config_path(location)
path = os.path.join(paths.config_path(), location)
if not os.path.exists(path):
log.debug("Creating %s path" % (paths.config_path(path),))
os.mkdir(path)
s.get_configuration()
self.get_authorisation(s)

View File

@@ -1,8 +1,10 @@
#!/usr/bin/python
import keys
import logging
import vk_api
import core
from vk_api.audio import VkAudio
from wxUI import two_factor_auth
log = logging.getLogger("vkSessionHandler")
class vkObject(object):
@@ -10,14 +12,27 @@ class vkObject(object):
def __init__(self):
self.api_key = keys.keyring.get_api_key()
def login(self, user, password, filename):
log.debug("Logging in vk using user/password authentication")
self.session_object = vk_api.VkApi(app_id=self.api_key, login=user, password=password, scope="wall, notify, friends, photos, audio, video, docs, notes, pages, status, groups, messages, notifications, stats", config_filename=filename)
self.session_object.auth()
def login(self, user, password, token, alt_token, filename):
if alt_token == False:
log.info("Using kate's token...")
# Let's import the patched vk_api module for using a different user agent
import vk_api_patched as vk_api
if token == "" or token == None:
log.info("Token is not valid. Generating one...")
token = core.requestAuth(user, password)
token = token[0]
receipt = core.getReceipt(token)
token = core.validateToken(token, receipt)
log.info("Token validated...")
self.session_object = vk_api.VkApi(app_id=self.api_key, login=user, password=password, token=token, scope="offline, wall, notify, friends, photos, audio, video, docs, notes, pages, status, groups, messages, notifications, stats", config_filename=filename)
else:
import vk_api
self.session_object = vk_api.VkApi(app_id=self.api_key, login=user, password=password, scope="offline, wall, notify, friends, photos, audio, video, docs, notes, pages, status, groups, messages, notifications, stats", config_filename=filename, auth_handler=two_factor_auth)
self.session_object.auth()
self.client = self.session_object.get_api()
# self.client = API(s, v=self.api_version)
# print self.client.audio.get()
log.debug("Getting tokens for 24 hours...")
self.client.account.getProfileInfo()
# info = self.client.account.getProfileInfo()
# Add session data to the application statistics.
self.client.stats.trackVisitor()
self.client_audio = VkAudio(self.session_object)

View File

@@ -0,0 +1,49 @@
# -*- coding: utf-8 -*-
""" this is a patched version of vk_api to use a different user agent for authenticating against VK.
Everything else looks the same, the only change in the module is the new user agent, emulating a kate mobile session."""
import logging
import vk_api
import threading
import requests
import jconfig_patched as jconfig
from vk_api.enums import VkUserPermissions
from vk_api.exceptions import *
DEFAULT_USER_SCOPE = sum(VkUserPermissions)
class VkApi(vk_api.VkApi):
def __init__(self, login=None, password=None, token=None,
auth_handler=None, captcha_handler=None,
config=jconfig.Config, config_filename='vk_config.v2.json',
api_version='5.92', app_id=2685278, scope=DEFAULT_USER_SCOPE,
client_secret='lxhD8OD7dMsqtXIm5IUY'):
self.login = login
self.password = password
self.token = {'access_token': token}
self.api_version = api_version
self.app_id = app_id
self.scope = scope
self.client_secret = client_secret
self.storage = config(self.login, filename=config_filename)
self.http = requests.Session()
self.http.headers.update({'User-agent': 'KateMobileAndroid/47-427 (Android 6.0.1; SDK 23; armeabi-v7a; samsung SM-G900F; ru)'})
self.last_request = 0.0
self.error_handlers = {
NEED_VALIDATION_CODE: self.need_validation_handler,
CAPTCHA_ERROR_CODE: captcha_handler or self.captcha_handler,
TOO_MANY_RPS_CODE: self.too_many_rps_handler,
TWOFACTOR_CODE: auth_handler or self.auth_handler
}
self.lock = threading.Lock()
self.logger = logging.getLogger('vk_api_patched')
self.logger.info('Started patched VK API client...')

View File

@@ -1,10 +1,30 @@
# -*- coding: utf-8 -*-
import time
import wx
import widgetUtils
code = None
remember = True
def new_account_dialog():
return wx.MessageDialog(None, _(u"In order to continue, you need to configure your VK account before. Would you like to autorhise a new account now?"), _(u"Authorisation"), wx.YES_NO).ShowModal()
def two_factor_auth():
global code, remember
wx.CallAfter(get_code)
while code == None:
time.sleep(0.5)
return (code, remember)
def get_code():
global code, remember
dlg = wx.TextEntryDialog(None, _(u"Please provide the authentication code you have received from VK."), _(u"Two factor authentication code"))
response = dlg.ShowModal()
if response == widgetUtils.OK:
code = dlg.GetValue()
dlg.Destroy()
dlg.Destroy()
class newSessionDialog(widgetUtils.BaseDialog):
def __init__(self):
super(newSessionDialog, self).__init__(parent=None, id=wx.NewId(), title=_(u"Authorise VK"))

View File

@@ -1,4 +1,4 @@
# -*- coding: utf-8 -*-
# -*- coding: utf-8 -*-
""" Setup file to create executables and distribute the source code of this application. Don't forget this file! """
############################################################
# Copyright (c) 2016 Manuel Eduardo Cortéz Vallejo <manuel@manuelcortez.net>
@@ -27,7 +27,7 @@ from glob import glob
def get_architecture_files():
if platform.architecture()[0][:2] == "32":
return [
("", ["../windows-dependencies/x86/bootstrap.exe"]),
("", ["../windows-dependencies/x86/oggenc2.exe", "../windows-dependencies/x86/bootstrap.exe"]),
("Microsoft.VC90.CRT", glob("../windows-dependencies/x86/Microsoft.VC90.CRT/*")),
("Microsoft.VC90.MFC", glob("../windows-dependencies/x86/Microsoft.VC90.MFC/*")),]
elif platform.architecture()[0][:2] == "64":
@@ -47,7 +47,7 @@ def get_data():
]+get_sounds()+get_locales()+get_documentation()+accessible_output2.find_datafiles()+enchant.utils.win32_data_files()+get_architecture_files()+sound_lib.find_datafiles()
def get_documentation ():
answer = []
answer = [("documentation", ["documentation/license.txt"])]
depth = 6
for root, dirs, files in os.walk('documentation'):
if depth == 0:

View File

@@ -1,28 +1,43 @@
# -*- coding: utf-8 -*-
""" Sound utilities for socialized."""
""" Sound utilities for socializer."""
from __future__ import unicode_literals
import sys
import os
import logging as original_logger
log = original_logger.getLogger("sound")
import glob
import subprocess
import logging
import paths
import sound_lib
import output
from sound_lib import recording
from mysc.repeating_timer import RepeatingTimer
from mysc.thread_utils import call_threaded
from sound_lib import output, input
import glob
log = logging.getLogger("sound")
def recode_audio(filename, quality=4.5):
subprocess.call(r'"%s" -q %r "%s"' % (os.path.join(paths.app_path(), 'oggenc2.exe'), quality, filename))
def get_recording(filename):
# try:
val = recording.WaveRecording(filename=filename)
# except sound_lib.main.BassError:
# sound_lib.input.Input()
# val = sound_lib.recording.WaveRecording(filename=filename)
return val
class soundSystem(object):
def check_soundpack(self):
""" Checks if the folder where live the current soundpack exists."""
self.soundpack_OK = False
if os.path.exists(paths.sound_path(self.config["current_soundpack"])):
self.path = paths.sound_path(self.config["current_soundpack"])
if os.path.exists(os.path.join(paths.sound_path(), self.config["current_soundpack"])):
self.path = os.path.join(paths.sound_path(), self.config["current_soundpack"])
self.soundpack_OK = True
elif os.path.exists(paths.sound_path("default")):
elif os.path.exists(os.path.join(paths.sound_path(), "default")):
log.error("The soundpack does not exist, using default...")
self.path = paths.sound_path("default")
self.path = os.path.join(paths.sound_path(), "default")
self.soundpack_OK = True
else:
log.error("The current soundpack could not be found and the default soundpack has been deleted, Socializer will not play sounds.")

0
src/test/__init__.py Normal file
View File

View File

@@ -0,0 +1,27 @@
import unittest
import testconfig
import languageHandler
from sessionmanager import utils
from sessionmanager import renderers
class renderersTestCase(unittest.TestCase):
def setUp(self):
languageHandler.setLanguage("en")
vk = testconfig.get_vk()
self.vk = vk.get_api()
def test_render_person(self):
""" Test the person renderer function."""
user = self.vk.users.get(user_ids=1, fields="first_name, last_name, last_seen")
self.assertIsInstance(user, list)
self.assertEquals(len(user), 1)
user = user[0]
rendered_object = renderers.render_person(user, user["last_seen"])
self.assertIsInstance(rendered_object, list)
self.assertEquals(len(rendered_object), 2)
self.assertIsInstance(rendered_object[0], unicode)
self.assertIsInstance(rendered_object[1], unicode)
if __name__ == "__main__":
unittest.main()

9
src/test/testconfig.py Normal file
View File

@@ -0,0 +1,9 @@
import os
from vk_api import VkApi
def get_vk():
login = os.environ['LOGIN']
password = os.environ['PASSWORD']
vk = VkApi(login, password)
vk.auth(token_only=True)
return vk

View File

@@ -16,18 +16,15 @@ except ImportError:
from platform_utils import paths
def perform_update(endpoint, current_version, app_name='', password=None, update_available_callback=None, progress_callback=None, update_complete_callback=None):
def perform_update(endpoint, current_version, update_type="stable", app_name='', password=None, update_available_callback=None, progress_callback=None, update_complete_callback=None):
requests_session = create_requests_session(app_name=app_name, version=current_version)
available_update = find_update(endpoint, requests_session=requests_session)
if not available_update:
logger.debug("No update available")
return False
available_version = float(available_update['current_version'])
if not float(available_version) > float(current_version) or platform.system()+platform.architecture()[0][:2] not in available_update['downloads']:
logger.debug("No update for this architecture")
available_version, available_description, update_url = find_version_data(update_type, current_version, available_update)
if available_version == False:
return False
available_description = available_update.get('description', None)
update_url = available_update ['downloads'][platform.system()+platform.architecture()[0][:2]]
logger.info("A new update is available. Version %s" % available_version)
if callable(update_available_callback) and not update_available_callback(version=available_version, description=available_description): #update_available_callback should return a falsy value to stop the process
logger.info("User canceled update.")
@@ -57,6 +54,29 @@ def find_update(endpoint, requests_session):
content = response.json()
return content
def find_version_data(update_type, current_version, available_update):
if update_type == "stable":
available_version = float(available_update['current_version'])
if not float(available_version) > float(current_version) or platform.system()+platform.architecture()[0][:2] not in available_update['downloads']:
logger.debug("No update for this architecture")
return (False, False, False)
available_description = available_update.get('description', None)
update_url = available_update ['downloads'][platform.system()+platform.architecture()[0][:2]]
return (available_version, available_description, update_url)
else: # Unstable versions, based in commits instead of version numbers.
# A condition for this to work is a successful ran of a pipeline.
if "status" not in available_update:
return (False, False, False)
if "status" in available_update and available_update["status"] != "success":
return (False, False, False)
available_version = available_update["short_id"]
if available_version == current_version:
return (False, False, False)
available_description = available_update["message"]
# ToDo: simplify this so it can be reused in other projects.
update_url = "https://code.manuelcortez.net/manuelcortez/socializer/-/jobs/artifacts/master/raw/socializer.zip?job=alpha"
return (available_version, available_description, update_url)
def download_update(update_url, update_destination, requests_session, progress_callback=None, chunk_size=io.DEFAULT_BUFFER_SIZE):
total_downloaded = total_size = 0
with io.open(update_destination, 'w+b') as outfile:

View File

@@ -8,9 +8,15 @@ from requests.exceptions import ConnectionError
from wxUpdater import *
logger = logging.getLogger("updater")
def do_update(endpoint=application.update_url):
def do_update(update_type="stable"):
if update_type == "stable":
endpoint = application.update_stable_url
version = application.version
else:
endpoint = application.update_next_url
version = application.update_next_version
try:
return update.perform_update(endpoint=endpoint, current_version=application.version, app_name=application.name, update_available_callback=available_update_dialog, progress_callback=progress_callback, update_complete_callback=update_finished)
return update.perform_update(endpoint=endpoint, current_version=version, app_name=application.name, update_type=update_type, update_available_callback=available_update_dialog, progress_callback=progress_callback, update_complete_callback=update_finished)
except ConnectionError:
logger.exception("Update failed.")
output.speak("An exception occurred while attempting to update " + application.name + ". If this message persists, contact the " + application.name + " developers. More information about the exception has been written to the error log.",True)

View File

@@ -12,11 +12,13 @@ def available_update_dialog(version, description):
else:
return False
def create_progress_dialog():
return wx.ProgressDialog(_(u"Download in Progress"), _(u"Downloading the new version..."), parent=None, maximum=100)
def progress_callback(total_downloaded, total_size):
wx.CallAfter(_progress_callback, total_downloaded, total_size)
def _progress_callback(total_downloaded, total_size):
global progress_dialog
if progress_dialog == None:
progress_dialog = create_progress_dialog()
@@ -27,4 +29,4 @@ def progress_callback(total_downloaded, total_size):
progress_dialog.Update((total_downloaded*100)/total_size, _(u"Updating... %s of %s") % (str(utils.convert_bytes(total_downloaded)), str(utils.convert_bytes(total_size))))
def update_finished():
ms = wx.MessageDialog(None, _(u"The update has been downloaded and installed successfully. Press OK to continue."), _(u"Done!")).ShowModal()
return wx.MessageDialog(None, _(u"The update has been downloaded and installed successfully. Press OK to continue."), _(u"Done!")).ShowModal()

19
src/write_version_data.py Normal file
View File

@@ -0,0 +1,19 @@
#! /usr/bin/env python# -*- coding: iso-8859-1 -*-
""" Write version info (taken from the last commit) to application.py. This method has been implemented this way for running the alpha channel updates.
This file is not intended to be called by the user. It will be used only by the Gitlab CI runner."""
import requests
from codecs import open
print("Writing version data for alpha update...")
commit_info = requests.get("https://code.manuelcortez.net/api/v4/projects/4/repository/commits/master")
commit_info = commit_info.json()
commit = commit_info["short_id"]
print("Got new version info: {commit}".format(commit=commit,))
file = open("application.py", "r", encoding="utf-8")
lines = file.readlines()
lines[-1] = 'update_next_version = "{commit}"'.format(commit=commit,)
file.close()
file2 = open("application.py", "w", encoding="utf-8")
file2.writelines(lines)
file2.close()
print("Wrote application.py with the new version info.")

View File

@@ -25,5 +25,14 @@ def show_error_code(code):
def bad_authorisation():
return wx.MessageDialog(None, _(u"authorisation failed. Your configuration will not be saved. Please close and open again the application for authorising your account. Make sure you have typed your credentials correctly."), _(u"Error"), style=wx.ICON_ERROR).ShowModal()
def no_audio_albums():
return wx.MessageDialog(None, _(u"You do not have audio albums to add tis file."), _(u"Error"), style=wx.ICON_ERROR).ShowModal()
def no_video_albums():
return wx.MessageDialog(None, _(u"You do not have video albums to add tis file."), _(u"Error"), style=wx.ICON_ERROR).ShowModal()
def delete_audio_album():
return wx.MessageDialog(None, _(u"Do you really want to delete this Album? this will be deleted from VK too."), _(u"Attention"), style=wx.ICON_QUESTION|wx.YES_NO).ShowModal()
def updated_status():
return wx.MessageDialog(None, _(u"Your status message has been successfully updated."), _(u"Success")).ShowModal()

View File

@@ -49,3 +49,9 @@ class attachDialog(widgetUtils.BaseDialog):
result = dlg.GetValue()
dlg.Destroy()
return result
def get_audio(self):
openFileDialog = wx.FileDialog(self, _(u"Select the audio file to be uploaded"), "", "", _("Audio files (*.mp3)|*.mp3"), wx.FD_OPEN | wx.FD_FILE_MUST_EXIST)
if openFileDialog.ShowModal() == wx.ID_CANCEL:
return None
return openFileDialog.GetPath()

View File

@@ -22,6 +22,12 @@ class general(wx.Panel, widgetUtils.BaseDialog):
sizer.Add(box3, 0, wx.ALL, 5)
self.load_images = wx.CheckBox(self, wx.NewId(), _(u"Load images in posts"))
sizer.Add(self.load_images, 0, wx.ALL, 5)
lbl4 = wx.StaticText(self, wx.NewId(), _(u"Update channel"))
self.update_channel = wx.ComboBox(self, wx.NewId(), choices=[_(u"Stable"), _(u"Alpha")], value=_(u"Native"), style=wx.CB_READONLY)
box4 = wx.BoxSizer(wx.HORIZONTAL)
box4.Add(lbl4, 0, wx.ALL, 5)
box4.Add(self.update_channel, 0, wx.ALL, 5)
sizer.Add(box4, 0, wx.ALL, 5)
self.SetSizer(sizer)
class chat(wx.Panel, widgetUtils.BaseDialog):
@@ -84,3 +90,8 @@ class configurationDialog(widgetUtils.BaseDialog):
control = getattr(p, key)
getattr(control, "SetValue")(value)
def alpha_channel():
return wx.MessageDialog(None, _(u"The alpha channel contains bleeding edge changes introduced to Socializer. A new alpha update is generated every time there are new changes in the project. Take into account that updates are generated automatically and may fail at any time due to errors in the build process. Use alpha channels when you are sure you want to try the latest changes and contribute with reports to fix bugs. Never use alpha channel updates for everyday use. Do you want to continue?"), _(u"Attention"), style=wx.ICON_QUESTION|wx.YES_NO).ShowModal()
def weekly_channel():
return wx.MessageDialog(None, _(u"The weekly channel generates an update automatically every week by building the source code present in the project. This version is used to test features added to the next stable version. Do you want to continue?"), _(u"Attention"), style=wx.ICON_QUESTION|wx.YES_NO).ShowModal()

View File

@@ -130,11 +130,14 @@ class selectAttachment(widgetUtils.BaseDialog):
if selection in self.attachments_list:
self.attachments.Append(selection)
self.indexes.append(self.cb.GetSelection())
self.remove.Enable(True)
def remove_attachment(self, *args, **kwargs):
n = self.attachments.GetSelection()
self.attachments.Delete(n)
self.indexes.remove(n)
self.indexes.pop(n)
if len(self.indexes) == 0:
self.remove.Enable(False)
def get_all_attachments(self):
return self.indexes

View File

@@ -20,7 +20,7 @@ class mainWindow(wx.Frame):
me = wx.Menu()
profile = wx.Menu()
self.view_profile = profile.Append(wx.NewId(), _(u"View profile"))
self.edit_profile = profile.Append(wx.NewId(), _(u"Edit profile"))
# self.edit_profile = profile.Append(wx.NewId(), _(u"Edit profile"))
self.open_in_browser = profile.Append(wx.NewId(), _(u"Open in browser"))
me.Append(wx.NewId(), _(u"Profile"), profile)
self.set_status = me.Append(wx.NewId(), _(u"Set status message"))
@@ -51,6 +51,7 @@ class mainWindow(wx.Frame):
self.documentation = help_.Append(wx.NewId(), _(u"Manual"))
self.check_for_updates = help_.Append(wx.NewId(), _(u"Check for updates"))
self.changelog = help_.Append(wx.NewId(), _(u"Chan&gelog"))
self.report = help_.Append(wx.NewId(), _(u"Report an error"))
mb.Append(player, _(u"Audio player"))
mb.Append(help_, _(u"Help"))
self.SetMenuBar(mb)

View File

@@ -79,3 +79,11 @@ class notificationsMenu(wx.Menu):
super(notificationsMenu, self).__init__()
self.mark_as_read = wx.MenuItem(self, wx.NewId(), _(u"Mark as read"))
self.Append(self.mark_as_read)
class attachMenu(wx.Menu):
def __init__(self):
super(attachMenu, self).__init__()
self.upload = wx.MenuItem(self, wx.NewId(), _(u"Upload from computer"))
self.Append(self.upload)
self.add = wx.MenuItem(self, wx.NewId(), _(u"Add from VK"))
self.Append(self.add)

View File

@@ -51,6 +51,15 @@ class feedTab(homeTab):
super(feedTab, self).__init__(parent=parent)
self.name = "me_feed"
class communityTab(feedTab):
def create_post_buttons(self):
self.load = wx.Button(self, wx.NewId(), _(u"Load community"))
self.post = wx.Button(self, -1, _(u"&Post"))
self.postBox = wx.BoxSizer(wx.HORIZONTAL)
self.postBox.Add(self.load, 0, wx.ALL, 5)
self.postBox.Add(self.post, 0, wx.ALL, 5)
class audioTab(homeTab):
def create_list(self):
self.lbl = wx.StaticText(self, wx.NewId(), _(u"Mu&sic"))
@@ -78,6 +87,7 @@ class audioAlbumTab(audioTab):
self.play = wx.Button(self, -1, _(u"P&lay"))
self.play_all = wx.Button(self, -1, _(u"Play &All"))
self.postBox = wx.BoxSizer(wx.HORIZONTAL)
self.postBox.Add(self.load, 0, wx.ALL, 5)
self.postBox.Add(self.post, 0, wx.ALL, 5)
self.postBox.Add(self.play, 0, wx.ALL, 5)
self.postBox.Add(self.play_all, 0, wx.ALL, 5)
@@ -168,7 +178,7 @@ class chatTab(wx.Panel):
def create_chat(self):
lbl2 = wx.StaticText(self, -1, _(u"Write a message"))
self.text = wx.TextCtrl(self, -1)
self.text = wx.TextCtrl(self, -1, size=(400, -1), style=wx.TE_MULTILINE)
box = wx.BoxSizer(wx.HORIZONTAL)
box.Add(lbl2, 0, wx.ALL, 20)
box.Add(self.text, 0, wx.ALL, 5)

View File

@@ -0,0 +1,38 @@
# -*- coding: utf-8 -*-
import wx
import widgetUtils
class audioRecorderDialog(widgetUtils.BaseDialog):
def __init__(self):
super(audioRecorderDialog, self).__init__(None, title=_(u"Record voice message"))
panel = wx.Panel(self)
sizer = wx.BoxSizer(wx.VERTICAL)
self.play = wx.Button(panel, -1, _(u"&Play"))
self.play.Disable()
self.pause = wx.Button(panel, -1, _(u"&Pause"))
self.pause.Disable()
self.record = wx.Button(panel, -1, _(u"&Record"))
self.record.SetFocus()
self.discard = wx.Button(panel, -1, _(u"&Discard"))
self.discard.Disable()
ok = wx.Button(panel, wx.ID_OK, _(u"&Add"))
cancel = wx.Button(panel, wx.ID_CANCEL, _(u"&Cancel"))
btnSizer = wx.BoxSizer(wx.HORIZONTAL)
btnSizer2 = wx.BoxSizer(wx.HORIZONTAL)
btnSizer.Add(self.play, 0, wx.ALL, 5)
btnSizer.Add(self.pause, 0, wx.ALL, 5)
btnSizer.Add(self.record, 0, wx.ALL, 5)
btnSizer2.Add(ok, 0, wx.ALL, 5)
btnSizer2.Add(cancel, 0, wx.ALL, 5)
sizer.Add(btnSizer, 0, wx.ALL, 5)
sizer.Add(btnSizer2, 0, wx.ALL, 5)
panel.SetSizer(sizer)
self.SetClientSize(sizer.CalcMin())
def enable_control(self, control):
if hasattr(self, control):
getattr(self, control).Enable()
def disable_control(self, control):
if hasattr(self, control):
getattr(self, control).Disable()

View File

@@ -1,4 +1,4 @@
{"current_version": "0.14",
"description": "Added management for audio albums. Bugfixes. Updated translations. Added a context menu for some items. Unread chats will be opened at startup.",
{"current_version": "0.17",
"description": ".",
"downloads":
{"Windows32": "https://github.com/manuelcortez/socializer/blob/master/nightly/socializer-nightly-build.zip?raw=true"}}
{"Windows32": "https://code.manuelcortez.net/manuelcortez/socializer/-/jobs/artifacts/master/raw/socializer.zip?job=stable"}}

Binary file not shown.

Binary file not shown.