示例#1
0
    def getSomeMetadata(self, channel_id, infohash):


        s1 = SubtitleInfo("eng", None)
        s2 = SubtitleInfo("rus", None)

        self.content1 = u"Subtitle Content 1"
        self.content2 = u"Subtitle Content 2"

        hasher = sha()
        hasher.update(self.content1)
        s1.checksum = hasher.digest()

        hasher = sha()
        hasher.update(self.content2)
        s2.checksum = hasher.digest()

        metadata = MetadataDTO(channel_id, infohash, time.time(),
                               "", {"eng":s1, "rus":s2})

        if self.nextKeypair is None:
            metadata.signature = "fake"
        else:
            metadata.sign(self.nextKeypair)

        return metadata
    def getSomeMetadata(self, channel_id, infohash):

        s1 = SubtitleInfo("eng", None)
        s2 = SubtitleInfo("rus", None)

        self.content1 = u"Subtitle Content 1"
        self.content2 = u"Subtitle Content 2"

        hasher = sha()
        hasher.update(self.content1)
        s1.checksum = hasher.digest()

        hasher = sha()
        hasher.update(self.content2)
        s2.checksum = hasher.digest()

        metadata = MetadataDTO(channel_id, infohash, time.time(), "", {
            "eng": s1,
            "rus": s2
        })

        if self.nextKeypair is None:
            metadata.signature = "fake"
        else:
            metadata.sign(self.nextKeypair)

        return metadata
def _createSubtitlesDict(bitmask, listOfChecksums):
    langList = _languagesUtil.maskToLangCodes(bitmask)
    if len(langList) != len(listOfChecksums):
        raise SerializationException("Unexpected num of checksums")
     
    subtitles = {}
    for i in range(0, len(langList)):
        sub = SubtitleInfo(langList[i])
        sub.checksum = listOfChecksums[i]
        subtitles[langList[i]] = sub
    return subtitles
示例#4
0
def _createSubtitlesDict(bitmask, listOfChecksums):
    langList = _languagesUtil.maskToLangCodes(bitmask)
    if len(langList) != len(listOfChecksums):
        raise SerializationException("Unexpected num of checksums")

    subtitles = {}
    for i in range(0, len(langList)):
        sub = SubtitleInfo(langList[i])
        sub.checksum = listOfChecksums[i]
        subtitles[langList[i]] = sub
    return subtitles