예제 #1
0
        logging.debug("%s: Logging LOGOUT activity @ %s" %
                      (user.username, end_datetime))
        cur_user_log_entry.end_datetime = end_datetime
        cur_user_log_entry.save()  # total-seconds will be computed here.


class VideoFile(models.Model):
    youtube_id = models.CharField(max_length=20, primary_key=True)
    flagged_for_download = models.BooleanField(default=False)
    flagged_for_subtitle_download = models.BooleanField(default=False)
    download_in_progress = models.BooleanField(default=False)
    subtitle_download_in_progress = models.BooleanField(default=False)
    priority = models.IntegerField(default=0)
    percent_complete = models.IntegerField(default=0)
    subtitles_downloaded = models.BooleanField(default=False)
    cancel_download = models.BooleanField(default=False)

    class Meta:
        ordering = ["priority", "youtube_id"]


class LanguagePack(models.Model):
    lang_id = models.CharField(max_length=5, primary_key=True)
    lang_version = models.CharField(max_length=5)
    software_version = models.CharField(max_length=12)
    lang_name = models.CharField(max_length=30)


model_sync.add_syncing_models([VideoLog, ExerciseLog, UserLogSummary])
예제 #2
0
파일: models.py 프로젝트: NiallEgan/ka-lite
            )

        logging.debug("%s: Logging LOGOUT activity @ %s" % (user.username, end_datetime))
        cur_user_log_entry.end_datetime = end_datetime
        cur_user_log_entry.save()  # total-seconds will be computed here.


class VideoFile(models.Model):
    youtube_id = models.CharField(max_length=20, primary_key=True)
    flagged_for_download = models.BooleanField(default=False)
    flagged_for_subtitle_download = models.BooleanField(default=False)
    download_in_progress = models.BooleanField(default=False)
    subtitle_download_in_progress = models.BooleanField(default=False)
    priority = models.IntegerField(default=0)
    percent_complete = models.IntegerField(default=0)
    subtitles_downloaded = models.BooleanField(default=False)
    cancel_download = models.BooleanField(default=False)

    class Meta:
        ordering = ["priority", "youtube_id"]


class LanguagePack(models.Model):
    lang_id = models.CharField(max_length=5, primary_key=True)
    lang_version = models.CharField(max_length=5)
    software_version = models.CharField(max_length=12)
    lang_name = models.CharField(max_length=30)


model_sync.add_syncing_models([VideoLog, ExerciseLog, UserLogSummary])
예제 #3
0
            metadata.save()

    def get_uuid(self):
        assert self.public_key is not None, "public_key required for get_uuid"

        return uuid.uuid5(ROOT_UUID_NAMESPACE, str(self.public_key)).hex

    @staticmethod
    def get_device_counters(zone):
        device_counters = {}
        for device in Device.objects.by_zone(zone):
            if device.id not in device_counters:
                device_counters[device.id] = device.get_metadata().counter_position
        return device_counters


class ImportPurgatory(models.Model):
    timestamp = models.DateTimeField(auto_now_add=True)
    counter = models.IntegerField()
    retry_attempts = models.IntegerField(default=0)
    model_count = models.IntegerField(default=0)
    serialized_models = models.TextField()
    exceptions = models.TextField()

    def save(self, *args, **kwargs):
        self.counter = self.counter or Device.get_own_device().get_counter()
        super(ImportPurgatory, self).save(*args, **kwargs)


model_sync.add_syncing_models([Facility, FacilityGroup, FacilityUser, SyncedLog])