void scrobbler_notify_read ( struct audio_file fd,
int  eof 
)

Notify the AudioScrobbler thread that a read from the file has been performed.

Definition at line 155 of file scrobbler.c.

00156 {
00157         struct scrobbler_entry *nse;
00158         unsigned int len;
00159 
00160         /* Don't accept streams or submit songs twice */
00161         if (!scrobbler_enabled || fd->stream || fd->_scrobbler_done)
00162                 return;
00163         
00164         if (eof) {
00165                 /* Just take the position - catches formats without seeking */
00166                 len = fd->time_cur;
00167         } else {
00168                 /* We may only submit if we're past four minutes or past 50% */
00169                 if ((fd->time_cur < 240) &&
00170                     (fd->time_cur < (fd->time_len / 2)))
00171                         return;
00172 
00173                 len = fd->time_len;
00174         }
00175 
00176         /* Track was too short */
00177         if (len < 30)
00178                 return;
00179         
00180         /* Mark it as processed */
00181         fd->_scrobbler_done = 1;
00182 
00183         /* We must have a title and an artist or an album */
00184         if (fd->title == NULL || (fd->artist == NULL && fd->album == NULL))
00185                 return;
00186 
00187         /* Place the track in our queue */
00188         nse = g_slice_new(struct scrobbler_entry);
00189         nse->artist = http_escape(fd->artist, NULL);
00190         nse->title = http_escape(fd->title, NULL);
00191         nse->album = http_escape(fd->album, NULL);
00192         nse->length = len;
00193         nse->time = time(NULL);
00194 
00195         g_mutex_lock(scrobbler_lock);
00196         scrobbler_queue_insert_tail(nse);
00197         g_cond_signal(scrobbler_avail);
00198         g_mutex_unlock(scrobbler_lock);
00199 }

Here is the call graph for this function:

Here is the caller graph for this function:

 All Data Structures Files Functions Variables Defines
Generated on Mon Mar 15 04:45:46 2010 for herrie by  doxygen 1.6.3