Esempio n. 1
0
    def testPlPlay(self):
        '''ajout de 4000 videos dans la PL'''
        return
        repVideos = Util.configValue('commun', 'repertoireVideo')
        ficVideos = Util.listerRepertoire(repVideos, False)

        for number in range(1, 1001):
            indAleatoire = random.randint(0, len(ficVideos) - 1)
            self.listPl.insert(tk.END, ficVideos[indAleatoire])

        #appel de la methode
        self.evt.playPL(self.listPl, self.pbar, self.timer)
        self.root.mainloop()
Esempio n. 2
0
 def rechercherPLAvecVideo(self, selVideoObj):
     '''
     methode qui recherche les playlist qui contiennent la video en parametre
     retourne une liste de PL
     '''
     retour = []
     ficPL = Util.listerRepertoire(
         Util.configValue('commun', 'repertoirePL'))
     for fichier in ficPL:
         plCur = self.load(fichier)
         for video in plCur.videos:
             if video.getNom() == selVideoObj.getNom():
                 retour.append(plCur)
     return retour
Esempio n. 3
0
 def calculerStatPL(self):
     '''
     recherche toutes les playlist sur le disque
     stocke dans un dictionnaire le nombre de PL par jour
     '''
     #on stocke l'heure du fichier
     ficPL = Util.listerRepertoire(
         Util.configValue('commun', 'repertoirePL'), False)
     for fichier in ficPL:
         retour = re.match(
             r"PL__([\d]{4})-([\d]{2})-([\d]{2})__([\d]{2})h00.obj",
             fichier)
         if retour:
             jjmmaaaaFichier = retour.group(3) + '-' + retour.group(
                 2) + '-' + retour.group(1)  #ex 09112017
             self.statPL['PL' + jjmmaaaaFichier] = self.statPL.get(
                 'PL' + jjmmaaaaFichier, 0) + 1
Esempio n. 4
0
 def rechercherPLprocheDate(self, pdate):
     '''
     p1 date recherche de la PL selon cette date
     recherche toutes les playlist du meme jour que la date parametre
     si recherche > 1 playlist, on choisit celle qui est le plus proche de l'heure
     retourne le nom du fichier de la playlist'''
     jjmmaaaaParam = pdate.strftime('%d%m%Y')  #ex 21032017
     heureParam = pdate.strftime('%Hh%M')  #ex 15h00
     PLcriteresOK = [
     ]  #tableau des playlists qui ont le jour ok par rapport au parametre
     #on stocke l'heure du fichier
     ficPL = Util.listerRepertoire(
         Util.configValue('commun', 'repertoirePL'), False)
     for fichier in ficPL:
         retour = re.match(
             r"PL__([\d]{4})-([\d]{2})-([\d]{2})__([\d]{2})h00.obj",
             fichier)
         if retour:
             jjmmaaaaFichier = retour.group(3) + retour.group(
                 2) + retour.group(1)  #ex 21032017
             heureFichier = retour.group(4) + 'h00'  #ex 15h00
             if jjmmaaaaFichier == jjmmaaaaParam:
                 PLcriteresOK.append(retour.group() + ':' + heureFichier)
     if len(PLcriteresOK) == 0:
         raise CineException('PLRechercheKO')
     if len(PLcriteresOK) == 1:
         #une seule PL matche donc on la retourne
         return PLcriteresOK[0].split(':')[0]
     #il faut faire une recherche en prenant l'heure la plus proche'
     heurePlusProche = None  # heure fictive pour initialiser recherche
     for plTrouvee in PLcriteresOK:
         heurePL = plTrouvee.split(':')[1]
         if Util.heureCompare(heureParam, heurePL, heurePlusProche) < 0:
             plPlusProcheHeureParam = plTrouvee.split(':')[0]
             heurePlusProche = heurePL
     return plPlusProcheHeureParam