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
cli(settings)
¶
SUISA Sendemeldung.
Create and send playout reports to SUISA.
The reports are based on data from ACRCloud.
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_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_composer(music)
¶
Get composer from a given dict.
music: music dict from API
composer: string representing the composer
Source code in suisa_sendemeldung/suisa_sendemeldung.py
get_csv(data, settings)
¶
Create SUISA compatible csv data.
data: To data to create csv from
settings: The settings provided to the script
csv: The converted data
Source code in suisa_sendemeldung/suisa_sendemeldung.py
294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 | |
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, settings)
¶
Create SUISA compatible xlsx data.
data: The data to create xlsx from
settings: The settings provided to the script
xlsx: The converted data as BytesIO object
Source code in suisa_sendemeldung/suisa_sendemeldung.py
427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 | |
main(settings)
¶
ACRCloud client for SUISA reporting @ RaBe.
Source code in suisa_sendemeldung/suisa_sendemeldung.py
661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 698 699 700 701 702 703 704 705 706 707 708 709 710 711 712 713 714 715 716 717 718 719 720 721 722 723 724 725 726 727 728 729 730 731 732 733 734 735 736 737 738 739 740 741 742 743 744 | |
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(settings)
¶
Parse date from args.
settings: The settings 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(settings, start_date)
¶
Parse filename from settings and start_date.
settings: the settings 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
reformat_start_date_in_xlsx(worksheet)
¶
Set date number formatting on relevant columns.
Source code in suisa_sendemeldung/suisa_sendemeldung.py
send_message(msg, server='127.0.0.1', port=587, login=None, password=None)
¶
Send email.
msg: The message to send (an email.message.Message object)
server: The SMTP server to use to send the email.
port: The port of the SMTP server.
login: The username for `sender`@`server`.
password: The password for `sender`@`server`.
Source code in suisa_sendemeldung/suisa_sendemeldung.py
validate_arguments(settings)
¶
Validate the arguments provided to the script.
After this function we are sure that there are no conflicts in the arguments.
settings: the Settings instance to validate
InvalidValueError: if there are invalid argument combinations
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`.