* @brief Check if file is a supported media type (callback version) * * @param file_path [in] Path to media file to check * @param callback [in] Function(err, is_media) * - err: Error object if operation failed * - is_media: Boolean indicating if file is supported * * Supported Ty
(file_path, callback)
| 71 | * @note Checks both file existence and MIME type |
| 72 | */ |
| 73 | function is_media_file_callback(file_path, callback) { |
| 74 | fs.access(file_path, (err) => { |
| 75 | if (err) { |
| 76 | logger(LOG_LEVEL.ERROR, `Error accessing audio source file ${err.message}`); |
| 77 | return callback(null, false); |
| 78 | } |
| 79 | |
| 80 | const mime_type = mime.lookup(file_path); |
| 81 | |
| 82 | callback(null, cfg.media_mime_types.includes(mime_type)); |
| 83 | }); |
| 84 | } |
| 85 | |
| 86 | /** |
| 87 | * @brief Get media file duration and metadata (callback version) |
no test coverage detected