Exemple #1
0
 def __delitem__(self, index):
     item = self.items[index]
     self.ttime -= item.song.length
     if item.hasbeenplayed():
         self.ptime -= item.song.length
     self.items.__delitem__(index)
     self._updateplaystarttimes()
Exemple #2
0
 def __delitem__(self, index):
     item = self.items[index]
     self.ttime -= item.song.length
     if item.hasbeenplayed():
         self.ptime -= item.song.length
     self.items.__delitem__(index)
     self._updateplaystarttimes()
Exemple #3
0
    def _playitem(self, item):
        """ check for a song abortion, register song as being played
        and update playlist information accordingly"""

        if not item.hasbeenplayed():
            self.ptime += item.song.length
        self.playingitem = item
        item.markplayed()
        self._updateplaystarttimes()
        self._logplay(item)
Exemple #4
0
 def _updateplaystarttimes(self):
     # TODO: take crossfading time into account
     if self.playingitem:
         playstarttime = self.playingitem.playstarttime + self.playingitem.song.length
     else:
         playstarttime = time.time()
     for item in self.items:
         if not item.hasbeenplayed():
             item.playstarttime = playstarttime
             playstarttime += item.song.length
Exemple #5
0
    def _playitem(self, item):
        """ check for a song abortion, register song as being played
        and update playlist information accordingly"""

        if not item.hasbeenplayed():
            self.ptime += item.song.length
        self.playingitem = item
        item.markplayed()
        self._updateplaystarttimes()
        self._logplay(item)
Exemple #6
0
 def _updateplaystarttimes(self):
     # TODO: take crossfading time into account
     if self.playingitem:
         playstarttime = self.playingitem.playstarttime + self.playingitem.song.length
     else:
         playstarttime = time.time()
     for item in self.items:
         if not item.hasbeenplayed():
             item.playstarttime = playstarttime
             playstarttime += item.song.length
Exemple #7
0
 def _markunplayed(self, item):
     """ mark song unplayed and adjust playlist information accordingly """
     if item.hasbeenplayed():
         self.ptime -= item.song.length
         item.markunplayed()
         self._updateplaystarttimes()
Exemple #8
0
 def insert(self, index, item):
     self.ttime += item.song.length
     if item.hasbeenplayed():
         self.ptime += item.song.length
     self.items.insert(index, item)
Exemple #9
0
 def append(self, item):
     self.ttime += item.song.length
     if item.hasbeenplayed():
         self.ptime += item.song.length
     self.items.append(item)
Exemple #10
0
 def _markunplayed(self, item):
     """ mark song unplayed and adjust playlist information accordingly """
     if item.hasbeenplayed():
         self.ptime -= item.song.length
         item.markunplayed()
         self._updateplaystarttimes()
Exemple #11
0
 def insert(self, index, item):
     self.ttime += item.song.length
     if item.hasbeenplayed():
         self.ptime += item.song.length
     self.items.insert(index, item)
Exemple #12
0
 def append(self, item):
     self.ttime += item.song.length
     if item.hasbeenplayed():
         self.ptime += item.song.length
     self.items.append(item)