Suisa sendemeldung
SUISA Sendemeldung bugs SUISA with email once per month.
Fetches data on our playout history and formats them in a CSV file format containing the data (like Track, Title and ISRC) requested by SUISA. Also takes care of sending the report to SUISA via email for hands-off operations.
check_duplicate(entry_a, entry_b)
Check if two entries are duplicates by checking their acrid in all music items.
entry_a: first entry
entry_b: second entry
True if the entries are duplicates, False otherwise
Source code in suisa_sendemeldung/suisa_sendemeldung.py
create_message(sender, recipient, subject, text, filename, filetype, data, cc=None, bcc=None)
Create email message.
sender: The sender of the email. Login will be made with this user.
recipient: The recipient of the email. Can be a list.
subject: The subject of the email.
text: The body of the email.
filename: The filename of the attachment
filetype: The filetype of the attachment
data: The attachment data.
cc: cc recipient
bcc: bcc recipient
Source code in suisa_sendemeldung/suisa_sendemeldung.py
funge_release_date(release_date='')
Make a release_date from ACR conform to what seems to be the spec.
Source code in suisa_sendemeldung/suisa_sendemeldung.py
get_arguments(parser, sysargs)
Create :class:ArgumentParser
with arguments.
parser: the parser to add arguments
sysargs: sys.arg[1:] or something else for testing
args: the parsed args from the parser
Source code in suisa_sendemeldung/suisa_sendemeldung.py
139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 |
|
get_artist(music)
Get artist from a given dict.
music: music dict from API
artist: string representing the artist
Source code in suisa_sendemeldung/suisa_sendemeldung.py
get_csv(data, station_name='')
Create SUISA compatible csv data.
data: To data to create csv from
station_name: Default station name for output
csv: The converted data
Source code in suisa_sendemeldung/suisa_sendemeldung.py
516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 |
|
get_email_attachment(filename, filetype, data)
Create attachment based on required filetype and data.
filename: The filename of the attachment
filetype: The filetype of the attachment
data: The attachment data
Source code in suisa_sendemeldung/suisa_sendemeldung.py
get_isrc(music)
Get a valid ISRC from the music record or return an empty string.
Source code in suisa_sendemeldung/suisa_sendemeldung.py
get_xlsx(data, station_name='')
Create SUISA compatible xlsx data.
data: The data to create xlsx from
station_name: Default station name for output
xlsx: The converted data as BytesIO object
Source code in suisa_sendemeldung/suisa_sendemeldung.py
main()
Entrypoint for SUISA Sendemeldung .
Source code in suisa_sendemeldung/suisa_sendemeldung.py
838 839 840 841 842 843 844 845 846 847 848 849 850 851 852 853 854 855 856 857 858 859 860 861 862 863 864 865 866 867 868 869 870 871 872 873 874 875 876 877 878 879 880 881 882 883 884 885 886 887 888 889 890 891 892 893 894 895 896 897 898 899 900 901 902 903 904 905 906 907 908 909 910 911 912 913 914 915 916 917 918 919 920 |
|
merge_duplicates(data)
Merge consecutive entries into one if they are duplicates.
data: The data provided by ACRClient
data: The processed data
Source code in suisa_sendemeldung/suisa_sendemeldung.py
parse_date(args)
Parse date from args.
args: the arguments provided to the script
start_date: the start date of the requested interval
end_date: the end date of the requested interval
Source code in suisa_sendemeldung/suisa_sendemeldung.py
parse_filename(args, start_date)
Parse filename from args and start_date.
args: the arguments provided to the script
start_date: start of reporting period
filename: the filename to use for the csv data
Source code in suisa_sendemeldung/suisa_sendemeldung.py
send_message(msg, server='127.0.0.1', login=None, password=None)
Send email.
msg: The message to send (an email.messag.Message object)
server: The SMTP server to use to send the email.
login: The username for `sender`@`server`.
password: The password for `sender`@`server`.
Source code in suisa_sendemeldung/suisa_sendemeldung.py
validate_arguments(parser, args)
Validate the arguments provided to the script.
After this function we are sure that there are no conflicts in the arguments.
parser: the ArgumentParser to use for throwing errors
args: the arguments to validate
Source code in suisa_sendemeldung/suisa_sendemeldung.py
write_csv(filename, csv)
Write contents of csv
to file.
filename: The file to write to.
csv: The data to write to `filename`.
Source code in suisa_sendemeldung/suisa_sendemeldung.py
write_xlsx(filename, xlsx)
Write contents of xlsx
to file.
filename: The file to write to.
xlsx: The data to write to `filename`.