Skip to main content
https://badge.fury.io/py/ntv.png https://travis-ci.org/onjin/ntv.png?branch=master https://pypip.in/d/ntv/badge.png

Python wrapper over n.pl movies schedule.

  • Free software: BSD license

Features

  • python wrapper over tv program from n.pl site

  • ntv-cli command utility to list and search tv program

Installation

  • pip install ntv

CLI usage

List channels from today schedule:

  • ntv-cli channels

Find channel by id or by name

  • ntv-cli channels film

  • ntv-cli channels -c 833

Display all movies from today schedule

  • ntv-cli movies

Find movies by channel name or/and movie name

  • ntv-cli movies axn

  • ntv-cli movies comedy -t madagaskar

Change schedule date by adding -d option:

  • ntv-cli channels -d 2013-12-24

  • ntv-cli movies -d 2013-12-24

API

ntv.shortcuts.search

Shorcut function to search n.pl schedule and get result as dictionary

Example usage:

from ntv.shortcuts import search

print search()
print search(datetime.today())

print search(datetime.today(), channel_id=8)
print search(datetime.today(), channel_name='comedy')
print search(datetime.today(), movie_title='braindead')
print search(datetime.today(), channel_name='comedy', movie_title='braindead')

Example result:

{
    1313: {
        'index': 1313,
        'name': 'First channel',
        'movies': [
            {
                'title': '1st movie',
                'start_time': datetime.strptime(
                    '2013-10-12 00:00:00', '%Y-%m-%d %H:%M:%S'
                ),
                'end_time': datetime.strptime(
                    '2013-10-12 01:00:00', '%Y-%m-%d %H:%M:%S'
                ),
                'inf': False
            },
            {
                'title': '2nd movie',
                'start_time': datetime.strptime(
                    '2013-10-12 01:00:00', '%Y-%m-%d %H:%M:%S'
                ),
                'end_time': datetime.strptime(
                    '2013-10-12 02:00:00', '%Y-%m-%d %H:%M:%S'
                ),
                'inf': False
            },
            {
                'title': '3rd movie',
                'start_time': datetime.strptime(
                    '2013-10-12 02:00:00', '%Y-%m-%d %H:%M:%S'
                ),
                'end_time': datetime.strptime(
                    '2013-10-12 03:00:00', '%Y-%m-%d %H:%M:%S'
                ),
                'inf': False
            },
        ]
    },
    1414: {
        'index': 1414,
        'name': 'Second channel',
        'movies': [
            {
                'title': '1st movie',
                'start_time': datetime.strptime(
                    '2013-10-12 00:00:00', '%Y-%m-%d %H:%M:%S'
                ),
                'end_time': datetime.strptime(
                    '2013-10-12 01:00:00', '%Y-%m-%d %H:%M:%S'
                ),
                'inf': False
            },
            {
                'title': '2nd movie',
                'start_time': datetime.strptime(
                    '2013-10-12 01:00:00', '%Y-%m-%d %H:%M:%S'
                ),
                'end_time': datetime.strptime(
                    '2013-10-12 02:00:00', '%Y-%m-%d %H:%M:%S'
                ),
                'inf': False
            },
            {
                'title': '3rd movie',
                'start_time': datetime.strptime(
                    '2013-10-12 02:00:00', '%Y-%m-%d %H:%M:%S'
                ),
                'end_time': datetime.strptime(
                    '2013-10-12 03:00:00', '%Y-%m-%d %H:%M:%S'
                ),
                'inf': False
            },
        ]
    },
}

Low-level API

ntv.web.fetcher

Gets raw data from website as

from ntv.web import fetcher

print fetcher()
print fetcher(datetime.today())

ntv.web.result_to_dict

Changes raw result from fetcher into final dictionary

from ntv.web import fetcher, result_to_dict

print result_to_dict(fetcher())

ntv.web.filtered

Filters result dict using params: channel_id, channel_name, movie_title

from ntv.web import fetcher, result_to_dict, filtered

print filtered(result_to_dict(fetcher()), channel_name='canal')

History

0.3.3 (2013-11-08)

  • Fixed -d option

0.3.2 (2013-11-03)

  • Added ‘on_air’ -a option

0.3.1 (2013-10-25)

  • Fixed filtering using channel and movie together

0.3.0 (2013-10-11)

  • Changed dict.itermitems() to items() for compatibility with python 3.x

0.2.0 (2013-10-11)

  • Fixed utf-8 input titles and names

0.1.0 (2013-10-11)

  • First release on PyPI.

Metadata

Release files for ntv 0.4.4

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for ntv 0.4.4
File Size Uploaded
ntv-0.4.4.tar.gz 16.2 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for ntv 0.4.4
File Interpreter ABI Platform
ntv-0.4.4-py2.py3-none-any.whl Python 2, Python 3 none any Details

Total release size: 24.0 kB

Release files / ntv-0.4.4.tar.gz

Download URL ntv-0.4.4.tar.gz
Size 16.2 kB
Tags Source
SHA-256 checksum
How to use checksums
53e18a080061363b2bba66afdfd0ac81b8ae3b6f8a1ec6bff54d803334328786
BLAKE2b-256 checksum
How to use checksums
649bd4e4f5a3160bbb74728d10c590bb45a8796978b76df32978d226e12ee03d
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No

Release files / ntv-0.4.4-py2.py3-none-any.whl

Download URL ntv-0.4.4-py2.py3-none-any.whl
Size 7.8 kB
Tags Python 2 Python 3
SHA-256 checksum
How to use checksums
a5df635b289fc57d1cba11d099620e908a67108660cfc98ea0330cdbe6e29b0d
BLAKE2b-256 checksum
How to use checksums
53aa97776c49434b7d7262226b6d6603151090c42fdf61ced2fa9f34cf9ea6e6
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No

Release history Release notifications | RSS feed

This release

0.4.4 This release

2 release files

0.4.3

2 release files

0.4.2

2 release files

0.4.1

2 release files

0.4.0

2 release files

0.3.4

1 release file

0.3.3

1 release file

0.3.2

1 release file

0.3.1

1 release file

0.3.0

1 release file

0.2.0

1 release file

0.1.0

1 release file

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page