Skip to content

Commit

Permalink
code: move ffmpeg quote refining to internal class
Browse files Browse the repository at this point in the history
  • Loading branch information
MSOB7YY committed Nov 12, 2023
1 parent 1a2945d commit e719215
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 7 deletions.
2 changes: 1 addition & 1 deletion lib/controller/ffmpeg_controller.dart
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ class NamidaFFMPEG {
final tagsMapToEditConverted = <String, String?>{};
for (final t in tagsMap.entries) {
final fieldName = _defaultTagsMap[t.key];
if (fieldName != null) tagsMapToEditConverted[fieldName] = t.value;
if (fieldName != null) tagsMapToEditConverted[fieldName] = t.value?.replaceAll('"', r'\"');
}

// if (tagsMap[FFMPEGTagField.trackNumber] != null || tagsMap[FFMPEGTagField.discNumber] != null) {
Expand Down
10 changes: 4 additions & 6 deletions lib/youtube/yt_utils.dart
Original file line number Diff line number Diff line change
Expand Up @@ -138,21 +138,19 @@ class YTUtils {
}
}

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

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

Expand Down

0 comments on commit e719215

Please sign in to comment.