cs.mediainfo


Namecs.mediainfo JSON
Version 20240519 PyPI version JSON
download
home_pageNone
SummarySimple minded facilities for media information. This contains mostly lexical functions for extracting information from strings or constructing media filenames from metadata.
upload_time2024-05-19 02:18:55
maintainerNone
docs_urlNone
authorNone
requires_pythonNone
licenseGNU General Public License v3 or later (GPLv3+)
keywords python2 python3
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            Simple minded facilities for media information.
This contains mostly lexical functions
for extracting information from strings
or constructing media filenames from metadata.

*Latest release 20240519*:
Initial PyPI release, particularly for SeriesEpisodeInfo which I use in cs.app.playon.

The default filename parsing rules are based on my personal convention,
which is to name media files as:

  series_name--episode_info--title--source--etc-etc.ext

where the components are:
* `series_name`:
  the programme series name downcased and with whitespace replaced by dashes;
  in the case of standalone items like movies this is often the studio.
* `episode_info`: a structures field with episode information:
  `s`_n_ is a series/season,
  `e`_n_` is an episode number within the season,
  `x`_n_` is a "extra" - addition material supplied with the season,
  etc.
* `title`: the episode title downcased and with whitespace replaced by dashes
* `source`: the source of the media
* `ext`: filename extension such as `mp4`.

As you may imagine,
as a rule I dislike mixed case filenames
and filenames with embedded whitespace.
I also like a media filename to contain enough information
to identify the file contents in a compact and human readable form.

## Class `EpisodeDatumDefn(EpisodeDatumDefn)`

An `EpisodeInfo` marker definition.

*Method `EpisodeDatumDefn.parse(self, s, offset=0)`*:
Parse an episode datum from a string, return the value and new offset.
Raise `ValueError` if the string doesn't match this definition.

Parameters:
* `s`: the string
* `offset`: parse offset, default 0

## Class `EpisodeInfo(types.SimpleNamespace)`

Trite class for episodic information, used to store, match
or transcribe series/season, episode, etc values.

*Method `EpisodeInfo.__getitem__(self, name)`*:
We can look up values by name.

*Method `EpisodeInfo.as_dict(self)`*:
Return the episode info as a `dict`.

*Method `EpisodeInfo.as_tags(self, prefix=None)`*:
Generator yielding the episode info as `Tag`s.

*Method `EpisodeInfo.from_filename_part(s, offset=0)`*:
Factory to return an `EpisodeInfo` from a filename episode field.

Parameters:
* `s`: the string containing the episode information
* `offset`: the start of the episode information, default 0

The episode information must extend to the end of the string
because the factory returns just the information. See the
`parse_filename_part` class method for the core parse.

*Method `EpisodeInfo.get(self, name, default=None)`*:
Look up value by name with default.

*Method `EpisodeInfo.parse_filename_part(s, offset=0)`*:
Parse episode information from a string,
returning the matched fields and the new offset.

Parameters:
`s`: the string containing the episode information.
`offset`: the starting offset of the information, default 0.

*Property `EpisodeInfo.season`*:
.season property, synonym for .series

## Function `main(argv=None)`

Main command line running some test code.

## Function `parse_name(name, sep='--')`

Parse the descriptive part of a filename
(the portion remaining after stripping the file extension)
and yield `(part,fields)` for each part as delineated by `sep`.

## Function `part_to_title(part)`

Convert a filename part into a title string.

Example:

    >>> part_to_title('episode-name')
    'Episode Name'

## Function `pathname_info(pathname)`

Parse information from the basename of a file pathname.
Return a mapping of field => values in the order parsed.

## Function `scrub_title(title: str, *, season=None, episode=None) -> str`

Strip redundant text from the start of an episode title.

I frequently get "title" strings with leading season/episode information.
This function cleans up these strings to return the unadorned title.

## Class `SeriesEpisodeInfo(cs.deco.Promotable)`

Episode information from a TV series episode.

*Method `SeriesEpisodeInfo.as_dict(self)`*:
Return the non-`None` values as a `dict`.

*Method `SeriesEpisodeInfo.from_str(episode_title: str, series=None)`*:
Infer a `SeriesEpisodeInfo` from an episode title.

This recognises the common `'sSSeEE - Episode Title'` format
and variants like `Series Name - sSSeEE - Episode Title'`
or `'sSSeEE - Episode Title - Part: One'`.

## Function `title_to_part(title)`

Convert a title string into a filename part.
This is lossy; the `part_to_title` function cannot completely reverse this.

Example:

    >>> title_to_part('Episode Name')
    'episode-name'

# Release Log



*Release 20240519*:
Initial PyPI release, particularly for SeriesEpisodeInfo which I use in cs.app.playon.


            

Raw data

            {
    "_id": null,
    "home_page": null,
    "name": "cs.mediainfo",
    "maintainer": null,
    "docs_url": null,
    "requires_python": null,
    "maintainer_email": null,
    "keywords": "python2, python3",
    "author": null,
    "author_email": "Cameron Simpson <cs@cskk.id.au>",
    "download_url": "https://files.pythonhosted.org/packages/30/fb/92479f9b3bb782a7a85e3c8c40b37623b3d9e74982c45ecbcbfd01d77ab0/cs.mediainfo-20240519.tar.gz",
    "platform": null,
    "description": "Simple minded facilities for media information.\nThis contains mostly lexical functions\nfor extracting information from strings\nor constructing media filenames from metadata.\n\n*Latest release 20240519*:\nInitial PyPI release, particularly for SeriesEpisodeInfo which I use in cs.app.playon.\n\nThe default filename parsing rules are based on my personal convention,\nwhich is to name media files as:\n\n  series_name--episode_info--title--source--etc-etc.ext\n\nwhere the components are:\n* `series_name`:\n  the programme series name downcased and with whitespace replaced by dashes;\n  in the case of standalone items like movies this is often the studio.\n* `episode_info`: a structures field with episode information:\n  `s`_n_ is a series/season,\n  `e`_n_` is an episode number within the season,\n  `x`_n_` is a \"extra\" - addition material supplied with the season,\n  etc.\n* `title`: the episode title downcased and with whitespace replaced by dashes\n* `source`: the source of the media\n* `ext`: filename extension such as `mp4`.\n\nAs you may imagine,\nas a rule I dislike mixed case filenames\nand filenames with embedded whitespace.\nI also like a media filename to contain enough information\nto identify the file contents in a compact and human readable form.\n\n## Class `EpisodeDatumDefn(EpisodeDatumDefn)`\n\nAn `EpisodeInfo` marker definition.\n\n*Method `EpisodeDatumDefn.parse(self, s, offset=0)`*:\nParse an episode datum from a string, return the value and new offset.\nRaise `ValueError` if the string doesn't match this definition.\n\nParameters:\n* `s`: the string\n* `offset`: parse offset, default 0\n\n## Class `EpisodeInfo(types.SimpleNamespace)`\n\nTrite class for episodic information, used to store, match\nor transcribe series/season, episode, etc values.\n\n*Method `EpisodeInfo.__getitem__(self, name)`*:\nWe can look up values by name.\n\n*Method `EpisodeInfo.as_dict(self)`*:\nReturn the episode info as a `dict`.\n\n*Method `EpisodeInfo.as_tags(self, prefix=None)`*:\nGenerator yielding the episode info as `Tag`s.\n\n*Method `EpisodeInfo.from_filename_part(s, offset=0)`*:\nFactory to return an `EpisodeInfo` from a filename episode field.\n\nParameters:\n* `s`: the string containing the episode information\n* `offset`: the start of the episode information, default 0\n\nThe episode information must extend to the end of the string\nbecause the factory returns just the information. See the\n`parse_filename_part` class method for the core parse.\n\n*Method `EpisodeInfo.get(self, name, default=None)`*:\nLook up value by name with default.\n\n*Method `EpisodeInfo.parse_filename_part(s, offset=0)`*:\nParse episode information from a string,\nreturning the matched fields and the new offset.\n\nParameters:\n`s`: the string containing the episode information.\n`offset`: the starting offset of the information, default 0.\n\n*Property `EpisodeInfo.season`*:\n.season property, synonym for .series\n\n## Function `main(argv=None)`\n\nMain command line running some test code.\n\n## Function `parse_name(name, sep='--')`\n\nParse the descriptive part of a filename\n(the portion remaining after stripping the file extension)\nand yield `(part,fields)` for each part as delineated by `sep`.\n\n## Function `part_to_title(part)`\n\nConvert a filename part into a title string.\n\nExample:\n\n    >>> part_to_title('episode-name')\n    'Episode Name'\n\n## Function `pathname_info(pathname)`\n\nParse information from the basename of a file pathname.\nReturn a mapping of field => values in the order parsed.\n\n## Function `scrub_title(title: str, *, season=None, episode=None) -> str`\n\nStrip redundant text from the start of an episode title.\n\nI frequently get \"title\" strings with leading season/episode information.\nThis function cleans up these strings to return the unadorned title.\n\n## Class `SeriesEpisodeInfo(cs.deco.Promotable)`\n\nEpisode information from a TV series episode.\n\n*Method `SeriesEpisodeInfo.as_dict(self)`*:\nReturn the non-`None` values as a `dict`.\n\n*Method `SeriesEpisodeInfo.from_str(episode_title: str, series=None)`*:\nInfer a `SeriesEpisodeInfo` from an episode title.\n\nThis recognises the common `'sSSeEE - Episode Title'` format\nand variants like `Series Name - sSSeEE - Episode Title'`\nor `'sSSeEE - Episode Title - Part: One'`.\n\n## Function `title_to_part(title)`\n\nConvert a title string into a filename part.\nThis is lossy; the `part_to_title` function cannot completely reverse this.\n\nExample:\n\n    >>> title_to_part('Episode Name')\n    'episode-name'\n\n# Release Log\n\n\n\n*Release 20240519*:\nInitial PyPI release, particularly for SeriesEpisodeInfo which I use in cs.app.playon.\n\n",
    "bugtrack_url": null,
    "license": "GNU General Public License v3 or later (GPLv3+)",
    "summary": "Simple minded facilities for media information. This contains mostly lexical functions for extracting information from strings or constructing media filenames from metadata.",
    "version": "20240519",
    "project_urls": {
        "URL": "https://bitbucket.org/cameron_simpson/css/commits/all"
    },
    "split_keywords": [
        "python2",
        " python3"
    ],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "f9a119f2e938c2ef0ada53ae454b6ece51c339b7c2e39df3a742202e85ea1350",
                "md5": "30b058ceb681604f5ea03834f71c4547",
                "sha256": "25c7d6d512d4b906ba131f4c4afebfb4d2f50b87ed38d4c463b3e46c60b0b9c4"
            },
            "downloads": -1,
            "filename": "cs.mediainfo-20240519-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "30b058ceb681604f5ea03834f71c4547",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": null,
            "size": 7317,
            "upload_time": "2024-05-19T02:18:53",
            "upload_time_iso_8601": "2024-05-19T02:18:53.313006Z",
            "url": "https://files.pythonhosted.org/packages/f9/a1/19f2e938c2ef0ada53ae454b6ece51c339b7c2e39df3a742202e85ea1350/cs.mediainfo-20240519-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "30fb92479f9b3bb782a7a85e3c8c40b37623b3d9e74982c45ecbcbfd01d77ab0",
                "md5": "ac38e056531ec0cb9d28ba57f857a20c",
                "sha256": "2046e4dee5936720bcbb64184e34f76701d8fe9efe00e5cd03e1d51afb5b2dde"
            },
            "downloads": -1,
            "filename": "cs.mediainfo-20240519.tar.gz",
            "has_sig": false,
            "md5_digest": "ac38e056531ec0cb9d28ba57f857a20c",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": null,
            "size": 6675,
            "upload_time": "2024-05-19T02:18:55",
            "upload_time_iso_8601": "2024-05-19T02:18:55.665500Z",
            "url": "https://files.pythonhosted.org/packages/30/fb/92479f9b3bb782a7a85e3c8c40b37623b3d9e74982c45ecbcbfd01d77ab0/cs.mediainfo-20240519.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2024-05-19 02:18:55",
    "github": false,
    "gitlab": false,
    "bitbucket": true,
    "codeberg": false,
    "bitbucket_user": "cameron_simpson",
    "bitbucket_project": "css",
    "lcname": "cs.mediainfo"
}
        
Elapsed time: 3.85549s