Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Recording doesn't start, missing models from online? #5

Open
ipkpjersi opened this issue Nov 5, 2019 · 1 comment
Open

Recording doesn't start, missing models from online? #5

ipkpjersi opened this issue Nov 5, 2019 · 1 comment

Comments

@ipkpjersi
Copy link

Hi,

My wanted.json is formatted properly but it never starts recording:

another run 2019-11-04 23:56:18.987819

  • Serving Flask app "webapp" (lazy loading)
  • Environment: production
    WARNING: This is a development server. Do not use it in a production deployment.
    Use a production WSGI server instead.
  • Debug mode: off
  • Running on https://0.0.0.0:8778/ (Press CTRL+C to quit)
    [2019-11-04 23:56:20,212] Connecting to MyFreeCams chat server xchat98...
    [2019-11-04 23:56:20,666] Login handshake completed. Logged in as 'Guest19679' with sessionId 240974130
    1089 models online
    finished run
    another run 2019-11-04 23:56:22.082396
    [2019-11-04 23:56:22,592] Connecting to MyFreeCams chat server xchat80...
    [2019-11-04 23:56:23,203] Login handshake completed. Logged in as 'Guest47596' with sessionId 240975758
    1089 models online
    finished run
    another run 2019-11-04 23:56:24.521563
    [2019-11-04 23:56:25,026] Connecting to MyFreeCams chat server xchat84...
    [2019-11-04 23:56:25,491] Login handshake completed. Logged in as 'Guest50163' with sessionId 240974995
    1089 models online
    finished run
    another run 2019-11-04 23:56:26.913987
    [2019-11-04 23:56:27,426] Connecting to MyFreeCams chat server xchat73...
    [2019-11-04 23:56:27,847] Login handshake completed. Logged in as 'Guest92166' with sessionId 240979110

For some reason, it says 1089 models online and it's like the models I put in wanted.json aren't online because I have mfc-node setup and it says 1320 models online.

Thanks.

@Jprnp
Copy link

Jprnp commented Oct 26, 2021

I found the reason and wrote a fix for it.

In your classes/models.py:

def get_online_models():
    '''returns a dictionary of all online models in free chat'''
    server_config = requests.get(SERVER_CONFIG_URL).json()
    servers = list(server_config['h5video_servers'].keys())
    servers.extend(list(server_config['ngvideo_servers'].keys()))
    servers.extend(list(server_config['wzext_servers'].keys()))
    servers.extend(list(server_config['wzobs_servers'].keys()))
    models = {}

In your classes/recording.py:

class RecordingThread(threading.Thread):
    '''thread for recording a MFC session'''
    URL_TEMPLATE1 = "hlsvariant://https://edgevideo.myfreecams.com/hls/NxServer/{srv}/ngrp:mfc_a_{id}.f4v_mobile/playlist.m3u8"
    URL_TEMPLATE2 = "hlsvariant://http://video{srv}.myfreecams.com:1935/NxServer/ngrp:mfc_{id}.f4v_mobile/playlist.m3u8"
   

...

    @property
    def stream(self):
        '''returns a dictionary with available streams'''
        streams = {} #not sure this is needed for the finally to work
        try_count = 0
        template = ""
        no_to_subtract = 0
        while len(streams) == 0 and try_count < 4:
            try:
                if try_count == 0:
                    template = self.URL_TEMPLATE1
                    no_to_subtract = 700
                elif try_count == 1:
                    template = self.URL_TEMPLATE1
                    no_to_subtract = 500
                elif try_count == 2:
                    template = self.URL_TEMPLATE2
                    no_to_subtract = 700
                elif try_count == 3:
                    template = self.URL_TEMPLATE2
                    no_to_subtract = 500

                streams = livestreamer.Livestreamer().streams(template.format(
                    id=int(self.session['uid']) + 100_000_000,
                    srv=int(self.session['camserv']) - no_to_subtract))
            except:
                try_count += 1
        
        return streams.get('best')

@Damianonymous, please validate and, if possible, implement this on your code.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants