releaseinfo

package module
v0.0.0-...-01f6c28 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Oct 16, 2016 License: GPL-3.0 Imports: 13 Imported by: 6

README

Release Info Parser

A library for parsing media file names and paths and returning structured information about them.

Ported from Sonarr's parser code.

Example


result, err := releaseinfo.Parse("WEEDS.S03E01-06.DUAL.Bluray.AC3.-HELLYWOOD.avi")
if err != nil {
    log.Fatal(err)
}

fmt.Printf("%#v", result)

=> &releaseinfo.EpisodeInfo{
    SeriesTitle:"WEEDS",
    SeriesTitleInfo:releaseinfo.SeriesTitleInfo{
        Title:"WEEDS", 
        TitleWithoutYear:"WEEDS", 
        Year:0
    }, 
    Quality:releaseinfo.QualityModel{
        Quality:releaseinfo.Quality{Id:6, Name:"Bluray-720p"}, 
        Revision:0, 
        QualitySource:"name"
    }, 
    SeasonNumber:3, 
    EpisodeNumbers:[]int{1, 2, 3, 4, 5, 6}, 
    AbsoluteEpisodeNumbers:[]int{}, 
    AirDate:"", 
    Language:language.Tag{lang:0x9a, region:0x0, script:0x0, pVariant:0x0, pExt:0x0, str:""}, 
    FullSeason:false, 
    Special:false, 
    ReleaseGroup:"HELLYWOOD", 
    ReleaseHash:""
}

Documentation

Index

Constants

View Source
const (
	RevisionDefault int = iota
	RevisionProper
)

Variables

View Source
var (
	QualityUnknown     = Quality{0, "Unknown"}
	QualitySDTV        = Quality{1, "SDTV"}
	QualityDVD         = Quality{2, "DVD"}
	QualityWEBDL1080p  = Quality{3, "WEBDL-1080p"}
	QualityHDTV720p    = Quality{4, "HDTV-720p"}
	QualityWEBDL720p   = Quality{5, "WEBDL-720p"}
	QualityBluray720p  = Quality{6, "Bluray-720p"}
	QualityBluray1080p = Quality{7, "Bluray-1080p"}
	QualityWEBDL480p   = Quality{8, "WEBDL-480p"}
	QualityHDTV1080p   = Quality{9, "HDTV-1080p"}
	QualityRAWHD       = Quality{10, "Raw-HD"}
	QualityHDTV2160p   = Quality{16, "HDTV-2160p"}
	QualityWEBDL2160p  = Quality{18, "WEBDL-2160p"}
	QualityBluray2160p = Quality{19, "Bluray-2160p"}
)

Functions

func CleanSeriesTitle

func CleanSeriesTitle(title string) string

func IsSceneTitle

func IsSceneTitle(title string) (bool, error)

This method should prefer false negatives over false positives. It's better not to use a title that might be scene than to use one that isn't scene

func NormalizeSeriesTitle

func NormalizeSeriesTitle(title string) string

Normalize a series title, removing all spaces, punctation and whitespace

func ParseLanguage

func ParseLanguage(title string) language.Tag

func ParseReleaseGroup

func ParseReleaseGroup(title string) string

func ParseSeriesName

func ParseSeriesName(title string) string

ParseSeriesName parses just the name of the series from the title. If Parse fails internally then the passed in title is cleaned up and returned as-is.

func ParseSubtitleLanguage

func ParseSubtitleLanguage(fileName string) (language.Tag, error)

Types

type EpisodeInfo

type EpisodeInfo struct {
	SeriesTitle            string
	SeriesTitleInfo        SeriesTitleInfo
	Quality                QualityModel
	SeasonNumber           int
	EpisodeNumbers         []int
	AbsoluteEpisodeNumbers []int
	AirDate                string
	Language               language.Tag
	FullSeason             bool
	Special                bool
	ReleaseGroup           string
	ReleaseHash            string
}

func Parse

func Parse(title string) (*EpisodeInfo, error)

func ParsePath

func ParsePath(path string) (*EpisodeInfo, error)

ParsePath extracts episode info from a full path

func (EpisodeInfo) IsAbsoluteNumbering

func (i EpisodeInfo) IsAbsoluteNumbering() bool

func (EpisodeInfo) IsDaily

func (i EpisodeInfo) IsDaily() bool

func (EpisodeInfo) IsPossibleSpecialEpisode

func (i EpisodeInfo) IsPossibleSpecialEpisode() bool

func (EpisodeInfo) String

func (i EpisodeInfo) String() string

type Quality

type Quality struct {
	Id   int
	Name string
}

func QualityFromString

func QualityFromString(q string) Quality

func (Quality) MarshalJSON

func (q Quality) MarshalJSON() ([]byte, error)

func (Quality) String

func (q Quality) String() string

func (Quality) UnmarshalJSON

func (q Quality) UnmarshalJSON(b []byte) error

type QualityModel

type QualityModel struct {
	Quality       Quality
	Revision      int
	QualitySource string
}

func ParseQuality

func ParseQuality(name string) QualityModel

func (QualityModel) String

func (qm QualityModel) String() string

type Resolution

type Resolution string
const (
	Resolution480p    Resolution = "480p"
	Resolution576p    Resolution = "576p"
	Resolution720p    Resolution = "720p"
	Resolution1080p   Resolution = "1080p"
	Resolution2160p   Resolution = "2160p"
	ResolutionUnknown Resolution = "unknown"
)

func ParseResolution

func ParseResolution(name string) Resolution

type SeriesTitleInfo

type SeriesTitleInfo struct {
	Title            string
	TitleWithoutYear string
	Year             int
}

func (SeriesTitleInfo) Equal

func (i SeriesTitleInfo) Equal(title string) bool

func (SeriesTitleInfo) Normalize

func (i SeriesTitleInfo) Normalize() string

Directories

Path Synopsis
cli

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL