gtsocial-umbx

Unnamed repository; edit this file 'description' to name the repository.
Log | Files | Refs | README | LICENSE

standard.go (2994B)


      1 package iptc
      2 
      3 import (
      4 	"errors"
      5 )
      6 
      7 // StreamTagInfo encapsulates the properties of each tag.
      8 type StreamTagInfo struct {
      9 	// Description is the human-readable description of the tag.
     10 	Description string
     11 }
     12 
     13 var (
     14 	standardTags = map[StreamTagKey]StreamTagInfo{
     15 		{1, 120}: {"ARM Identifier"},
     16 
     17 		{1, 122}: {"ARM Version"},
     18 		{2, 0}:   {"Record Version"},
     19 		{2, 3}:   {"Object Type Reference"},
     20 		{2, 4}:   {"Object Attribute Reference"},
     21 		{2, 5}:   {"Object Name"},
     22 		{2, 7}:   {"Edit Status"},
     23 		{2, 8}:   {"Editorial Update"},
     24 		{2, 10}:  {"Urgency"},
     25 		{2, 12}:  {"Subject Reference"},
     26 		{2, 15}:  {"Category"},
     27 		{2, 20}:  {"Supplemental Category"},
     28 		{2, 22}:  {"Fixture Identifier"},
     29 		{2, 25}:  {"Keywords"},
     30 		{2, 26}:  {"Content Location Code"},
     31 		{2, 27}:  {"Content Location Name"},
     32 		{2, 30}:  {"Release Date"},
     33 		{2, 35}:  {"Release Time"},
     34 		{2, 37}:  {"Expiration Date"},
     35 		{2, 38}:  {"Expiration Time"},
     36 		{2, 40}:  {"Special Instructions"},
     37 		{2, 42}:  {"Action Advised"},
     38 		{2, 45}:  {"Reference Service"},
     39 		{2, 47}:  {"Reference Date"},
     40 		{2, 50}:  {"Reference Number"},
     41 		{2, 55}:  {"Date Created"},
     42 		{2, 60}:  {"Time Created"},
     43 		{2, 62}:  {"Digital Creation Date"},
     44 		{2, 63}:  {"Digital Creation Time"},
     45 		{2, 65}:  {"Originating Program"},
     46 		{2, 70}:  {"Program Version"},
     47 		{2, 75}:  {"Object Cycle"},
     48 		{2, 80}:  {"By-line"},
     49 		{2, 85}:  {"By-line Title"},
     50 		{2, 90}:  {"City"},
     51 		{2, 92}:  {"Sublocation"},
     52 		{2, 95}:  {"Province/State"},
     53 		{2, 100}: {"Country/Primary Location Code"},
     54 		{2, 101}: {"Country/Primary Location Name"},
     55 		{2, 103}: {"Original Transmission Reference"},
     56 		{2, 105}: {"Headline"},
     57 		{2, 110}: {"Credit"},
     58 		{2, 115}: {"Source"},
     59 		{2, 116}: {"Copyright Notice"},
     60 		{2, 118}: {"Contact"},
     61 		{2, 120}: {"Caption/Abstract"},
     62 		{2, 122}: {"Writer/Editor"},
     63 		{2, 125}: {"Rasterized Caption"},
     64 		{2, 130}: {"Image Type"},
     65 		{2, 131}: {"Image Orientation"},
     66 		{2, 135}: {"Language Identifier"},
     67 		{2, 150}: {"Audio Type"},
     68 		{2, 151}: {"Audio Sampling Rate"},
     69 		{2, 152}: {"Audio Sampling Resolution"},
     70 		{2, 153}: {"Audio Duration"},
     71 		{2, 154}: {"Audio Outcue"},
     72 		{2, 200}: {"ObjectData Preview File Format"},
     73 		{2, 201}: {"ObjectData Preview File Format Version"},
     74 		{2, 202}: {"ObjectData Preview Data"},
     75 		{7, 10}:  {"Size Mode"},
     76 		{7, 20}:  {"Max Subfile Size"},
     77 		{7, 90}:  {"ObjectData Size Announced"},
     78 		{7, 95}:  {"Maximum ObjectData Size"},
     79 		{8, 10}:  {"Subfile"},
     80 		{9, 10}:  {"Confirmed ObjectData Size"},
     81 	}
     82 )
     83 
     84 var (
     85 	// ErrTagNotStandard indicates that the given tag is not known among the
     86 	// documented standard set.
     87 	ErrTagNotStandard = errors.New("not a standard tag")
     88 )
     89 
     90 // GetTagInfo return the info for the given tag. Returns ErrTagNotStandard if
     91 // not known.
     92 func GetTagInfo(recordNumber, datasetNumber int) (sti StreamTagInfo, err error) {
     93 	stk := StreamTagKey{uint8(recordNumber), uint8(datasetNumber)}
     94 
     95 	sti, found := standardTags[stk]
     96 	if found == false {
     97 		return sti, ErrTagNotStandard
     98 	}
     99 
    100 	return sti, nil
    101 }