summaryrefslogtreecommitdiff
path: root/rhimport/rdxport_responses.go
blob: 2871408f86dcaa8d11dfd97d7e648be03aa69be0 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
//
//  rhimportd
//
//  The Radio Helsinki Rivendell Import Daemon
//
//
//  Copyright (C) 2015-2016 Christian Pointner <equinox@helsinki.at>
//
//  This file is part of rhimportd.
//
//  rhimportd is free software: you can redistribute it and/or modify
//  it under the terms of the GNU General Public License as published by
//  the Free Software Foundation, either version 3 of the License, or
//  any later version.
//
//  rhimportd is distributed in the hope that it will be useful,
//  but WITHOUT ANY WARRANTY; without even the implied warranty of
//  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
//  GNU General Public License for more details.
//
//  You should have received a copy of the GNU General Public License
//  along with rhimportd. If not, see <http://www.gnu.org/licenses/>.
//

package rhimport

import (
	"encoding/xml"
	"fmt"
	"io"
)

type RDWebResult struct {
	ResponseCode      int    `xml:"ResponseCode"`
	ErrorString       string `xml:"ErrorString"`
	AudioConvertError int    `xml:"AudioConvertError"`
}

func NewRDWebResultFromXML(data io.Reader) (res *RDWebResult, err error) {
	decoder := xml.NewDecoder(data)
	res = &RDWebResult{}
	if xmlerr := decoder.Decode(res); xmlerr != nil {
		err = fmt.Errorf("Error parsing XML response: %s", xmlerr)
		return
	}
	return
}

type RDCartAdd struct {
	Carts []RDCart `xml:"cart"`
}

type RDCart struct {
	Number             uint   `xml:"number"`
	Type               string `xml:"type"`
	GroupName          string `xml:"groupName"`
	Title              string `xml:"title"`
	Artist             string `xml:"artist"`
	Album              string `xml:"album"`
	Year               string `xml:"year"`
	Label              string `xml:"label"`
	Client             string `xml:"client"`
	Agency             string `xml:"agency"`
	Publisher          string `xml:"publisher"`
	Composer           string `xml:"composer"`
	UserDefined        string `xml:"userDefined"`
	UsageCode          uint   `xml:"usageCode"`
	ForcedLength       string `xml:"forcedLength"`
	AverageLength      string `xml:"averageLength"`
	LengthDeviation    string `xml:"lengthDeviation"`
	AverageSegueLength string `xml:"averageSegueLenth"`
	AverageHookLength  string `xml:"averageHookLength"`
	CutQuantity        uint   `xml:"cutQuantity"`
	LastCutPlayed      uint   `xml:"lastCutPlayed"`
	Validity           uint   `xml:"validity"`
	EnforceLength      bool   `xml:"enforceLength"`
	Asynchronous       bool   `xml:"asyncronous"`
	Owner              string `xml:"owner"`
	MetadataDatetime   string `xml:"metadataDatetime"`
}

func NewRDCartAddFromXML(data io.Reader) (cart *RDCartAdd, err error) {
	decoder := xml.NewDecoder(data)
	cart = &RDCartAdd{}
	if xmlerr := decoder.Decode(cart); xmlerr != nil {
		err = fmt.Errorf("Error parsing XML response: %s", xmlerr)
		return
	}
	return
}

type RDCutAdd struct {
	Cuts []RDCut `xml:"cut"`
}

type RDCut struct {
	Name             string `xml:"cutName"`
	CartNumber       uint   `xml:"cartNumber"`
	Number           uint   `xml:"cutNumber"`
	EverGreen        bool   `xml:"evergreen"`
	Description      string `xml:"description"`
	OutCue           string `xml:"outcue"`
	ISRC             string `xml:"isrc"`
	ISCI             string `xml:"isci"`
	Length           int    `xml:"length"`
	OriginDateTime   string `xml:"originDatetime"`
	StartDateTime    string `xml:"startDatetime"`
	EndDateTime      string `xml:"endDatetime"`
	Sunday           bool   `xml:"sun"`
	Monday           bool   `xml:"mon"`
	Tuesday          bool   `xml:"tue"`
	Wednesday        bool   `xml:"wed"`
	Thursday         bool   `xml:"thu"`
	Friday           bool   `xml:"fri"`
	Saturday         bool   `xml:"sat"`
	StartDaypart     string `xml:"startDaypart"`
	EndDayPart       string `xml:"endDaypart"`
	OriginName       string `xml:"originName"`
	Weight           int    `xml:"weight"`
	LastPlayDateTime string `xml:"lastPlayDatetime"`
	PlayCounter      uint   `xml:"playCounter"`
	LocalCounter     uint   `xml:"localCounter"`
	Validiy          uint   `xml:"validity"`
	CondingFormat    int    `xml:"codingFormat"`
	SampleRate       int    `xml:"sampleRate"`
	BitRate          int    `xml:"bitRate"`
	Channels         int    `xml:"channels"`
	PlayGain         int    `xml:"playGain"`
	StartPoint       int    `xml:"startPoint"`
	EndPoint         int    `xml:"endPoint"`
	FadeUpPoint      int    `xml:"fadeupPoint"`
	FadeDownPoint    int    `xml:"fadedownPoint"`
	SegueStartPoint  int    `xml:"segueStartPoint"`
	SegueEndPoint    int    `xml:"segueEndPoint"`
	SegueGain        int    `xml:"segueGain"`
	HookStartPoint   int    `xml:"hookStartPoint"`
	HookEndPoint     int    `xml:"hookEndPoint"`
	TalkStartPoint   int    `xml:"talkStartPoint"`
	TalkEndPoint     int    `xml:"talkEndPoint"`
}

func NewRDCutAddFromXML(data io.Reader) (cut *RDCutAdd, err error) {
	decoder := xml.NewDecoder(data)
	cut = &RDCutAdd{}
	if xmlerr := decoder.Decode(cut); xmlerr != nil {
		err = fmt.Errorf("Error parsing XML response: %s", xmlerr)
		return
	}
	return
}