예제 #1
0
파일: test.py 프로젝트: esp0/nrkdl
def download_live_test():
    r = NRK.program('msui22009314')
    url, q, fp = r[0].download(path='test') # fix path
    assert url == 'http://nordond26c-f.akamaihd.net/i/no/open/12/12e45a2be69e24cb072f9d92a9c30727224ddd0e/7595713e-ee38-4325-8d05-c0ac2e2fd53c_,141,316,563,1266,2250,.mp4.csmil/master.m3u8?cc1=uri%3Dhttps%3a%2f%2fundertekst.nrk.no%2fprod%2fMSUI22%2f00%2fMSUI22009314AA%2fTMP%2fmaster.m3u8%7Ename%3DNorsk%7Edefault%3Dyes%7Eforced%3Dno%7Elang%3Dnb'
    assert q == 'high'
    assert fp.endswith('Brannmann Sam\Brannmann Sam 23_26')
    assert len(NRK.downloads()) == 1
예제 #2
0
def download_live_test():
    r = NRK.program('msui22009314')
    url, q, fp = r[0].download(path='test')  # fix path
    assert url == 'http://nordond26c-f.akamaihd.net/i/no/open/12/12e45a2be69e24cb072f9d92a9c30727224ddd0e/7595713e-ee38-4325-8d05-c0ac2e2fd53c_,141,316,563,1266,2250,.mp4.csmil/master.m3u8?cc1=uri%3Dhttps%3a%2f%2fundertekst.nrk.no%2fprod%2fMSUI22%2f00%2fMSUI22009314AA%2fTMP%2fmaster.m3u8%7Ename%3DNorsk%7Edefault%3Dyes%7Eforced%3Dno%7Elang%3Dnb'
    assert q == 'high'
    assert fp.endswith('Brannmann Sam\Brannmann Sam 23_26')
    assert len(NRK.downloads()) == 1
예제 #3
0
파일: examples.py 프로젝트: Hellowlol/nrkdl
def example_site_rip(date=None):
    """ Please, dont do this.. """
    nrk = NRK()
    all_programs = nrk.site_rip()

    for media in all_programs:
        if media.type == "serie":
            for serie in media.episodes():
                serie.download()
        else:
            media.download()
예제 #4
0
파일: examples.py 프로젝트: xeor/nrkdl
def example_site_rip(date=None):
    """ Please, dont do this.. """
    nrk = NRK()
    all_programs = nrk.site_rip()

    for media in all_programs:
        if media.type == 'serie':
            for serie in media.episodes():
                serie.download()
        else:
            media.download()
예제 #5
0
파일: test_nrkdl.py 프로젝트: xeor/nrkdl
def test_expires_at(f, *args):
    n = NRK(dry_run=True)

    today = datetime.datetime.now()
    d_today = today.strftime('%d.%m.%Y')
    f_day = datetime.timedelta(weeks=4 * 3)
    fut = today + f_day
    ds = '%s-%s' % (d_today, fut.strftime('%d.%m.%Y'))

    with mock.patch(ips, side_effect=['::', 'y']):
        n.expires_at(ds)
        assert len(n.downloads())
예제 #6
0
async def example_search():
    nrk = NRK()
    search_results = await nrk.search('Brannman Sam')
    for search in search_results:
        for season in search.seasons():
            for episode in await season.episodes():
                await episode.download()
                episode.subtitle()

    print('We found %s episodes to download' % len(nrk.downloads()))
    nrk.dry_run = True
    await nrk.downloads().start()
예제 #7
0
def test_expires_at(f, *args):
    n = NRK(dry_run=True)

    today = datetime.datetime.now()
    d_today = today.strftime('%d.%m.%Y')
    f_day = datetime.timedelta(weeks=4 * 3)
    fut = today + f_day
    ds = '%s-%s' % (d_today, fut.strftime('%d.%m.%Y'))

    with mock.patch(ips, side_effect=['::', 'y']):
        n.expires_at(ds)
        assert len(n.downloads())
예제 #8
0
파일: gui.py 프로젝트: Hellowlol/nrkdl
def main():

    parser = GooeyParser()

    parser.add_argument('-u', '--url', default=False,
                        required=False, help='"url1 url2 url3"')

    parser.add_argument('-e', '--encoding', default='latin-1',
                        required=False, help='Set encoding')

    parser.add_argument('-save', '--save_path', default=False,
                        required=False, help='Download to this folder', widget='DirChooser')

    parser.add_argument('-dr', '--dry_run', action='store_true', default=False,
                        required=False, help='Dry run, dont download anything')

    parser.add_argument('-v', '--verbose', action='store_true', default=False,
                        required=False, help='Show ffmpeg output')

    parser.add_argument('-w', '--workers', default=2,
                        required=False, help='Number of thread pool workers')

    parser.add_argument('-st', '--subtitle', action='store_true', default=False,
                        required=False, help='Download subtitle for this media file?')

    parser.add_argument('-if', '--input_file', default=False,
                        required=False, help='List of files to download', widget='FileChooser')

    p = parser.parse_args()

    NRK.dry_run = p.dry_run
    NRK.verbose = p.verbose
    NRK.subtitle = p.subtitle

    NRK.cli = False
    NRK.encoding = p.encoding
    NRK.workers = int(p.workers)

    if p.save_path:
        NRK.SAVE_PATH = p.save_path

    if p.input_file:
        NRK._from_file(p.input_file)

    if p.url:
        NRK.parse_url(p.url)
예제 #9
0
def test_seasons_live():
    r = NRK.series('brannmann-sam')
    x = sorted([s.season_number for s in r[0].seasons()])
    assert x == [1, 2, 3, 4, 5]

    eps_in_third_season = sorted([s for s in r[0].seasons()], key=lambda s: s.season_number)
    # find another way to test this as the result will be
    # invalid when nrk loose its usage rights to this season
    assert len(eps_in_third_season[2].episodes()) == 52
예제 #10
0
파일: test_nrkdl.py 프로젝트: xeor/nrkdl
def test_seasons_live():
    r = NRK.series('brannmann-sam')
    x = sorted([s.season_number for s in r[0].seasons()])
    assert x == [1, 2, 3, 4, 5]

    eps_in_third_season = sorted([s for s in r[0].seasons()], key=lambda s: s.season_number)
    # find another way to test this as the result will be
    # invalid when nrk loose its usage rights to this season
    assert len(eps_in_third_season[2].episodes()) == 52
예제 #11
0
파일: examples.py 프로젝트: Hellowlol/nrkdl
def example_search():
    nrk = NRK()
    search_results = nrk.search("Brannman Sam")
    for search in search_results:
        for season in search.seasons():
            for episode in season.episodes():
                episode.download()
                episode.subtitle()

    print("We found %s episodes to download" % len(nrk.downloads()))
    nrk.dry_run = True
    nrk.downloads().start()
예제 #12
0
파일: test.py 프로젝트: esp0/nrkdl
def series_live_test():
    r = NRK.series('brannman-sam')
    pass
예제 #13
0
파일: test_nrkdl.py 프로젝트: xeor/nrkdl
def test_categories_live():
    r = NRK.categories()
    sl = [c.id for c in sorted(r, key=lambda v: v.id)]
    assert sl == ['NRK-arkivet', 'all-programs', 'barn', 'dokumentar', 'drama-serier', 'film', 'humor',
                  'kultur', 'livsstil', 'natur', 'nyheter', 'samisk', 'sport', 'synstolk',
                  'tegnspraak', 'underholdning', 'vitenskap']
예제 #14
0
def site_rip_live_test():
    r = NRK.site_rip()
    all_names = []
    for i in r:
        print(i.name.encode('latin-1'))
예제 #15
0
def series_live_test():
    r = NRK.series('brannman-sam')
    pass
예제 #16
0
def program_live_test():
    r = NRK.program('msui22009314')
    assert r[0].full_title == 'Brannmann Sam 23:26'
예제 #17
0
파일: gui.py 프로젝트: xeor/nrkdl
def main():

    NRK = NRK(gui=True)

    parser = GooeyParser()

    parser.add_argument('-u', '--url', action='store', default=False,
                        required=False, widget='TextField', help='"url1 url2 url3"')

    parser.add_argument('-e', '--encoding', default='latin-1',
                        required=False, help='Set encoding')

    parser.add_argument('-save', '--save_path', default=False,
                        required=False, help='Download to this folder', widget='DirChooser')

    parser.add_argument('-dr', '--dry_run', action='store_true', default=False,
                        required=False, help='Dry run, dont download anything')

    parser.add_argument('-v', '--verbose', action='store_true', default=False,
                        required=False, help='Show ffmpeg output')

    parser.add_argument('-w', '--workers', default=2,
                        required=False, help='Number of thread pool workers')

    parser.add_argument('-st', '--subtitle', action='store_true', default=False,
                        required=False, help='Download subtitle for this media file?')

    parser.add_argument('-if', '--input_file', default=False,
                        required=False, help='List of files to download', widget='FileChooser')

    p = parser.parse_args()

    NRK.dry_run = p.dry_run
    NRK.verbose = p.verbose
    NRK.subtitle = p.subtitle

    NRK.cli = False
    NRK.encoding = p.encoding
    NRK.workers = int(p.workers)

    if p.save_path:
        NRK.SAVE_PATH = p.save_path

    if p.input_file:
        NRK._from_file(p.input_file)

    if p.url:
        NRK.parse_url(p.url)
예제 #18
0
def test_program_static():
    assert NRK.program('MSUS27001913')[0] == p()
예제 #19
0
def test_channels_live():
    assert len(NRK.channels()) == 5
예제 #20
0
파일: test_nrkdl.py 프로젝트: xeor/nrkdl
def test_program_static():
    assert NRK.program('MSUS27001913')[0] == p()
예제 #21
0
파일: test_nrkdl.py 프로젝트: xeor/nrkdl
def test_programs_live():
    r = NRK.programs()
    for ff in r:
        print(ff.name.encode('utf-8'))
예제 #22
0
파일: test.py 프로젝트: esp0/nrkdl
def programs_live_test():
    r = NRK.programs()
예제 #23
0
파일: test.py 프로젝트: esp0/nrkdl
def site_rip_live_test():
    r = NRK.site_rip()
    all_names = []
    for i in r:
        print(i.name.encode('latin-1'))
예제 #24
0
def test_series_live():
    r = NRK.series('kash-og-zook')
    assert r[0].name == 'Kash og Zook'
예제 #25
0
파일: examples.py 프로젝트: esp0/nrkdl
def example_parse_url():
    # This starts downloading right away

    NRK.parse_urls('https://tv.nrk.no/serie/skam/MYNT15001016/sesong-2/episode-10 http://tv.nrksuper.no/serie/lili/MSUI28008314/sesong-1/episode-3')
예제 #26
0
def test_categories_live():
    r = NRK.categories()
    sl = [c.id for c in sorted(r, key=lambda v: v.id)]
    assert sl == ['NRK-arkivet', 'all-programs', 'barn', 'dokumentar', 'drama-serier', 'film', 'humor',
                  'kultur', 'livsstil', 'natur', 'nyheter', 'samisk', 'sport', 'synstolk',
                  'tegnspraak', 'underholdning', 'vitenskap']
예제 #27
0
def search_live_test():
    r = NRK.search('brannman-sam')
    assert r[0].name == 'Brannmann Sam'
예제 #28
0
파일: test_nrkdl.py 프로젝트: xeor/nrkdl
import datetime
import sys

from os.path import basename, getsize, split

import mock
import pytest


from nrkdl import NRK
import nrkdl
from utils import c_out, parse_datestring, which, ppatch


# We dont want to download ANY files
nrk = NRK(dry_run=True, encoding='utf-8', workers=100)

if sys.version_info >= (3, 0):
    PY3 = True
    ips = 'builtins.input'
else:
    PY3 = False
    ips = '__builtin__.raw_input'


def q_clear():
    def outer(func):
        def inner(*args, **kwargs):
            try:
                func(*args, **kwargs)
            finally:
예제 #29
0
파일: test.py 프로젝트: esp0/nrkdl
def search_live_test():
    r = NRK.search('brannman-sam')
    assert r[0].name == 'Brannmann Sam'
예제 #30
0
파일: test.py 프로젝트: esp0/nrkdl
def program_live_test():
    r = NRK.program('msui22009314')
    assert r[0].full_title == 'Brannmann Sam 23:26'
예제 #31
0
def programs_live_test():
    r = NRK.programs()
예제 #32
0
파일: test_nrkdl.py 프로젝트: xeor/nrkdl
def test_channels_live():
    assert len(NRK.channels()) == 5
예제 #33
0
def test_programs_live():
    r = NRK.programs()
    for ff in r:
        print(ff.name.encode('utf-8'))
    pass
예제 #34
0
파일: test_nrkdl.py 프로젝트: xeor/nrkdl
def test_series_live():
    r = NRK.series('kash-og-zook')
    assert r[0].name == 'Kash og Zook'