Giter Club home page Giter Club logo

pinylib's People

Contributors

nortxort avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

pinylib's Issues

Userinfo [MAJOR]

As stated by James Koss (phuein) here in this commit in tunebot: phuein/Tunebot@6d9b70c

The /userinfo command is now depreciated, instead this is replaced by 'account' which comes in the amf data in the _listen function. See tunebots _listen in tinychat.py and see the line if cmd == "account": etc.

on_joins tinychat_id parsing

I have noticed that the tinychat id is not available at times. Looking at the code we only see that the tinychat_id is set when receiving an "on_join" from a user, however if we were to duplicate that for "on_joins", I seem to be receiving a tinychat_id for any particular user with an account.

The code line 495, should also be after line 521.

tc_info = tinychat_api.tinychat_user_info(join_info_dict['account'])
            if tc_info is not None:
                user.tinychat_id = tc_info['tinychat_id']
                user.last_login = tc_info['last_active']

socket.ioctl is Win32 specific

https://github.com/nortxort/pinylib/blob/master/rtmplib/rtmp.py#L249

2017-02-26 12:19:29,120 : CRITICAL : pinylib.py : 176 : connect() : pinylib : connect error: '_socketobject' object has no attribute 'ioctl'
Traceback (most recent call last):
  File "/home/aida/Projects/coco/pinylib/pinylib.py", line 171, in connect
    'cookie': self.param.cauth_cookie()
  File "/home/aida/Projects/coco/pinylib/rtmplib/rtmp.py", line 250, in connect
    self.socket.ioctl(socket.SIO_KEEPALIVE_VALS, (1, 10000, 3000))
AttributeError: '_socketobject' object has no attribute 'ioctl'

os check needed in pinylib.connect and pinylib._green_connect for the is_win argument.

source: https://docs.python.org/2/library/socket.html#socket.socket.ioctl

Start Playlist

I think the playlist should be redefined and updated since sometimes the next item in the playlist does not play. As well as this the playlist resets itself at random intervals, I personally think this is due to the fact that there are different threads of start_playlist() going on at once, that is why we should only make one main thread for the playlist and all content added thereof onto it (similarly to the tunebot autoplaylist but in a different manner).

This would make the whole bot easier to work with, for starters I think where we start new threads for start_playlist() should be removed.

Tech

I got 99 problems and a RTMP packet is one..

So i wanted to try and see if PING could be used to keep the bot alive, and for the most it works. Now i don't know if it's related to using PING, but sometimes i would receive a packet that looked like so:
{'msg': 4, 'event_type': 512, 'event_data': '\x07pri'} it does look like a PING response, but the event_type is all fucked up. This caused problems, of course. I would get assertion error in rtmp_protocol.RtmpReader.next. The thing is, when ever i would get get this odd packet, the bot would become unresponsive, but i could still send messages from the console.

Has anyone else had this issue??

APL to API

There are several issues with ISPs around the world which tend to ban the apl.tinychat.com/ etc. urls including the room connection information. So I think we could edit the tinychat_api.py to change 'http://apl.tinychat.com/api/find.room/%s?site=tinychat&password=%s&url=tinychat.com' to 'http://api.tinychat.com/api/find.room/%s?site=tinychat&password=%s&url=tinychat.com'.

Just changing that small apl to api can mean more people might be able to connect to the room via other ISPs who have blocked that url.

Adding contributors

With you halting the development of this project, would you be willing to add either anyone as a contributor allowing us to push and commit changes and pull requests as needed?

Let's log some unicode

https://github.com/nortxort/pinylib/blob/master/pinylib.py#L63

fh.file_writer(path, file_name, msg.encode('ascii', 'ignore'))
Currently any unicode is just left out.

Let's log that too aye?
fh.file_writer(path, file_name, msg.encode(encoding='UTF-8',errors='ignore')
Confirmed working under Linux, should be fine for Windows as well.


[aida@programmerfag pinybot-master]$ cat files/logs/awkwardlysocial/logs/2016-08-24_awkwardlysocial.log | grep aida
[14:45:24] [joins] guest-54301:54301 changed nick to: aida
[14:45:31] enzo: sup aida
### Before UTF-8 encoding
[14:45:37] [users] aida: !syncuser aida
[14:45:39] [users] aida: !yt DN "bonnie & clyde
[14:57:32] [joins] Joins Moderator aida:54301:ccpd
### After UTF-8 encoding
[14:57:56] aida: DΞΔN
[14:57:57] [users] aida: !yt DΞΔN
[14:57:59] [users] aida: !stop 
[15:07:14] aida: ¥ ¼  Ñ  ñ
[15:07:18] aida: Ą ą  IJ  ij
[15:07:22] aida: Ə Ɛ  ƕ  ƺ
[15:07:28] aida: ɖ ɞ  ɫ  ɷ
[15:07:33] aida: ʱ ʬ  ˕  ˨
[15:07:37] aida: o̕    o̚ ơ o͡o
[15:07:41] aida: Ύ Δ  δ  Ϡ
[15:07:47] aida: Љ Щ  щ  Ӄ
[15:07:53] aida: ؟ ب  حٍ    ۳
[15:07:57] aida: ߄ ߐ  ߋ  ߹

Thinktank

This issue is for discussion new ideas and improvements related to pinylib.

Add README.md

Just a simple addition of a README file to explain what this library is to new users would be ideal.

Also, great work Nort!

Standardise uptime

I was wondering, maybe uptime as an information variable should be a standard in the library. The library itself has a the ability to make a connection. If this was the case, even when integrating with something like the bot, all the bot would have to do would be to interpret the uptime.

The uptime does not have to be given in a particular format, maybe just plainly as seconds or raw time.time(). Any other application using the library can interpret it in the way it wants. You usually see client connection or actual uptime as default information on a variety of interfaces now, so I was placing the idea.

New users will not receive media in play (if it was played independently)

I have only realised that any new users which join will be unable to receive any media that is being played by the bot. This is due to the fact that the media is not actually in the playlist, instead it is just being independently timed, see https://github.com/nortxort/pinylib/blob/master/bot_example.py#L134 .

We could try to add all media we start to the playlist. That could be open for discussion.

EDIT: Might be worth changing the 'if len(self.playlist) is not 0:' to 'if self.media_timer_thread is not None:'. That seems to work.

Great to know where to find you..

Hey Nort,

Hope I'm not being intrusive but it would be nice to know where others and myself can find you on Tinychat to discuss possible features to this already fantastic library. If providing the room publically is an issue, you can email us.

In addition, I'm making a customised version of the bot_example.py to show how it can be developed from the given.

Thanks,
Tech

Merge possibility?

Hey Nort,

I was thinking, once I have completed V12 of my bot, would you like to merge to form one major bot. And seeing that you are creating a Wiki as well, we could bother contribute to create a major bot. :)

Thanks,
Tech

Ping functionality

Hey Nort,

I have asked around and there is no need for the ping request, since the swf doesn't actually accept or recognise any ping requests or 'pongs' anything back as result. There maybe no point in keeping it in.

Tech

SWF edit

Nort edit the base (tinychat.py) to use the new swf client which is 1.0.0649 and also edit the u''Desktop, 1.0.0649 line as well.

Thanks,
Tech

Tinychat enforcing HTTPS

Any request made http://tinychat.com needs to https now. This can cause some issues with requests using urllib3. Not sure if these same issues apply on Windows or other Linux distributions

README

pip install pyamf requests colorama
Should be pip2 Windows also has pip2.exe.

Add User Information (Key Error)

Actual error:

File "/home/ubuntu/workspace/tinychat.py", line 425, in callback
self.user_is_guest(uid)
File "/home/ubuntu/workspace/PinyB0T.py", line 693, in user_is_guest
user = self.add_user_info(self.id_and_nick[uid])
KeyError: '720186'

I believe the issue is since the user (who is a guest) has left, and the bot tries to find the user information when the information isn't actually in the dictionary.

This error occurs occassionally.

Undercover message support for send_media_broadcast_close in tinychat.py

There should be the option to allow sending an undercover message, in the send_media_broadcast_close function, for a stated nick name as opposed to sending it to all the users.

This just needs to be the same as how send_media_broadcast_start deals with undercover messages.

I might submit a pull request another time.

EDIT: A pull request was submitted to deal with this.

AssertionErrors may occur

At line : https://github.com/nortxort/pinylib/blob/master/rtmp/rtmp_protocol.py#L539

You have specified that when receiving any user control message we should assert the STREAM_BEGIN UserControlTypes. This will not hold true if the packet is anything else i.e. PING_REQUEST/PING_RESPONSE. I just received an error since the bot uses the ping request at intervals. This could be changed possibly.

EDIT: I think if you just change the line to read:
elif amf_data['msg'] == data_types.USER_CONTROL and amf_data['event_type'] == user_control_types.STREAM_BEGIN:

it should then work and not return an AssertionError if anything other than STREAM_BEGINs are encountered. Though an AssertionError will still occur as the packet is not handled, so we just need a way of handling packets which are new or unknown without receiving assertion errors. Maybe the handle packet call could be moved elsewhere in the _callback function?

Greenrooms not supported?

Hey Nort,

I just wanted to ask whether greenrooms are fully supported since I am able to connect to it but unable to send messsages and the messages within the greenroom is not shown either.

Thanks,
Tech

Recommend Projects

  • React photo React

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

  • Vue.js photo Vue.js

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

  • Typescript photo Typescript

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

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

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

  • web

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

  • server

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

  • Machine learning

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

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

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

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.