| 293 | |
| 294 | |
| 295 | void GUI::gui_bottom::from_json(const nlohmann::json &j) |
| 296 | { |
| 297 | using nana::to_wstring; |
| 298 | |
| 299 | if(j.contains("vidinfo")) |
| 300 | { |
| 301 | vidinfo = j["vidinfo"]; |
| 302 | } |
| 303 | |
| 304 | if(j.contains("playlist_info")) |
| 305 | { |
| 306 | playlist_info = j["playlist_info"]; |
| 307 | if(j.contains("playsel_string")) |
| 308 | { |
| 309 | playsel_string = to_wstring(j["playsel_string"].get<std::string>()); |
| 310 | apply_playsel_string(); |
| 311 | } |
| 312 | else playlist_selection.assign(playlist_info["entries"].size(), true); |
| 313 | } |
| 314 | if(j.contains("strfmt")) |
| 315 | { |
| 316 | strfmt = to_wstring(j["strfmt"].get<std::string>()); |
| 317 | use_strfmt = j["use_strfmt"]; |
| 318 | } |
| 319 | if(j.contains("fmt1")) |
| 320 | fmt1 = to_wstring(j["fmt1"].get<std::string>()); |
| 321 | if(j.contains("fmt2")) |
| 322 | fmt2 = to_wstring(j["fmt2"].get<std::string>()); |
| 323 | if(j.contains("cmdinfo")) |
| 324 | cmdinfo = to_wstring(j["cmdinfo"].get<std::string>()); |
| 325 | if(j.contains("playlist_vid_cmdinfo")) |
| 326 | playlist_vid_cmdinfo = to_wstring(j["playlist_vid_cmdinfo"].get<std::string>()); |
| 327 | if(j.contains("idx_error")) |
| 328 | idx_error = j["idx_error"].get<int>(); |
| 329 | if(j.contains("is_yttab")) |
| 330 | is_yttab = j["is_yttab"]; |
| 331 | if(j.contains("is_ytplaylist")) |
| 332 | is_ytplaylist = j["is_ytplaylist"]; |
| 333 | if(j.contains("is_gen_playlist")) |
| 334 | is_gen_playlist = j["is_gen_playlist"]; |
| 335 | if(j.contains("output_buffer")) |
| 336 | pgui->outbox.buffer(url, j["output_buffer"].get<std::string>()); |
| 337 | if(j.contains("dlcmd")) |
| 338 | pgui->outbox.commands[url] = j["dlcmd"].get<std::string>(); |
| 339 | if(j.contains("media_title")) |
| 340 | media_title = j["media_title"].get<std::string>(); |
| 341 | if(j.contains("sub_format")) |
| 342 | sub_format = j["sub_format"].get<std::string>(); |
| 343 | if(j.contains("sub_langs")) |
| 344 | sub_langs = j["sub_langs"].get<std::string>(); |
| 345 | if(j.contains("outfile")) |
| 346 | { |
| 347 | outfile = fs::u8path(j["outfile"].get<std::string>()); |
| 348 | outpath = conf.outpath = outfile.parent_path(); |
| 349 | pgui->l_outpath.caption(outpath.u8string()); |
| 350 | pgui->l_outpath.tooltip("Custom file name:\n<bold>" + outfile.filename().string() + |
| 351 | "</>\n(this overrides the output template from the settings)"); |
| 352 | } |