Пример #1
0
    "coderate_LP": dvb3.frontend.FEC_3_4
}

print sys.argv
if len(sys.argv) > 1:
    channels = [int(x) for x in sys.argv[1:]]
else:
    channels = [600, 601, 18]

print "RECORDING CHANNELS", channels


class DieAtTime(Axon.Component.component):
    delay = 10

    def main(self):
        now = time.time()
        while 1:
            if (time.time() - now) > self.delay:
                raise "AARRRRGGGHHH"
            yield 1


DieAtTime(delay=7500).activate()
Pipeline(
    DVB_Multiplex(freq, channels, feparams),  # BBC TWO
    SimpleFileWriter("Programme" + str(channels) + (str(time.time())) +
                     ".ts")).run()

# RELEASE: MH, MPS
Пример #2
0
                c += 1
                data = self.recv("inbox")
                size += len(data)
                self.send(data, "outbox")
            if (c % 20) == 0:
                t_dash = time.time()
                if t_dash - t > 1:
                    print int((size / (t_dash - t)) * 8)
                    t = t_dash
                    size = 0
            yield 1


if 1:
    pipeline(
        DVB_Multiplex(freq, [600, 601], feparams),
        SimpleFileWriter("somefile.ts"),
    ).run()

if 0:
    pipeline(
        ReadFileAdaptor("somefile.ts", readsize=8000000),
        MaxSizePacketiser(),
        Multicast_transceiver("0.0.0.0", 0, "224.168.2.9", 1600),
    ).activate()

    pipeline(
        Multicast_transceiver("0.0.0.0", 1600, "224.168.2.9", 0),
        SimpleDetupler(1),
        SimpleFileWriter("otherfile.ts"),
    ).run()
# You may obtain a copy of the License at
#
#     http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#
#

from Kamaelia.Device.DVB.Core import DVB_Multiplex
from Kamaelia.Chassis.Pipeline import Pipeline
from Kamaelia.File.Writing import SimpleFileWriter

import dvb3

feparams = {
    "inversion": dvb3.frontend.INVERSION_AUTO,
    "constellation": dvb3.frontend.QAM_16,
    "code_rate_HP": dvb3.frontend.FEC_3_4,
    "code_rate_LP": dvb3.frontend.FEC_3_4,
}

Pipeline(
    DVB_Multiplex(505.8, [640, 641], feparams),  # BBC NEWS CHANNEL
    SimpleFileWriter("BBC_NEWS_CHANNEL.ts")).run()

# RELEASE: MH, MPS
Пример #4
0
    from Kamaelia.Device.DVB.NowNext import NowNextServiceFilter

    import dvb3.frontend
    feparams = {
        "inversion": dvb3.frontend.INVERSION_AUTO,
        "constellation": dvb3.frontend.QAM_16,
        "code_rate_HP": dvb3.frontend.FEC_3_4,
        "code_rate_LP": dvb3.frontend.FEC_3_4,
    }

    demo = "Now and next"
    #    demo="All schedule info"

    if demo == "Now and next":
        Pipeline(
            DVB_Multiplex(505833330.0 / 1000000.0, [EIT_PID], feparams),
            DVB_Demuxer({EIT_PID: ["outbox"]}),
            ReassemblePSITables(),
            ParseEventInformationTable_Subset(
                True, False, False, False),  # now and next for this mux only
            SimplifyEIT(),
            NowNextProgrammeJunctionDetect(),
            NowNextServiceFilter(4164),
            ConsoleEchoer(),
        ).run()

    elif demo == "All schedule info":
        Pipeline(
            DVB_Multiplex(505833330.0 / 1000000.0, [EIT_PID], feparams),
            DVB_Demuxer({EIT_PID: ["outbox"]}),
            ReassemblePSITables(),
Пример #5
0
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#

from Kamaelia.Device.DVB.Core import DVB_Multiplex
from Kamaelia.Chassis.Pipeline import Pipeline
from Kamaelia.File.Writing import SimpleFileWriter

import dvb3

freq = 505.833330  # 529.833330   # 505.833330
feparams = {
    "inversion": dvb3.frontend.INVERSION_AUTO,
    "constellation": dvb3.frontend.QAM_16,
    "code_rate_HP": dvb3.frontend.FEC_3_4,
    "code_rate_LP": dvb3.frontend.FEC_3_4,
}

Pipeline(
    # FIXME: Hmm. Need to check whether 0x2000 is supported by freecom DVB-T stick
    # FIXME: If it isn't need to change this to grab the pids manually, as it used to.
    # FIXME: Though that could be a different example...
    DVB_Multiplex(freq, [0x2000],
                  feparams),  # BBC Multiplex 1, whole transport stream
    SimpleFileWriter("BBC_MUX_1.ts"),
).run()

# RELEASE: MH, MPS
Пример #6
0
    from Kamaelia.Chassis.Pipeline import Pipeline
    from Kamaelia.File.Writing import SimpleFileWriter
    from Kamaelia.File.ReadFileAdaptor import ReadFileAdaptor
    from Kamaelia.Chassis.Graphline import Graphline
    from Kamaelia.Util.Console import ConsoleEchoer

    import dvb3.frontend
    feparams = {
        "inversion": dvb3.frontend.INVERSION_AUTO,
        "constellation": dvb3.frontend.QAM_16,
        "code_rate_HP": dvb3.frontend.FEC_3_4,
        "code_rate_LP": dvb3.frontend.FEC_3_4,
    }

    Graphline(
        SOURCE=DVB_Multiplex(505833330.0 / 1000000.0, [18, 20, 600, 601],
                             feparams),
        DEMUX=DVB_Demuxer({
            18: ["_EIT_"],
            20: ["_DATETIME_"]
        }),
        EIT=Pipeline(
            PSIPacketReconstructor(),
            EITPacketParser(),
            NowNextServiceFilter(4164, 4228),  # BBC ONE & BBC TWO
            NowNextChanges(),
            ConsoleEchoer(),
        ),
        DATETIME=Pipeline(
            PSIPacketReconstructor(),
            TimeAndDatePacketParser(),
            ConsoleEchoer(),
Пример #7
0
            yield 1


__kamaelia_components__ = ( ParseTimeAndDateTable, )

if __name__ == "__main__":
    
    from Kamaelia.Chassis.Pipeline import Pipeline
    from Kamaelia.Util.Console import ConsoleEchoer
    
    from Kamaelia.Device.DVB.Core import DVB_Multiplex, DVB_Demuxer
    from Kamaelia.Device.DVB.Parse.ReassemblePSITables import ReassemblePSITables
    from Kamaelia.Device.DVB.Parse.PrettifyTables import PrettifyTimeAndDateTable

    import dvb3.frontend
    feparams = {
        "inversion" : dvb3.frontend.INVERSION_AUTO,
        "constellation" : dvb3.frontend.QAM_16,
        "code_rate_HP" : dvb3.frontend.FEC_3_4,
        "code_rate_LP" : dvb3.frontend.FEC_3_4,
    }
    
    Pipeline( DVB_Multiplex(505833330.0/1000000.0, [0x2000], feparams),
              DVB_Demuxer({ TDT_PID:["outbox"]}),
              ReassemblePSITables(),
              ParseTimeAndDateTable(),
              PrettifyTimeAndDateTable(),
              ConsoleEchoer(),
            ).run()

Пример #8
0
                "CBBC":4671,
              }

print "-----STARTING MACRO----- time =",time.time()

def repeatingFile():
    def rfa_factory(_):
        return RateControlledFileReader("junction.ts",readmode="bytes",rate=18000000/8,chunksize=2048)
    return Graphline(CAROUSEL=Carousel(rfa_factory, make1stRequest=True),
                     linkages = { ("CAROUSEL","requestNext") : ("CAROUSEL","next"),
                                  ("CAROUSEL","outbox") : ("self", "outbox"),
                                  ("CAROUSEL","signal") : ("self", "signal"),
                                },
                    )

Graphline(
    SOURCE=DVB_Multiplex(freq, pids["BBC TWO"]+pids["EIT"], feparams), # BBC Channels + EIT data
    DEMUX=DVB_Demuxer({
        610: ["BBCTWO"],
        611: ["BBCTWO"],
        18: ["BBCTWO"],   # BBCONE","BBCONE_2","BBCTWO","BBCTWO_2", "CBEEBIES"
    }),
    BBCTWO_HI = ChannelTranscoder(service_ids["BBC TWO"], **params["HI"]),
    linkages={
       ("SOURCE", "outbox"):("DEMUX","inbox"),
       ("DEMUX", "BBCTWO"): ("BBCTWO_HI", "inbox"),
    }
).run()

# RELEASE: MH, MPS
Пример #9
0
__kamaelia_components__ = ( ParseProgramMapTable, )

if __name__ == "__main__":
    
    from Kamaelia.Chassis.Pipeline import Pipeline
    from Kamaelia.Util.Console import ConsoleEchoer
    
    from Kamaelia.Device.DVB.Core import DVB_Multiplex, DVB_Demuxer
    from Kamaelia.Device.DVB.Parse.ReassemblePSITables import ReassemblePSITables
    from Kamaelia.Device.DVB.Parse.PrettifyTables import PrettifyProgramMapTable
    
    import dvb3.frontend
    feparams = {
        "inversion" : dvb3.frontend.INVERSION_AUTO,
        "constellation" : dvb3.frontend.QAM_16,
        "code_rate_HP" : dvb3.frontend.FEC_3_4,
        "code_rate_LP" : dvb3.frontend.FEC_3_4,
    }

    PMT_PID = 4228    # "BBC TWO" on Crystal Palace transmitter in UK

    Pipeline( DVB_Multiplex(505833330.0/1000000.0, [PMT_PID], feparams),
              DVB_Demuxer({ PMT_PID:["outbox"]}),
              ReassemblePSITables(),
              ParseProgramMapTable(),
              PrettifyProgramMapTable(),
              ConsoleEchoer(),
            ).run()

Пример #10
0
#
#

import dvb3

from Kamaelia.Chassis.Pipeline import Pipeline
from Kamaelia.Device.DVB.Core import DVB_Multiplex, DVB_Demuxer
from Kamaelia.Device.DVB.Parse.ReassemblePSITables import ReassemblePSITables
from Kamaelia.Device.DVB.Parse.ParseTimeAndDateTable import ParseTimeAndDateTable
from Kamaelia.Device.DVB.Parse.PrettifyTables import PrettifyTimeAndDateTable
from Kamaelia.Util.Console import ConsoleEchoer

FREQUENCY = 754.166670
feparams = {
    "inversion": dvb3.frontend.INVERSION_AUTO,
    "constellation": dvb3.frontend.QAM_16,
    "code_rate_HP": dvb3.frontend.FEC_3_4,
    "code_rate_LP": dvb3.frontend.FEC_3_4,
}

TDT_PID = 0x14

Pipeline(
    DVB_Multiplex(FREQUENCY, [TDT_PID], feparams),
    DVB_Demuxer({TDT_PID: ["outbox"]}),
    ReassemblePSITables(),
    ParseTimeAndDateTable(),
    PrettifyTimeAndDateTable(),
    ConsoleEchoer(),
).run()
Пример #11
0
        for chan in chan_by_name.keys():
            print("'" + chan + "'")

        sys.exit(0)
    channel = sys.argv[1]

    print("You want channel", channel)
    print("Using the following tuning info")
    print("")
    pprint.pprint(chan_by_name[channel])
    print("")

    chan_info = chan_by_name[channel]

    if chan_info["apid"] + chan_info["vpid"] == 0:
        print(
            "Sorry, I can't determine the audio & video pids for that channel")
        sys.exit(0)

    X = time.localtime()
    str_stamp = "%d%02d%02d%02d%02d" % (X.tm_year, X.tm_mon, X.tm_mday,
                                        X.tm_hour, X.tm_min)
    filename = channel + "." + str_stamp + ".ts"

    print("Recording", channel, "to", filename)

    Pipeline(
        DVB_Multiplex(0, [chan_info["apid"], chan_info["vpid"]],
                      chan_info["feparams"]),  # BBC NEWS CHANNEL
        SimpleFileWriter(filename)).run()
Пример #12
0
                        line = "crid://%s%s| |%s|%s||%s|%s|%s|" % (
                            cridAuth, cridFrag, startTime, endTime, channel,
                            title, lcn)
                        lines.append(line)

        if len(lines):
            self.send("\n".join(lines) + "\n", "outbox")

    def formatDateTime(self, dt):
        tz = "+00:00"
        return dt.strftime("%Y-%m-%dT%H:%M:%S") + tz


SYSTEM = Graphline(SHUTDOWN=WatchdogTimer(timeout=MAX_RUNTIME),
                   WATCHDOG=WatchdogTimer(timeout=NOMORE_DATA_THRESHOLD),
                   RECVR=DVB_Multiplex(freqHz / 1000000.0, [17, 18], feparams),
                   DEMUX=DVB_Demuxer({
                       18: ["eit"],
                       17: ["sdt"]
                   }),
                   EIT=Pipeline(
                       ReassemblePSITables(),
                       ParseEventInformationTable_Subset(
                           actual_presentFollowing=False,
                           actual_schedule=True,
                           other_schedule=True),
                   ),
                   SDT=Pipeline(
                       ReassemblePSITables(),
                       ParseServiceDescriptionTable_ActualAndOtherTS(),
                   ),
Пример #13
0
    "constellation" : dvb3.frontend.QAM_16,
    "code_rate_HP" : dvb3.frontend.FEC_3_4,
    "code_rate_LP" : dvb3.frontend.FEC_3_4,
}

freq = 634.166
feparams = {
    "inversion" : dvb3.frontend.INVERSION_AUTO,
    "constellation" : dvb3.frontend.QAM_16,
    "code_rate_HP" : dvb3.frontend.FEC_3_4,
    "code_rate_LP" : dvb3.frontend.FEC_3_4,
}


freq = 754.166670
feparams = {
    "inversion" : dvb3.frontend.INVERSION_AUTO,
    "constellation" : dvb3.frontend.QAM_16,
    "code_rate_HP" : dvb3.frontend.FEC_3_4,
    "code_rate_LP" : dvb3.frontend.FEC_3_4,
}

# SOURCE=DVB_Multiplex(freq, pids["BBC TWO"]+pids["EIT"], feparams), # BBC Channels + EIT dat
Pipeline(
#   DVB_Multiplex(freq, [640, 641,18], feparams), # BBC THREE
   DVB_Multiplex(freq, [620, 621,18], feparams), # BBC THREE
   SimpleFileWriter("BBC_THREE.ts")
).run()

# RELEASE: MH, MPS
Пример #14
0
#
# (Code provided for inspection purposes, running this on the internet would
# in all likelihood mean you're in breach of copyright!)
#
# Note how similar this is to the original radio tuner code.
#
freq = 850.166670
feparams = {
    "inversion": dvb3.frontend.INVERSION_AUTO,
    "constellation": dvb3.frontend.QAM_16,
    "coderate_HP": dvb3.frontend.FEC_3_4,
    "coderate_LP": dvb3.frontend.FEC_3_4,
}

Pipeline(
    DVB_Multiplex(freq, [6210], feparams),  # RADIO ONE
    PublishTo("RADIO"),
).activate()

#
#\-----------------------------------------------------------------


#/-----------------------------------------------------------------
# Handle clients connecting to us:
def ServeRadio():
    return SubscribeTo("RADIO")


SimpleServer(protocol=ServeRadio, port=mydataport).activate()
#
Пример #15
0
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#
# This code is designed soley for the purposes of demonstrating the tools
# for timeshifting.
#

from Kamaelia.Device.DVB.Core import DVB_Multiplex
from Kamaelia.Chassis.Pipeline import Pipeline
from Kamaelia.File.Writing import SimpleFileWriter

import dvb3.frontend

import time

feparams = {
    "inversion" : dvb3.frontend.INVERSION_AUTO,
    "constellation" : dvb3.frontend.QAM_16,
    "code_rate_HP" : dvb3.frontend.FEC_3_4,
    "code_rate_LP" : dvb3.frontend.FEC_3_4,                                
}

Pipeline(
   DVB_Multiplex(505.833330, [0x12, 0x14], feparams), # capture EIT and TOT and TDT
   SimpleFileWriter("%04d-%02d-%02d %02d.%02d.%02d MUX1_EIT_TOT_TDT.ts" % time.localtime()[0:6])
).run()

# RELEASE: MH, MPS