#!/usr/bin/python
# -*- coding: utf-8 -*-

import os, os.path, stat, sys

ex_no = '10'

students = [
  ('J.C. Blanchette', 'blanchette', 'jbe248@vu.nl'),

  ('A. Afroozeh (Azim)', '70214', 'aah770@student.vu.nl'),
  ('K. Ali Karam Soltany (Kaveh)', '33588', 'kay210@student.vu.nl'),
  ('S. Allu (Sriram)', '98592', 'sau460@student.vu.nl'),
  ('S. Ansmink (Sam)', '14595', 'sak330@student.vu.nl'),
  ('S. Arora (Shubham)', '73120', 'saa214@student.vu.nl'),
  ('Q. Bakker (Quincy)', '86278', 'qbr210@student.vu.nl'),
  ('D. Balakrishnan (Dhayalan)', '68788', 'dbn282@student.vu.nl'),
  ('J.R. Barkema (Joris)', '115667', 'jorisbarkema@gmail.com'),
  ('I.I. Birlica (Iulian)', '104919', 'iba820@student.vu.nl'),
  ('S.H. Bjarnadóttir (Svava)', '71489', 'sbr444@student.vu.nl'),
  ('J.M. Briggeman (Jordy)', '85018', 'jbn605@student.vu.nl'),
  ('L.Y. Coltof (Lorian)', '54586', 'lcf400@student.vu.nl'),
  ('C. van Ek (Casper)', '25849', 'cek270@student.vu.nl'),
  ('G.P.S. Frankhuizen (Geoffrey)', '14734', 'gfn250@student.vu.nl'),
  ('S.A.M. van Gerwen (Sarah)', '48790', 'sgn274@student.vu.nl'),
  ('F.A.K.G. de Greef (Freddy)', '58046', 'fgf240@student.vu.nl'),
  ('F. Guo (Furong)', '94297', 'fgo320@student.vu.nl'),
  ('S. Gupta (Sarthak)', '50089', 'sga520@student.vu.nl'),
  ('S. He (Shuxin)', '65013', 'she212@student.vu.nl'),
  ('S. Heijungs (Simon)', '58116', 'shs308@student.vu.nl'),
  ('K. Kahlman (Koen)', '36296', 'kkn530@student.vu.nl'),
  ('M.E. Kanakis (Marios)', '64576', 'mks404@student.vu.nl'),
  ('J.M. Kenyon (Joshua)', '26592', 'jkn434@student.vu.nl'),
  ('R.B. Kluiving (Boas)', '101093', 'rkg710@student.vu.nl'),
  ('M.N. Koomen (Mick)', '83833', 'mkn676@student.vu.nl'),
  ('N.G.F. Koster (Rick)', '14967', 'nkr850@student.vu.nl'),
  ('O.L.A. Kramer (Olmo)', '114786', 'okr700@student.vu.nl'),
  ('A.D. Kuin (Aiman)', '83912', 'akn461@student.vu.nl'),
  ('E. Kultorp (Eirik)', '40173', 'ekp350@student.vu.nl'),
  ('E. Link (Erik)', '40858', 'elk280@student.vu.nl'),
  ('D.C.V. Louwrink (Daniël)', '100126', 'dlk340@student.vu.nl'),
  ('F. Lyu (Fangzheng)', '75233', 'flu220@student.vu.nl'),
  ('K. Maat (Kyrian)', '84522', 'kmt360@student.vu.nl'),
  ('N. el Mahjoubi (Nizar)', '83069', 'nmi950@student.vu.nl'),
  ('A. Markovic (Aleksandar)', '77610', 'amc340@student.vu.nl'),
  ('D. Mazzucato (Denis)', '103158', 'dmo530@student.vu.nl'),
  ('T.C. Meijerink (Thijs)', '92674', 'tmk390@student.vu.nl'),
  ('L.J. Mettrop (Lennart)', '19027', 'lmp500@student.vu.nl'),
  ('R. Mossinkoff (Rico)', '24756', 'rmf700@student.vu.nl'),
  ('M. Mundra (Mansi)', '107747', 'mma386@student.vu.nl'),
  ('V. Murugesan (Vignesh)', '101069', 'vmn510@student.vu.nl'),
  ('S. Negi (Saurabh)', '67833', 'sni580@student.vu.nl'),
  ('F. Parolini (Francesco)', '103521', 'fpi310@student.vu.nl'),
  ('A. Radhakrishnan (Abijith)', '100141', 'arr227@student.vu.nl'),
  ('M.G. Redder (Gracia)', '59711', 'mrr960@student.vu.nl'),
  ('Y. Ren (Yaping)', '94971', 'yrn330@student.vu.nl'),
  ('C.J. van Roon (Christiaan)', '82937', 'crn870@student.vu.nl'),
  ('A. Rossi (Andrea)', '76154', 'ari720@student.vu.nl'),
  ('N. Sathyan (Neeraj)', '93803', 'nsn271@student.vu.nl'),
  ('H.A.H. Schomaker (Mannus)', '88226', 'hsr650@student.vu.nl'),
  ('A. Shankar (Abhinav)', '64551', 'asr397@student.vu.nl'),
  ('A. Stevenet (Antoni)', '15939', 'ast247@student.vu.nl'),
  ('G.H. Strønstad (Gøran)', '30366', 'gsd800@student.vu.nl'),
  ('L.W.A. Stuurman (Laurens)', '79237', 'lsn321@student.vu.nl'),
  ('R.R. van der Wiel (Robin)', '44342', 'rwl440@student.vu.nl'),
  ('S.O. Vos (Sophie)', '11198', 'svs850@student.vu.nl'),
  ('W. bij \'t Vuur (Wolf)', '30757', 'wvr350@student.vu.nl'),
  ('R.M.A. Webbers (Robin)', '54355', 'rws203@student.vu.nl'),
  ('M. Werensteijn (Mitchell)', '14969', 'mwn307@student.vu.nl'),
  ('F.M. Westers (Frank)', '78565', 'fws620@student.vu.nl'),
  ('M.G. Wiggerman (Marc)', '79945', 'mwn345@student.vu.nl'),
  ('F.Q. Willemsen (Floris-Jan)', '74104', 'fwn670@student.vu.nl'),
  ('W.K. van Woerkom (Wijnand)', '70613', 'wwm700@student.vu.nl'),
  ('V. Yaglamunov (Vladislav)', '107868', 'vyv400@student.vu.nl'),
  ]

homework_dir = os.path.dirname(os.path.abspath(__file__)) + '/' + ex_no + '/'

for (student_name, lean_file_base, email) in students:
  lean_file_pattern = homework_dir + '*_' + lean_file_base + '_*.lean'
  lean_file_name = homework_dir + lean_file_base + '.lean'
  os.system ('cp ' + lean_file_pattern + ' ' + lean_file_name + ' 2> /dev/null')

  if os.path.isfile(lean_file_name):
    print ('SEND ' + student_name + ' ' + lean_file_base + ' ' + email + ' ' + lean_file_name)
    os.system ('./send.py "' + email + '" "[LoVe] Homework ' + ex_no + ' marking (look for ZZZ below)" ' + lean_file_name)
  else:
    print ('ERROR: Cannot find ' + lean_file_name)
