Merge branch 'master' into next

This commit is contained in:
Manuel Cortez 2018-12-31 11:51:33 -06:00
commit 42a5b67386
5 changed files with 25 additions and 6 deletions

View File

@ -12,7 +12,6 @@ translators = [u"Darya Ratnikova (Russian)", u"Manuel Cortez (Spanish)"]
bts_name = "socializer" bts_name = "socializer"
bts_access_token = "U29jaWFsaXplcg" bts_access_token = "U29jaWFsaXplcg"
bts_url = "https://issues.manuelcortez.net" bts_url = "https://issues.manuelcortez.net"
bts_project_id = 4
### Update information ### Update information
# URL to retrieve the latest updates for the stable branch. # 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" update_stable_url = "https://code.manuelcortez.net/manuelcortez/socializer/raw/master/update-files/socializer.json"

View File

@ -57,7 +57,7 @@ class reportBug(object):
operating_system = platform.platform() 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) 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) auth=HTTPBasicAuth(application.bts_name, application.bts_access_token)
url = "{bts_url}/issue/{project_id}/new".format(bts_url=application.bts_url, project_id=application.bts_project_id) url = "{bts_url}/issue/new".format(bts_url=application.bts_url)
call_threaded(self.do_report, url, json=json, auth=auth) call_threaded(self.do_report, url, json=json, auth=auth)
self.dialog.show_progress() self.dialog.show_progress()
self.dialog.EndModal(wx.ID_OK) self.dialog.EndModal(wx.ID_OK)

View File

@ -98,6 +98,16 @@ def render_newsfeed_item(status, session):
composed_audio = render_audio(status["audio"]["items"][i], session) composed_audio = render_audio(status["audio"]["items"][i], session)
prem += u"{0} - {1}, ".format(composed_audio[0], composed_audio[1]) 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) 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. # handle new friends for people in the news buffer.
elif status["type"] == "friend": elif status["type"] == "friend":
msg_users = u"" msg_users = u""

View File

@ -20,7 +20,7 @@ sessions = {}
identifiers = ["aid", "gid", "uid", "pid", "id", "post_id", "nid", "date"] 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. # 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") post_types = dict(audio="audio", friend="friends", video="video", post="post_type", audio_playlist="audio_playlist")
def find_item(list, item): def find_item(list, item):
""" Find an item in a list by taking an identifier. """ Find an item in a list by taking an identifier.
@ -65,9 +65,9 @@ class vkSession(object):
# 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, # 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. # 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. # Here we check if the post contains data of the type it advertises.
if "type" in i and post_types[i["type"]] not in i: if i.get("type") != None and post_types.get(i["type"]) not in i:
log.error("Detected empty post. Skipping...") log.error("Detected invalid or unsupported post. Skipping...")
print i log.error(i)
continue continue
if find_item(self.db[name]["items"], i) == False: if find_item(self.db[name]["items"], i) == False:
# if i not in self.db[name]["items"]: # if i not in self.db[name]["items"]:

View File

@ -51,6 +51,15 @@ class feedTab(homeTab):
super(feedTab, self).__init__(parent=parent) super(feedTab, self).__init__(parent=parent)
self.name = "me_feed" 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): class audioTab(homeTab):
def create_list(self): def create_list(self):
self.lbl = wx.StaticText(self, wx.NewId(), _(u"Mu&sic")) 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 = wx.Button(self, -1, _(u"P&lay"))
self.play_all = wx.Button(self, -1, _(u"Play &All")) self.play_all = wx.Button(self, -1, _(u"Play &All"))
self.postBox = wx.BoxSizer(wx.HORIZONTAL) 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.post, 0, wx.ALL, 5)
self.postBox.Add(self.play, 0, wx.ALL, 5) self.postBox.Add(self.play, 0, wx.ALL, 5)
self.postBox.Add(self.play_all, 0, wx.ALL, 5) self.postBox.Add(self.play_all, 0, wx.ALL, 5)