Skip to content

Commit

Permalink
fix: writing youtube metadata with quotes
Browse files Browse the repository at this point in the history
  • Loading branch information
MSOB7YY committed Nov 11, 2023
1 parent d005512 commit ac117f5
Showing 1 changed file with 13 additions and 4 deletions.
17 changes: 13 additions & 4 deletions lib/youtube/yt_utils.dart
Original file line number Diff line number Diff line change
Expand Up @@ -137,13 +137,22 @@ class YTUtils {
album = info?.uploaderName;
}
}

String? refineForQuotes(String? text) => text?.replaceAll('"', r'\"');

String? synopsis;
if (description != null) {
try {
synopsis = HtmlParser.parseHTML(description).text;
} catch (_) {}
}
return {
FFMPEGTagField.title: title,
FFMPEGTagField.artist: artist,
FFMPEGTagField.album: album,
FFMPEGTagField.title: refineForQuotes(title),
FFMPEGTagField.artist: refineForQuotes(artist),
FFMPEGTagField.album: refineForQuotes(album),
FFMPEGTagField.comment: YoutubeController.inst.getYoutubeLink(id),
FFMPEGTagField.year: date == null ? null : DateFormat('yyyyMMdd').format(date),
FFMPEGTagField.synopsis: description == null ? null : HtmlParser.parseHTML(description).text,
FFMPEGTagField.synopsis: refineForQuotes(synopsis),
};
}

Expand Down

0 comments on commit ac117f5

Please sign in to comment.