Updated changelog
This commit is contained in:
		| @@ -12,6 +12,8 @@ | |||||||
| * Socializer will skip 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. | * Socializer will skip 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. | ||||||
| * Fixed an error when people was trying to open a post in an empty buffer, or accessing the menu when there are no posts in the buffer. | * Fixed an error when people was 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. | * Now Socializer will not send a notification every 5 minutes. | ||||||
|  | * 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. | ||||||
|  |  | ||||||
| ## Changes in version 0.16 (13.12.2018) | ## Changes in version 0.16 (13.12.2018) | ||||||
|  |  | ||||||
|   | |||||||
| @@ -16,6 +16,7 @@ import attach | |||||||
| from pubsub import pub | from pubsub import pub | ||||||
| from vk_api.exceptions import VkApiError | from vk_api.exceptions import VkApiError | ||||||
| from vk_api import upload | from vk_api import upload | ||||||
|  | from requests.exceptions import ReadTimeout, ConnectionError | ||||||
| from wxUI.tabs import home | from wxUI.tabs import home | ||||||
| from sessionmanager import session, renderers, utils | from sessionmanager import session, renderers, utils | ||||||
| from mysc.thread_utils import call_threaded | from mysc.thread_utils import call_threaded | ||||||
| @@ -87,6 +88,9 @@ class baseBuffer(object): | |||||||
| 			log.error(u"Error {0}: {1}".format(err.code, err.message)) | 			log.error(u"Error {0}: {1}".format(err.code, err.message)) | ||||||
| 			retrieved = err.code | 			retrieved = err.code | ||||||
| 			return retrieved | 			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 show_nextpage  == False: | ||||||
| 			if self.tab.list.get_count() > 0 and num > 0: | 			if self.tab.list.get_count() > 0 and num > 0: | ||||||
| 				v = [i for i in self.session.db[self.name]["items"][:num]] | 				v = [i for i in self.session.db[self.name]["items"][:num]] | ||||||
| @@ -141,7 +145,6 @@ class baseBuffer(object): | |||||||
| 				r = uploader.photo_wall(photos, caption=description) | 				r = uploader.photo_wall(photos, caption=description) | ||||||
| 				id = r[0]["id"] | 				id = r[0]["id"] | ||||||
| 				owner_id = r[0]["owner_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) | 				local_attachments += "photo{0}_{1},".format(owner_id, id) | ||||||
| 		return local_attachments | 		return local_attachments | ||||||
|  |  | ||||||
| @@ -334,10 +337,13 @@ class feedBuffer(baseBuffer): | |||||||
| 		retrieved = True | 		retrieved = True | ||||||
| 		try: | 		try: | ||||||
| 			num = getattr(self.session, "get_page")(show_nextpage=show_nextpage, name=self.name, *self.args, **self.kwargs) | 			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)) | 			log.error(u"Error {0}: {1}".format(err.code, err.message)) | ||||||
| 			retrieved = err.code | 			retrieved = err.code | ||||||
| 			return retrieved | 			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 show_nextpage  == False: | ||||||
| 			if self.tab.list.get_count() > 0 and num > 0: | 			if self.tab.list.get_count() > 0 and num > 0: | ||||||
| 				v = [i for i in self.session.db[self.name]["items"][:num]] | 				v = [i for i in self.session.db[self.name]["items"][:num]] | ||||||
| @@ -479,6 +485,8 @@ class audioBuffer(feedBuffer): | |||||||
| 			self.tab.list.remove_item(self.tab.list.get_selected()) | 			self.tab.list.remove_item(self.tab.list.get_selected()) | ||||||
|  |  | ||||||
| 	def move_to_album(self, *args, **kwargs): | 	def move_to_album(self, *args, **kwargs): | ||||||
|  | 		if len(self.session.audio_albums) == 0: | ||||||
|  | 			return commonMessages.no_audio_albums() | ||||||
| 		post = self.get_post() | 		post = self.get_post() | ||||||
| 		if post == None: | 		if post == None: | ||||||
| 			return | 			return | ||||||
| @@ -601,6 +609,8 @@ class videoBuffer(feedBuffer): | |||||||
| 			self.tab.list.remove_item(self.tab.list.get_selected()) | 			self.tab.list.remove_item(self.tab.list.get_selected()) | ||||||
|  |  | ||||||
| 	def move_to_album(self, *args, **kwargs): | 	def move_to_album(self, *args, **kwargs): | ||||||
|  | 		if len(self.session.video_albums) == 0: | ||||||
|  | 			return commonMessages.no_video_albums() | ||||||
| 		post= self.get_post() | 		post= self.get_post() | ||||||
| 		if post == None: | 		if post == None: | ||||||
| 			return | 			return | ||||||
| @@ -735,10 +745,13 @@ class chatBuffer(baseBuffer): | |||||||
| 		retrieved = True # Control variable for handling unauthorised/connection errors. | 		retrieved = True # Control variable for handling unauthorised/connection errors. | ||||||
| 		try: | 		try: | ||||||
| 			num = getattr(self.session, "get_messages")(name=self.name, *self.args, **self.kwargs) | 			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)) | 			log.error(u"Error {0}: {1}".format(err.code, err.message)) | ||||||
| 			retrieved = err.code | 			retrieved = err.code | ||||||
| 			return retrieved | 			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 show_nextpage  == False: | ||||||
| 			if self.tab.history.GetValue() != "" and num > 0: | 			if self.tab.history.GetValue() != "" and num > 0: | ||||||
| 				v = [i for i in self.session.db[self.name]["items"][:num]] | 				v = [i for i in self.session.db[self.name]["items"][:num]] | ||||||
| @@ -914,10 +927,13 @@ class requestsBuffer(peopleBuffer): | |||||||
| 		retrieved = True | 		retrieved = True | ||||||
| 		try: | 		try: | ||||||
| 			ids = self.session.vk.client.friends.getRequests(*self.args, **self.kwargs) | 			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)) | 			log.error(u"Error {0}: {1}".format(err.code, err.message)) | ||||||
| 			retrieved = err.code | 			retrieved = err.code | ||||||
| 			return retrieved | 			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") | 		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 show_nextpage  == False: | ||||||
| 			if self.tab.list.get_count() > 0 and num > 0: | 			if self.tab.list.get_count() > 0 and num > 0: | ||||||
|   | |||||||
| @@ -2,7 +2,7 @@ | |||||||
| import threading | import threading | ||||||
| from vk_api.longpoll import VkLongPoll, VkEventType | from vk_api.longpoll import VkLongPoll, VkEventType | ||||||
| from pubsub import pub | from pubsub import pub | ||||||
| from requests.exceptions import ReadTimeout | from requests.exceptions import ReadTimeout, ConnectionError | ||||||
|  |  | ||||||
| from logging import getLogger | from logging import getLogger | ||||||
| log = getLogger("controller.longpolThread") | log = getLogger("controller.longpolThread") | ||||||
| @@ -23,5 +23,5 @@ class worker(threading.Thread): | |||||||
| 					pub.sendMessage("user-online", event=event) | 					pub.sendMessage("user-online", event=event) | ||||||
| 				elif event.type == VkEventType.USER_OFFLINE: | 				elif event.type == VkEventType.USER_OFFLINE: | ||||||
| 					pub.sendMessage("user-offline", event=event) | 					pub.sendMessage("user-offline", event=event) | ||||||
| 		except ReadTimeout: | 		except ReadTimeout, ConnectionError: | ||||||
| 			pub.sendMessage("longpoll-read-timeout") | 			pub.sendMessage("longpoll-read-timeout") | ||||||
| @@ -25,5 +25,11 @@ def show_error_code(code): | |||||||
| def bad_authorisation(): | 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() | 	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(): | 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() | 	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() | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user