Skip to content

Commit

Permalink
[jsonapi] apply rating meta update to media if supported through ffmp…
Browse files Browse the repository at this point in the history
…eg AVDictionary api
  • Loading branch information
whatdoineed2do/Ray committed Nov 5, 2023
1 parent a799d9b commit 7ddc7d9
Showing 1 changed file with 20 additions and 0 deletions.
20 changes: 20 additions & 0 deletions src/httpd_jsonapi.c
Original file line number Diff line number Diff line change
Expand Up @@ -3686,6 +3686,26 @@ track_sync_rating(const struct db_media_file_info *dbmfi, unsigned *updated, uns
char rating[5] = { '\0' };
char dest[PATH_MAX];

// keep in sync with scan_metadata_ffmpeg and incl types supported by ffmpeg AVDictionary interface
static const char *supported_meta[] = {
"mpeg", "flac", NULL
};
const char **supported = supported_meta;
while (*supported)
{
if (strcmp(dbmfi->codectype, *supported) == 0) {
break;
}
++supported;
}
if (*supported == NULL)
{
// unsupported rating, dont bother
// using stream[x]->codecpar but this is already known in db and via dbmfi
DPRINTF(E_WARN, L_WEB, "unsupported metadata update for 'rating' on '%s' (%s) - skipping\n", dbmfi->path, dbmfi->codectype);
return ENOEXEC;
}

AVFormatContext* ctx = NULL;
if ( (ret = avformat_open_input(&ctx, dbmfi->path, NULL, NULL)) != 0)
{
Expand Down

0 comments on commit 7ddc7d9

Please sign in to comment.