*
*/
static htsmsg_t *
-htsp_file_open(htsp_connection_t *htsp, const char *path, int fd)
+htsp_file_open(htsp_connection_t *htsp, const char *path, int fd, dvr_entry_t *de)
{
struct stat st;
return htsp_error(htsp, N_("Unable to open file"));
}
+ if (de) {
+ de->de_playcount++;
+ dvr_entry_changed_notify(de);
+ }
+
htsp_file_t *hf = calloc(1, sizeof(htsp_file_t));
hf->hf_fd = fd;
hf->hf_id = ++htsp->htsp_file_id;
if (filename == NULL)
return htsp_error(htsp, N_("DVR schedule does not have a file yet"));
- return htsp_file_open(htsp, filename, 0);
+ return htsp_file_open(htsp, filename, 0, de);
} else if ((s2 = tvh_strbegins(str, "imagecache/")) != NULL) {
int fd = imagecache_open(atoi(s2));
if (fd < 0)
return htsp_error(htsp, N_("Failed to open image"));
- return htsp_file_open(htsp, str, fd);
+ return htsp_file_open(htsp, str, fd, NULL);
} else {
return htsp_error(htsp, N_("Unknown file"));
return HTTP_STATUS_UNAUTHORIZED;
pthread_mutex_lock(&global_lock);
-
de = dvr_entry_find_by_uuid(remain);
if (de == NULL)
de = dvr_entry_find_by_id(atoi(remain));
return HTTP_STATUS_UNAUTHORIZED;
}
- /* Play count + 1 when write access */
- if (!dvr_entry_verify(de, hc->hc_access, 0)) {
- de->de_playcount = de->de_playcount + 1;
- dvr_entry_changed_notify(de);
- }
-
fname = tvh_strdupa(filename);
content = muxer_container_filename2mime(fname, 1);
charset = de->de_config ? de->de_config->dvr_charset_id : NULL;
free(str);
}
}
+ /* Play count + 1 when write access */
+ if (!hc->hc_no_output && file_start <= 0 &&
+ !dvr_entry_verify(de, hc->hc_access, 0)) {
+ de = dvr_entry_find_by_uuid(remain);
+ if (de == NULL)
+ de = dvr_entry_find_by_id(atoi(remain));
+ if (de) {
+ de->de_playcount = de->de_playcount + 1;
+ dvr_entry_changed_notify(de);
+ }
+ }
pthread_mutex_unlock(&global_lock);
if (tcp_id == NULL) {
close(fd);