Ejemplo n.º 1
0
    def get(self, *args, **kwargs):
        #cam, data = load_api_data('jasmin')
        cam = CamService.objects.get(prefix='xcams')
        response = urllib.urlopen(
            "https://cams.dnxlive.com/xml/v0.3/onlineCamsStatus.xml")
        cam_data = ET.parse(response)

        #Model.objects.filter(cam_service__prefix='jasmin').update(available=False)
        changed_objects = []

        for i in cam_data.findall('./webcam'):
            try:
                check_online = Model.objects.get(name=cam.prefix +
                                                 i.attrib['account'])
            except Model.DoesNotExist:
                check_online = None

            profiles = Profile.objects.filter(role=Profile.ROLE_USER)
            favourites = FavoriteModel.objects.all()
            data = {'available': True}
            if not check_online:
                data.update({'bay_online_time': datetime.now()})
                print 'new'
            elif not check_online.bay_online_time:
                data.update({'bay_online_time': datetime.now()})
                print 'update'
                for p in profiles:
                    # if p in favourites:
                    model_went_online(p, check_online)
                    print 'sent'

            updated, created = Model.objects.update_or_create(
                name=cam.prefix + i.attrib['account'], defaults=data)
            if updated:
                changed_objects.append(updated)
            elif created:
                changed_objects.append(created)

        Model.objects.filter(cam_service__prefix='xcams').exclude(
            name__in=changed_objects).update(available=False,
                                             bay_online_time=None)

        return JsonResponse({'success': True})
Ejemplo n.º 2
0
    def get(self, *args, **kwargs):

        #Model.objects.filter(cam_service__prefix='bonga').update(available=False)
        changed_objects = []
        for i in self.data:
            if i['gender'] == u'Женщины':
                sex = Sex.objects.get(code='w')
            elif i['gender'] == u'Пара Женщина + Женщина':
                sex = Sex.objects.get(code='w')
            elif i['gender'] == u'Пара женщина + мужчина':
                sex = Sex.objects.get(code='w')
            else:
                sex = None

            if i['ethnicity'] == u'Европейское/Кавказское':
                race = Race.objects.get(code='white')
            elif i['ethnicity'] == u'Латиноамериканское':
                race = Race.objects.get(code='latin')
            elif i['ethnicity'] == u'Ближневосточное':
                race = Race.objects.get(code='west')
            elif i['ethnicity'] == u'Индийское':
                race = Race.objects.get(code='indian')
            elif i['ethnicity'] == u'Темнокожие':
                race = Race.objects.get(code='black')
            elif i['ethnicity'] == u'Азиатcкое':
                race = Race.objects.get(code='asian')
            else:
                race = None

            if i['hair_color'] == u'Тёмные':
                hair = HairColor.objects.get(code='black')
            elif i['hair_color'] == u'Светлые':
                hair = HairColor.objects.get(code='white')
            elif i['hair_color'] == u'Рыжие':
                hair = HairColor.objects.get(code='red')
            else:
                hair = None

            if i['bust_penis_size'] == u'Большая':
                bust_penis_size = BustSize.objects.get(code='big')
            elif i['bust_penis_size'] == u'Средняя':
                bust_penis_size = BustSize.objects.get(code='middle')
            elif i['bust_penis_size'] == u'Маленькая':
                bust_penis_size = BustSize.objects.get(code='small')
            elif i['bust_penis_size'] == u'Огромные':
                bust_penis_size = BustSize.objects.get(code='biggest')
            else:
                bust_penis_size = None

            try:
                check_online = Model.objects.get(name=self.cam.prefix + i['username'])
            except Model.DoesNotExist:
                check_online = None

            data = {
                'name': self.cam.prefix + i['username'],
                'display_name': i['username'],
                'profile_image': i['profile_images']['thumbnail_image_medium'],
                'age': i['display_age'],
                'available': True if i['status'] == 1 else False,
                'cam_service': self.cam,
                'chat_url': i['chat_url_on_home_page'],
                'online_time': i['online_time'],
                'sex': sex,
                'race': race,
                'hair_color': hair,
                'bust_size': bust_penis_size,
            }
            profiles = Profile.objects.filter(role=Profile.ROLE_USER)
            favourites = FavoriteModel.objects.all()
            if not check_online:
                data.update({'bay_online_time': datetime.now()})
                print 'new'
            elif not check_online.bay_online_time:
                data.update({'bay_online_time': datetime.now()})
                print 'update'
                for p in profiles:
                    #if p in favourites:
                        model_went_online(p, check_online)
                        print 'sent'

            updated, created = Model.objects.update_or_create(
                name=self.cam.prefix + i['username'],
                defaults=data
            )
            if updated:
                changed_objects.append(updated)
            elif created:
                changed_objects.append(created)

            CamSnapshot.objects.create(
                model=Model.objects.get(name=self.cam.prefix + i['username']),
                snapshot_url=i['profile_images']['thumbnail_image_medium_live'],
            )

        Model.objects.filter(cam_service__prefix='bonga').exclude(name__in=changed_objects).update(available=False, bay_online_time=None)

        return JsonResponse({'success': True})
Ejemplo n.º 3
0
    def get(self, *args, **kwargs):

        changed_objects = []
        for i in self.data:
            if i['gender'] == u'f':
                sex = Sex.objects.get(code='w')
            elif i['gender'] == u'm':
                sex = Sex.objects.get(code='m')
            elif i['gender'] == u't':
                sex = Sex.objects.get(code='t')
            elif i['gender'] == u'c':
                sex = Sex.objects.get(code='w')
            else:
                sex = None

            try:
                check_online = Model.objects.get(name=self.cam.prefix + i['username'])
            except Model.DoesNotExist:
                check_online = None

            data = {
                'name': self.cam.prefix + i['username'],
                'display_name': i['username'],
                'profile_image': i['image_url'],
                'age': i['age'],
                'available': True,
                'cam_service': self.cam,
                'chat_url': i['chat_room_url'],
                'online_time': i['seconds_online'],
                'sex': sex,
                # 'race': race,
                # 'hair_color': hair,
                # 'bust_size': bust_penis_size,
            }

            profiles = Profile.objects.filter(role=Profile.ROLE_USER)
            favourites = FavoriteModel.objects.all()
            if not check_online:
                data.update({'bay_online_time': datetime.now()})
                print 'new'
            elif not check_online.bay_online_time:
                data.update({'bay_online_time': datetime.now()})
                print 'update'
                for p in profiles:
                    # if p in favourites:
                    model_went_online(p, check_online)
                    print 'sent'

            updated, created = Model.objects.update_or_create(
                name=self.cam.prefix + i['username'],
                defaults=data
            )
            if updated:
                changed_objects.append(updated)
            elif created:
                changed_objects.append(created)

            CamSnapshot.objects.create(
                model=Model.objects.get(name=self.cam.prefix + i['username']),
                snapshot_url=i['image_url'],
            )

        Model.objects.filter(cam_service__prefix='chatur').exclude(name__in=changed_objects).update(available=False,
                                                                                                   bay_online_time=None)
        return JsonResponse({'success': True})
Ejemplo n.º 4
0
    def get(self, *args, **kwargs):
        #cam, data = load_api_data('jasmin')
        cam = CamService.objects.get(prefix='xlove')
        response = urllib.urlopen(cam.api_url)
        cam_data = ET.parse(response)

        changed_objects = []

        for i in cam_data.findall('./performer'):
            if i.find('./sex').text == u'Женщина':
                sex = Sex.objects.get(code='w')
            elif i.find('./sex').text == u'Мужчина':
                sex = Sex.objects.get(code='m')
            # elif i['persons'][0]['sex'] == u'hermaphrodite':
            #     sex = Sex.objects.get(code='t')
            # elif i['persons'][0]['sex'] == u'shemale':
            #     sex = Sex.objects.get(code='t')
            # elif i['persons'][0]['sex'] == u'transgendered':
            #     sex = Sex.objects.get(code='t')
            else:
                sex = None

            # if i['ethnicity'] == u'white':
            #     race = Race.objects.get(code='white')
            # elif i['ethnicity'] == u'latin':
            #     race = Race.objects.get(code='latin')
            # elif i['ethnicity'] == u'ebony':
            #     race = Race.objects.get(code='black')
            # elif i['ethnicity'] == u'asian':
            #     race = Race.objects.get(code='asian')
            # else:
            #     race = None
            #
            # if i['persons'][0]['body']['hairColor'] == u'brown':
            #     hair = HairColor.objects.get(code='black')
            # elif i['persons'][0]['body']['hairColor'] == u'black':
            #     hair = HairColor.objects.get(code='black')
            # elif i['persons'][0]['body']['hairColor'] == u'other':
            #     hair = HairColor.objects.get(code='black')
            # elif i['persons'][0]['body']['hairColor'] == u'blonde':
            #     hair = HairColor.objects.get(code='white')
            # elif i['persons'][0]['body']['hairColor'] == u'blue':
            #     hair = HairColor.objects.get(code='white')
            # elif i['persons'][0]['body']['hairColor'] == u'clown hair':
            #     hair = HairColor.objects.get(code='white')
            # elif i['persons'][0]['body']['hairColor'] == u'orange':
            #     hair = HairColor.objects.get(code='red')
            # elif i['persons'][0]['body']['hairColor'] == u'pink':
            #     hair = HairColor.objects.get(code='red')
            # elif i['persons'][0]['body']['hairColor'] == u'auburn':
            #     hair = HairColor.objects.get(code='red')
            # elif i['persons'][0]['body']['hairColor'] == u'fire red':
            #     hair = HairColor.objects.get(code='red')
            # else:
            #     hair = None
            #
            # if i['persons'][0]['body']['breastSize'] == u'big':
            #     bust_size = BustSize.objects.get(code='big')
            # elif i['persons'][0]['body']['breastSize'] == u'normal':
            #     bust_size = BustSize.objects.get(code='middle')
            # elif i['persons'][0]['body']['breastSize'] == u'tiny':
            #     bust_size = BustSize.objects.get(code='small')
            # elif i['persons'][0]['body']['breastSize'] == u'huge':
            #     bust_size = BustSize.objects.get(code='biggest')
            # else:
            #     bust_size = None
            #
            # if i['persons'][0]['body']['build'] == u'skinny':
            #     figure = Figure.objects.get(code='s')
            # elif i['persons'][0]['body']['build'] == u'petite':
            #     figure = Figure.objects.get(code='s')
            # elif i['persons'][0]['body']['build'] == u'athletic':
            #     figure = Figure.objects.get(code='n')
            # elif i['persons'][0]['body']['build'] == u'average':
            #     figure = Figure.objects.get(code='n')
            # elif i['persons'][0]['body']['build'] == u'muscular':
            #     figure = Figure.objects.get(code='n')
            # elif i['persons'][0]['body']['build'] == u'above average':
            #     figure = Figure.objects.get(code='c')
            # elif i['persons'][0]['body']['build'] == u'obese':
            #     figure = Figure.objects.get(code='l')
            # elif i['persons'][0]['body']['build'] == u'large':
            #     figure = Figure.objects.get(code='l')
            # else:
            #     figure = None

            try:
                check_online = Model.objects.get(name=cam.prefix +
                                                 i.find('./id').text)
            except Model.DoesNotExist:
                check_online = None

            data = {
                'name': cam.prefix + i.find('./id').text,
                'display_name': i.find('./screenname').text,
                'profile_image': i.find('./liveimage').text,
                'age': i.find('./age').text,
                'available': True,
                'cam_service': cam,
                'chat_url': i.find('./freechatlink').text,
                # 'online_time': i['seconds_online'],
                'sex': sex,
                # 'race': race,
                # 'hair_color': hair,
                # 'bust_size': bust_size,
                # 'figure': figure,
            }

            Model.objects.update_or_create(name=cam.prefix +
                                           i.find('./id').text,
                                           defaults=data)

            profiles = Profile.objects.filter(role=Profile.ROLE_USER)
            favourites = FavoriteModel.objects.all()
            if not check_online:
                data.update({'bay_online_time': datetime.now()})
                print 'new'
            elif not check_online.bay_online_time:
                data.update({'bay_online_time': datetime.now()})
                print 'update'
                for p in profiles:
                    # if p in favourites:
                    model_went_online(p, check_online)
                    print 'sent'

            updated, created = Model.objects.update_or_create(
                name=cam.prefix + i.find('./id').text, defaults=data)
            if updated:
                changed_objects.append(updated)
            elif created:
                changed_objects.append(created)

        Model.objects.filter(cam_service__prefix='xlove').exclude(
            name__in=changed_objects).update(available=False,
                                             bay_online_time=None)
        return JsonResponse({'success': True})